diff options
-rw-r--r-- | include/linux/mfd/wm8994/pdata.h | 4 | ||||
-rw-r--r-- | include/sound/wm8993.h | 4 | ||||
-rw-r--r-- | sound/soc/codecs/wm8993.c | 2 | ||||
-rw-r--r-- | sound/soc/codecs/wm8994.c | 2 | ||||
-rw-r--r-- | sound/soc/codecs/wm_hubs.c | 35 | ||||
-rw-r--r-- | sound/soc/codecs/wm_hubs.h | 4 |
6 files changed, 47 insertions, 4 deletions
diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h index f0361c031927..fc87be4fdc25 100644 --- a/include/linux/mfd/wm8994/pdata.h +++ b/include/linux/mfd/wm8994/pdata.h | |||
@@ -164,6 +164,10 @@ struct wm8994_pdata { | |||
164 | int num_micd_rates; | 164 | int num_micd_rates; |
165 | struct wm8958_micd_rate *micd_rates; | 165 | struct wm8958_micd_rate *micd_rates; |
166 | 166 | ||
167 | /* Power up delays to add after microphone bias power up (ms) */ | ||
168 | int micb1_delay; | ||
169 | int micb2_delay; | ||
170 | |||
167 | /* LINEOUT can be differential or single ended */ | 171 | /* LINEOUT can be differential or single ended */ |
168 | unsigned int lineout1_diff:1; | 172 | unsigned int lineout1_diff:1; |
169 | unsigned int lineout2_diff:1; | 173 | unsigned int lineout2_diff:1; |
diff --git a/include/sound/wm8993.h b/include/sound/wm8993.h index eee19f63c0d8..8016fd826f5a 100644 --- a/include/sound/wm8993.h +++ b/include/sound/wm8993.h | |||
@@ -32,6 +32,10 @@ struct wm8993_platform_data { | |||
32 | unsigned int lineout1fb:1; | 32 | unsigned int lineout1fb:1; |
33 | unsigned int lineout2fb:1; | 33 | unsigned int lineout2fb:1; |
34 | 34 | ||
35 | /* Delay to add for microphones to stabalise after power up */ | ||
36 | int micbias1_delay; | ||
37 | int micbias2_delay; | ||
38 | |||
35 | /* Microphone biases: 0=0.9*AVDD1 1=0.65*AVVD1 */ | 39 | /* Microphone biases: 0=0.9*AVDD1 1=0.65*AVVD1 */ |
36 | unsigned int micbias1_lvl:1; | 40 | unsigned int micbias1_lvl:1; |
37 | unsigned int micbias2_lvl:1; | 41 | unsigned int micbias2_lvl:1; |
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 | ||
647 | static 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 | |||
647 | void wm_hubs_update_class_w(struct snd_soc_codec *codec) | 669 | void 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"), | |||
834 | SND_SOC_DAPM_INPUT("IN2RN"), | 856 | SND_SOC_DAPM_INPUT("IN2RN"), |
835 | SND_SOC_DAPM_INPUT("IN2RP:VXRP"), | 857 | SND_SOC_DAPM_INPUT("IN2RP:VXRP"), |
836 | 858 | ||
837 | SND_SOC_DAPM_SUPPLY("MICBIAS2", WM8993_POWER_MANAGEMENT_1, 5, 0, NULL, 0), | 859 | SND_SOC_DAPM_SUPPLY("MICBIAS2", WM8993_POWER_MANAGEMENT_1, 5, 0, |
838 | SND_SOC_DAPM_SUPPLY("MICBIAS1", WM8993_POWER_MANAGEMENT_1, 4, 0, NULL, 0), | 860 | micbias_event, SND_SOC_DAPM_POST_PMU), |
861 | SND_SOC_DAPM_SUPPLY("MICBIAS1", WM8993_POWER_MANAGEMENT_1, 4, 0, | ||
862 | micbias_event, SND_SOC_DAPM_POST_PMU), | ||
839 | 863 | ||
840 | SND_SOC_DAPM_MIXER("IN1L PGA", WM8993_POWER_MANAGEMENT_2, 6, 0, | 864 | SND_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); | |||
1170 | int wm_hubs_handle_analogue_pdata(struct snd_soc_codec *codec, | 1194 | int 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 | ||
61 | extern irqreturn_t wm_hubs_dcs_done(int irq, void *data); | 65 | extern irqreturn_t wm_hubs_dcs_done(int irq, void *data); |