e539ab07fdedfbae6acc41be2d2fa90b7b5f4a9e
[openwrt/openwrt.git] /
1 From 6401f3831443dc2eeb588f8d08e7513298dd2c52 Mon Sep 17 00:00:00 2001
2 From: b-ak <anur.bhargav@gmail.com>
3 Date: Wed, 9 Jan 2019 22:41:21 +0530
4 Subject: [PATCH 397/773] ASoC: tlv320aic32x4: SND_SOC_DAPM_MICBIAS is
5 deprecated
6
7 commit 04d979d7a7bac2f645cd827ea37e5ffa5b4e1f97 upstream.
8
9 SND_SOC_DAPM_MICBIAS is deprecated, replace it with SND_SOC_DAPM_SUPPLY.
10
11 MICBIAS voltage wasn't supplied to the microphone with the older
12 SND_SOC_DAPM_MICBIAS widget, hence the microphone wouldn't work.
13
14 This patch fixes the problem.
15
16 Signed-off-by: b-ak <anur.bhargav@gmail.com>
17 Signed-off-by: Mark Brown <broonie@kernel.org>
18 ---
19 sound/soc/codecs/tlv320aic32x4.c | 30 +++++++++++++++++++++++++++++-
20 sound/soc/codecs/tlv320aic32x4.h | 1 +
21 2 files changed, 30 insertions(+), 1 deletion(-)
22
23 --- a/sound/soc/codecs/tlv320aic32x4.c
24 +++ b/sound/soc/codecs/tlv320aic32x4.c
25 @@ -79,6 +79,32 @@ struct aic32x4_priv {
26 struct device *dev;
27 };
28
29 +static int mic_bias_event(struct snd_soc_dapm_widget *w,
30 + struct snd_kcontrol *kcontrol, int event)
31 +{
32 + struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
33 +
34 + switch (event) {
35 + case SND_SOC_DAPM_POST_PMU:
36 + /* Change Mic Bias Registor */
37 + snd_soc_component_update_bits(component, AIC32X4_MICBIAS,
38 + AIC32x4_MICBIAS_MASK,
39 + AIC32X4_MICBIAS_LDOIN |
40 + AIC32X4_MICBIAS_2075V);
41 + printk(KERN_DEBUG "%s: Mic Bias will be turned ON\n", __func__);
42 + break;
43 + case SND_SOC_DAPM_PRE_PMD:
44 + snd_soc_component_update_bits(component, AIC32X4_MICBIAS,
45 + AIC32x4_MICBIAS_MASK, 0);
46 + printk(KERN_DEBUG "%s: Mic Bias will be turned OFF\n",
47 + __func__);
48 + break;
49 + }
50 +
51 + return 0;
52 +}
53 +
54 +
55 static int aic32x4_get_mfp1_gpio(struct snd_kcontrol *kcontrol,
56 struct snd_ctl_elem_value *ucontrol)
57 {
58 @@ -450,7 +476,9 @@ static const struct snd_soc_dapm_widget
59 SND_SOC_DAPM_MUX("IN3_R to Left Mixer Negative Resistor", SND_SOC_NOPM, 0, 0,
60 in3r_to_lmixer_controls),
61
62 - SND_SOC_DAPM_MICBIAS("Mic Bias", AIC32X4_MICBIAS, 6, 0),
63 + SND_SOC_DAPM_SUPPLY("Mic Bias", AIC32X4_MICBIAS, 6, 0, mic_bias_event,
64 + SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
65 +
66
67 SND_SOC_DAPM_OUTPUT("HPL"),
68 SND_SOC_DAPM_OUTPUT("HPR"),
69 --- a/sound/soc/codecs/tlv320aic32x4.h
70 +++ b/sound/soc/codecs/tlv320aic32x4.h
71 @@ -195,6 +195,7 @@ int aic32x4_remove(struct device *dev);
72 /* AIC32X4_MICBIAS */
73 #define AIC32X4_MICBIAS_LDOIN BIT(3)
74 #define AIC32X4_MICBIAS_2075V 0x60
75 +#define AIC32x4_MICBIAS_MASK GENMASK(6, 3)
76
77 /* AIC32X4_LMICPGANIN */
78 #define AIC32X4_LMICPGANIN_IN2R_10K 0x10