aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/twl4030.c
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@nokia.com>2009-10-29 05:58:10 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-10-29 08:58:21 -0400
commit7729cf749350b04c80ee1652961de238afc9d5b1 (patch)
tree43c250c93d7099d97a69113d0cf5e82b8d68fc80 /sound/soc/codecs/twl4030.c
parent86139a13ced74b3911c33940f0049b8f97bae07a (diff)
ASoC: TWL4030: Change APLL powering sequence
It seams that certain part of the twl4030 codec needs the APLL enabled before they are enabled. Paths which has any digital processing needs need the APLL enabled before they can function. For example the vibra output will have some random data after it is enabled and before the APLL also enabled. If only analog components are in use (analog bypass), than it seams, that the APLL does not need to be enabled. This lowers the power consumption with around ~0.005A. Adding DAPM_SUPPLY to the Digital playback route and also to the capture route to enable and disable the APLL. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs/twl4030.c')
-rw-r--r--sound/soc/codecs/twl4030.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index ccaeb366eb7c..277e99ce5558 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -620,6 +620,20 @@ static int vibramux_event(struct snd_soc_dapm_widget *w,
620 return 0; 620 return 0;
621} 621}
622 622
623static int apll_event(struct snd_soc_dapm_widget *w,
624 struct snd_kcontrol *kcontrol, int event)
625{
626 switch (event) {
627 case SND_SOC_DAPM_PRE_PMU:
628 twl4030_apll_enable(w->codec, 1);
629 break;
630 case SND_SOC_DAPM_POST_PMD:
631 twl4030_apll_enable(w->codec, 0);
632 break;
633 }
634 return 0;
635}
636
623static void headset_ramp(struct snd_soc_codec *codec, int ramp) 637static void headset_ramp(struct snd_soc_codec *codec, int ramp)
624{ 638{
625 struct snd_soc_device *socdev = codec->socdev; 639 struct snd_soc_device *socdev = codec->socdev;
@@ -1185,6 +1199,9 @@ static const struct snd_soc_dapm_widget twl4030_dapm_widgets[] = {
1185 SND_SOC_DAPM_MIXER("Analog Voice Playback Mixer", 1199 SND_SOC_DAPM_MIXER("Analog Voice Playback Mixer",
1186 TWL4030_REG_VDL_APGA_CTL, 0, 0, NULL, 0), 1200 TWL4030_REG_VDL_APGA_CTL, 0, 0, NULL, 0),
1187 1201
1202 SND_SOC_DAPM_SUPPLY("APLL Enable", SND_SOC_NOPM, 0, 0, apll_event,
1203 SND_SOC_DAPM_PRE_PMU|SND_SOC_DAPM_POST_PMD),
1204
1188 /* Output MIXER controls */ 1205 /* Output MIXER controls */
1189 /* Earpiece */ 1206 /* Earpiece */
1190 SND_SOC_DAPM_MIXER("Earpiece Mixer", SND_SOC_NOPM, 0, 0, 1207 SND_SOC_DAPM_MIXER("Earpiece Mixer", SND_SOC_NOPM, 0, 0,
@@ -1312,6 +1329,13 @@ static const struct snd_soc_dapm_route intercon[] = {
1312 {"Digital R2 Playback Mixer", NULL, "DAC Right2"}, 1329 {"Digital R2 Playback Mixer", NULL, "DAC Right2"},
1313 {"Digital Voice Playback Mixer", NULL, "DAC Voice"}, 1330 {"Digital Voice Playback Mixer", NULL, "DAC Voice"},
1314 1331
1332 /* Supply for the digital part (APLL) */
1333 {"Digital R1 Playback Mixer", NULL, "APLL Enable"},
1334 {"Digital L1 Playback Mixer", NULL, "APLL Enable"},
1335 {"Digital R2 Playback Mixer", NULL, "APLL Enable"},
1336 {"Digital L2 Playback Mixer", NULL, "APLL Enable"},
1337 {"Digital Voice Playback Mixer", NULL, "APLL Enable"},
1338
1315 {"Analog L1 Playback Mixer", NULL, "Digital L1 Playback Mixer"}, 1339 {"Analog L1 Playback Mixer", NULL, "Digital L1 Playback Mixer"},
1316 {"Analog R1 Playback Mixer", NULL, "Digital R1 Playback Mixer"}, 1340 {"Analog R1 Playback Mixer", NULL, "Digital R1 Playback Mixer"},
1317 {"Analog L2 Playback Mixer", NULL, "Digital L2 Playback Mixer"}, 1341 {"Analog L2 Playback Mixer", NULL, "Digital L2 Playback Mixer"},
@@ -1472,14 +1496,12 @@ static int twl4030_set_bias_level(struct snd_soc_codec *codec,
1472{ 1496{
1473 switch (level) { 1497 switch (level) {
1474 case SND_SOC_BIAS_ON: 1498 case SND_SOC_BIAS_ON:
1475 twl4030_apll_enable(codec, 1);
1476 break; 1499 break;
1477 case SND_SOC_BIAS_PREPARE: 1500 case SND_SOC_BIAS_PREPARE:
1478 break; 1501 break;
1479 case SND_SOC_BIAS_STANDBY: 1502 case SND_SOC_BIAS_STANDBY:
1480 if (codec->bias_level == SND_SOC_BIAS_OFF) 1503 if (codec->bias_level == SND_SOC_BIAS_OFF)
1481 twl4030_power_up(codec); 1504 twl4030_power_up(codec);
1482 twl4030_apll_enable(codec, 0);
1483 break; 1505 break;
1484 case SND_SOC_BIAS_OFF: 1506 case SND_SOC_BIAS_OFF:
1485 twl4030_power_down(codec); 1507 twl4030_power_down(codec);