aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm8940.c
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2013-11-08 12:19:55 -0500
committerMark Brown <broonie@linaro.org>2013-11-24 08:50:41 -0500
commit6435e5be652633b87f73460f9c17be361404ee01 (patch)
treee20f625b2ce4a0f5c8d845c5f93bab9b28868389 /sound/soc/codecs/wm8940.c
parent6ce4eac1f600b34f2f7f58f9cd8f0503d79e42ae (diff)
ASoC: wm8940: Convert to table based control and DAPM init
Signed-off-by: Mark Brown <broonie@linaro.org> Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Acked-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'sound/soc/codecs/wm8940.c')
-rw-r--r--sound/soc/codecs/wm8940.c28
1 files changed, 7 insertions, 21 deletions
diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c
index b1591c61c254..4858b5c039fa 100644
--- a/sound/soc/codecs/wm8940.c
+++ b/sound/soc/codecs/wm8940.c
@@ -264,7 +264,7 @@ static const struct snd_soc_dapm_widget wm8940_dapm_widgets[] = {
264 SND_SOC_DAPM_INPUT("AUX"), 264 SND_SOC_DAPM_INPUT("AUX"),
265}; 265};
266 266
267static const struct snd_soc_dapm_route audio_map[] = { 267static const struct snd_soc_dapm_route wm8940_dapm_routes[] = {
268 /* Mono output mixer */ 268 /* Mono output mixer */
269 {"Mono Mixer", "PCM Playback Switch", "DAC"}, 269 {"Mono Mixer", "PCM Playback Switch", "DAC"},
270 {"Mono Mixer", "Aux Playback Switch", "Aux Input"}, 270 {"Mono Mixer", "Aux Playback Switch", "Aux Input"},
@@ -296,21 +296,6 @@ static const struct snd_soc_dapm_route audio_map[] = {
296 {"ADC", NULL, "Boost Mixer"}, 296 {"ADC", NULL, "Boost Mixer"},
297}; 297};
298 298
299static int wm8940_add_widgets(struct snd_soc_codec *codec)
300{
301 struct snd_soc_dapm_context *dapm = &codec->dapm;
302 int ret;
303
304 ret = snd_soc_dapm_new_controls(dapm, wm8940_dapm_widgets,
305 ARRAY_SIZE(wm8940_dapm_widgets));
306 if (ret)
307 goto error_ret;
308 ret = snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
309
310error_ret:
311 return ret;
312}
313
314#define wm8940_reset(c) snd_soc_write(c, WM8940_SOFTRESET, 0); 299#define wm8940_reset(c) snd_soc_write(c, WM8940_SOFTRESET, 0);
315 300
316static int wm8940_set_dai_fmt(struct snd_soc_dai *codec_dai, 301static int wm8940_set_dai_fmt(struct snd_soc_dai *codec_dai,
@@ -716,11 +701,6 @@ static int wm8940_probe(struct snd_soc_codec *codec)
716 return ret; 701 return ret;
717 } 702 }
718 703
719 ret = snd_soc_add_codec_controls(codec, wm8940_snd_controls,
720 ARRAY_SIZE(wm8940_snd_controls));
721 if (ret)
722 return ret;
723 ret = wm8940_add_widgets(codec);
724 return ret; 704 return ret;
725} 705}
726 706
@@ -736,6 +716,12 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8940 = {
736 .suspend = wm8940_suspend, 716 .suspend = wm8940_suspend,
737 .resume = wm8940_resume, 717 .resume = wm8940_resume,
738 .set_bias_level = wm8940_set_bias_level, 718 .set_bias_level = wm8940_set_bias_level,
719 .controls = wm8940_snd_controls,
720 .num_controls = ARRAY_SIZE(wm8940_snd_controls),
721 .dapm_widgets = wm8940_dapm_widgets,
722 .num_dapm_widgets = ARRAY_SIZE(wm8940_dapm_widgets),
723 .dapm_routes = wm8940_dapm_routes,
724 .num_dapm_routes = ARRAY_SIZE(wm8940_dapm_routes),
739 .reg_cache_size = ARRAY_SIZE(wm8940_reg_defaults), 725 .reg_cache_size = ARRAY_SIZE(wm8940_reg_defaults),
740 .reg_word_size = sizeof(u16), 726 .reg_word_size = sizeof(u16),
741 .reg_cache_default = wm8940_reg_defaults, 727 .reg_cache_default = wm8940_reg_defaults,