aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm8523.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-08-22 11:02:43 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-08-22 18:23:17 -0400
commit1661699aaa64e6024770ea7adff4fc6216cb25ca (patch)
tree4a46641c65f9cf6b11f98ab5282926a47cb2d6f3 /sound/soc/codecs/wm8523.c
parentfef24d92a649ba1415c0a834259048153a2ab30a (diff)
ASoC: Convert WM8523 to table based control and DAPM initialization
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>
Diffstat (limited to 'sound/soc/codecs/wm8523.c')
-rw-r--r--sound/soc/codecs/wm8523.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/sound/soc/codecs/wm8523.c b/sound/soc/codecs/wm8523.c
index 52812d1a90e4..5355a7a944f7 100644
--- a/sound/soc/codecs/wm8523.c
+++ b/sound/soc/codecs/wm8523.c
@@ -85,7 +85,7 @@ static const char *wm8523_zd_count_text[] = {
85static const struct soc_enum wm8523_zc_count = 85static const struct soc_enum wm8523_zc_count =
86 SOC_ENUM_SINGLE(WM8523_ZERO_DETECT, 0, 2, wm8523_zd_count_text); 86 SOC_ENUM_SINGLE(WM8523_ZERO_DETECT, 0, 2, wm8523_zd_count_text);
87 87
88static const struct snd_kcontrol_new wm8523_snd_controls[] = { 88static const struct snd_kcontrol_new wm8523_controls[] = {
89SOC_DOUBLE_R_TLV("Playback Volume", WM8523_DAC_GAINL, WM8523_DAC_GAINR, 89SOC_DOUBLE_R_TLV("Playback Volume", WM8523_DAC_GAINL, WM8523_DAC_GAINR,
90 0, 448, 0, dac_tlv), 90 0, 448, 0, dac_tlv),
91SOC_SINGLE("ZC Switch", WM8523_DAC_CTRL3, 4, 1, 0), 91SOC_SINGLE("ZC Switch", WM8523_DAC_CTRL3, 4, 1, 0),
@@ -102,22 +102,11 @@ SND_SOC_DAPM_OUTPUT("LINEVOUTL"),
102SND_SOC_DAPM_OUTPUT("LINEVOUTR"), 102SND_SOC_DAPM_OUTPUT("LINEVOUTR"),
103}; 103};
104 104
105static const struct snd_soc_dapm_route intercon[] = { 105static const struct snd_soc_dapm_route wm8523_dapm_routes[] = {
106 { "LINEVOUTL", NULL, "DAC" }, 106 { "LINEVOUTL", NULL, "DAC" },
107 { "LINEVOUTR", NULL, "DAC" }, 107 { "LINEVOUTR", NULL, "DAC" },
108}; 108};
109 109
110static int wm8523_add_widgets(struct snd_soc_codec *codec)
111{
112 struct snd_soc_dapm_context *dapm = &codec->dapm;
113
114 snd_soc_dapm_new_controls(dapm, wm8523_dapm_widgets,
115 ARRAY_SIZE(wm8523_dapm_widgets));
116 snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
117
118 return 0;
119}
120
121static struct { 110static struct {
122 int value; 111 int value;
123 int ratio; 112 int ratio;
@@ -480,10 +469,6 @@ static int wm8523_probe(struct snd_soc_codec *codec)
480 /* Bias level configuration will have done an extra enable */ 469 /* Bias level configuration will have done an extra enable */
481 regulator_bulk_disable(ARRAY_SIZE(wm8523->supplies), wm8523->supplies); 470 regulator_bulk_disable(ARRAY_SIZE(wm8523->supplies), wm8523->supplies);
482 471
483 snd_soc_add_controls(codec, wm8523_snd_controls,
484 ARRAY_SIZE(wm8523_snd_controls));
485 wm8523_add_widgets(codec);
486
487 return 0; 472 return 0;
488 473
489err_enable: 474err_enable:
@@ -513,6 +498,13 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8523 = {
513 .reg_word_size = sizeof(u16), 498 .reg_word_size = sizeof(u16),
514 .reg_cache_default = wm8523_reg, 499 .reg_cache_default = wm8523_reg,
515 .volatile_register = wm8523_volatile_register, 500 .volatile_register = wm8523_volatile_register,
501
502 .controls = wm8523_controls,
503 .num_controls = ARRAY_SIZE(wm8523_controls),
504 .dapm_widgets = wm8523_dapm_widgets,
505 .num_dapm_widgets = ARRAY_SIZE(wm8523_dapm_widgets),
506 .dapm_routes = wm8523_dapm_routes,
507 .num_dapm_routes = ARRAY_SIZE(wm8523_dapm_routes),
516}; 508};
517 509
518static const struct of_device_id wm8523_of_match[] = { 510static const struct of_device_id wm8523_of_match[] = {