diff options
author | Zeng Zhaoming <zengzm.kernel@gmail.com> | 2012-03-29 12:13:02 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-04-02 18:02:11 -0400 |
commit | f0cdcf3ab6c62b3f774a2af15dfa01988e7a9b02 (patch) | |
tree | 5947f2df2929703d21bd9d01b7d988f4af18ed3d /sound/soc | |
parent | dd775ae2549217d3ae09363e3edb305d0fa19928 (diff) |
ASoC: sgtl5000: Enable VAG when DAC/ADC up
As manual described, VAG is an internal voltage reference of DAC/ADC,
So enabled it before DAC/ADC up.
One more thing should care about is VAG fully ramped down requires 400ms,
wait it to avoid pop.
Signed-off-by: Zeng Zhaoming <zengzm.kernel@gmail.com>
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/codecs/sgtl5000.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index d1926266fe00..8e92fb88ed09 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c | |||
@@ -143,11 +143,11 @@ static int mic_bias_event(struct snd_soc_dapm_widget *w, | |||
143 | } | 143 | } |
144 | 144 | ||
145 | /* | 145 | /* |
146 | * using codec assist to small pop, hp_powerup or lineout_powerup | 146 | * As manual described, ADC/DAC only works when VAG powerup, |
147 | * should stay setting until vag_powerup is fully ramped down, | 147 | * So enabled VAG before ADC/DAC up. |
148 | * vag fully ramped down require 400ms. | 148 | * In power down case, we need wait 400ms when vag fully ramped down. |
149 | */ | 149 | */ |
150 | static int small_pop_event(struct snd_soc_dapm_widget *w, | 150 | static int power_vag_event(struct snd_soc_dapm_widget *w, |
151 | struct snd_kcontrol *kcontrol, int event) | 151 | struct snd_kcontrol *kcontrol, int event) |
152 | { | 152 | { |
153 | switch (event) { | 153 | switch (event) { |
@@ -156,7 +156,7 @@ static int small_pop_event(struct snd_soc_dapm_widget *w, | |||
156 | SGTL5000_VAG_POWERUP, SGTL5000_VAG_POWERUP); | 156 | SGTL5000_VAG_POWERUP, SGTL5000_VAG_POWERUP); |
157 | break; | 157 | break; |
158 | 158 | ||
159 | case SND_SOC_DAPM_PRE_PMD: | 159 | case SND_SOC_DAPM_POST_PMD: |
160 | snd_soc_update_bits(w->codec, SGTL5000_CHIP_ANA_POWER, | 160 | snd_soc_update_bits(w->codec, SGTL5000_CHIP_ANA_POWER, |
161 | SGTL5000_VAG_POWERUP, 0); | 161 | SGTL5000_VAG_POWERUP, 0); |
162 | msleep(400); | 162 | msleep(400); |
@@ -201,12 +201,8 @@ static const struct snd_soc_dapm_widget sgtl5000_dapm_widgets[] = { | |||
201 | mic_bias_event, | 201 | mic_bias_event, |
202 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), | 202 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), |
203 | 203 | ||
204 | SND_SOC_DAPM_PGA_E("HP", SGTL5000_CHIP_ANA_POWER, 4, 0, NULL, 0, | 204 | SND_SOC_DAPM_PGA("HP", SGTL5000_CHIP_ANA_POWER, 4, 0, NULL, 0), |
205 | small_pop_event, | 205 | SND_SOC_DAPM_PGA("LO", SGTL5000_CHIP_ANA_POWER, 0, 0, NULL, 0), |
206 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD), | ||
207 | SND_SOC_DAPM_PGA_E("LO", SGTL5000_CHIP_ANA_POWER, 0, 0, NULL, 0, | ||
208 | small_pop_event, | ||
209 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMD), | ||
210 | 206 | ||
211 | SND_SOC_DAPM_MUX("Capture Mux", SND_SOC_NOPM, 0, 0, &adc_mux), | 207 | SND_SOC_DAPM_MUX("Capture Mux", SND_SOC_NOPM, 0, 0, &adc_mux), |
212 | SND_SOC_DAPM_MUX("Headphone Mux", SND_SOC_NOPM, 0, 0, &dac_mux), | 208 | SND_SOC_DAPM_MUX("Headphone Mux", SND_SOC_NOPM, 0, 0, &dac_mux), |
@@ -221,8 +217,11 @@ static const struct snd_soc_dapm_widget sgtl5000_dapm_widgets[] = { | |||
221 | 0, SGTL5000_CHIP_DIG_POWER, | 217 | 0, SGTL5000_CHIP_DIG_POWER, |
222 | 1, 0), | 218 | 1, 0), |
223 | 219 | ||
224 | SND_SOC_DAPM_ADC("ADC", "Capture", SGTL5000_CHIP_ANA_POWER, 1, 0), | 220 | SND_SOC_DAPM_SUPPLY("VAG_POWER", SGTL5000_CHIP_ANA_POWER, 7, 0, |
221 | power_vag_event, | ||
222 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), | ||
225 | 223 | ||
224 | SND_SOC_DAPM_ADC("ADC", "Capture", SGTL5000_CHIP_ANA_POWER, 1, 0), | ||
226 | SND_SOC_DAPM_DAC("DAC", "Playback", SGTL5000_CHIP_ANA_POWER, 3, 0), | 225 | SND_SOC_DAPM_DAC("DAC", "Playback", SGTL5000_CHIP_ANA_POWER, 3, 0), |
227 | }; | 226 | }; |
228 | 227 | ||
@@ -231,9 +230,11 @@ static const struct snd_soc_dapm_route sgtl5000_dapm_routes[] = { | |||
231 | {"Capture Mux", "LINE_IN", "LINE_IN"}, /* line_in --> adc_mux */ | 230 | {"Capture Mux", "LINE_IN", "LINE_IN"}, /* line_in --> adc_mux */ |
232 | {"Capture Mux", "MIC_IN", "MIC_IN"}, /* mic_in --> adc_mux */ | 231 | {"Capture Mux", "MIC_IN", "MIC_IN"}, /* mic_in --> adc_mux */ |
233 | 232 | ||
233 | {"ADC", NULL, "VAG_POWER"}, | ||
234 | {"ADC", NULL, "Capture Mux"}, /* adc_mux --> adc */ | 234 | {"ADC", NULL, "Capture Mux"}, /* adc_mux --> adc */ |
235 | {"AIFOUT", NULL, "ADC"}, /* adc --> i2s_out */ | 235 | {"AIFOUT", NULL, "ADC"}, /* adc --> i2s_out */ |
236 | 236 | ||
237 | {"DAC", NULL, "VAG_POWER"}, | ||
237 | {"DAC", NULL, "AIFIN"}, /* i2s-->dac,skip audio mux */ | 238 | {"DAC", NULL, "AIFIN"}, /* i2s-->dac,skip audio mux */ |
238 | {"Headphone Mux", "DAC", "DAC"}, /* dac --> hp_mux */ | 239 | {"Headphone Mux", "DAC", "DAC"}, /* dac --> hp_mux */ |
239 | {"LO", NULL, "DAC"}, /* dac --> line_out */ | 240 | {"LO", NULL, "DAC"}, /* dac --> line_out */ |