aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/soc/pxa/magician.c34
-rw-r--r--sound/soc/pxa/tosa.c35
2 files changed, 25 insertions, 44 deletions
diff --git a/sound/soc/pxa/magician.c b/sound/soc/pxa/magician.c
index 41ab6678b65d..259e048681c0 100644
--- a/sound/soc/pxa/magician.c
+++ b/sound/soc/pxa/magician.c
@@ -41,9 +41,8 @@ static int magician_hp_switch;
41static int magician_spk_switch = 1; 41static int magician_spk_switch = 1;
42static int magician_in_sel = MAGICIAN_MIC; 42static int magician_in_sel = MAGICIAN_MIC;
43 43
44static void magician_ext_control(struct snd_soc_codec *codec) 44static void magician_ext_control(struct snd_soc_dapm_context *dapm)
45{ 45{
46 struct snd_soc_dapm_context *dapm = &codec->dapm;
47 46
48 snd_soc_dapm_mutex_lock(dapm); 47 snd_soc_dapm_mutex_lock(dapm);
49 48
@@ -75,10 +74,9 @@ static void magician_ext_control(struct snd_soc_codec *codec)
75static int magician_startup(struct snd_pcm_substream *substream) 74static int magician_startup(struct snd_pcm_substream *substream)
76{ 75{
77 struct snd_soc_pcm_runtime *rtd = substream->private_data; 76 struct snd_soc_pcm_runtime *rtd = substream->private_data;
78 struct snd_soc_codec *codec = rtd->codec;
79 77
80 /* check the jack status at stream startup */ 78 /* check the jack status at stream startup */
81 magician_ext_control(codec); 79 magician_ext_control(&rtd->card->dapm);
82 80
83 return 0; 81 return 0;
84} 82}
@@ -277,13 +275,13 @@ static int magician_get_hp(struct snd_kcontrol *kcontrol,
277static int magician_set_hp(struct snd_kcontrol *kcontrol, 275static int magician_set_hp(struct snd_kcontrol *kcontrol,
278 struct snd_ctl_elem_value *ucontrol) 276 struct snd_ctl_elem_value *ucontrol)
279{ 277{
280 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 278 struct snd_soc_card *card = snd_kcontrol_chip(kcontrol);
281 279
282 if (magician_hp_switch == ucontrol->value.integer.value[0]) 280 if (magician_hp_switch == ucontrol->value.integer.value[0])
283 return 0; 281 return 0;
284 282
285 magician_hp_switch = ucontrol->value.integer.value[0]; 283 magician_hp_switch = ucontrol->value.integer.value[0];
286 magician_ext_control(codec); 284 magician_ext_control(&card->dapm);
287 return 1; 285 return 1;
288} 286}
289 287
@@ -297,13 +295,13 @@ static int magician_get_spk(struct snd_kcontrol *kcontrol,
297static int magician_set_spk(struct snd_kcontrol *kcontrol, 295static int magician_set_spk(struct snd_kcontrol *kcontrol,
298 struct snd_ctl_elem_value *ucontrol) 296 struct snd_ctl_elem_value *ucontrol)
299{ 297{
300 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 298 struct snd_soc_card *card = snd_kcontrol_chip(kcontrol);
301 299
302 if (magician_spk_switch == ucontrol->value.integer.value[0]) 300 if (magician_spk_switch == ucontrol->value.integer.value[0])
303 return 0; 301 return 0;
304 302
305 magician_spk_switch = ucontrol->value.integer.value[0]; 303 magician_spk_switch = ucontrol->value.integer.value[0];
306 magician_ext_control(codec); 304 magician_ext_control(&card->dapm);
307 return 1; 305 return 1;
308} 306}
309 307
@@ -400,7 +398,6 @@ static int magician_uda1380_init(struct snd_soc_pcm_runtime *rtd)
400{ 398{
401 struct snd_soc_codec *codec = rtd->codec; 399 struct snd_soc_codec *codec = rtd->codec;
402 struct snd_soc_dapm_context *dapm = &codec->dapm; 400 struct snd_soc_dapm_context *dapm = &codec->dapm;
403 int err;
404 401
405 /* NC codec pins */ 402 /* NC codec pins */
406 snd_soc_dapm_nc_pin(dapm, "VOUTLHP"); 403 snd_soc_dapm_nc_pin(dapm, "VOUTLHP");
@@ -410,19 +407,6 @@ static int magician_uda1380_init(struct snd_soc_pcm_runtime *rtd)
410 snd_soc_dapm_nc_pin(dapm, "VINL"); 407 snd_soc_dapm_nc_pin(dapm, "VINL");
411 snd_soc_dapm_nc_pin(dapm, "VINR"); 408 snd_soc_dapm_nc_pin(dapm, "VINR");
412 409
413 /* Add magician specific controls */
414 err = snd_soc_add_codec_controls(codec, uda1380_magician_controls,
415 ARRAY_SIZE(uda1380_magician_controls));
416 if (err < 0)
417 return err;
418
419 /* Add magician specific widgets */
420 snd_soc_dapm_new_controls(dapm, uda1380_dapm_widgets,
421 ARRAY_SIZE(uda1380_dapm_widgets));
422
423 /* Set up magician specific audio path interconnects */
424 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
425
426 return 0; 410 return 0;
427} 411}
428 412
@@ -456,6 +440,12 @@ static struct snd_soc_card snd_soc_card_magician = {
456 .dai_link = magician_dai, 440 .dai_link = magician_dai,
457 .num_links = ARRAY_SIZE(magician_dai), 441 .num_links = ARRAY_SIZE(magician_dai),
458 442
443 .controls = uda1380_magician_controls,
444 .num_controls = ARRAY_SIZE(uda1380_magician_controls),
445 .dapm_widgets = uda1380_dapm_widgets,
446 .num_dapm_widgets = ARRAY_SIZE(uda1380_dapm_widgets),
447 .dapm_routes = audio_map,
448 .num_dapm_routes = ARRAY_SIZE(audio_map),
459}; 449};
460 450
461static struct platform_device *magician_snd_device; 451static struct platform_device *magician_snd_device;
diff --git a/sound/soc/pxa/tosa.c b/sound/soc/pxa/tosa.c
index cead1658d10a..4a956d1cb269 100644
--- a/sound/soc/pxa/tosa.c
+++ b/sound/soc/pxa/tosa.c
@@ -44,9 +44,8 @@
44static int tosa_jack_func; 44static int tosa_jack_func;
45static int tosa_spk_func; 45static int tosa_spk_func;
46 46
47static void tosa_ext_control(struct snd_soc_codec *codec) 47static void tosa_ext_control(struct snd_soc_dapm_context *dapm)
48{ 48{
49 struct snd_soc_dapm_context *dapm = &codec->dapm;
50 49
51 snd_soc_dapm_mutex_lock(dapm); 50 snd_soc_dapm_mutex_lock(dapm);
52 51
@@ -82,10 +81,9 @@ static void tosa_ext_control(struct snd_soc_codec *codec)
82static int tosa_startup(struct snd_pcm_substream *substream) 81static int tosa_startup(struct snd_pcm_substream *substream)
83{ 82{
84 struct snd_soc_pcm_runtime *rtd = substream->private_data; 83 struct snd_soc_pcm_runtime *rtd = substream->private_data;
85 struct snd_soc_codec *codec = rtd->codec;
86 84
87 /* check the jack status at stream startup */ 85 /* check the jack status at stream startup */
88 tosa_ext_control(codec); 86 tosa_ext_control(&rtd->card->dapm);
89 87
90 return 0; 88 return 0;
91} 89}
@@ -104,13 +102,13 @@ static int tosa_get_jack(struct snd_kcontrol *kcontrol,
104static int tosa_set_jack(struct snd_kcontrol *kcontrol, 102static int tosa_set_jack(struct snd_kcontrol *kcontrol,
105 struct snd_ctl_elem_value *ucontrol) 103 struct snd_ctl_elem_value *ucontrol)
106{ 104{
107 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 105 struct snd_soc_card *card = snd_kcontrol_chip(kcontrol);
108 106
109 if (tosa_jack_func == ucontrol->value.integer.value[0]) 107 if (tosa_jack_func == ucontrol->value.integer.value[0])
110 return 0; 108 return 0;
111 109
112 tosa_jack_func = ucontrol->value.integer.value[0]; 110 tosa_jack_func = ucontrol->value.integer.value[0];
113 tosa_ext_control(codec); 111 tosa_ext_control(&card->dapm);
114 return 1; 112 return 1;
115} 113}
116 114
@@ -124,13 +122,13 @@ static int tosa_get_spk(struct snd_kcontrol *kcontrol,
124static int tosa_set_spk(struct snd_kcontrol *kcontrol, 122static int tosa_set_spk(struct snd_kcontrol *kcontrol,
125 struct snd_ctl_elem_value *ucontrol) 123 struct snd_ctl_elem_value *ucontrol)
126{ 124{
127 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 125 struct snd_soc_card *card = snd_kcontrol_chip(kcontrol);
128 126
129 if (tosa_spk_func == ucontrol->value.integer.value[0]) 127 if (tosa_spk_func == ucontrol->value.integer.value[0])
130 return 0; 128 return 0;
131 129
132 tosa_spk_func = ucontrol->value.integer.value[0]; 130 tosa_spk_func = ucontrol->value.integer.value[0];
133 tosa_ext_control(codec); 131 tosa_ext_control(&card->dapm);
134 return 1; 132 return 1;
135} 133}
136 134
@@ -191,24 +189,10 @@ static int tosa_ac97_init(struct snd_soc_pcm_runtime *rtd)
191{ 189{
192 struct snd_soc_codec *codec = rtd->codec; 190 struct snd_soc_codec *codec = rtd->codec;
193 struct snd_soc_dapm_context *dapm = &codec->dapm; 191 struct snd_soc_dapm_context *dapm = &codec->dapm;
194 int err;
195 192
196 snd_soc_dapm_nc_pin(dapm, "OUT3"); 193 snd_soc_dapm_nc_pin(dapm, "OUT3");
197 snd_soc_dapm_nc_pin(dapm, "MONOOUT"); 194 snd_soc_dapm_nc_pin(dapm, "MONOOUT");
198 195
199 /* add tosa specific controls */
200 err = snd_soc_add_codec_controls(codec, tosa_controls,
201 ARRAY_SIZE(tosa_controls));
202 if (err < 0)
203 return err;
204
205 /* add tosa specific widgets */
206 snd_soc_dapm_new_controls(dapm, tosa_dapm_widgets,
207 ARRAY_SIZE(tosa_dapm_widgets));
208
209 /* set up tosa specific audio path audio_map */
210 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
211
212 return 0; 196 return 0;
213} 197}
214 198
@@ -239,6 +223,13 @@ static struct snd_soc_card tosa = {
239 .owner = THIS_MODULE, 223 .owner = THIS_MODULE,
240 .dai_link = tosa_dai, 224 .dai_link = tosa_dai,
241 .num_links = ARRAY_SIZE(tosa_dai), 225 .num_links = ARRAY_SIZE(tosa_dai),
226
227 .controls = tosa_controls,
228 .num_controls = ARRAY_SIZE(tosa_controls),
229 .dapm_widgets = tosa_dapm_widgets,
230 .num_dapm_widgets = ARRAY_SIZE(tosa_dapm_widgets),
231 .dapm_routes = audio_map,
232 .num_dapm_routes = ARRAY_SIZE(audio_map),
242}; 233};
243 234
244static int tosa_probe(struct platform_device *pdev) 235static int tosa_probe(struct platform_device *pdev)