aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm8350.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-12-03 06:31:58 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-12-03 16:35:10 -0500
commite6c94e9f6dd77c928419dc05af2b3d17ed9463b9 (patch)
treeaf360b04c887ccd044214c4cf842fe06037b2d10 /sound/soc/codecs/wm8350.c
parent455b91bfe86fd4773a15593eb7a834b9f552797d (diff)
ASoC: Convert WM8350 to table based DAPM and control init
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs/wm8350.c')
-rw-r--r--sound/soc/codecs/wm8350.c36
1 files changed, 8 insertions, 28 deletions
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c
index 7b095aeef695..8c4c9591ec05 100644
--- a/sound/soc/codecs/wm8350.c
+++ b/sound/soc/codecs/wm8350.c
@@ -696,7 +696,7 @@ static const struct snd_soc_dapm_widget wm8350_dapm_widgets[] = {
696 SND_SOC_DAPM_INPUT("IN3L"), 696 SND_SOC_DAPM_INPUT("IN3L"),
697}; 697};
698 698
699static const struct snd_soc_dapm_route audio_map[] = { 699static const struct snd_soc_dapm_route wm8350_dapm_routes[] = {
700 700
701 /* left playback mixer */ 701 /* left playback mixer */
702 {"Left Playback Mixer", "Playback Switch", "Left DAC"}, 702 {"Left Playback Mixer", "Playback Switch", "Left DAC"},
@@ -777,29 +777,6 @@ static const struct snd_soc_dapm_route audio_map[] = {
777 {"Beep", NULL, "IN3R PGA"}, 777 {"Beep", NULL, "IN3R PGA"},
778}; 778};
779 779
780static int wm8350_add_widgets(struct snd_soc_codec *codec)
781{
782 struct snd_soc_dapm_context *dapm = &codec->dapm;
783 int ret;
784
785 ret = snd_soc_dapm_new_controls(dapm,
786 wm8350_dapm_widgets,
787 ARRAY_SIZE(wm8350_dapm_widgets));
788 if (ret != 0) {
789 dev_err(codec->dev, "dapm control register failed\n");
790 return ret;
791 }
792
793 /* set up audio paths */
794 ret = snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
795 if (ret != 0) {
796 dev_err(codec->dev, "DAPM route register failed\n");
797 return ret;
798 }
799
800 return 0;
801}
802
803static int wm8350_set_dai_sysclk(struct snd_soc_dai *codec_dai, 780static int wm8350_set_dai_sysclk(struct snd_soc_dai *codec_dai,
804 int clk_id, unsigned int freq, int dir) 781 int clk_id, unsigned int freq, int dir)
805{ 782{
@@ -1634,10 +1611,6 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec)
1634 wm8350_mic_handler, 0, "Microphone detect", priv); 1611 wm8350_mic_handler, 0, "Microphone detect", priv);
1635 1612
1636 1613
1637 snd_soc_add_controls(codec, wm8350_snd_controls,
1638 ARRAY_SIZE(wm8350_snd_controls));
1639 wm8350_add_widgets(codec);
1640
1641 wm8350_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 1614 wm8350_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
1642 1615
1643 return 0; 1616 return 0;
@@ -1685,6 +1658,13 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8350 = {
1685 .read = wm8350_codec_read, 1658 .read = wm8350_codec_read,
1686 .write = wm8350_codec_write, 1659 .write = wm8350_codec_write,
1687 .set_bias_level = wm8350_set_bias_level, 1660 .set_bias_level = wm8350_set_bias_level,
1661
1662 .controls = wm8350_snd_controls,
1663 .num_controls = ARRAY_SIZE(wm8350_snd_controls),
1664 .dapm_widgets = wm8350_dapm_widgets,
1665 .num_dapm_widgets = ARRAY_SIZE(wm8350_dapm_widgets),
1666 .dapm_routes = wm8350_dapm_routes,
1667 .num_dapm_routes = ARRAY_SIZE(wm8350_dapm_routes),
1688}; 1668};
1689 1669
1690static int __devinit wm8350_probe(struct platform_device *pdev) 1670static int __devinit wm8350_probe(struct platform_device *pdev)