diff mbox series

[3/3] ASoC: codecs: msm8916-wcd-digital: fix dmic support

Message ID 20170717135410.26812-4-srinivas.kandagatla@linaro.org
State New
Headers show
Series ASoC: codecs: msm8916-wcd-digital: Fix dmic support | expand

Commit Message

Srinivas Kandagatla July 17, 2017, 1:54 p.m. UTC
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>


This patch fixes dmic support which was broken in this driver.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

---
 sound/soc/codecs/msm8916-wcd-digital.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

-- 
2.11.0

Comments

Mark Brown July 17, 2017, 2:45 p.m. UTC | #1
On Mon, Jul 17, 2017 at 03:54:10PM +0200, srinivas.kandagatla@linaro.org wrote:
> From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

> 

> This patch fixes dmic support which was broken in this driver.


In what way is DMIC support broken and how does this patch fix it?
Srinivas Kandagatla July 17, 2017, 2:52 p.m. UTC | #2
On 17/07/17 15:45, Mark Brown wrote:
> On Mon, Jul 17, 2017 at 03:54:10PM +0200, srinivas.kandagatla@linaro.org wrote:

>> From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

>>

>> This patch fixes dmic support which was broken in this driver.

> 

> In what way is DMIC support broken and how does this patch fix it?

> 

The driver was not selecting DMIC in CIC filter source path.
Which is why dmic was not functional from the beginning.

--srini
diff mbox series

Patch

diff --git a/sound/soc/codecs/msm8916-wcd-digital.c b/sound/soc/codecs/msm8916-wcd-digital.c
index 126a0ee8aded..3265bd404fd7 100644
--- a/sound/soc/codecs/msm8916-wcd-digital.c
+++ b/sound/soc/codecs/msm8916-wcd-digital.c
@@ -168,6 +168,9 @@ 
 
 #define LPASS_CDC_TX2_VOL_CTL_CFG		(0x2A8)
 #define LPASS_CDC_TX1_MUX_CTL			(0x28C)
+#define TX_MUX_CTL_ADC_DMIC_SEL_MASK		BIT(0)
+#define TX_MUX_CTL_ADC_DMIC_SEL_DMIC		BIT(0)
+#define TX_MUX_CTL_ADC_DMIC_SEL_ADC		0
 #define TX_MUX_CTL_CUT_OFF_FREQ_MASK		GENMASK(5, 4)
 #define TX_MUX_CTL_CUT_OFF_FREQ_SHIFT		4
 #define TX_MUX_CTL_CF_NEG_3DB_4HZ		(0x0 << 4)
@@ -439,17 +442,37 @@  static int msm8916_wcd_digital_enable_dmic(struct snd_soc_dapm_widget *w,
 				    DMIC_B1_CTL_DMIC0_CLK_SEL_DIV3);
 		switch (dmic) {
 		case 1:
+			snd_soc_update_bits(codec, LPASS_CDC_TX1_MUX_CTL,
+					    TX_MUX_CTL_ADC_DMIC_SEL_MASK,
+					    TX_MUX_CTL_ADC_DMIC_SEL_DMIC);
 			snd_soc_update_bits(codec, LPASS_CDC_TX1_DMIC_CTL,
 					    TXN_DMIC_CTL_CLK_SEL_MASK,
 					    TXN_DMIC_CTL_CLK_SEL_DIV3);
 			break;
 		case 2:
+			snd_soc_update_bits(codec, LPASS_CDC_TX2_MUX_CTL,
+					    TX_MUX_CTL_ADC_DMIC_SEL_MASK,
+					    TX_MUX_CTL_ADC_DMIC_SEL_DMIC);
 			snd_soc_update_bits(codec, LPASS_CDC_TX2_DMIC_CTL,
 					    TXN_DMIC_CTL_CLK_SEL_MASK,
 					    TXN_DMIC_CTL_CLK_SEL_DIV3);
 			break;
 		}
 		break;
+	case SND_SOC_DAPM_POST_PMD:
+		switch (dmic) {
+		case 1:
+			snd_soc_update_bits(codec, LPASS_CDC_TX1_MUX_CTL,
+					    TX_MUX_CTL_ADC_DMIC_SEL_MASK,
+					    0);
+			break;
+		case 2:
+			snd_soc_update_bits(codec, LPASS_CDC_TX2_MUX_CTL,
+					    TX_MUX_CTL_ADC_DMIC_SEL_MASK,
+					    0);
+			break;
+		}
+		break;
 	}
 
 	return 0;
@@ -536,6 +559,8 @@  static const struct snd_soc_dapm_widget msm8916_wcd_digital_dapm_widgets[] = {
 	/* Connectivity Clock */
 	SND_SOC_DAPM_SUPPLY_S("CDC_CONN", -2, LPASS_CDC_CLK_OTHR_CTL, 2, 0,
 			      NULL, 0),
+	SND_SOC_DAPM_MIC("Digital Mic1", NULL),
+	SND_SOC_DAPM_MIC("Digital Mic2", NULL),
 
 };