linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: tlv320aic32x4: SND_SOC_DAPM_MICBIAS is deprecated
@ 2019-01-09 17:11 b-ak
  2019-01-09 18:38 ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: b-ak @ 2019-01-09 17:11 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	alsa-devel, linux-kernel

SND_SOC_DAPM_MICBIAS is deprecated, replace it with SND_SOC_DAPM_SUPPLY.

MICBIAS voltage wasn't supplied to the microphone with the older
SND_SOC_DAPM_MICBIAS widget, hence the microphone wouldn't work.

This patch fixes the problem.

Signed-off-by: b-ak <anur.bhargav@gmail.com>
---
 sound/soc/codecs/tlv320aic32x4.c | 30 +++++++++++++++++++++++++++++-
 sound/soc/codecs/tlv320aic32x4.h |  1 +
 2 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/tlv320aic32x4.c b/sound/soc/codecs/tlv320aic32x4.c
index e2b5a11b16d1..521663d8b585 100644
--- a/sound/soc/codecs/tlv320aic32x4.c
+++ b/sound/soc/codecs/tlv320aic32x4.c
@@ -79,6 +79,32 @@ struct aic32x4_priv {
 	struct device *dev;
 };
 
+static int mic_bias_event(struct snd_soc_dapm_widget *w,
+	struct snd_kcontrol *kcontrol, int event)
+{
+	struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
+
+	switch (event) {
+	case SND_SOC_DAPM_POST_PMU:
+		/* Change Mic Bias Registor */
+		snd_soc_component_update_bits(component, AIC32X4_MICBIAS,
+				AIC32x4_MICBIAS_MASK,
+				AIC32X4_MICBIAS_LDOIN |
+				AIC32X4_MICBIAS_2075V);
+		printk(KERN_DEBUG "%s: Mic Bias will be turned ON\n", __func__);
+		break;
+	case SND_SOC_DAPM_PRE_PMD:
+		snd_soc_component_update_bits(component, AIC32X4_MICBIAS,
+				AIC32x4_MICBIAS_MASK, 0);
+		printk(KERN_DEBUG "%s: Mic Bias will be turned OFF\n",
+				__func__);
+		break;
+	}
+
+	return 0;
+}
+
+
 static int aic32x4_get_mfp1_gpio(struct snd_kcontrol *kcontrol,
 	struct snd_ctl_elem_value *ucontrol)
 {
@@ -450,7 +476,9 @@ static const struct snd_soc_dapm_widget aic32x4_dapm_widgets[] = {
 	SND_SOC_DAPM_MUX("IN3_R to Left Mixer Negative Resistor", SND_SOC_NOPM, 0, 0,
 			in3r_to_lmixer_controls),
 
-	SND_SOC_DAPM_MICBIAS("Mic Bias", AIC32X4_MICBIAS, 6, 0),
+	SND_SOC_DAPM_SUPPLY("Mic Bias", AIC32X4_MICBIAS, 6, 0, mic_bias_event,
+			SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
+
 
 	SND_SOC_DAPM_OUTPUT("HPL"),
 	SND_SOC_DAPM_OUTPUT("HPR"),
diff --git a/sound/soc/codecs/tlv320aic32x4.h b/sound/soc/codecs/tlv320aic32x4.h
index e9df49edbf19..c2d74025bf4b 100644
--- a/sound/soc/codecs/tlv320aic32x4.h
+++ b/sound/soc/codecs/tlv320aic32x4.h
@@ -195,6 +195,7 @@ int aic32x4_remove(struct device *dev);
 /* AIC32X4_MICBIAS */
 #define AIC32X4_MICBIAS_LDOIN		BIT(3)
 #define AIC32X4_MICBIAS_2075V		0x60
+#define AIC32x4_MICBIAS_MASK            GENMASK(6, 3)
 
 /* AIC32X4_LMICPGANIN */
 #define AIC32X4_LMICPGANIN_IN2R_10K	0x10
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: tlv320aic32x4: SND_SOC_DAPM_MICBIAS is deprecated
  2019-01-09 17:11 [PATCH] ASoC: tlv320aic32x4: SND_SOC_DAPM_MICBIAS is deprecated b-ak
@ 2019-01-09 18:38 ` Mark Brown
  2019-01-09 18:51   ` b-ak
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2019-01-09 18:38 UTC (permalink / raw)
  To: b-ak
  Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, alsa-devel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 591 bytes --]

On Wed, Jan 09, 2019 at 10:41:21PM +0530, b-ak wrote:
> SND_SOC_DAPM_MICBIAS is deprecated, replace it with SND_SOC_DAPM_SUPPLY.
> 
> MICBIAS voltage wasn't supplied to the microphone with the older
> SND_SOC_DAPM_MICBIAS widget, hence the microphone wouldn't work.
> 
> This patch fixes the problem.

Note that the reason we've not done that already for everything is that
the DAPM graph needs updating for the new routing in machine drivers as
the two widgets are wired differently.  However this is fine here as
there aren't any in tree users I can see so I'll apply, thanks!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: tlv320aic32x4: SND_SOC_DAPM_MICBIAS is deprecated
  2019-01-09 18:38 ` Mark Brown
@ 2019-01-09 18:51   ` b-ak
  2019-01-09 19:13     ` Mark Brown
  0 siblings, 1 reply; 4+ messages in thread
From: b-ak @ 2019-01-09 18:51 UTC (permalink / raw)
  To: Mark Brown, linux-kernel

On Wed, Jan 09, 2019 at 06:38:36PM +0000, Mark Brown wrote:
> On Wed, Jan 09, 2019 at 10:41:21PM +0530, b-ak wrote:
> > SND_SOC_DAPM_MICBIAS is deprecated, replace it with SND_SOC_DAPM_SUPPLY.
> > 
> > MICBIAS voltage wasn't supplied to the microphone with the older
> > SND_SOC_DAPM_MICBIAS widget, hence the microphone wouldn't work.
> > 
> > This patch fixes the problem.
> 
> Note that the reason we've not done that already for everything is that
> the DAPM graph needs updating for the new routing in machine drivers as
> the two widgets are wired differently.  However this is fine here as
> there aren't any in tree users I can see so I'll apply, thanks!

Hello Mark,

Thank you so much for that.

And can you please point me to some documentation of the new updates talking about the
differences in the routing?

- Bhargav


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: tlv320aic32x4: SND_SOC_DAPM_MICBIAS is deprecated
  2019-01-09 18:51   ` b-ak
@ 2019-01-09 19:13     ` Mark Brown
  0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2019-01-09 19:13 UTC (permalink / raw)
  To: b-ak; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 662 bytes --]

On Thu, Jan 10, 2019 at 12:21:24AM +0530, b-ak wrote:

> > Note that the reason we've not done that already for everything is that
> > the DAPM graph needs updating for the new routing in machine drivers as
> > the two widgets are wired differently.  However this is fine here as
> > there aren't any in tree users I can see so I'll apply, thanks!

> And can you please point me to some documentation of the new updates talking about the
> differences in the routing?

Can't think of a specific doc about the transition but there are a bunch
of existing conversions like this:

2ca087bc9edafd7cd1e89d0ac61a31067985bd15 ASoC: rx51: Correct DAPM route for capture

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-01-09 19:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-09 17:11 [PATCH] ASoC: tlv320aic32x4: SND_SOC_DAPM_MICBIAS is deprecated b-ak
2019-01-09 18:38 ` Mark Brown
2019-01-09 18:51   ` b-ak
2019-01-09 19:13     ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).