diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-07-04 13:27:51 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-07-05 14:00:21 -0400 |
commit | 4c7c5374ce6876d3d2c7013ef815051df4258952 (patch) | |
tree | 4bc4d5bc647c125a32f5a65b6fd9358d3c934e14 /sound | |
parent | 8e9ddf811ba021506d2316fcfe619faa0ab3f567 (diff) |
ASoC: Manage WM8731 ACTIVE bit as a supply widget
Now we have supply widgets there's no need to open code the handling of
the ACTIVE bit.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Tested-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/codecs/wm8731.c | 29 |
1 files changed, 3 insertions, 26 deletions
diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c index 2dc964b55e4f..76b4361e9b80 100644 --- a/sound/soc/codecs/wm8731.c +++ b/sound/soc/codecs/wm8731.c | |||
@@ -175,6 +175,7 @@ static const struct snd_kcontrol_new wm8731_input_mux_controls = | |||
175 | SOC_DAPM_ENUM("Input Select", wm8731_insel_enum); | 175 | SOC_DAPM_ENUM("Input Select", wm8731_insel_enum); |
176 | 176 | ||
177 | static const struct snd_soc_dapm_widget wm8731_dapm_widgets[] = { | 177 | static const struct snd_soc_dapm_widget wm8731_dapm_widgets[] = { |
178 | SND_SOC_DAPM_SUPPLY("ACTIVE",WM8731_ACTIVE, 0, 0, NULL, 0), | ||
178 | SND_SOC_DAPM_SUPPLY("OSC", WM8731_PWR, 5, 1, NULL, 0), | 179 | SND_SOC_DAPM_SUPPLY("OSC", WM8731_PWR, 5, 1, NULL, 0), |
179 | SND_SOC_DAPM_MIXER("Output Mixer", WM8731_PWR, 4, 1, | 180 | SND_SOC_DAPM_MIXER("Output Mixer", WM8731_PWR, 4, 1, |
180 | &wm8731_output_mixer_controls[0], | 181 | &wm8731_output_mixer_controls[0], |
@@ -204,6 +205,8 @@ static int wm8731_check_osc(struct snd_soc_dapm_widget *source, | |||
204 | static const struct snd_soc_dapm_route wm8731_intercon[] = { | 205 | static const struct snd_soc_dapm_route wm8731_intercon[] = { |
205 | {"DAC", NULL, "OSC", wm8731_check_osc}, | 206 | {"DAC", NULL, "OSC", wm8731_check_osc}, |
206 | {"ADC", NULL, "OSC", wm8731_check_osc}, | 207 | {"ADC", NULL, "OSC", wm8731_check_osc}, |
208 | {"DAC", NULL, "ACTIVE"}, | ||
209 | {"ADC", NULL, "ACTIVE"}, | ||
207 | 210 | ||
208 | /* output mixer */ | 211 | /* output mixer */ |
209 | {"Output Mixer", "Line Bypass Switch", "Line Input"}, | 212 | {"Output Mixer", "Line Bypass Switch", "Line Input"}, |
@@ -315,29 +318,6 @@ static int wm8731_hw_params(struct snd_pcm_substream *substream, | |||
315 | return 0; | 318 | return 0; |
316 | } | 319 | } |
317 | 320 | ||
318 | static int wm8731_pcm_prepare(struct snd_pcm_substream *substream, | ||
319 | struct snd_soc_dai *dai) | ||
320 | { | ||
321 | struct snd_soc_codec *codec = dai->codec; | ||
322 | |||
323 | /* set active */ | ||
324 | snd_soc_write(codec, WM8731_ACTIVE, 0x0001); | ||
325 | |||
326 | return 0; | ||
327 | } | ||
328 | |||
329 | static void wm8731_shutdown(struct snd_pcm_substream *substream, | ||
330 | struct snd_soc_dai *dai) | ||
331 | { | ||
332 | struct snd_soc_codec *codec = dai->codec; | ||
333 | |||
334 | /* deactivate */ | ||
335 | if (!codec->active) { | ||
336 | udelay(50); | ||
337 | snd_soc_write(codec, WM8731_ACTIVE, 0x0); | ||
338 | } | ||
339 | } | ||
340 | |||
341 | static int wm8731_mute(struct snd_soc_dai *dai, int mute) | 321 | static int wm8731_mute(struct snd_soc_dai *dai, int mute) |
342 | { | 322 | { |
343 | struct snd_soc_codec *codec = dai->codec; | 323 | struct snd_soc_codec *codec = dai->codec; |
@@ -480,7 +460,6 @@ static int wm8731_set_bias_level(struct snd_soc_codec *codec, | |||
480 | snd_soc_write(codec, WM8731_PWR, reg | 0x0040); | 460 | snd_soc_write(codec, WM8731_PWR, reg | 0x0040); |
481 | break; | 461 | break; |
482 | case SND_SOC_BIAS_OFF: | 462 | case SND_SOC_BIAS_OFF: |
483 | snd_soc_write(codec, WM8731_ACTIVE, 0x0); | ||
484 | snd_soc_write(codec, WM8731_PWR, 0xffff); | 463 | snd_soc_write(codec, WM8731_PWR, 0xffff); |
485 | regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), | 464 | regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), |
486 | wm8731->supplies); | 465 | wm8731->supplies); |
@@ -496,9 +475,7 @@ static int wm8731_set_bias_level(struct snd_soc_codec *codec, | |||
496 | SNDRV_PCM_FMTBIT_S24_LE) | 475 | SNDRV_PCM_FMTBIT_S24_LE) |
497 | 476 | ||
498 | static struct snd_soc_dai_ops wm8731_dai_ops = { | 477 | static struct snd_soc_dai_ops wm8731_dai_ops = { |
499 | .prepare = wm8731_pcm_prepare, | ||
500 | .hw_params = wm8731_hw_params, | 478 | .hw_params = wm8731_hw_params, |
501 | .shutdown = wm8731_shutdown, | ||
502 | .digital_mute = wm8731_mute, | 479 | .digital_mute = wm8731_mute, |
503 | .set_sysclk = wm8731_set_dai_sysclk, | 480 | .set_sysclk = wm8731_set_dai_sysclk, |
504 | .set_fmt = wm8731_set_dai_fmt, | 481 | .set_fmt = wm8731_set_dai_fmt, |