diff options
author | Marek Vasut <marex@denx.de> | 2013-05-28 14:55:56 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-06-04 13:46:57 -0400 |
commit | dd4d2d6dfb49e8916064f2cb07f0ad7b32a82fb7 (patch) | |
tree | a5448d62c0b18e40182e6cc1e8bc1adb2c212985 /sound | |
parent | af8ee11209e749c75eabf32b2a4ca631f396acf8 (diff) |
ASoC: sgtl5000: Fix VAG_POWER enabling/disabling order
The VAG_POWER must be enabled after all other bits in CHIP_ANA_POWER
and disabled before any other bit in CHIP_ANA_POWER. See the SGTL5000
datasheet (Table 31, BIT 7, page 42-43). Failing to follow this order
will result in ugly loud "POP" noise at the end of playback.
To achieve such order, use the _PRE and _POST DAPM widgets to trigger
the power_vag_event, where the event type check has to be fixed
accordingly as well.
Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/codecs/sgtl5000.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c index 1c3b20fc7ec3..b4297416401e 100644 --- a/sound/soc/codecs/sgtl5000.c +++ b/sound/soc/codecs/sgtl5000.c | |||
@@ -153,12 +153,12 @@ static int power_vag_event(struct snd_soc_dapm_widget *w, | |||
153 | struct snd_kcontrol *kcontrol, int event) | 153 | struct snd_kcontrol *kcontrol, int event) |
154 | { | 154 | { |
155 | switch (event) { | 155 | switch (event) { |
156 | case SND_SOC_DAPM_PRE_PMU: | 156 | case SND_SOC_DAPM_POST_PMU: |
157 | snd_soc_update_bits(w->codec, SGTL5000_CHIP_ANA_POWER, | 157 | snd_soc_update_bits(w->codec, SGTL5000_CHIP_ANA_POWER, |
158 | SGTL5000_VAG_POWERUP, SGTL5000_VAG_POWERUP); | 158 | SGTL5000_VAG_POWERUP, SGTL5000_VAG_POWERUP); |
159 | break; | 159 | break; |
160 | 160 | ||
161 | case SND_SOC_DAPM_POST_PMD: | 161 | case SND_SOC_DAPM_PRE_PMD: |
162 | snd_soc_update_bits(w->codec, SGTL5000_CHIP_ANA_POWER, | 162 | snd_soc_update_bits(w->codec, SGTL5000_CHIP_ANA_POWER, |
163 | SGTL5000_VAG_POWERUP, 0); | 163 | SGTL5000_VAG_POWERUP, 0); |
164 | msleep(400); | 164 | msleep(400); |
@@ -219,12 +219,11 @@ static const struct snd_soc_dapm_widget sgtl5000_dapm_widgets[] = { | |||
219 | 0, SGTL5000_CHIP_DIG_POWER, | 219 | 0, SGTL5000_CHIP_DIG_POWER, |
220 | 1, 0), | 220 | 1, 0), |
221 | 221 | ||
222 | SND_SOC_DAPM_SUPPLY("VAG_POWER", SGTL5000_CHIP_ANA_POWER, 7, 0, | ||
223 | power_vag_event, | ||
224 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), | ||
225 | |||
226 | SND_SOC_DAPM_ADC("ADC", "Capture", SGTL5000_CHIP_ANA_POWER, 1, 0), | 222 | SND_SOC_DAPM_ADC("ADC", "Capture", SGTL5000_CHIP_ANA_POWER, 1, 0), |
227 | SND_SOC_DAPM_DAC("DAC", "Playback", SGTL5000_CHIP_ANA_POWER, 3, 0), | 223 | SND_SOC_DAPM_DAC("DAC", "Playback", SGTL5000_CHIP_ANA_POWER, 3, 0), |
224 | |||
225 | SND_SOC_DAPM_PRE("VAG_POWER_PRE", power_vag_event), | ||
226 | SND_SOC_DAPM_POST("VAG_POWER_POST", power_vag_event), | ||
228 | }; | 227 | }; |
229 | 228 | ||
230 | /* routes for sgtl5000 */ | 229 | /* routes for sgtl5000 */ |
@@ -232,16 +231,13 @@ static const struct snd_soc_dapm_route sgtl5000_dapm_routes[] = { | |||
232 | {"Capture Mux", "LINE_IN", "LINE_IN"}, /* line_in --> adc_mux */ | 231 | {"Capture Mux", "LINE_IN", "LINE_IN"}, /* line_in --> adc_mux */ |
233 | {"Capture Mux", "MIC_IN", "MIC_IN"}, /* mic_in --> adc_mux */ | 232 | {"Capture Mux", "MIC_IN", "MIC_IN"}, /* mic_in --> adc_mux */ |
234 | 233 | ||
235 | {"ADC", NULL, "VAG_POWER"}, | ||
236 | {"ADC", NULL, "Capture Mux"}, /* adc_mux --> adc */ | 234 | {"ADC", NULL, "Capture Mux"}, /* adc_mux --> adc */ |
237 | {"AIFOUT", NULL, "ADC"}, /* adc --> i2s_out */ | 235 | {"AIFOUT", NULL, "ADC"}, /* adc --> i2s_out */ |
238 | 236 | ||
239 | {"DAC", NULL, "VAG_POWER"}, | ||
240 | {"DAC", NULL, "AIFIN"}, /* i2s-->dac,skip audio mux */ | 237 | {"DAC", NULL, "AIFIN"}, /* i2s-->dac,skip audio mux */ |
241 | {"Headphone Mux", "DAC", "DAC"}, /* dac --> hp_mux */ | 238 | {"Headphone Mux", "DAC", "DAC"}, /* dac --> hp_mux */ |
242 | {"LO", NULL, "DAC"}, /* dac --> line_out */ | 239 | {"LO", NULL, "DAC"}, /* dac --> line_out */ |
243 | 240 | ||
244 | {"LINE_IN", NULL, "VAG_POWER"}, | ||
245 | {"Headphone Mux", "LINE_IN", "LINE_IN"},/* line_in --> hp_mux */ | 241 | {"Headphone Mux", "LINE_IN", "LINE_IN"},/* line_in --> hp_mux */ |
246 | {"HP", NULL, "Headphone Mux"}, /* hp_mux --> hp */ | 242 | {"HP", NULL, "Headphone Mux"}, /* hp_mux --> hp */ |
247 | 243 | ||