diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-09-16 12:55:06 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-09-19 13:30:58 -0400 |
commit | 8259df12fd3f3429648411bfff37dfbb34a2d9b2 (patch) | |
tree | 726433a3cf48fae93b221041b18dbf761c852b0e /sound/soc | |
parent | 53daf20893b18000768aaa617a60b987fa39f875 (diff) |
ASoC: WM8996 only needs bandgap for analogue functionality
Rather than managing the bandgap in the bias level control use a supply
widget as we only actually need to enable it for analogue paths, not
fully digital ones.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/codecs/wm8996.c | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/sound/soc/codecs/wm8996.c b/sound/soc/codecs/wm8996.c index 5174874a5f7b..c584e3e6a6fe 100644 --- a/sound/soc/codecs/wm8996.c +++ b/sound/soc/codecs/wm8996.c | |||
@@ -666,6 +666,25 @@ SOC_SINGLE_TLV("DSP2 EQ B5 Volume", WM8996_DSP2_RX_EQ_GAINS_2, 6, 31, 0, | |||
666 | eq_tlv), | 666 | eq_tlv), |
667 | }; | 667 | }; |
668 | 668 | ||
669 | static int bg_event(struct snd_soc_dapm_widget *w, | ||
670 | struct snd_kcontrol *kcontrol, int event) | ||
671 | { | ||
672 | struct snd_soc_codec *codec = w->codec; | ||
673 | struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec); | ||
674 | int ret = 0; | ||
675 | |||
676 | switch (event) { | ||
677 | case SND_SOC_DAPM_POST_PMU: | ||
678 | msleep(2); | ||
679 | break; | ||
680 | default: | ||
681 | BUG(); | ||
682 | ret = -EINVAL; | ||
683 | } | ||
684 | |||
685 | return ret; | ||
686 | } | ||
687 | |||
669 | static int cp_event(struct snd_soc_dapm_widget *w, | 688 | static int cp_event(struct snd_soc_dapm_widget *w, |
670 | struct snd_kcontrol *kcontrol, int event) | 689 | struct snd_kcontrol *kcontrol, int event) |
671 | { | 690 | { |
@@ -999,7 +1018,8 @@ SND_SOC_DAPM_SUPPLY_S("AIFCLK", 2, WM8996_CLOCKING_1, 2, 0, NULL, 0), | |||
999 | SND_SOC_DAPM_SUPPLY_S("Charge Pump", 2, WM8996_CHARGE_PUMP_1, 15, 0, cp_event, | 1018 | SND_SOC_DAPM_SUPPLY_S("Charge Pump", 2, WM8996_CHARGE_PUMP_1, 15, 0, cp_event, |
1000 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | | 1019 | SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | |
1001 | SND_SOC_DAPM_POST_PMD), | 1020 | SND_SOC_DAPM_POST_PMD), |
1002 | 1021 | SND_SOC_DAPM_SUPPLY("Bandgap", WM8996_POWER_MANAGEMENT_1, WM8996_BG_ENA_SHIFT, | |
1022 | 0, bg_event, SND_SOC_DAPM_POST_PMU), | ||
1003 | SND_SOC_DAPM_SUPPLY("LDO2", WM8996_POWER_MANAGEMENT_2, 1, 0, NULL, 0), | 1023 | SND_SOC_DAPM_SUPPLY("LDO2", WM8996_POWER_MANAGEMENT_2, 1, 0, NULL, 0), |
1004 | SND_SOC_DAPM_SUPPLY("MICB1 Audio", WM8996_MICBIAS_1, 4, 1, NULL, 0), | 1024 | SND_SOC_DAPM_SUPPLY("MICB1 Audio", WM8996_MICBIAS_1, 4, 1, NULL, 0), |
1005 | SND_SOC_DAPM_SUPPLY("MICB2 Audio", WM8996_MICBIAS_2, 4, 1, NULL, 0), | 1025 | SND_SOC_DAPM_SUPPLY("MICB2 Audio", WM8996_MICBIAS_2, 4, 1, NULL, 0), |
@@ -1159,18 +1179,22 @@ static const struct snd_soc_dapm_route wm8996_dapm_routes[] = { | |||
1159 | 1179 | ||
1160 | { "MICB1", NULL, "LDO2" }, | 1180 | { "MICB1", NULL, "LDO2" }, |
1161 | { "MICB1", NULL, "MICB1 Audio" }, | 1181 | { "MICB1", NULL, "MICB1 Audio" }, |
1182 | { "MICB1", NULL, "Bandgap" }, | ||
1162 | { "MICB2", NULL, "LDO2" }, | 1183 | { "MICB2", NULL, "LDO2" }, |
1163 | { "MICB2", NULL, "MICB2 Audio" }, | 1184 | { "MICB2", NULL, "MICB2 Audio" }, |
1185 | { "MICB2", NULL, "Bandgap" }, | ||
1164 | 1186 | ||
1165 | { "IN1L PGA", NULL, "IN2LN" }, | 1187 | { "IN1L PGA", NULL, "IN2LN" }, |
1166 | { "IN1L PGA", NULL, "IN2LP" }, | 1188 | { "IN1L PGA", NULL, "IN2LP" }, |
1167 | { "IN1L PGA", NULL, "IN1LN" }, | 1189 | { "IN1L PGA", NULL, "IN1LN" }, |
1168 | { "IN1L PGA", NULL, "IN1LP" }, | 1190 | { "IN1L PGA", NULL, "IN1LP" }, |
1191 | { "IN1L PGA", NULL, "Bandgap" }, | ||
1169 | 1192 | ||
1170 | { "IN1R PGA", NULL, "IN2RN" }, | 1193 | { "IN1R PGA", NULL, "IN2RN" }, |
1171 | { "IN1R PGA", NULL, "IN2RP" }, | 1194 | { "IN1R PGA", NULL, "IN2RP" }, |
1172 | { "IN1R PGA", NULL, "IN1RN" }, | 1195 | { "IN1R PGA", NULL, "IN1RN" }, |
1173 | { "IN1R PGA", NULL, "IN1RP" }, | 1196 | { "IN1R PGA", NULL, "IN1RP" }, |
1197 | { "IN1R PGA", NULL, "Bandgap" }, | ||
1174 | 1198 | ||
1175 | { "ADCL", NULL, "IN1L PGA" }, | 1199 | { "ADCL", NULL, "IN1L PGA" }, |
1176 | 1200 | ||
@@ -1304,6 +1328,7 @@ static const struct snd_soc_dapm_route wm8996_dapm_routes[] = { | |||
1304 | { "DAC2R", NULL, "DAC2R Mixer" }, | 1328 | { "DAC2R", NULL, "DAC2R Mixer" }, |
1305 | 1329 | ||
1306 | { "HPOUT2L PGA", NULL, "Charge Pump" }, | 1330 | { "HPOUT2L PGA", NULL, "Charge Pump" }, |
1331 | { "HPOUT2L PGA", NULL, "Bandgap" }, | ||
1307 | { "HPOUT2L PGA", NULL, "DAC2L" }, | 1332 | { "HPOUT2L PGA", NULL, "DAC2L" }, |
1308 | { "HPOUT2L_DLY", NULL, "HPOUT2L PGA" }, | 1333 | { "HPOUT2L_DLY", NULL, "HPOUT2L PGA" }, |
1309 | { "HPOUT2L_DCS", NULL, "HPOUT2L_DLY" }, | 1334 | { "HPOUT2L_DCS", NULL, "HPOUT2L_DLY" }, |
@@ -1311,6 +1336,7 @@ static const struct snd_soc_dapm_route wm8996_dapm_routes[] = { | |||
1311 | { "HPOUT2L_RMV_SHORT", NULL, "HPOUT2L_OUTP" }, | 1336 | { "HPOUT2L_RMV_SHORT", NULL, "HPOUT2L_OUTP" }, |
1312 | 1337 | ||
1313 | { "HPOUT2R PGA", NULL, "Charge Pump" }, | 1338 | { "HPOUT2R PGA", NULL, "Charge Pump" }, |
1339 | { "HPOUT2R PGA", NULL, "Bandgap" }, | ||
1314 | { "HPOUT2R PGA", NULL, "DAC2R" }, | 1340 | { "HPOUT2R PGA", NULL, "DAC2R" }, |
1315 | { "HPOUT2R_DLY", NULL, "HPOUT2R PGA" }, | 1341 | { "HPOUT2R_DLY", NULL, "HPOUT2R PGA" }, |
1316 | { "HPOUT2R_DCS", NULL, "HPOUT2R_DLY" }, | 1342 | { "HPOUT2R_DCS", NULL, "HPOUT2R_DLY" }, |
@@ -1318,6 +1344,7 @@ static const struct snd_soc_dapm_route wm8996_dapm_routes[] = { | |||
1318 | { "HPOUT2R_RMV_SHORT", NULL, "HPOUT2R_OUTP" }, | 1344 | { "HPOUT2R_RMV_SHORT", NULL, "HPOUT2R_OUTP" }, |
1319 | 1345 | ||
1320 | { "HPOUT1L PGA", NULL, "Charge Pump" }, | 1346 | { "HPOUT1L PGA", NULL, "Charge Pump" }, |
1347 | { "HPOUT1L PGA", NULL, "Bandgap" }, | ||
1321 | { "HPOUT1L PGA", NULL, "DAC1L" }, | 1348 | { "HPOUT1L PGA", NULL, "DAC1L" }, |
1322 | { "HPOUT1L_DLY", NULL, "HPOUT1L PGA" }, | 1349 | { "HPOUT1L_DLY", NULL, "HPOUT1L PGA" }, |
1323 | { "HPOUT1L_DCS", NULL, "HPOUT1L_DLY" }, | 1350 | { "HPOUT1L_DCS", NULL, "HPOUT1L_DLY" }, |
@@ -1325,6 +1352,7 @@ static const struct snd_soc_dapm_route wm8996_dapm_routes[] = { | |||
1325 | { "HPOUT1L_RMV_SHORT", NULL, "HPOUT1L_OUTP" }, | 1352 | { "HPOUT1L_RMV_SHORT", NULL, "HPOUT1L_OUTP" }, |
1326 | 1353 | ||
1327 | { "HPOUT1R PGA", NULL, "Charge Pump" }, | 1354 | { "HPOUT1R PGA", NULL, "Charge Pump" }, |
1355 | { "HPOUT1R PGA", NULL, "Bandgap" }, | ||
1328 | { "HPOUT1R PGA", NULL, "DAC1R" }, | 1356 | { "HPOUT1R PGA", NULL, "DAC1R" }, |
1329 | { "HPOUT1R_DLY", NULL, "HPOUT1R PGA" }, | 1357 | { "HPOUT1R_DLY", NULL, "HPOUT1R PGA" }, |
1330 | { "HPOUT1R_DCS", NULL, "HPOUT1R_DLY" }, | 1358 | { "HPOUT1R_DCS", NULL, "HPOUT1R_DLY" }, |
@@ -1643,14 +1671,7 @@ static int wm8996_set_bias_level(struct snd_soc_codec *codec, | |||
1643 | 1671 | ||
1644 | switch (level) { | 1672 | switch (level) { |
1645 | case SND_SOC_BIAS_ON: | 1673 | case SND_SOC_BIAS_ON: |
1646 | break; | ||
1647 | |||
1648 | case SND_SOC_BIAS_PREPARE: | 1674 | case SND_SOC_BIAS_PREPARE: |
1649 | if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY) { | ||
1650 | snd_soc_update_bits(codec, WM8996_POWER_MANAGEMENT_1, | ||
1651 | WM8996_BG_ENA, WM8996_BG_ENA); | ||
1652 | msleep(2); | ||
1653 | } | ||
1654 | break; | 1675 | break; |
1655 | 1676 | ||
1656 | case SND_SOC_BIAS_STANDBY: | 1677 | case SND_SOC_BIAS_STANDBY: |
@@ -1673,9 +1694,6 @@ static int wm8996_set_bias_level(struct snd_soc_codec *codec, | |||
1673 | codec->cache_only = false; | 1694 | codec->cache_only = false; |
1674 | snd_soc_cache_sync(codec); | 1695 | snd_soc_cache_sync(codec); |
1675 | } | 1696 | } |
1676 | |||
1677 | snd_soc_update_bits(codec, WM8996_POWER_MANAGEMENT_1, | ||
1678 | WM8996_BG_ENA, 0); | ||
1679 | break; | 1697 | break; |
1680 | 1698 | ||
1681 | case SND_SOC_BIAS_OFF: | 1699 | case SND_SOC_BIAS_OFF: |