summaryrefslogtreecommitdiff
path: root/asoc/codecs/wcd938x
diff options
context:
space:
mode:
authorqctecmdr <qctecmdr@localhost>2019-10-25 05:37:28 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2019-10-25 05:37:28 -0700
commit80870fbc90310163f83e7d99f9ba1f3a45446a9b (patch)
treec96b390cac8b296b56cde373281ec0ac325263e4 /asoc/codecs/wcd938x
parent0c5dd6fd105fa078e5c242fd9c0563c521a61cd0 (diff)
parentd06525fa6853fe6faff8e4bf9b8355b80abccdd4 (diff)
downloadmsm-extra-80870fbc90310163f83e7d99f9ba1f3a45446a9b.tar.gz
Merge "ASoC: Fix audio distortion issue during headset record"
Diffstat (limited to 'asoc/codecs/wcd938x')
-rw-r--r--asoc/codecs/wcd938x/internal.h4
-rw-r--r--asoc/codecs/wcd938x/wcd938x-mbhc.c10
-rw-r--r--asoc/codecs/wcd938x/wcd938x.c15
3 files changed, 29 insertions, 0 deletions
diff --git a/asoc/codecs/wcd938x/internal.h b/asoc/codecs/wcd938x/internal.h
index 098a60da..46d61a00 100644
--- a/asoc/codecs/wcd938x/internal.h
+++ b/asoc/codecs/wcd938x/internal.h
@@ -149,6 +149,7 @@ enum {
WCD_BOLERO_EVT_IMPED_TRUE, /* for imped true */
WCD_BOLERO_EVT_IMPED_FALSE, /* for imped false */
WCD_BOLERO_EVT_RX_COMPANDER_SOFT_RST,
+ WCD_BOLERO_EVT_BCS_CLK_OFF,
};
enum {
@@ -182,6 +183,9 @@ enum {
extern struct wcd938x_mbhc *wcd938x_soc_get_mbhc(
struct snd_soc_component *component);
+extern void wcd938x_disable_bcs_before_slow_insert(
+ struct snd_soc_component *component,
+ bool bcs_disable);
extern int wcd938x_mbhc_micb_adjust_voltage(struct snd_soc_component *component,
int volt, int micb_num);
extern int wcd938x_get_micb_vout_ctl_val(u32 micb_mv);
diff --git a/asoc/codecs/wcd938x/wcd938x-mbhc.c b/asoc/codecs/wcd938x/wcd938x-mbhc.c
index 27566ee8..0687de64 100644
--- a/asoc/codecs/wcd938x/wcd938x-mbhc.c
+++ b/asoc/codecs/wcd938x/wcd938x-mbhc.c
@@ -803,6 +803,15 @@ static void wcd938x_mbhc_moisture_polling_ctrl(struct wcd_mbhc *mbhc,
0x04, (enable << 2));
}
+static void wcd938x_mbhc_bcs_enable(struct wcd_mbhc *mbhc,
+ bool bcs_enable)
+{
+ if (bcs_enable)
+ wcd938x_disable_bcs_before_slow_insert(mbhc->component, false);
+ else
+ wcd938x_disable_bcs_before_slow_insert(mbhc->component, true);
+}
+
static const struct wcd_mbhc_cb mbhc_cb = {
.request_irq = wcd938x_mbhc_request_irq,
.irq_control = wcd938x_mbhc_irq_control,
@@ -827,6 +836,7 @@ static const struct wcd_mbhc_cb mbhc_cb = {
.mbhc_get_moisture_status = wcd938x_mbhc_get_moisture_status,
.mbhc_moisture_polling_ctrl = wcd938x_mbhc_moisture_polling_ctrl,
.mbhc_moisture_detect_en = wcd938x_mbhc_moisture_detect_en,
+ .bcs_enable = wcd938x_mbhc_bcs_enable,
};
static int wcd938x_get_hph_type(struct snd_kcontrol *kcontrol,
diff --git a/asoc/codecs/wcd938x/wcd938x.c b/asoc/codecs/wcd938x/wcd938x.c
index 04954d9f..0355ea6f 100644
--- a/asoc/codecs/wcd938x/wcd938x.c
+++ b/asoc/codecs/wcd938x/wcd938x.c
@@ -1523,6 +1523,21 @@ static int wcd938x_codec_enable_adc(struct snd_soc_dapm_widget *w,
return 0;
}
+void wcd938x_disable_bcs_before_slow_insert(struct snd_soc_component *component,
+ bool bcs_disable)
+{
+ struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component);
+
+ if (wcd938x->update_wcd_event) {
+ if (bcs_disable)
+ wcd938x->update_wcd_event(wcd938x->handle,
+ WCD_BOLERO_EVT_BCS_CLK_OFF, 0);
+ else
+ wcd938x->update_wcd_event(wcd938x->handle,
+ WCD_BOLERO_EVT_BCS_CLK_OFF, 1);
+ }
+}
+
int wcd938x_tx_channel_config(struct snd_soc_component *component,
int channel, int mode)
{