diff options
Diffstat (limited to 'sound/soc/pxa/magician.c')
-rw-r--r-- | sound/soc/pxa/magician.c | 34 |
1 files changed, 12 insertions, 22 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; | |||
41 | static int magician_spk_switch = 1; | 41 | static int magician_spk_switch = 1; |
42 | static int magician_in_sel = MAGICIAN_MIC; | 42 | static int magician_in_sel = MAGICIAN_MIC; |
43 | 43 | ||
44 | static void magician_ext_control(struct snd_soc_codec *codec) | 44 | static 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) | |||
75 | static int magician_startup(struct snd_pcm_substream *substream) | 74 | static 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, | |||
277 | static int magician_set_hp(struct snd_kcontrol *kcontrol, | 275 | static 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, | |||
297 | static int magician_set_spk(struct snd_kcontrol *kcontrol, | 295 | static 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 | ||
461 | static struct platform_device *magician_snd_device; | 451 | static struct platform_device *magician_snd_device; |