diff options
author | James Courtier-Dutton <James@superbug.co.uk> | 2006-10-09 18:08:00 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2007-02-09 03:00:38 -0500 |
commit | 9148cc502752b12051760e6c5ba5daaea3367360 (patch) | |
tree | de02a490f42d253f2baf5c690bb4a92406d04e9e /sound/pci/emu10k1 | |
parent | 6add0f4242fc52a97a92fca99a39f35298c2b50b (diff) |
[ALSA] snd_emu10k1: Added support for 14dB Attenuation PADS on DACs and ADCs.
Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pci/emu10k1')
-rw-r--r-- | sound/pci/emu10k1/emu10k1_main.c | 29 | ||||
-rw-r--r-- | sound/pci/emu10k1/emumixer.c | 216 |
2 files changed, 187 insertions, 58 deletions
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c index 09c4db8495b2..341a2775d286 100644 --- a/sound/pci/emu10k1/emu10k1_main.c +++ b/sound/pci/emu10k1/emu10k1_main.c | |||
@@ -725,25 +725,27 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu) | |||
725 | snd_emu1010_fpga_read(emu, EMU_HANA_OPTICAL_TYPE, &tmp ); | 725 | snd_emu1010_fpga_read(emu, EMU_HANA_OPTICAL_TYPE, &tmp ); |
726 | /* ADAT input. */ | 726 | /* ADAT input. */ |
727 | snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, 0x01 ); | 727 | snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, 0x01 ); |
728 | snd_emu1010_fpga_read(emu, EMU_HANA_DOCK_PADS, &tmp ); | 728 | snd_emu1010_fpga_read(emu, EMU_HANA_ADC_PADS, &tmp ); |
729 | /* Set no attenuation on Audio Dock pads. */ | 729 | /* Set no attenuation on Audio Dock pads. */ |
730 | snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PADS, 0x00 ); | 730 | snd_emu1010_fpga_write(emu, EMU_HANA_ADC_PADS, 0x00 ); |
731 | emu->emu1010.adc_pads = 0x00; | ||
731 | snd_emu1010_fpga_read(emu, EMU_HANA_DOCK_MISC, &tmp ); | 732 | snd_emu1010_fpga_read(emu, EMU_HANA_DOCK_MISC, &tmp ); |
732 | /* Unmute Audio dock DACs, Headphone source DAC-4. */ | 733 | /* Unmute Audio dock DACs, Headphone source DAC-4. */ |
733 | snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_MISC, 0x30 ); | 734 | snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_MISC, 0x30 ); |
734 | snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2, 0x12 ); | 735 | snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2, 0x12 ); |
735 | snd_emu1010_fpga_read(emu, EMU_HANA_UNKNOWN13, &tmp ); | 736 | snd_emu1010_fpga_read(emu, EMU_HANA_DAC_PADS, &tmp ); |
736 | /* Unknown. */ | 737 | /* DAC PADs. */ |
737 | snd_emu1010_fpga_write(emu, EMU_HANA_UNKNOWN13, 0x0f ); | 738 | snd_emu1010_fpga_write(emu, EMU_HANA_DAC_PADS, 0x0f ); |
739 | emu->emu1010.dac_pads = 0x0f; | ||
738 | snd_emu1010_fpga_read(emu, EMU_HANA_DOCK_MISC, &tmp ); | 740 | snd_emu1010_fpga_read(emu, EMU_HANA_DOCK_MISC, &tmp ); |
739 | snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_MISC, 0x30 ); | 741 | snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_MISC, 0x30 ); |
740 | snd_emu1010_fpga_read(emu, EMU_HANA_SPDIF_MODE, &tmp ); | 742 | snd_emu1010_fpga_read(emu, EMU_HANA_SPDIF_MODE, &tmp ); |
741 | /* SPDIF Format. Set Consumer mode, 24bit, copy enable */ | 743 | /* SPDIF Format. Set Consumer mode, 24bit, copy enable */ |
742 | snd_emu1010_fpga_write(emu, EMU_HANA_SPDIF_MODE, 0x10 ); | 744 | snd_emu1010_fpga_write(emu, EMU_HANA_SPDIF_MODE, 0x10 ); |
743 | /* MIDI routing */ | 745 | /* MIDI routing */ |
744 | snd_emu1010_fpga_write(emu, EMU_HANA_MIDI, 0x19 ); | 746 | snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_IN, 0x19 ); |
745 | /* Unknown. */ | 747 | /* Unknown. */ |
746 | snd_emu1010_fpga_write(emu, EMU_HANA_UNKNOWN12, 0x0c ); | 748 | snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_OUT, 0x0c ); |
747 | /* snd_emu1010_fpga_write(emu, 0x09, 0x0f ); // IRQ Enable: All on */ | 749 | /* snd_emu1010_fpga_write(emu, 0x09, 0x0f ); // IRQ Enable: All on */ |
748 | /* IRQ Enable: All off */ | 750 | /* IRQ Enable: All off */ |
749 | snd_emu1010_fpga_write(emu, EMU_HANA_IRQ_ENABLE, 0x00 ); | 751 | snd_emu1010_fpga_write(emu, EMU_HANA_IRQ_ENABLE, 0x00 ); |
@@ -880,10 +882,10 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu) | |||
880 | /* Initial boot complete. Now patches */ | 882 | /* Initial boot complete. Now patches */ |
881 | 883 | ||
882 | snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &tmp ); | 884 | snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &tmp ); |
883 | snd_emu1010_fpga_write(emu, EMU_HANA_MIDI, 0x19 ); /* MIDI Route */ | 885 | snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_IN, 0x19 ); /* MIDI Route */ |
884 | snd_emu1010_fpga_write(emu, EMU_HANA_UNKNOWN12, 0x0c ); /* Unknown */ | 886 | snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_OUT, 0x0c ); /* Unknown */ |
885 | snd_emu1010_fpga_write(emu, EMU_HANA_MIDI, 0x19 ); /* MIDI Route */ | 887 | snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_IN, 0x19 ); /* MIDI Route */ |
886 | snd_emu1010_fpga_write(emu, EMU_HANA_UNKNOWN12, 0x0c ); /* Unknown */ | 888 | snd_emu1010_fpga_write(emu, EMU_HANA_MIDI_OUT, 0x0c ); /* Unknown */ |
887 | snd_emu1010_fpga_read(emu, EMU_HANA_SPDIF_MODE, &tmp ); | 889 | snd_emu1010_fpga_read(emu, EMU_HANA_SPDIF_MODE, &tmp ); |
888 | snd_emu1010_fpga_write(emu, EMU_HANA_SPDIF_MODE, 0x10 ); /* SPDIF Format spdif (or 0x11 for aes/ebu) */ | 890 | snd_emu1010_fpga_write(emu, EMU_HANA_SPDIF_MODE, 0x10 ); /* SPDIF Format spdif (or 0x11 for aes/ebu) */ |
889 | 891 | ||
@@ -902,7 +904,6 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu) | |||
902 | if ((err = snd_emu1010_load_firmware(emu, dock_filename)) != 0) { | 904 | if ((err = snd_emu1010_load_firmware(emu, dock_filename)) != 0) { |
903 | return err; | 905 | return err; |
904 | } | 906 | } |
905 | snd_printk(KERN_INFO "emu1010: Audio Dock Firmware loaded\n"); | ||
906 | snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 0 ); | 907 | snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 0 ); |
907 | snd_emu1010_fpga_read(emu, EMU_HANA_IRQ_STATUS, ® ); | 908 | snd_emu1010_fpga_read(emu, EMU_HANA_IRQ_STATUS, ® ); |
908 | snd_printk(KERN_INFO "emu1010: EMU_HANA+DOCK_IRQ_STATUS=0x%x\n",reg); | 909 | snd_printk(KERN_INFO "emu1010: EMU_HANA+DOCK_IRQ_STATUS=0x%x\n",reg); |
@@ -915,6 +916,10 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu) | |||
915 | return 0; | 916 | return 0; |
916 | return -ENODEV; | 917 | return -ENODEV; |
917 | } | 918 | } |
919 | snd_printk(KERN_INFO "emu1010: Audio Dock Firmware loaded\n"); | ||
920 | snd_emu1010_fpga_read(emu, EMU_DOCK_MAJOR_REV, &tmp ); | ||
921 | snd_emu1010_fpga_read(emu, EMU_DOCK_MINOR_REV, &tmp2 ); | ||
922 | snd_printk("Audio Dock ver:%d.%d\n",tmp ,tmp2); | ||
918 | } | 923 | } |
919 | #if 0 | 924 | #if 0 |
920 | snd_emu1010_fpga_link_dst_src_write(emu, | 925 | snd_emu1010_fpga_link_dst_src_write(emu, |
diff --git a/sound/pci/emu10k1/emumixer.c b/sound/pci/emu10k1/emumixer.c index c8176dc8142f..2edf92a4f065 100644 --- a/sound/pci/emu10k1/emumixer.c +++ b/sound/pci/emu10k1/emumixer.c | |||
@@ -315,30 +315,30 @@ static int snd_emu1010_input_source_put(struct snd_kcontrol *kcontrol, | |||
315 | } | 315 | } |
316 | 316 | ||
317 | static struct snd_kcontrol_new snd_emu1010_output_enum_ctls[] __devinitdata = { | 317 | static struct snd_kcontrol_new snd_emu1010_output_enum_ctls[] __devinitdata = { |
318 | EMU1010_SOURCE_OUTPUT("Playback Dock DAC1 Left", 0), | 318 | EMU1010_SOURCE_OUTPUT("Dock DAC1 Left Playback Switch", 0), |
319 | EMU1010_SOURCE_OUTPUT("Playback Dock DAC1 Right", 1), | 319 | EMU1010_SOURCE_OUTPUT("Dock DAC1 Right Playback Switch", 1), |
320 | EMU1010_SOURCE_OUTPUT("Playback Dock DAC2 Left", 2), | 320 | EMU1010_SOURCE_OUTPUT("Dock DAC2 Left Playback Switch", 2), |
321 | EMU1010_SOURCE_OUTPUT("Playback Dock DAC2 Right", 3), | 321 | EMU1010_SOURCE_OUTPUT("Dock DAC2 Right Playback Switch", 3), |
322 | EMU1010_SOURCE_OUTPUT("Playback Dock DAC3 Left", 4), | 322 | EMU1010_SOURCE_OUTPUT("Dock DAC3 Left Playback Switch", 4), |
323 | EMU1010_SOURCE_OUTPUT("Playback Dock DAC3 Right", 5), | 323 | EMU1010_SOURCE_OUTPUT("Dock DAC3 Right Playback Switch", 5), |
324 | EMU1010_SOURCE_OUTPUT("Playback Dock DAC4 Left", 6), | 324 | EMU1010_SOURCE_OUTPUT("Dock DAC4 Left Playback Switch", 6), |
325 | EMU1010_SOURCE_OUTPUT("Playback Dock DAC4 Right", 7), | 325 | EMU1010_SOURCE_OUTPUT("Dock DAC4 Right Playback Switch", 7), |
326 | EMU1010_SOURCE_OUTPUT("Playback Dock Phones Left", 8), | 326 | EMU1010_SOURCE_OUTPUT("Dock Phones Left Playback Switch", 8), |
327 | EMU1010_SOURCE_OUTPUT("Playback Dock Phones Right", 9), | 327 | EMU1010_SOURCE_OUTPUT("Dock Phones Right Playback Switch", 9), |
328 | EMU1010_SOURCE_OUTPUT("Playback Dock SPDIF Left", 0xa), | 328 | EMU1010_SOURCE_OUTPUT("Dock SPDIF Left Playback Switch", 0xa), |
329 | EMU1010_SOURCE_OUTPUT("Playback Dock SPDIF Right", 0xb), | 329 | EMU1010_SOURCE_OUTPUT("Dock SPDIF Right Playback Switch", 0xb), |
330 | EMU1010_SOURCE_OUTPUT("Playback 1010 SPDIF Left", 0xc), | 330 | EMU1010_SOURCE_OUTPUT("1010 SPDIF Left Playback Switch", 0xc), |
331 | EMU1010_SOURCE_OUTPUT("Playback 1010 SPDIF Right", 0xd), | 331 | EMU1010_SOURCE_OUTPUT("1010 SPDIF Right Playback Switch", 0xd), |
332 | EMU1010_SOURCE_OUTPUT("Playback 0202 DAC Left", 0xe), | 332 | EMU1010_SOURCE_OUTPUT("0202 DAC Left Playback Switch", 0xe), |
333 | EMU1010_SOURCE_OUTPUT("Playback 0202 DAC Right", 0xf), | 333 | EMU1010_SOURCE_OUTPUT("0202 DAC Right Playback Switch", 0xf), |
334 | EMU1010_SOURCE_OUTPUT("Playback 1010 ADAT 0", 0x10), | 334 | EMU1010_SOURCE_OUTPUT("1010 ADAT 0 Playback Switch", 0x10), |
335 | EMU1010_SOURCE_OUTPUT("Playback 1010 ADAT 1", 0x11), | 335 | EMU1010_SOURCE_OUTPUT("1010 ADAT 1 Playback Switch", 0x11), |
336 | EMU1010_SOURCE_OUTPUT("Playback 1010 ADAT 2", 0x12), | 336 | EMU1010_SOURCE_OUTPUT("1010 ADAT 2 Playback Switch", 0x12), |
337 | EMU1010_SOURCE_OUTPUT("Playback 1010 ADAT 3", 0x13), | 337 | EMU1010_SOURCE_OUTPUT("1010 ADAT 3 Playback Switch", 0x13), |
338 | EMU1010_SOURCE_OUTPUT("Playback 1010 ADAT 4", 0x14), | 338 | EMU1010_SOURCE_OUTPUT("1010 ADAT 4 Playback Switch", 0x14), |
339 | EMU1010_SOURCE_OUTPUT("Playback 1010 ADAT 5", 0x15), | 339 | EMU1010_SOURCE_OUTPUT("1010 ADAT 5 Playback Switch", 0x15), |
340 | EMU1010_SOURCE_OUTPUT("Playback 1010 ADAT 6", 0x16), | 340 | EMU1010_SOURCE_OUTPUT("1010 ADAT 6 Playback Switch", 0x16), |
341 | EMU1010_SOURCE_OUTPUT("Playback 1010 ADAT 7", 0x17), | 341 | EMU1010_SOURCE_OUTPUT("1010 ADAT 7 Playback Switch", 0x17), |
342 | }; | 342 | }; |
343 | 343 | ||
344 | #define EMU1010_SOURCE_INPUT(xname,chid) \ | 344 | #define EMU1010_SOURCE_INPUT(xname,chid) \ |
@@ -352,28 +352,142 @@ static struct snd_kcontrol_new snd_emu1010_output_enum_ctls[] __devinitdata = { | |||
352 | } | 352 | } |
353 | 353 | ||
354 | static struct snd_kcontrol_new snd_emu1010_input_enum_ctls[] __devinitdata = { | 354 | static struct snd_kcontrol_new snd_emu1010_input_enum_ctls[] __devinitdata = { |
355 | EMU1010_SOURCE_INPUT("DSP 0 CAPTURE ENUM", 0), | 355 | EMU1010_SOURCE_INPUT("DSP 0 Capture Switch", 0), |
356 | EMU1010_SOURCE_INPUT("DSP 1 CAPTURE ENUM", 1), | 356 | EMU1010_SOURCE_INPUT("DSP 1 Capture Switch", 1), |
357 | EMU1010_SOURCE_INPUT("DSP 2 CAPTURE ENUM", 2), | 357 | EMU1010_SOURCE_INPUT("DSP 2 Capture Switch", 2), |
358 | EMU1010_SOURCE_INPUT("DSP 3 CAPTURE ENUM", 3), | 358 | EMU1010_SOURCE_INPUT("DSP 3 Capture Switch", 3), |
359 | EMU1010_SOURCE_INPUT("DSP 4 CAPTURE ENUM", 4), | 359 | EMU1010_SOURCE_INPUT("DSP 4 Capture Switch", 4), |
360 | EMU1010_SOURCE_INPUT("DSP 5 CAPTURE ENUM", 5), | 360 | EMU1010_SOURCE_INPUT("DSP 5 Capture Switch", 5), |
361 | EMU1010_SOURCE_INPUT("DSP 6 CAPTURE ENUM", 6), | 361 | EMU1010_SOURCE_INPUT("DSP 6 Capture Switch", 6), |
362 | EMU1010_SOURCE_INPUT("DSP 7 CAPTURE ENUM", 7), | 362 | EMU1010_SOURCE_INPUT("DSP 7 Capture Switch", 7), |
363 | EMU1010_SOURCE_INPUT("DSP 8 CAPTURE ENUM", 8), | 363 | EMU1010_SOURCE_INPUT("DSP 8 Capture Switch", 8), |
364 | EMU1010_SOURCE_INPUT("DSP 9 CAPTURE ENUM", 9), | 364 | EMU1010_SOURCE_INPUT("DSP 9 Capture Switch", 9), |
365 | EMU1010_SOURCE_INPUT("DSP A CAPTURE ENUM", 0xa), | 365 | EMU1010_SOURCE_INPUT("DSP A Capture Switch", 0xa), |
366 | EMU1010_SOURCE_INPUT("DSP B CAPTURE ENUM", 0xb), | 366 | EMU1010_SOURCE_INPUT("DSP B Capture Switch", 0xb), |
367 | EMU1010_SOURCE_INPUT("DSP C CAPTURE ENUM", 0xc), | 367 | EMU1010_SOURCE_INPUT("DSP C Capture Switch", 0xc), |
368 | EMU1010_SOURCE_INPUT("DSP D CAPTURE ENUM", 0xd), | 368 | EMU1010_SOURCE_INPUT("DSP D Capture Switch", 0xd), |
369 | EMU1010_SOURCE_INPUT("DSP E CAPTURE ENUM", 0xe), | 369 | EMU1010_SOURCE_INPUT("DSP E Capture Switch", 0xe), |
370 | EMU1010_SOURCE_INPUT("DSP F CAPTURE ENUM", 0xf), | 370 | EMU1010_SOURCE_INPUT("DSP F Capture Switch", 0xf), |
371 | EMU1010_SOURCE_INPUT("DSP 10 CAPTURE ENUM", 0x10), | 371 | EMU1010_SOURCE_INPUT("DSP 10 Capture Switch", 0x10), |
372 | EMU1010_SOURCE_INPUT("DSP 11 CAPTURE ENUM", 0x11), | 372 | EMU1010_SOURCE_INPUT("DSP 11 Capture Switch", 0x11), |
373 | EMU1010_SOURCE_INPUT("DSP 12 CAPTURE ENUM", 0x12), | 373 | EMU1010_SOURCE_INPUT("DSP 12 Capture Switch", 0x12), |
374 | EMU1010_SOURCE_INPUT("DSP 13 CAPTURE ENUM", 0x13), | 374 | EMU1010_SOURCE_INPUT("DSP 13 Capture Switch", 0x13), |
375 | EMU1010_SOURCE_INPUT("DSP 14 CAPTURE ENUM", 0x14), | 375 | EMU1010_SOURCE_INPUT("DSP 14 Capture Switch", 0x14), |
376 | EMU1010_SOURCE_INPUT("DSP 15 CAPTURE ENUM", 0x15), | 376 | EMU1010_SOURCE_INPUT("DSP 15 Capture Switch", 0x15), |
377 | }; | ||
378 | |||
379 | |||
380 | |||
381 | |||
382 | static int snd_emu1010_adc_pads_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | ||
383 | { | ||
384 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; | ||
385 | uinfo->count = 1; | ||
386 | uinfo->value.integer.min = 0; | ||
387 | uinfo->value.integer.max = 1; | ||
388 | return 0; | ||
389 | } | ||
390 | |||
391 | static int snd_emu1010_adc_pads_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | ||
392 | { | ||
393 | struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); | ||
394 | unsigned int mask = kcontrol->private_value & 0xff; | ||
395 | ucontrol->value.integer.value[0] = (emu->emu1010.adc_pads & mask) ? 1 : 0; | ||
396 | return 0; | ||
397 | } | ||
398 | |||
399 | static int snd_emu1010_adc_pads_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | ||
400 | { | ||
401 | struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); | ||
402 | unsigned int mask = kcontrol->private_value & 0xff; | ||
403 | unsigned int val, cache; | ||
404 | val = ucontrol->value.integer.value[0]; | ||
405 | cache = emu->emu1010.adc_pads; | ||
406 | if (val == 1) | ||
407 | cache = cache | mask; | ||
408 | else | ||
409 | cache = cache & ~mask; | ||
410 | if (cache != emu->emu1010.adc_pads) { | ||
411 | snd_emu1010_fpga_write(emu, EMU_HANA_ADC_PADS, cache ); | ||
412 | emu->emu1010.adc_pads = cache; | ||
413 | } | ||
414 | |||
415 | return 0; | ||
416 | } | ||
417 | |||
418 | |||
419 | |||
420 | #define EMU1010_ADC_PADS(xname,chid) \ | ||
421 | { \ | ||
422 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | ||
423 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ | ||
424 | .info = snd_emu1010_adc_pads_info, \ | ||
425 | .get = snd_emu1010_adc_pads_get, \ | ||
426 | .put = snd_emu1010_adc_pads_put, \ | ||
427 | .private_value = chid \ | ||
428 | } | ||
429 | |||
430 | static struct snd_kcontrol_new snd_emu1010_adc_pads[] __devinitdata = { | ||
431 | EMU1010_ADC_PADS("ADC1 14dB PAD Audio Dock Capture Switch", EMU_HANA_DOCK_ADC_PAD1), | ||
432 | EMU1010_ADC_PADS("ADC2 14dB PAD Audio Dock Capture Switch", EMU_HANA_DOCK_ADC_PAD2), | ||
433 | EMU1010_ADC_PADS("ADC3 14dB PAD Audio Dock Capture Switch", EMU_HANA_DOCK_ADC_PAD3), | ||
434 | EMU1010_ADC_PADS("ADC1 14dB PAD 0202 Capture Switch", EMU_HANA_0202_ADC_PAD1), | ||
435 | }; | ||
436 | |||
437 | static int snd_emu1010_dac_pads_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | ||
438 | { | ||
439 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; | ||
440 | uinfo->count = 1; | ||
441 | uinfo->value.integer.min = 0; | ||
442 | uinfo->value.integer.max = 1; | ||
443 | return 0; | ||
444 | } | ||
445 | |||
446 | static int snd_emu1010_dac_pads_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | ||
447 | { | ||
448 | struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); | ||
449 | unsigned int mask = kcontrol->private_value & 0xff; | ||
450 | ucontrol->value.integer.value[0] = (emu->emu1010.dac_pads & mask) ? 1 : 0; | ||
451 | return 0; | ||
452 | } | ||
453 | |||
454 | static int snd_emu1010_dac_pads_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | ||
455 | { | ||
456 | struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol); | ||
457 | unsigned int mask = kcontrol->private_value & 0xff; | ||
458 | unsigned int val, cache; | ||
459 | val = ucontrol->value.integer.value[0]; | ||
460 | cache = emu->emu1010.dac_pads; | ||
461 | if (val == 1) | ||
462 | cache = cache | mask; | ||
463 | else | ||
464 | cache = cache & ~mask; | ||
465 | if (cache != emu->emu1010.dac_pads) { | ||
466 | snd_emu1010_fpga_write(emu, EMU_HANA_DAC_PADS, cache ); | ||
467 | emu->emu1010.dac_pads = cache; | ||
468 | } | ||
469 | |||
470 | return 0; | ||
471 | } | ||
472 | |||
473 | |||
474 | |||
475 | #define EMU1010_DAC_PADS(xname,chid) \ | ||
476 | { \ | ||
477 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ | ||
478 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, \ | ||
479 | .info = snd_emu1010_dac_pads_info, \ | ||
480 | .get = snd_emu1010_dac_pads_get, \ | ||
481 | .put = snd_emu1010_dac_pads_put, \ | ||
482 | .private_value = chid \ | ||
483 | } | ||
484 | |||
485 | static struct snd_kcontrol_new snd_emu1010_dac_pads[] __devinitdata = { | ||
486 | EMU1010_DAC_PADS("DAC1 Audio Dock 14dB PAD Playback Switch", EMU_HANA_DOCK_DAC_PAD1), | ||
487 | EMU1010_DAC_PADS("DAC2 Audio Dock 14dB PAD Playback Switch", EMU_HANA_DOCK_DAC_PAD2), | ||
488 | EMU1010_DAC_PADS("DAC3 Audio Dock 14dB PAD Playback Switch", EMU_HANA_DOCK_DAC_PAD3), | ||
489 | EMU1010_DAC_PADS("DAC4 Audio Dock 14dB PAD Playback Switch", EMU_HANA_DOCK_DAC_PAD4), | ||
490 | EMU1010_DAC_PADS("DAC1 0202 14dB PAD Playback Switch", EMU_HANA_0202_DAC_PAD1), | ||
377 | }; | 491 | }; |
378 | 492 | ||
379 | #if 0 | 493 | #if 0 |
@@ -1367,6 +1481,16 @@ int __devinit snd_emu10k1_mixer(struct snd_emu10k1 *emu, | |||
1367 | if (err < 0) | 1481 | if (err < 0) |
1368 | return err; | 1482 | return err; |
1369 | } | 1483 | } |
1484 | for (i = 0; i < ARRAY_SIZE(snd_emu1010_adc_pads); i++) { | ||
1485 | err = snd_ctl_add(card, snd_ctl_new1(&snd_emu1010_adc_pads[i], emu)); | ||
1486 | if (err < 0) | ||
1487 | return err; | ||
1488 | } | ||
1489 | for (i = 0; i < ARRAY_SIZE(snd_emu1010_dac_pads); i++) { | ||
1490 | err = snd_ctl_add(card, snd_ctl_new1(&snd_emu1010_dac_pads[i], emu)); | ||
1491 | if (err < 0) | ||
1492 | return err; | ||
1493 | } | ||
1370 | } | 1494 | } |
1371 | 1495 | ||
1372 | return 0; | 1496 | return 0; |