diff options
Diffstat (limited to 'sound/soc/codecs/twl4030.c')
-rw-r--r-- | sound/soc/codecs/twl4030.c | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c index 13773028f6f1..51848880504a 100644 --- a/sound/soc/codecs/twl4030.c +++ b/sound/soc/codecs/twl4030.c | |||
@@ -322,6 +322,30 @@ static int outmixer_event(struct snd_soc_dapm_widget *w, | |||
322 | return ret; | 322 | return ret; |
323 | } | 323 | } |
324 | 324 | ||
325 | static int handsfree_event(struct snd_soc_dapm_widget *w, | ||
326 | struct snd_kcontrol *kcontrol, int event) | ||
327 | { | ||
328 | struct soc_enum *e = (struct soc_enum *)w->kcontrols->private_value; | ||
329 | unsigned char hs_ctl; | ||
330 | |||
331 | hs_ctl = twl4030_read_reg_cache(w->codec, e->reg); | ||
332 | |||
333 | if (hs_ctl & TWL4030_HF_CTL_REF_EN) { | ||
334 | hs_ctl |= TWL4030_HF_CTL_RAMP_EN; | ||
335 | twl4030_write(w->codec, e->reg, hs_ctl); | ||
336 | hs_ctl |= TWL4030_HF_CTL_LOOP_EN; | ||
337 | twl4030_write(w->codec, e->reg, hs_ctl); | ||
338 | hs_ctl |= TWL4030_HF_CTL_HB_EN; | ||
339 | twl4030_write(w->codec, e->reg, hs_ctl); | ||
340 | } else { | ||
341 | hs_ctl &= ~(TWL4030_HF_CTL_RAMP_EN | TWL4030_HF_CTL_LOOP_EN | ||
342 | | TWL4030_HF_CTL_HB_EN); | ||
343 | twl4030_write(w->codec, e->reg, hs_ctl); | ||
344 | } | ||
345 | |||
346 | return 0; | ||
347 | } | ||
348 | |||
325 | /* | 349 | /* |
326 | * Some of the gain controls in TWL (mostly those which are associated with | 350 | * Some of the gain controls in TWL (mostly those which are associated with |
327 | * the outputs) are implemented in an interesting way: | 351 | * the outputs) are implemented in an interesting way: |
@@ -806,10 +830,12 @@ static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = { | |||
806 | SND_SOC_DAPM_MUX("CarkitR Mux", SND_SOC_NOPM, 0, 0, | 830 | SND_SOC_DAPM_MUX("CarkitR Mux", SND_SOC_NOPM, 0, 0, |
807 | &twl4030_dapm_carkitr_control), | 831 | &twl4030_dapm_carkitr_control), |
808 | /* HandsfreeL/R */ | 832 | /* HandsfreeL/R */ |
809 | SND_SOC_DAPM_MUX("HandsfreeL Mux", TWL4030_REG_HFL_CTL, 5, 0, | 833 | SND_SOC_DAPM_MUX_E("HandsfreeL Mux", TWL4030_REG_HFL_CTL, 5, 0, |
810 | &twl4030_dapm_handsfreel_control), | 834 | &twl4030_dapm_handsfreel_control, handsfree_event, |
811 | SND_SOC_DAPM_MUX("HandsfreeR Mux", TWL4030_REG_HFR_CTL, 5, 0, | 835 | SND_SOC_DAPM_POST_PMU|SND_SOC_DAPM_POST_PMD), |
812 | &twl4030_dapm_handsfreer_control), | 836 | SND_SOC_DAPM_MUX_E("HandsfreeR Mux", TWL4030_REG_HFR_CTL, 5, 0, |
837 | &twl4030_dapm_handsfreer_control, handsfree_event, | ||
838 | SND_SOC_DAPM_POST_PMU|SND_SOC_DAPM_POST_PMD), | ||
813 | 839 | ||
814 | SND_SOC_DAPM_ADC("ADCL", "Left Capture", SND_SOC_NOPM, 0, 0), | 840 | SND_SOC_DAPM_ADC("ADCL", "Left Capture", SND_SOC_NOPM, 0, 0), |
815 | SND_SOC_DAPM_ADC("ADCR", "Right Capture", SND_SOC_NOPM, 0, 0), | 841 | SND_SOC_DAPM_ADC("ADCR", "Right Capture", SND_SOC_NOPM, 0, 0), |