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 | |
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>
-rw-r--r-- | include/sound/emu10k1.h | 29 | ||||
-rw-r--r-- | sound/pci/emu10k1/emu10k1_main.c | 29 | ||||
-rw-r--r-- | sound/pci/emu10k1/emumixer.c | 216 |
3 files changed, 209 insertions, 65 deletions
diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h index 396812eb668..7cfa91e7bde 100644 --- a/include/sound/emu10k1.h +++ b/include/sound/emu10k1.h | |||
@@ -974,7 +974,7 @@ | |||
974 | #define EMU_HANA_OPTICAL_OUT_SPDIF 0x00 | 974 | #define EMU_HANA_OPTICAL_OUT_SPDIF 0x00 |
975 | #define EMU_HANA_OPTICAL_OUT_ADAT 0x02 | 975 | #define EMU_HANA_OPTICAL_OUT_ADAT 0x02 |
976 | 976 | ||
977 | #define EMU_HANA_MIDI 0x0c /* 000000x 1 bit Control MIDI */ | 977 | #define EMU_HANA_MIDI_IN 0x0c /* 000000x 1 bit Control MIDI */ |
978 | #define EMU_HANA_MIDI_IN_FROM_HAMOA 0x00 /* HAMOA MIDI in to Alice 2 MIDI B */ | 978 | #define EMU_HANA_MIDI_IN_FROM_HAMOA 0x00 /* HAMOA MIDI in to Alice 2 MIDI B */ |
979 | #define EMU_HANA_MIDI_IN_FROM_DOCK 0x01 /* Audio Dock MIDI in to Alice 2 MIDI B */ | 979 | #define EMU_HANA_MIDI_IN_FROM_DOCK 0x01 /* Audio Dock MIDI in to Alice 2 MIDI B */ |
980 | 980 | ||
@@ -1000,10 +1000,11 @@ | |||
1000 | #define EMU_HANA_DOCK_LEDS_3_MANUAL_CLIP 0x10 /* Manual Clip detection */ | 1000 | #define EMU_HANA_DOCK_LEDS_3_MANUAL_CLIP 0x10 /* Manual Clip detection */ |
1001 | #define EMU_HANA_DOCK_LEDS_3_MANUAL_SIGNAL 0x20 /* Manual Signal detection */ | 1001 | #define EMU_HANA_DOCK_LEDS_3_MANUAL_SIGNAL 0x20 /* Manual Signal detection */ |
1002 | 1002 | ||
1003 | #define EMU_HANA_DOCK_PADS 0x10 /* 0000xxx 3 bit Audio Dock ADC 14dB pads */ | 1003 | #define EMU_HANA_ADC_PADS 0x10 /* 0000xxx 3 bit Audio Dock ADC 14dB pads */ |
1004 | #define EMU_HANA_DOCK_PAD1 0x01 /* 14dB Attenuation on ADC 1 */ | 1004 | #define EMU_HANA_DOCK_ADC_PAD1 0x01 /* 14dB Attenuation on Audio Dock ADC 1 */ |
1005 | #define EMU_HANA_DOCK_PAD2 0x02 /* 14dB Attenuation on ADC 2 */ | 1005 | #define EMU_HANA_DOCK_ADC_PAD2 0x02 /* 14dB Attenuation on Audio Dock ADC 2 */ |
1006 | #define EMU_HANA_DOCK_PAD3 0x04 /* 14dB Attenuation on ADC 3 */ | 1006 | #define EMU_HANA_DOCK_ADC_PAD3 0x04 /* 14dB Attenuation on Audio Dock ADC 3 */ |
1007 | #define EMU_HANA_0202_ADC_PAD1 0x08 /* 14dB Attenuation on 0202 ADC 1 */ | ||
1007 | 1008 | ||
1008 | #define EMU_HANA_DOCK_MISC 0x11 /* 0xxxxxx 6 bit Audio Dock misc bits */ | 1009 | #define EMU_HANA_DOCK_MISC 0x11 /* 0xxxxxx 6 bit Audio Dock misc bits */ |
1009 | #define EMU_HANA_DOCK_DAC1_MUTE 0x01 /* DAC 1 Mute */ | 1010 | #define EMU_HANA_DOCK_DAC1_MUTE 0x01 /* DAC 1 Mute */ |
@@ -1015,8 +1016,20 @@ | |||
1015 | #define EMU_HANA_DOCK_PHONES_192_DAC3 0x20 /* DAC 3 Headphones source at 192kHz */ | 1016 | #define EMU_HANA_DOCK_PHONES_192_DAC3 0x20 /* DAC 3 Headphones source at 192kHz */ |
1016 | #define EMU_HANA_DOCK_PHONES_192_DAC4 0x30 /* DAC 4 Headphones source at 192kHz */ | 1017 | #define EMU_HANA_DOCK_PHONES_192_DAC4 0x30 /* DAC 4 Headphones source at 192kHz */ |
1017 | 1018 | ||
1018 | #define EMU_HANA_UNKNOWN12 0x12 /* 0xxxxxx 6 bit Unknown12 */ | 1019 | #define EMU_HANA_MIDI_OUT 0x12 /* 00xxxxx 5 bit Source for each MIDI out port */ |
1019 | #define EMU_HANA_UNKNOWN13 0x13 /* 0xxxxxx 6 bit Unknown13 */ | 1020 | #define EMU_HANA_MIDI_OUT_0202 0x01 /* 0202 MIDI from Alice 2. 0 = A, 1 = B */ |
1021 | #define EMU_HANA_MIDI_OUT_DOCK1 0x02 /* Audio Dock MIDI1 front, from Alice 2. 0 = A, 1 = B */ | ||
1022 | #define EMU_HANA_MIDI_OUT_DOCK2 0x04 /* Audio Dock MIDI2 rear, from Alice 2. 0 = A, 1 = B */ | ||
1023 | #define EMU_HANA_MIDI_OUT_SYNC2 0x08 /* Sync card. Not the actual MIDI out jack. 0 = A, 1 = B */ | ||
1024 | #define EMU_HANA_MIDI_OUT_LOOP 0x10 /* 0 = bits (3:0) normal. 1 = MIDI loopback enabled. */ | ||
1025 | |||
1026 | #define EMU_HANA_DAC_PADS 0x13 /* 00xxxxx 5 bit DAC 14dB attenuation pads */ | ||
1027 | #define EMU_HANA_DOCK_DAC_PAD1 0x01 /* 14dB Attenuation on AudioDock DAC 1. Left and Right */ | ||
1028 | #define EMU_HANA_DOCK_DAC_PAD2 0x02 /* 14dB Attenuation on AudioDock DAC 2. Left and Right */ | ||
1029 | #define EMU_HANA_DOCK_DAC_PAD3 0x04 /* 14dB Attenuation on AudioDock DAC 3. Left and Right */ | ||
1030 | #define EMU_HANA_DOCK_DAC_PAD4 0x08 /* 14dB Attenuation on AudioDock DAC 4. Left and Right */ | ||
1031 | #define EMU_HANA_0202_DAC_PAD1 0x10 /* 14dB Attenuation on 0202 DAC 1. Left and Right */ | ||
1032 | |||
1020 | /* 0x14 - 0x1f Unused R/W registers */ | 1033 | /* 0x14 - 0x1f Unused R/W registers */ |
1021 | #define EMU_HANA_IRQ_STATUS 0x20 /* 000xxxx 4 bits IRQ Status */ | 1034 | #define EMU_HANA_IRQ_STATUS 0x20 /* 000xxxx 4 bits IRQ Status */ |
1022 | #if 0 /* Already defined for reg 0x09 IRQ_ENABLE */ | 1035 | #if 0 /* Already defined for reg 0x09 IRQ_ENABLE */ |
@@ -1377,6 +1390,8 @@ struct snd_emu_chip_details { | |||
1377 | struct snd_emu1010 { | 1390 | struct snd_emu1010 { |
1378 | unsigned int output_source[64]; | 1391 | unsigned int output_source[64]; |
1379 | unsigned int input_source[64]; | 1392 | unsigned int input_source[64]; |
1393 | unsigned int adc_pads; /* bit mask */ | ||
1394 | unsigned int dac_pads; /* bit mask */ | ||
1380 | }; | 1395 | }; |
1381 | 1396 | ||
1382 | struct snd_emu10k1 { | 1397 | struct snd_emu10k1 { |
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c index 09c4db8495b..341a2775d28 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 c8176dc8142..2edf92a4f06 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; |