17 #include <linux/module.h>
23 #include <linux/i2c.h>
33 #include "../codecs/uda1380.h"
37 #define MAGICIAN_MIC 0
38 #define MAGICIAN_MIC_EXT 1
40 static int magician_hp_switch;
41 static int magician_spk_switch = 1;
48 if (magician_spk_switch)
52 if (magician_hp_switch)
57 switch (magician_in_sel) {
79 magician_ext_control(codec);
95 unsigned int acps, acds,
width;
261 .startup = magician_startup,
262 .hw_params = magician_capture_hw_params,
265 static struct snd_soc_ops magician_playback_ops = {
266 .startup = magician_startup,
267 .hw_params = magician_playback_hw_params,
270 static int magician_get_hp(
struct snd_kcontrol *kcontrol,
273 ucontrol->
value.integer.value[0] = magician_hp_switch;
277 static int magician_set_hp(
struct snd_kcontrol *kcontrol,
282 if (magician_hp_switch == ucontrol->
value.integer.value[0])
285 magician_hp_switch = ucontrol->
value.integer.value[0];
286 magician_ext_control(codec);
290 static int magician_get_spk(
struct snd_kcontrol *kcontrol,
293 ucontrol->
value.integer.value[0] = magician_spk_switch;
297 static int magician_set_spk(
struct snd_kcontrol *kcontrol,
302 if (magician_spk_switch == ucontrol->
value.integer.value[0])
305 magician_spk_switch = ucontrol->
value.integer.value[0];
306 magician_ext_control(codec);
310 static int magician_get_input(
struct snd_kcontrol *kcontrol,
313 ucontrol->
value.integer.value[0] = magician_in_sel;
317 static int magician_set_input(
struct snd_kcontrol *kcontrol,
320 if (magician_in_sel == ucontrol->
value.integer.value[0])
323 magician_in_sel = ucontrol->
value.integer.value[0];
325 switch (magician_in_sel) {
369 {
"Headphone Jack",
NULL,
"VOUTL"},
370 {
"Headphone Jack",
NULL,
"VOUTR"},
373 {
"Speaker",
NULL,
"VOUTL"},
374 {
"Speaker",
NULL,
"VOUTR"},
377 {
"VINM",
NULL,
"Headset Mic"},
378 {
"VINM",
NULL,
"Call Mic"},
381 static const char *input_select[] = {
"Call Mic",
"Headset Mic"};
382 static const struct soc_enum magician_in_sel_enum =
387 (
unsigned long)&magician_hp_switch,
388 magician_get_hp, magician_set_hp),
390 (
unsigned long)&magician_spk_switch,
391 magician_get_spk, magician_set_spk),
393 magician_get_input, magician_set_input),
433 .stream_name =
"UDA1380 Playback",
434 .cpu_dai_name =
"pxa-ssp-dai.0",
435 .codec_dai_name =
"uda1380-hifi-playback",
436 .platform_name =
"pxa-pcm-audio",
437 .codec_name =
"uda1380-codec.0-0018",
438 .init = magician_uda1380_init,
439 .ops = &magician_playback_ops,
443 .stream_name =
"UDA1380 Capture",
444 .cpu_dai_name =
"pxa2xx-i2s",
445 .codec_dai_name =
"uda1380-hifi-capture",
446 .platform_name =
"pxa-pcm-audio",
447 .codec_name =
"uda1380-codec.0-0018",
448 .ops = &magician_capture_ops,
456 .dai_link = magician_dai,
475 .platform_data = &uda1380_info,
479 static int __init magician_init(
void)
485 if (!machine_is_magician())
498 goto err_request_spk;
504 goto err_request_mic;
507 goto err_request_in_sel0;
510 goto err_request_in_sel1;
515 if (!magician_snd_device) {
520 platform_set_drvdata(magician_snd_device, &snd_soc_card_magician);
543 static void __exit magician_exit(
void)