diff options
author | Stanley.Miao <stanley.miao@windriver.com> | 2008-12-11 10:28:10 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2008-12-11 11:12:22 -0500 |
commit | 49d92c7d5bbd158734bc34ed578a68b214a48583 (patch) | |
tree | 99f3b1be80b7c27a10e8204d24c03b3bec243513 /sound/soc/codecs | |
parent | 4544f8a22f38ba4560320fcfbe8c7e81562ddc6f (diff) |
ASoC: TWL4030: hands-free start-up sequence.
A special start-up sequence is required to reduce the pop-noise of Class D
amplifier when enable hands-free on TWL4030.
Signed-off-by: Stanley.Miao <stanley.miao@windriver.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs')
-rw-r--r-- | sound/soc/codecs/twl4030.c | 34 | ||||
-rw-r--r-- | sound/soc/codecs/twl4030.h | 6 |
2 files changed, 36 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), |
diff --git a/sound/soc/codecs/twl4030.h b/sound/soc/codecs/twl4030.h index a2065d417c2e..54615c76802b 100644 --- a/sound/soc/codecs/twl4030.h +++ b/sound/soc/codecs/twl4030.h | |||
@@ -191,6 +191,12 @@ | |||
191 | #define TWL4030_RAMP_DELAY_2581MS 0x1C | 191 | #define TWL4030_RAMP_DELAY_2581MS 0x1C |
192 | #define TWL4030_RAMP_EN 0x02 | 192 | #define TWL4030_RAMP_EN 0x02 |
193 | 193 | ||
194 | /* HFL_CTL (0x29, 0x2A) Fields */ | ||
195 | #define TWL4030_HF_CTL_HB_EN 0x04 | ||
196 | #define TWL4030_HF_CTL_LOOP_EN 0x08 | ||
197 | #define TWL4030_HF_CTL_RAMP_EN 0x10 | ||
198 | #define TWL4030_HF_CTL_REF_EN 0x20 | ||
199 | |||
194 | /* APLL_CTL (0x3A) Fields */ | 200 | /* APLL_CTL (0x3A) Fields */ |
195 | 201 | ||
196 | #define TWL4030_APLL_EN 0x10 | 202 | #define TWL4030_APLL_EN 0x10 |