aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-08-21 12:54:52 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-08-22 14:00:37 -0400
commit02e79476998ba7e62842d20dca898c403ad55c7e (patch)
tree0b8494474dcd4e92c196400d80be3cf8ab898eff /sound/soc
parent20bac1f3f470e2d5c87af7b41b10e088e47989bb (diff)
ASoC: wm_hubs: Allow configuration of MICBIAS power up delay via pdata
Sometimes the analogue circuitry connected to the microphone needs some time to settle after power up. Allow systems to configure this delay in the platform data, the driver will then insert the required delay during power up of paths that involve the microphone. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/codecs/wm8993.c2
-rw-r--r--sound/soc/codecs/wm8994.c2
-rw-r--r--sound/soc/codecs/wm_hubs.c35
-rw-r--r--sound/soc/codecs/wm_hubs.h4
4 files changed, 39 insertions, 4 deletions
diff --git a/sound/soc/codecs/wm8993.c b/sound/soc/codecs/wm8993.c
index 9fd80d688979..94737a30716b 100644
--- a/sound/soc/codecs/wm8993.c
+++ b/sound/soc/codecs/wm8993.c
@@ -1520,6 +1520,8 @@ static int wm8993_probe(struct snd_soc_codec *codec)
1520 wm8993->pdata.lineout2fb, 1520 wm8993->pdata.lineout2fb,
1521 wm8993->pdata.jd_scthr, 1521 wm8993->pdata.jd_scthr,
1522 wm8993->pdata.jd_thr, 1522 wm8993->pdata.jd_thr,
1523 wm8993->pdata.micbias1_delay,
1524 wm8993->pdata.micbias2_delay,
1523 wm8993->pdata.micbias1_lvl, 1525 wm8993->pdata.micbias1_lvl,
1524 wm8993->pdata.micbias2_lvl); 1526 wm8993->pdata.micbias2_lvl);
1525 1527
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index 353612eec8bf..b74df52d2820 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -3145,6 +3145,8 @@ static void wm8994_handle_pdata(struct wm8994_priv *wm8994)
3145 pdata->lineout2fb, 3145 pdata->lineout2fb,
3146 pdata->jd_scthr, 3146 pdata->jd_scthr,
3147 pdata->jd_thr, 3147 pdata->jd_thr,
3148 pdata->micb1_delay,
3149 pdata->micb2_delay,
3148 pdata->micbias1_lvl, 3150 pdata->micbias1_lvl,
3149 pdata->micbias2_lvl); 3151 pdata->micbias2_lvl);
3150 3152
diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c
index b2e939a8970e..7a773a835b8e 100644
--- a/sound/soc/codecs/wm_hubs.c
+++ b/sound/soc/codecs/wm_hubs.c
@@ -644,6 +644,28 @@ static int lineout_event(struct snd_soc_dapm_widget *w,
644 return 0; 644 return 0;
645} 645}
646 646
647static int micbias_event(struct snd_soc_dapm_widget *w,
648 struct snd_kcontrol *kcontrol, int event)
649{
650 struct snd_soc_codec *codec = w->codec;
651 struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec);
652
653 switch (w->shift) {
654 case WM8993_MICB1_ENA_SHIFT:
655 if (hubs->micb1_delay)
656 msleep(hubs->micb1_delay);
657 break;
658 case WM8993_MICB2_ENA_SHIFT:
659 if (hubs->micb2_delay)
660 msleep(hubs->micb2_delay);
661 break;
662 default:
663 return -EINVAL;
664 }
665
666 return 0;
667}
668
647void wm_hubs_update_class_w(struct snd_soc_codec *codec) 669void wm_hubs_update_class_w(struct snd_soc_codec *codec)
648{ 670{
649 struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec); 671 struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec);
@@ -834,8 +856,10 @@ SND_SOC_DAPM_INPUT("IN1RP"),
834SND_SOC_DAPM_INPUT("IN2RN"), 856SND_SOC_DAPM_INPUT("IN2RN"),
835SND_SOC_DAPM_INPUT("IN2RP:VXRP"), 857SND_SOC_DAPM_INPUT("IN2RP:VXRP"),
836 858
837SND_SOC_DAPM_SUPPLY("MICBIAS2", WM8993_POWER_MANAGEMENT_1, 5, 0, NULL, 0), 859SND_SOC_DAPM_SUPPLY("MICBIAS2", WM8993_POWER_MANAGEMENT_1, 5, 0,
838SND_SOC_DAPM_SUPPLY("MICBIAS1", WM8993_POWER_MANAGEMENT_1, 4, 0, NULL, 0), 860 micbias_event, SND_SOC_DAPM_POST_PMU),
861SND_SOC_DAPM_SUPPLY("MICBIAS1", WM8993_POWER_MANAGEMENT_1, 4, 0,
862 micbias_event, SND_SOC_DAPM_POST_PMU),
839 863
840SND_SOC_DAPM_MIXER("IN1L PGA", WM8993_POWER_MANAGEMENT_2, 6, 0, 864SND_SOC_DAPM_MIXER("IN1L PGA", WM8993_POWER_MANAGEMENT_2, 6, 0,
841 in1l_pga, ARRAY_SIZE(in1l_pga)), 865 in1l_pga, ARRAY_SIZE(in1l_pga)),
@@ -1170,13 +1194,16 @@ EXPORT_SYMBOL_GPL(wm_hubs_add_analogue_routes);
1170int wm_hubs_handle_analogue_pdata(struct snd_soc_codec *codec, 1194int wm_hubs_handle_analogue_pdata(struct snd_soc_codec *codec,
1171 int lineout1_diff, int lineout2_diff, 1195 int lineout1_diff, int lineout2_diff,
1172 int lineout1fb, int lineout2fb, 1196 int lineout1fb, int lineout2fb,
1173 int jd_scthr, int jd_thr, int micbias1_lvl, 1197 int jd_scthr, int jd_thr,
1174 int micbias2_lvl) 1198 int micbias1_delay, int micbias2_delay,
1199 int micbias1_lvl, int micbias2_lvl)
1175{ 1200{
1176 struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec); 1201 struct wm_hubs_data *hubs = snd_soc_codec_get_drvdata(codec);
1177 1202
1178 hubs->lineout1_se = !lineout1_diff; 1203 hubs->lineout1_se = !lineout1_diff;
1179 hubs->lineout2_se = !lineout2_diff; 1204 hubs->lineout2_se = !lineout2_diff;
1205 hubs->micb1_delay = micbias1_delay;
1206 hubs->micb2_delay = micbias2_delay;
1180 1207
1181 if (!lineout1_diff) 1208 if (!lineout1_diff)
1182 snd_soc_update_bits(codec, WM8993_LINE_MIXER1, 1209 snd_soc_update_bits(codec, WM8993_LINE_MIXER1,
diff --git a/sound/soc/codecs/wm_hubs.h b/sound/soc/codecs/wm_hubs.h
index a5a09e6f87d5..24c763df21f9 100644
--- a/sound/soc/codecs/wm_hubs.h
+++ b/sound/soc/codecs/wm_hubs.h
@@ -36,6 +36,9 @@ struct wm_hubs_data {
36 struct list_head dcs_cache; 36 struct list_head dcs_cache;
37 bool (*check_class_w_digital)(struct snd_soc_codec *); 37 bool (*check_class_w_digital)(struct snd_soc_codec *);
38 38
39 int micb1_delay;
40 int micb2_delay;
41
39 bool lineout1_se; 42 bool lineout1_se;
40 bool lineout1n_ena; 43 bool lineout1n_ena;
41 bool lineout1p_ena; 44 bool lineout1p_ena;
@@ -56,6 +59,7 @@ extern int wm_hubs_handle_analogue_pdata(struct snd_soc_codec *,
56 int lineout1_diff, int lineout2_diff, 59 int lineout1_diff, int lineout2_diff,
57 int lineout1fb, int lineout2fb, 60 int lineout1fb, int lineout2fb,
58 int jd_scthr, int jd_thr, 61 int jd_scthr, int jd_thr,
62 int micbias1_dly, int micbias2_dly,
59 int micbias1_lvl, int micbias2_lvl); 63 int micbias1_lvl, int micbias2_lvl);
60 64
61extern irqreturn_t wm_hubs_dcs_done(int irq, void *data); 65extern irqreturn_t wm_hubs_dcs_done(int irq, void *data);