diff options
| author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-03-08 13:52:08 -0500 |
|---|---|---|
| committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-03-09 07:23:03 -0500 |
| commit | 378a90f4540cc113e6ef36861ae914b0c63700a0 (patch) | |
| tree | 40ccc0e1c8e07934e6f83f2c9812924a144b91af | |
| parent | 62f75aafdf180554b4fad29ff1f3827b151d39db (diff) | |
ASoC: Simplify WM9081 speaker startup by using widgets for spaker output
Now we have a register write minimisation code in DAPM we don't need to
worry about the ordering of the enable and disable of the PGA and the
output stage.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
| -rw-r--r-- | sound/soc/codecs/wm9081.c | 32 |
1 files changed, 6 insertions, 26 deletions
diff --git a/sound/soc/codecs/wm9081.c b/sound/soc/codecs/wm9081.c index effaf75cacc8..55cdf2982020 100644 --- a/sound/soc/codecs/wm9081.c +++ b/sound/soc/codecs/wm9081.c | |||
| @@ -389,27 +389,6 @@ SOC_DAPM_SINGLE("IN2 Switch", WM9081_ANALOGUE_MIXER, 2, 1, 0), | |||
| 389 | SOC_DAPM_SINGLE("Playback Switch", WM9081_ANALOGUE_MIXER, 4, 1, 0), | 389 | SOC_DAPM_SINGLE("Playback Switch", WM9081_ANALOGUE_MIXER, 4, 1, 0), |
| 390 | }; | 390 | }; |
| 391 | 391 | ||
| 392 | static int speaker_event(struct snd_soc_dapm_widget *w, | ||
| 393 | struct snd_kcontrol *kcontrol, int event) | ||
| 394 | { | ||
| 395 | struct snd_soc_codec *codec = w->codec; | ||
| 396 | unsigned int reg = snd_soc_read(codec, WM9081_POWER_MANAGEMENT); | ||
| 397 | |||
| 398 | switch (event) { | ||
| 399 | case SND_SOC_DAPM_POST_PMU: | ||
| 400 | reg |= WM9081_SPK_ENA; | ||
| 401 | break; | ||
| 402 | |||
| 403 | case SND_SOC_DAPM_PRE_PMD: | ||
| 404 | reg &= ~WM9081_SPK_ENA; | ||
| 405 | break; | ||
| 406 | } | ||
| 407 | |||
| 408 | snd_soc_write(codec, WM9081_POWER_MANAGEMENT, reg); | ||
| 409 | |||
| 410 | return 0; | ||
| 411 | } | ||
| 412 | |||
| 413 | struct _fll_div { | 392 | struct _fll_div { |
| 414 | u16 fll_fratio; | 393 | u16 fll_fratio; |
| 415 | u16 fll_outdiv; | 394 | u16 fll_outdiv; |
| @@ -747,9 +726,8 @@ SND_SOC_DAPM_MIXER_NAMED_CTL("Mixer", SND_SOC_NOPM, 0, 0, | |||
| 747 | 726 | ||
| 748 | SND_SOC_DAPM_PGA("LINEOUT PGA", WM9081_POWER_MANAGEMENT, 4, 0, NULL, 0), | 727 | SND_SOC_DAPM_PGA("LINEOUT PGA", WM9081_POWER_MANAGEMENT, 4, 0, NULL, 0), |
| 749 | 728 | ||
| 750 | SND_SOC_DAPM_PGA_E("Speaker PGA", WM9081_POWER_MANAGEMENT, 2, 0, NULL, 0, | 729 | SND_SOC_DAPM_PGA("Speaker PGA", WM9081_POWER_MANAGEMENT, 2, 0, NULL, 0), |
| 751 | speaker_event, | 730 | SND_SOC_DAPM_PGA("Speaker", WM9081_POWER_MANAGEMENT, 1, 0, NULL, 0), |
| 752 | SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), | ||
| 753 | 731 | ||
| 754 | SND_SOC_DAPM_OUTPUT("LINEOUT"), | 732 | SND_SOC_DAPM_OUTPUT("LINEOUT"), |
| 755 | SND_SOC_DAPM_OUTPUT("SPKN"), | 733 | SND_SOC_DAPM_OUTPUT("SPKN"), |
| @@ -780,8 +758,10 @@ static const struct snd_soc_dapm_route wm9081_audio_paths[] = { | |||
| 780 | { "Speaker PGA", NULL, "TOCLK" }, | 758 | { "Speaker PGA", NULL, "TOCLK" }, |
| 781 | { "Speaker PGA", NULL, "CLK_SYS" }, | 759 | { "Speaker PGA", NULL, "CLK_SYS" }, |
| 782 | 760 | ||
| 783 | { "SPKN", NULL, "Speaker PGA" }, | 761 | { "Speaker", NULL, "Speaker PGA" }, |
| 784 | { "SPKP", NULL, "Speaker PGA" }, | 762 | |
| 763 | { "SPKN", NULL, "Speaker" }, | ||
| 764 | { "SPKP", NULL, "Speaker" }, | ||
| 785 | }; | 765 | }; |
| 786 | 766 | ||
| 787 | static int wm9081_set_bias_level(struct snd_soc_codec *codec, | 767 | static int wm9081_set_bias_level(struct snd_soc_codec *codec, |
