aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTim Blechmann <tim@klingt.org>2009-02-20 13:38:16 -0500
committerTakashi Iwai <tiwai@suse.de>2009-02-23 02:28:02 -0500
commitf9ffc5d6f0161b66202f2df9ecc42d1be241020d (patch)
treea7c4704d7181b87437e16893baa09b158714d59c /sound
parente588ed8304f76cbb396ee85e657a58990298a675 (diff)
ALSA: hdsp - whitespace cleanup
Impact: remove trailing spaces Signed-off-by: Tim Blechmann <tim@klingt.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/rme9652/hdsp.c474
1 files changed, 237 insertions, 237 deletions
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c
index 12c6b4305ec1..dc65fe1c9c65 100644
--- a/sound/pci/rme9652/hdsp.c
+++ b/sound/pci/rme9652/hdsp.c
@@ -113,7 +113,7 @@ MODULE_FIRMWARE("digiface_firmware_rev11.bin");
113 113
114/* the meters are regular i/o-mapped registers, but offset 114/* the meters are regular i/o-mapped registers, but offset
115 considerably from the rest. the peak registers are reset 115 considerably from the rest. the peak registers are reset
116 when read; the least-significant 4 bits are full-scale counters; 116 when read; the least-significant 4 bits are full-scale counters;
117 the actual peak value is in the most-significant 24 bits. 117 the actual peak value is in the most-significant 24 bits.
118*/ 118*/
119 119
@@ -131,7 +131,7 @@ MODULE_FIRMWARE("digiface_firmware_rev11.bin");
131 26*3 values are read in ss mode 131 26*3 values are read in ss mode
132 14*3 in ds mode, with no gap between values 132 14*3 in ds mode, with no gap between values
133*/ 133*/
134#define HDSP_9652_peakBase 7164 134#define HDSP_9652_peakBase 7164
135#define HDSP_9652_rmsBase 4096 135#define HDSP_9652_rmsBase 4096
136 136
137/* c.f. the hdsp_9632_meters_t struct */ 137/* c.f. the hdsp_9632_meters_t struct */
@@ -173,12 +173,12 @@ MODULE_FIRMWARE("digiface_firmware_rev11.bin");
173#define HDSP_SPDIFEmphasis (1<<10) /* 0=none, 1=on */ 173#define HDSP_SPDIFEmphasis (1<<10) /* 0=none, 1=on */
174#define HDSP_SPDIFNonAudio (1<<11) /* 0=off, 1=on */ 174#define HDSP_SPDIFNonAudio (1<<11) /* 0=off, 1=on */
175#define HDSP_SPDIFOpticalOut (1<<12) /* 1=use 1st ADAT connector for SPDIF, 0=do not */ 175#define HDSP_SPDIFOpticalOut (1<<12) /* 1=use 1st ADAT connector for SPDIF, 0=do not */
176#define HDSP_SyncRef2 (1<<13) 176#define HDSP_SyncRef2 (1<<13)
177#define HDSP_SPDIFInputSelect0 (1<<14) 177#define HDSP_SPDIFInputSelect0 (1<<14)
178#define HDSP_SPDIFInputSelect1 (1<<15) 178#define HDSP_SPDIFInputSelect1 (1<<15)
179#define HDSP_SyncRef0 (1<<16) 179#define HDSP_SyncRef0 (1<<16)
180#define HDSP_SyncRef1 (1<<17) 180#define HDSP_SyncRef1 (1<<17)
181#define HDSP_AnalogExtensionBoard (1<<18) /* For H9632 cards */ 181#define HDSP_AnalogExtensionBoard (1<<18) /* For H9632 cards */
182#define HDSP_XLRBreakoutCable (1<<20) /* For H9632 cards */ 182#define HDSP_XLRBreakoutCable (1<<20) /* For H9632 cards */
183#define HDSP_Midi0InterruptEnable (1<<22) 183#define HDSP_Midi0InterruptEnable (1<<22)
184#define HDSP_Midi1InterruptEnable (1<<23) 184#define HDSP_Midi1InterruptEnable (1<<23)
@@ -314,7 +314,7 @@ MODULE_FIRMWARE("digiface_firmware_rev11.bin");
314#define HDSP_TimecodeSync (1<<27) 314#define HDSP_TimecodeSync (1<<27)
315#define HDSP_AEBO (1<<28) /* H9632 specific Analog Extension Boards */ 315#define HDSP_AEBO (1<<28) /* H9632 specific Analog Extension Boards */
316#define HDSP_AEBI (1<<29) /* 0 = present, 1 = absent */ 316#define HDSP_AEBI (1<<29) /* 0 = present, 1 = absent */
317#define HDSP_midi0IRQPending (1<<30) 317#define HDSP_midi0IRQPending (1<<30)
318#define HDSP_midi1IRQPending (1<<31) 318#define HDSP_midi1IRQPending (1<<31)
319 319
320#define HDSP_spdifFrequencyMask (HDSP_spdifFrequency0|HDSP_spdifFrequency1|HDSP_spdifFrequency2) 320#define HDSP_spdifFrequencyMask (HDSP_spdifFrequency0|HDSP_spdifFrequency1|HDSP_spdifFrequency2)
@@ -391,7 +391,7 @@ MODULE_FIRMWARE("digiface_firmware_rev11.bin");
391#define HDSP_CHANNEL_BUFFER_BYTES (4*HDSP_CHANNEL_BUFFER_SAMPLES) 391#define HDSP_CHANNEL_BUFFER_BYTES (4*HDSP_CHANNEL_BUFFER_SAMPLES)
392 392
393/* the size of the area we need to allocate for DMA transfers. the 393/* the size of the area we need to allocate for DMA transfers. the
394 size is the same regardless of the number of channels - the 394 size is the same regardless of the number of channels - the
395 Multiface still uses the same memory area. 395 Multiface still uses the same memory area.
396 396
397 Note that we allocate 1 more channel than is apparently needed 397 Note that we allocate 1 more channel than is apparently needed
@@ -460,7 +460,7 @@ struct hdsp {
460 unsigned char qs_in_channels; /* quad speed mode for H9632 */ 460 unsigned char qs_in_channels; /* quad speed mode for H9632 */
461 unsigned char ds_in_channels; 461 unsigned char ds_in_channels;
462 unsigned char ss_in_channels; /* different for multiface/digiface */ 462 unsigned char ss_in_channels; /* different for multiface/digiface */
463 unsigned char qs_out_channels; 463 unsigned char qs_out_channels;
464 unsigned char ds_out_channels; 464 unsigned char ds_out_channels;
465 unsigned char ss_out_channels; 465 unsigned char ss_out_channels;
466 466
@@ -502,9 +502,9 @@ static char channel_map_df_ss[HDSP_MAX_CHANNELS] = {
502 502
503static char channel_map_mf_ss[HDSP_MAX_CHANNELS] = { /* Multiface */ 503static char channel_map_mf_ss[HDSP_MAX_CHANNELS] = { /* Multiface */
504 /* Analog */ 504 /* Analog */
505 0, 1, 2, 3, 4, 5, 6, 7, 505 0, 1, 2, 3, 4, 5, 6, 7,
506 /* ADAT 2 */ 506 /* ADAT 2 */
507 16, 17, 18, 19, 20, 21, 22, 23, 507 16, 17, 18, 19, 20, 21, 22, 23,
508 /* SPDIF */ 508 /* SPDIF */
509 24, 25, 509 24, 25,
510 -1, -1, -1, -1, -1, -1, -1, -1 510 -1, -1, -1, -1, -1, -1, -1, -1
@@ -525,11 +525,11 @@ static char channel_map_H9632_ss[HDSP_MAX_CHANNELS] = {
525 /* SPDIF */ 525 /* SPDIF */
526 8, 9, 526 8, 9,
527 /* Analog */ 527 /* Analog */
528 10, 11, 528 10, 11,
529 /* AO4S-192 and AI4S-192 extension boards */ 529 /* AO4S-192 and AI4S-192 extension boards */
530 12, 13, 14, 15, 530 12, 13, 14, 15,
531 /* others don't exist */ 531 /* others don't exist */
532 -1, -1, -1, -1, -1, -1, -1, -1, 532 -1, -1, -1, -1, -1, -1, -1, -1,
533 -1, -1 533 -1, -1
534}; 534};
535 535
@@ -539,7 +539,7 @@ static char channel_map_H9632_ds[HDSP_MAX_CHANNELS] = {
539 /* SPDIF */ 539 /* SPDIF */
540 8, 9, 540 8, 9,
541 /* Analog */ 541 /* Analog */
542 10, 11, 542 10, 11,
543 /* AO4S-192 and AI4S-192 extension boards */ 543 /* AO4S-192 and AI4S-192 extension boards */
544 12, 13, 14, 15, 544 12, 13, 14, 15,
545 /* others don't exist */ 545 /* others don't exist */
@@ -587,7 +587,7 @@ static void snd_hammerfall_free_buffer(struct snd_dma_buffer *dmab, struct pci_d
587static struct pci_device_id snd_hdsp_ids[] = { 587static struct pci_device_id snd_hdsp_ids[] = {
588 { 588 {
589 .vendor = PCI_VENDOR_ID_XILINX, 589 .vendor = PCI_VENDOR_ID_XILINX,
590 .device = PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP, 590 .device = PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP,
591 .subvendor = PCI_ANY_ID, 591 .subvendor = PCI_ANY_ID,
592 .subdevice = PCI_ANY_ID, 592 .subdevice = PCI_ANY_ID,
593 }, /* RME Hammerfall-DSP */ 593 }, /* RME Hammerfall-DSP */
@@ -691,19 +691,19 @@ static int snd_hdsp_load_firmware_from_cache(struct hdsp *hdsp) {
691 unsigned long flags; 691 unsigned long flags;
692 692
693 if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) { 693 if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) {
694 694
695 snd_printk ("Hammerfall-DSP: loading firmware\n"); 695 snd_printk ("Hammerfall-DSP: loading firmware\n");
696 696
697 hdsp_write (hdsp, HDSP_control2Reg, HDSP_S_PROGRAM); 697 hdsp_write (hdsp, HDSP_control2Reg, HDSP_S_PROGRAM);
698 hdsp_write (hdsp, HDSP_fifoData, 0); 698 hdsp_write (hdsp, HDSP_fifoData, 0);
699 699
700 if (hdsp_fifo_wait (hdsp, 0, HDSP_LONG_WAIT)) { 700 if (hdsp_fifo_wait (hdsp, 0, HDSP_LONG_WAIT)) {
701 snd_printk ("Hammerfall-DSP: timeout waiting for download preparation\n"); 701 snd_printk ("Hammerfall-DSP: timeout waiting for download preparation\n");
702 return -EIO; 702 return -EIO;
703 } 703 }
704 704
705 hdsp_write (hdsp, HDSP_control2Reg, HDSP_S_LOAD); 705 hdsp_write (hdsp, HDSP_control2Reg, HDSP_S_LOAD);
706 706
707 for (i = 0; i < 24413; ++i) { 707 for (i = 0; i < 24413; ++i) {
708 hdsp_write(hdsp, HDSP_fifoData, hdsp->firmware_cache[i]); 708 hdsp_write(hdsp, HDSP_fifoData, hdsp->firmware_cache[i]);
709 if (hdsp_fifo_wait (hdsp, 127, HDSP_LONG_WAIT)) { 709 if (hdsp_fifo_wait (hdsp, 127, HDSP_LONG_WAIT)) {
@@ -713,7 +713,7 @@ static int snd_hdsp_load_firmware_from_cache(struct hdsp *hdsp) {
713 } 713 }
714 714
715 ssleep(3); 715 ssleep(3);
716 716
717 if (hdsp_fifo_wait (hdsp, 0, HDSP_LONG_WAIT)) { 717 if (hdsp_fifo_wait (hdsp, 0, HDSP_LONG_WAIT)) {
718 snd_printk ("Hammerfall-DSP: timeout at end of firmware loading\n"); 718 snd_printk ("Hammerfall-DSP: timeout at end of firmware loading\n");
719 return -EIO; 719 return -EIO;
@@ -726,15 +726,15 @@ static int snd_hdsp_load_firmware_from_cache(struct hdsp *hdsp) {
726#endif 726#endif
727 hdsp_write (hdsp, HDSP_control2Reg, hdsp->control2_register); 727 hdsp_write (hdsp, HDSP_control2Reg, hdsp->control2_register);
728 snd_printk ("Hammerfall-DSP: finished firmware loading\n"); 728 snd_printk ("Hammerfall-DSP: finished firmware loading\n");
729 729
730 } 730 }
731 if (hdsp->state & HDSP_InitializationComplete) { 731 if (hdsp->state & HDSP_InitializationComplete) {
732 snd_printk(KERN_INFO "Hammerfall-DSP: firmware loaded from cache, restoring defaults\n"); 732 snd_printk(KERN_INFO "Hammerfall-DSP: firmware loaded from cache, restoring defaults\n");
733 spin_lock_irqsave(&hdsp->lock, flags); 733 spin_lock_irqsave(&hdsp->lock, flags);
734 snd_hdsp_set_defaults(hdsp); 734 snd_hdsp_set_defaults(hdsp);
735 spin_unlock_irqrestore(&hdsp->lock, flags); 735 spin_unlock_irqrestore(&hdsp->lock, flags);
736 } 736 }
737 737
738 hdsp->state |= HDSP_FirmwareLoaded; 738 hdsp->state |= HDSP_FirmwareLoaded;
739 739
740 return 0; 740 return 0;
@@ -743,7 +743,7 @@ static int snd_hdsp_load_firmware_from_cache(struct hdsp *hdsp) {
743static int hdsp_get_iobox_version (struct hdsp *hdsp) 743static int hdsp_get_iobox_version (struct hdsp *hdsp)
744{ 744{
745 if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) { 745 if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) {
746 746
747 hdsp_write (hdsp, HDSP_control2Reg, HDSP_PROGRAM); 747 hdsp_write (hdsp, HDSP_control2Reg, HDSP_PROGRAM);
748 hdsp_write (hdsp, HDSP_fifoData, 0); 748 hdsp_write (hdsp, HDSP_fifoData, 0);
749 if (hdsp_fifo_wait (hdsp, 0, HDSP_SHORT_WAIT) < 0) 749 if (hdsp_fifo_wait (hdsp, 0, HDSP_SHORT_WAIT) < 0)
@@ -759,7 +759,7 @@ static int hdsp_get_iobox_version (struct hdsp *hdsp)
759 hdsp_fifo_wait (hdsp, 0, HDSP_SHORT_WAIT); 759 hdsp_fifo_wait (hdsp, 0, HDSP_SHORT_WAIT);
760 } else { 760 } else {
761 hdsp->io_type = Digiface; 761 hdsp->io_type = Digiface;
762 } 762 }
763 } else { 763 } else {
764 /* firmware was already loaded, get iobox type */ 764 /* firmware was already loaded, get iobox type */
765 if (hdsp_read(hdsp, HDSP_status2Register) & HDSP_version1) 765 if (hdsp_read(hdsp, HDSP_status2Register) & HDSP_version1)
@@ -807,13 +807,13 @@ static int hdsp_check_for_firmware (struct hdsp *hdsp, int load_on_demand)
807 807
808 808
809static int hdsp_fifo_wait(struct hdsp *hdsp, int count, int timeout) 809static int hdsp_fifo_wait(struct hdsp *hdsp, int count, int timeout)
810{ 810{
811 int i; 811 int i;
812 812
813 /* the fifoStatus registers reports on how many words 813 /* the fifoStatus registers reports on how many words
814 are available in the command FIFO. 814 are available in the command FIFO.
815 */ 815 */
816 816
817 for (i = 0; i < timeout; i++) { 817 for (i = 0; i < timeout; i++) {
818 818
819 if ((int)(hdsp_read (hdsp, HDSP_fifoStatus) & 0xff) <= count) 819 if ((int)(hdsp_read (hdsp, HDSP_fifoStatus) & 0xff) <= count)
@@ -845,11 +845,11 @@ static int hdsp_write_gain(struct hdsp *hdsp, unsigned int addr, unsigned short
845 845
846 if (addr >= HDSP_MATRIX_MIXER_SIZE) 846 if (addr >= HDSP_MATRIX_MIXER_SIZE)
847 return -1; 847 return -1;
848 848
849 if (hdsp->io_type == H9652 || hdsp->io_type == H9632) { 849 if (hdsp->io_type == H9652 || hdsp->io_type == H9632) {
850 850
851 /* from martin bjornsen: 851 /* from martin bjornsen:
852 852
853 "You can only write dwords to the 853 "You can only write dwords to the
854 mixer memory which contain two 854 mixer memory which contain two
855 mixer values in the low and high 855 mixer values in the low and high
@@ -868,7 +868,7 @@ static int hdsp_write_gain(struct hdsp *hdsp, unsigned int addr, unsigned short
868 868
869 hdsp->mixer_matrix[addr] = data; 869 hdsp->mixer_matrix[addr] = data;
870 870
871 871
872 /* `addr' addresses a 16-bit wide address, but 872 /* `addr' addresses a 16-bit wide address, but
873 the address space accessed via hdsp_write 873 the address space accessed via hdsp_write
874 uses byte offsets. put another way, addr 874 uses byte offsets. put another way, addr
@@ -877,17 +877,17 @@ static int hdsp_write_gain(struct hdsp *hdsp, unsigned int addr, unsigned short
877 to access 0 to 2703 ... 877 to access 0 to 2703 ...
878 */ 878 */
879 ad = addr/2; 879 ad = addr/2;
880 880
881 hdsp_write (hdsp, 4096 + (ad*4), 881 hdsp_write (hdsp, 4096 + (ad*4),
882 (hdsp->mixer_matrix[(addr&0x7fe)+1] << 16) + 882 (hdsp->mixer_matrix[(addr&0x7fe)+1] << 16) +
883 hdsp->mixer_matrix[addr&0x7fe]); 883 hdsp->mixer_matrix[addr&0x7fe]);
884 884
885 return 0; 885 return 0;
886 886
887 } else { 887 } else {
888 888
889 ad = (addr << 16) + data; 889 ad = (addr << 16) + data;
890 890
891 if (hdsp_fifo_wait(hdsp, 127, HDSP_LONG_WAIT)) 891 if (hdsp_fifo_wait(hdsp, 127, HDSP_LONG_WAIT))
892 return -1; 892 return -1;
893 893
@@ -923,7 +923,7 @@ static int hdsp_spdif_sample_rate(struct hdsp *hdsp)
923 923
924 if (status & HDSP_SPDIFErrorFlag) 924 if (status & HDSP_SPDIFErrorFlag)
925 return 0; 925 return 0;
926 926
927 switch (rate_bits) { 927 switch (rate_bits) {
928 case HDSP_spdifFrequency32KHz: return 32000; 928 case HDSP_spdifFrequency32KHz: return 32000;
929 case HDSP_spdifFrequency44_1KHz: return 44100; 929 case HDSP_spdifFrequency44_1KHz: return 44100;
@@ -931,13 +931,13 @@ static int hdsp_spdif_sample_rate(struct hdsp *hdsp)
931 case HDSP_spdifFrequency64KHz: return 64000; 931 case HDSP_spdifFrequency64KHz: return 64000;
932 case HDSP_spdifFrequency88_2KHz: return 88200; 932 case HDSP_spdifFrequency88_2KHz: return 88200;
933 case HDSP_spdifFrequency96KHz: return 96000; 933 case HDSP_spdifFrequency96KHz: return 96000;
934 case HDSP_spdifFrequency128KHz: 934 case HDSP_spdifFrequency128KHz:
935 if (hdsp->io_type == H9632) return 128000; 935 if (hdsp->io_type == H9632) return 128000;
936 break; 936 break;
937 case HDSP_spdifFrequency176_4KHz: 937 case HDSP_spdifFrequency176_4KHz:
938 if (hdsp->io_type == H9632) return 176400; 938 if (hdsp->io_type == H9632) return 176400;
939 break; 939 break;
940 case HDSP_spdifFrequency192KHz: 940 case HDSP_spdifFrequency192KHz:
941 if (hdsp->io_type == H9632) return 192000; 941 if (hdsp->io_type == H9632) return 192000;
942 break; 942 break;
943 default: 943 default:
@@ -1048,7 +1048,7 @@ static void hdsp_set_dds_value(struct hdsp *hdsp, int rate)
1048{ 1048{
1049 u64 n; 1049 u64 n;
1050 u32 r; 1050 u32 r;
1051 1051
1052 if (rate >= 112000) 1052 if (rate >= 112000)
1053 rate /= 4; 1053 rate /= 4;
1054 else if (rate >= 56000) 1054 else if (rate >= 56000)
@@ -1074,35 +1074,35 @@ static int hdsp_set_rate(struct hdsp *hdsp, int rate, int called_internally)
1074 there is no need for it (e.g. during module 1074 there is no need for it (e.g. during module
1075 initialization). 1075 initialization).
1076 */ 1076 */
1077 1077
1078 if (!(hdsp->control_register & HDSP_ClockModeMaster)) { 1078 if (!(hdsp->control_register & HDSP_ClockModeMaster)) {
1079 if (called_internally) { 1079 if (called_internally) {
1080 /* request from ctl or card initialization */ 1080 /* request from ctl or card initialization */
1081 snd_printk(KERN_ERR "Hammerfall-DSP: device is not running as a clock master: cannot set sample rate.\n"); 1081 snd_printk(KERN_ERR "Hammerfall-DSP: device is not running as a clock master: cannot set sample rate.\n");
1082 return -1; 1082 return -1;
1083 } else { 1083 } else {
1084 /* hw_param request while in AutoSync mode */ 1084 /* hw_param request while in AutoSync mode */
1085 int external_freq = hdsp_external_sample_rate(hdsp); 1085 int external_freq = hdsp_external_sample_rate(hdsp);
1086 int spdif_freq = hdsp_spdif_sample_rate(hdsp); 1086 int spdif_freq = hdsp_spdif_sample_rate(hdsp);
1087 1087
1088 if ((spdif_freq == external_freq*2) && (hdsp_autosync_ref(hdsp) >= HDSP_AUTOSYNC_FROM_ADAT1)) 1088 if ((spdif_freq == external_freq*2) && (hdsp_autosync_ref(hdsp) >= HDSP_AUTOSYNC_FROM_ADAT1))
1089 snd_printk(KERN_INFO "Hammerfall-DSP: Detected ADAT in double speed mode\n"); 1089 snd_printk(KERN_INFO "Hammerfall-DSP: Detected ADAT in double speed mode\n");
1090 else if (hdsp->io_type == H9632 && (spdif_freq == external_freq*4) && (hdsp_autosync_ref(hdsp) >= HDSP_AUTOSYNC_FROM_ADAT1)) 1090 else if (hdsp->io_type == H9632 && (spdif_freq == external_freq*4) && (hdsp_autosync_ref(hdsp) >= HDSP_AUTOSYNC_FROM_ADAT1))
1091 snd_printk(KERN_INFO "Hammerfall-DSP: Detected ADAT in quad speed mode\n"); 1091 snd_printk(KERN_INFO "Hammerfall-DSP: Detected ADAT in quad speed mode\n");
1092 else if (rate != external_freq) { 1092 else if (rate != external_freq) {
1093 snd_printk(KERN_INFO "Hammerfall-DSP: No AutoSync source for requested rate\n"); 1093 snd_printk(KERN_INFO "Hammerfall-DSP: No AutoSync source for requested rate\n");
1094 return -1; 1094 return -1;
1095 } 1095 }
1096 } 1096 }
1097 } 1097 }
1098 1098
1099 current_rate = hdsp->system_sample_rate; 1099 current_rate = hdsp->system_sample_rate;
1100 1100
1101 /* Changing from a "single speed" to a "double speed" rate is 1101 /* Changing from a "single speed" to a "double speed" rate is
1102 not allowed if any substreams are open. This is because 1102 not allowed if any substreams are open. This is because
1103 such a change causes a shift in the location of 1103 such a change causes a shift in the location of
1104 the DMA buffers and a reduction in the number of available 1104 the DMA buffers and a reduction in the number of available
1105 buffers. 1105 buffers.
1106 1106
1107 Note that a similar but essentially insoluble problem 1107 Note that a similar but essentially insoluble problem
1108 exists for externally-driven rate changes. All we can do 1108 exists for externally-driven rate changes. All we can do
@@ -1110,7 +1110,7 @@ static int hdsp_set_rate(struct hdsp *hdsp, int rate, int called_internally)
1110 1110
1111 if (rate > 96000 && hdsp->io_type != H9632) 1111 if (rate > 96000 && hdsp->io_type != H9632)
1112 return -EINVAL; 1112 return -EINVAL;
1113 1113
1114 switch (rate) { 1114 switch (rate) {
1115 case 32000: 1115 case 32000:
1116 if (current_rate > 48000) 1116 if (current_rate > 48000)
@@ -1200,7 +1200,7 @@ static int hdsp_set_rate(struct hdsp *hdsp, int rate, int called_internally)
1200 break; 1200 break;
1201 } 1201 }
1202 } 1202 }
1203 1203
1204 hdsp->system_sample_rate = rate; 1204 hdsp->system_sample_rate = rate;
1205 1205
1206 return 0; 1206 return 0;
@@ -1266,16 +1266,16 @@ static int snd_hdsp_midi_output_write (struct hdsp_midi *hmidi)
1266 unsigned char buf[128]; 1266 unsigned char buf[128];
1267 1267
1268 /* Output is not interrupt driven */ 1268 /* Output is not interrupt driven */
1269 1269
1270 spin_lock_irqsave (&hmidi->lock, flags); 1270 spin_lock_irqsave (&hmidi->lock, flags);
1271 if (hmidi->output) { 1271 if (hmidi->output) {
1272 if (!snd_rawmidi_transmit_empty (hmidi->output)) { 1272 if (!snd_rawmidi_transmit_empty (hmidi->output)) {
1273 if ((n_pending = snd_hdsp_midi_output_possible (hmidi->hdsp, hmidi->id)) > 0) { 1273 if ((n_pending = snd_hdsp_midi_output_possible (hmidi->hdsp, hmidi->id)) > 0) {
1274 if (n_pending > (int)sizeof (buf)) 1274 if (n_pending > (int)sizeof (buf))
1275 n_pending = sizeof (buf); 1275 n_pending = sizeof (buf);
1276 1276
1277 if ((to_write = snd_rawmidi_transmit (hmidi->output, buf, n_pending)) > 0) { 1277 if ((to_write = snd_rawmidi_transmit (hmidi->output, buf, n_pending)) > 0) {
1278 for (i = 0; i < to_write; ++i) 1278 for (i = 0; i < to_write; ++i)
1279 snd_hdsp_midi_write_byte (hmidi->hdsp, hmidi->id, buf[i]); 1279 snd_hdsp_midi_write_byte (hmidi->hdsp, hmidi->id, buf[i]);
1280 } 1280 }
1281 } 1281 }
@@ -1346,14 +1346,14 @@ static void snd_hdsp_midi_output_timer(unsigned long data)
1346{ 1346{
1347 struct hdsp_midi *hmidi = (struct hdsp_midi *) data; 1347 struct hdsp_midi *hmidi = (struct hdsp_midi *) data;
1348 unsigned long flags; 1348 unsigned long flags;
1349 1349
1350 snd_hdsp_midi_output_write(hmidi); 1350 snd_hdsp_midi_output_write(hmidi);
1351 spin_lock_irqsave (&hmidi->lock, flags); 1351 spin_lock_irqsave (&hmidi->lock, flags);
1352 1352
1353 /* this does not bump hmidi->istimer, because the 1353 /* this does not bump hmidi->istimer, because the
1354 kernel automatically removed the timer when it 1354 kernel automatically removed the timer when it
1355 expired, and we are now adding it back, thus 1355 expired, and we are now adding it back, thus
1356 leaving istimer wherever it was set before. 1356 leaving istimer wherever it was set before.
1357 */ 1357 */
1358 1358
1359 if (hmidi->istimer) { 1359 if (hmidi->istimer) {
@@ -1522,7 +1522,7 @@ static int snd_hdsp_control_spdif_info(struct snd_kcontrol *kcontrol, struct snd
1522static int snd_hdsp_control_spdif_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 1522static int snd_hdsp_control_spdif_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
1523{ 1523{
1524 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 1524 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
1525 1525
1526 snd_hdsp_convert_to_aes(&ucontrol->value.iec958, hdsp->creg_spdif); 1526 snd_hdsp_convert_to_aes(&ucontrol->value.iec958, hdsp->creg_spdif);
1527 return 0; 1527 return 0;
1528} 1528}
@@ -1532,7 +1532,7 @@ static int snd_hdsp_control_spdif_put(struct snd_kcontrol *kcontrol, struct snd_
1532 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 1532 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
1533 int change; 1533 int change;
1534 u32 val; 1534 u32 val;
1535 1535
1536 val = snd_hdsp_convert_from_aes(&ucontrol->value.iec958); 1536 val = snd_hdsp_convert_from_aes(&ucontrol->value.iec958);
1537 spin_lock_irq(&hdsp->lock); 1537 spin_lock_irq(&hdsp->lock);
1538 change = val != hdsp->creg_spdif; 1538 change = val != hdsp->creg_spdif;
@@ -1551,7 +1551,7 @@ static int snd_hdsp_control_spdif_stream_info(struct snd_kcontrol *kcontrol, str
1551static int snd_hdsp_control_spdif_stream_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 1551static int snd_hdsp_control_spdif_stream_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
1552{ 1552{
1553 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 1553 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
1554 1554
1555 snd_hdsp_convert_to_aes(&ucontrol->value.iec958, hdsp->creg_spdif_stream); 1555 snd_hdsp_convert_to_aes(&ucontrol->value.iec958, hdsp->creg_spdif_stream);
1556 return 0; 1556 return 0;
1557} 1557}
@@ -1561,7 +1561,7 @@ static int snd_hdsp_control_spdif_stream_put(struct snd_kcontrol *kcontrol, stru
1561 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 1561 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
1562 int change; 1562 int change;
1563 u32 val; 1563 u32 val;
1564 1564
1565 val = snd_hdsp_convert_from_aes(&ucontrol->value.iec958); 1565 val = snd_hdsp_convert_from_aes(&ucontrol->value.iec958);
1566 spin_lock_irq(&hdsp->lock); 1566 spin_lock_irq(&hdsp->lock);
1567 change = val != hdsp->creg_spdif_stream; 1567 change = val != hdsp->creg_spdif_stream;
@@ -1623,7 +1623,7 @@ static int snd_hdsp_info_spdif_in(struct snd_kcontrol *kcontrol, struct snd_ctl_
1623static int snd_hdsp_get_spdif_in(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 1623static int snd_hdsp_get_spdif_in(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
1624{ 1624{
1625 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 1625 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
1626 1626
1627 ucontrol->value.enumerated.item[0] = hdsp_spdif_in(hdsp); 1627 ucontrol->value.enumerated.item[0] = hdsp_spdif_in(hdsp);
1628 return 0; 1628 return 0;
1629} 1629}
@@ -1633,7 +1633,7 @@ static int snd_hdsp_put_spdif_in(struct snd_kcontrol *kcontrol, struct snd_ctl_e
1633 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 1633 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
1634 int change; 1634 int change;
1635 unsigned int val; 1635 unsigned int val;
1636 1636
1637 if (!snd_hdsp_use_is_exclusive(hdsp)) 1637 if (!snd_hdsp_use_is_exclusive(hdsp))
1638 return -EBUSY; 1638 return -EBUSY;
1639 val = ucontrol->value.enumerated.item[0] % ((hdsp->io_type == H9632) ? 4 : 3); 1639 val = ucontrol->value.enumerated.item[0] % ((hdsp->io_type == H9632) ? 4 : 3);
@@ -1670,7 +1670,7 @@ static int hdsp_set_spdif_output(struct hdsp *hdsp, int out)
1670static int snd_hdsp_get_spdif_out(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 1670static int snd_hdsp_get_spdif_out(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
1671{ 1671{
1672 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 1672 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
1673 1673
1674 ucontrol->value.integer.value[0] = hdsp_spdif_out(hdsp); 1674 ucontrol->value.integer.value[0] = hdsp_spdif_out(hdsp);
1675 return 0; 1675 return 0;
1676} 1676}
@@ -1680,7 +1680,7 @@ static int snd_hdsp_put_spdif_out(struct snd_kcontrol *kcontrol, struct snd_ctl_
1680 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 1680 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
1681 int change; 1681 int change;
1682 unsigned int val; 1682 unsigned int val;
1683 1683
1684 if (!snd_hdsp_use_is_exclusive(hdsp)) 1684 if (!snd_hdsp_use_is_exclusive(hdsp))
1685 return -EBUSY; 1685 return -EBUSY;
1686 val = ucontrol->value.integer.value[0] & 1; 1686 val = ucontrol->value.integer.value[0] & 1;
@@ -1714,7 +1714,7 @@ static int hdsp_set_spdif_professional(struct hdsp *hdsp, int val)
1714static int snd_hdsp_get_spdif_professional(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 1714static int snd_hdsp_get_spdif_professional(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
1715{ 1715{
1716 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 1716 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
1717 1717
1718 ucontrol->value.integer.value[0] = hdsp_spdif_professional(hdsp); 1718 ucontrol->value.integer.value[0] = hdsp_spdif_professional(hdsp);
1719 return 0; 1719 return 0;
1720} 1720}
@@ -1724,7 +1724,7 @@ static int snd_hdsp_put_spdif_professional(struct snd_kcontrol *kcontrol, struct
1724 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 1724 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
1725 int change; 1725 int change;
1726 unsigned int val; 1726 unsigned int val;
1727 1727
1728 if (!snd_hdsp_use_is_exclusive(hdsp)) 1728 if (!snd_hdsp_use_is_exclusive(hdsp))
1729 return -EBUSY; 1729 return -EBUSY;
1730 val = ucontrol->value.integer.value[0] & 1; 1730 val = ucontrol->value.integer.value[0] & 1;
@@ -1758,7 +1758,7 @@ static int hdsp_set_spdif_emphasis(struct hdsp *hdsp, int val)
1758static int snd_hdsp_get_spdif_emphasis(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 1758static int snd_hdsp_get_spdif_emphasis(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
1759{ 1759{
1760 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 1760 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
1761 1761
1762 ucontrol->value.integer.value[0] = hdsp_spdif_emphasis(hdsp); 1762 ucontrol->value.integer.value[0] = hdsp_spdif_emphasis(hdsp);
1763 return 0; 1763 return 0;
1764} 1764}
@@ -1768,7 +1768,7 @@ static int snd_hdsp_put_spdif_emphasis(struct snd_kcontrol *kcontrol, struct snd
1768 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 1768 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
1769 int change; 1769 int change;
1770 unsigned int val; 1770 unsigned int val;
1771 1771
1772 if (!snd_hdsp_use_is_exclusive(hdsp)) 1772 if (!snd_hdsp_use_is_exclusive(hdsp))
1773 return -EBUSY; 1773 return -EBUSY;
1774 val = ucontrol->value.integer.value[0] & 1; 1774 val = ucontrol->value.integer.value[0] & 1;
@@ -1802,7 +1802,7 @@ static int hdsp_set_spdif_nonaudio(struct hdsp *hdsp, int val)
1802static int snd_hdsp_get_spdif_nonaudio(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 1802static int snd_hdsp_get_spdif_nonaudio(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
1803{ 1803{
1804 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 1804 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
1805 1805
1806 ucontrol->value.integer.value[0] = hdsp_spdif_nonaudio(hdsp); 1806 ucontrol->value.integer.value[0] = hdsp_spdif_nonaudio(hdsp);
1807 return 0; 1807 return 0;
1808} 1808}
@@ -1812,7 +1812,7 @@ static int snd_hdsp_put_spdif_nonaudio(struct snd_kcontrol *kcontrol, struct snd
1812 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 1812 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
1813 int change; 1813 int change;
1814 unsigned int val; 1814 unsigned int val;
1815 1815
1816 if (!snd_hdsp_use_is_exclusive(hdsp)) 1816 if (!snd_hdsp_use_is_exclusive(hdsp))
1817 return -EBUSY; 1817 return -EBUSY;
1818 val = ucontrol->value.integer.value[0] & 1; 1818 val = ucontrol->value.integer.value[0] & 1;
@@ -1849,7 +1849,7 @@ static int snd_hdsp_info_spdif_sample_rate(struct snd_kcontrol *kcontrol, struct
1849static int snd_hdsp_get_spdif_sample_rate(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 1849static int snd_hdsp_get_spdif_sample_rate(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
1850{ 1850{
1851 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 1851 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
1852 1852
1853 switch (hdsp_spdif_sample_rate(hdsp)) { 1853 switch (hdsp_spdif_sample_rate(hdsp)) {
1854 case 32000: 1854 case 32000:
1855 ucontrol->value.enumerated.item[0] = 0; 1855 ucontrol->value.enumerated.item[0] = 0;
@@ -1879,7 +1879,7 @@ static int snd_hdsp_get_spdif_sample_rate(struct snd_kcontrol *kcontrol, struct
1879 ucontrol->value.enumerated.item[0] = 9; 1879 ucontrol->value.enumerated.item[0] = 9;
1880 break; 1880 break;
1881 default: 1881 default:
1882 ucontrol->value.enumerated.item[0] = 6; 1882 ucontrol->value.enumerated.item[0] = 6;
1883 } 1883 }
1884 return 0; 1884 return 0;
1885} 1885}
@@ -1903,7 +1903,7 @@ static int snd_hdsp_info_system_sample_rate(struct snd_kcontrol *kcontrol, struc
1903static int snd_hdsp_get_system_sample_rate(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 1903static int snd_hdsp_get_system_sample_rate(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
1904{ 1904{
1905 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 1905 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
1906 1906
1907 ucontrol->value.enumerated.item[0] = hdsp->system_sample_rate; 1907 ucontrol->value.enumerated.item[0] = hdsp->system_sample_rate;
1908 return 0; 1908 return 0;
1909} 1909}
@@ -1920,7 +1920,7 @@ static int snd_hdsp_get_system_sample_rate(struct snd_kcontrol *kcontrol, struct
1920static int snd_hdsp_info_autosync_sample_rate(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 1920static int snd_hdsp_info_autosync_sample_rate(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
1921{ 1921{
1922 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 1922 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
1923 static char *texts[] = {"32000", "44100", "48000", "64000", "88200", "96000", "None", "128000", "176400", "192000"}; 1923 static char *texts[] = {"32000", "44100", "48000", "64000", "88200", "96000", "None", "128000", "176400", "192000"};
1924 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 1924 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
1925 uinfo->count = 1; 1925 uinfo->count = 1;
1926 uinfo->value.enumerated.items = (hdsp->io_type == H9632) ? 10 : 7 ; 1926 uinfo->value.enumerated.items = (hdsp->io_type == H9632) ? 10 : 7 ;
@@ -1933,7 +1933,7 @@ static int snd_hdsp_info_autosync_sample_rate(struct snd_kcontrol *kcontrol, str
1933static int snd_hdsp_get_autosync_sample_rate(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 1933static int snd_hdsp_get_autosync_sample_rate(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
1934{ 1934{
1935 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 1935 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
1936 1936
1937 switch (hdsp_external_sample_rate(hdsp)) { 1937 switch (hdsp_external_sample_rate(hdsp)) {
1938 case 32000: 1938 case 32000:
1939 ucontrol->value.enumerated.item[0] = 0; 1939 ucontrol->value.enumerated.item[0] = 0;
@@ -1961,9 +1961,9 @@ static int snd_hdsp_get_autosync_sample_rate(struct snd_kcontrol *kcontrol, stru
1961 break; 1961 break;
1962 case 192000: 1962 case 192000:
1963 ucontrol->value.enumerated.item[0] = 9; 1963 ucontrol->value.enumerated.item[0] = 9;
1964 break; 1964 break;
1965 default: 1965 default:
1966 ucontrol->value.enumerated.item[0] = 6; 1966 ucontrol->value.enumerated.item[0] = 6;
1967 } 1967 }
1968 return 0; 1968 return 0;
1969} 1969}
@@ -1989,7 +1989,7 @@ static int hdsp_system_clock_mode(struct hdsp *hdsp)
1989static int snd_hdsp_info_system_clock_mode(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 1989static int snd_hdsp_info_system_clock_mode(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
1990{ 1990{
1991 static char *texts[] = {"Master", "Slave" }; 1991 static char *texts[] = {"Master", "Slave" };
1992 1992
1993 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 1993 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
1994 uinfo->count = 1; 1994 uinfo->count = 1;
1995 uinfo->value.enumerated.items = 2; 1995 uinfo->value.enumerated.items = 2;
@@ -2002,7 +2002,7 @@ static int snd_hdsp_info_system_clock_mode(struct snd_kcontrol *kcontrol, struct
2002static int snd_hdsp_get_system_clock_mode(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 2002static int snd_hdsp_get_system_clock_mode(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
2003{ 2003{
2004 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 2004 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
2005 2005
2006 ucontrol->value.enumerated.item[0] = hdsp_system_clock_mode(hdsp); 2006 ucontrol->value.enumerated.item[0] = hdsp_system_clock_mode(hdsp);
2007 return 0; 2007 return 0;
2008} 2008}
@@ -2039,7 +2039,7 @@ static int hdsp_clock_source(struct hdsp *hdsp)
2039 case 192000: 2039 case 192000:
2040 return 9; 2040 return 9;
2041 default: 2041 default:
2042 return 3; 2042 return 3;
2043 } 2043 }
2044 } else { 2044 } else {
2045 return 0; 2045 return 0;
@@ -2053,7 +2053,7 @@ static int hdsp_set_clock_source(struct hdsp *hdsp, int mode)
2053 case HDSP_CLOCK_SOURCE_AUTOSYNC: 2053 case HDSP_CLOCK_SOURCE_AUTOSYNC:
2054 if (hdsp_external_sample_rate(hdsp) != 0) { 2054 if (hdsp_external_sample_rate(hdsp) != 0) {
2055 if (!hdsp_set_rate(hdsp, hdsp_external_sample_rate(hdsp), 1)) { 2055 if (!hdsp_set_rate(hdsp, hdsp_external_sample_rate(hdsp), 1)) {
2056 hdsp->control_register &= ~HDSP_ClockModeMaster; 2056 hdsp->control_register &= ~HDSP_ClockModeMaster;
2057 hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register); 2057 hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register);
2058 return 0; 2058 return 0;
2059 } 2059 }
@@ -2064,7 +2064,7 @@ static int hdsp_set_clock_source(struct hdsp *hdsp, int mode)
2064 break; 2064 break;
2065 case HDSP_CLOCK_SOURCE_INTERNAL_44_1KHZ: 2065 case HDSP_CLOCK_SOURCE_INTERNAL_44_1KHZ:
2066 rate = 44100; 2066 rate = 44100;
2067 break; 2067 break;
2068 case HDSP_CLOCK_SOURCE_INTERNAL_48KHZ: 2068 case HDSP_CLOCK_SOURCE_INTERNAL_48KHZ:
2069 rate = 48000; 2069 rate = 48000;
2070 break; 2070 break;
@@ -2099,13 +2099,13 @@ static int snd_hdsp_info_clock_source(struct snd_kcontrol *kcontrol, struct snd_
2099{ 2099{
2100 static char *texts[] = {"AutoSync", "Internal 32.0 kHz", "Internal 44.1 kHz", "Internal 48.0 kHz", "Internal 64.0 kHz", "Internal 88.2 kHz", "Internal 96.0 kHz", "Internal 128 kHz", "Internal 176.4 kHz", "Internal 192.0 KHz" }; 2100 static char *texts[] = {"AutoSync", "Internal 32.0 kHz", "Internal 44.1 kHz", "Internal 48.0 kHz", "Internal 64.0 kHz", "Internal 88.2 kHz", "Internal 96.0 kHz", "Internal 128 kHz", "Internal 176.4 kHz", "Internal 192.0 KHz" };
2101 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 2101 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
2102 2102
2103 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 2103 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2104 uinfo->count = 1; 2104 uinfo->count = 1;
2105 if (hdsp->io_type == H9632) 2105 if (hdsp->io_type == H9632)
2106 uinfo->value.enumerated.items = 10; 2106 uinfo->value.enumerated.items = 10;
2107 else 2107 else
2108 uinfo->value.enumerated.items = 7; 2108 uinfo->value.enumerated.items = 7;
2109 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) 2109 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
2110 uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; 2110 uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
2111 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); 2111 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
@@ -2115,7 +2115,7 @@ static int snd_hdsp_info_clock_source(struct snd_kcontrol *kcontrol, struct snd_
2115static int snd_hdsp_get_clock_source(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 2115static int snd_hdsp_get_clock_source(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
2116{ 2116{
2117 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 2117 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
2118 2118
2119 ucontrol->value.enumerated.item[0] = hdsp_clock_source(hdsp); 2119 ucontrol->value.enumerated.item[0] = hdsp_clock_source(hdsp);
2120 return 0; 2120 return 0;
2121} 2121}
@@ -2125,7 +2125,7 @@ static int snd_hdsp_put_clock_source(struct snd_kcontrol *kcontrol, struct snd_c
2125 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 2125 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
2126 int change; 2126 int change;
2127 int val; 2127 int val;
2128 2128
2129 if (!snd_hdsp_use_is_exclusive(hdsp)) 2129 if (!snd_hdsp_use_is_exclusive(hdsp))
2130 return -EBUSY; 2130 return -EBUSY;
2131 val = ucontrol->value.enumerated.item[0]; 2131 val = ucontrol->value.enumerated.item[0];
@@ -2151,7 +2151,7 @@ static int snd_hdsp_put_clock_source(struct snd_kcontrol *kcontrol, struct snd_c
2151static int snd_hdsp_get_clock_source_lock(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 2151static int snd_hdsp_get_clock_source_lock(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
2152{ 2152{
2153 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 2153 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
2154 2154
2155 ucontrol->value.integer.value[0] = hdsp->clock_source_locked; 2155 ucontrol->value.integer.value[0] = hdsp->clock_source_locked;
2156 return 0; 2156 return 0;
2157} 2157}
@@ -2186,7 +2186,7 @@ static int hdsp_da_gain(struct hdsp *hdsp)
2186 case HDSP_DAGainMinus10dBV: 2186 case HDSP_DAGainMinus10dBV:
2187 return 2; 2187 return 2;
2188 default: 2188 default:
2189 return 1; 2189 return 1;
2190 } 2190 }
2191} 2191}
2192 2192
@@ -2201,8 +2201,8 @@ static int hdsp_set_da_gain(struct hdsp *hdsp, int mode)
2201 hdsp->control_register |= HDSP_DAGainPlus4dBu; 2201 hdsp->control_register |= HDSP_DAGainPlus4dBu;
2202 break; 2202 break;
2203 case 2: 2203 case 2:
2204 hdsp->control_register |= HDSP_DAGainMinus10dBV; 2204 hdsp->control_register |= HDSP_DAGainMinus10dBV;
2205 break; 2205 break;
2206 default: 2206 default:
2207 return -1; 2207 return -1;
2208 2208
@@ -2214,7 +2214,7 @@ static int hdsp_set_da_gain(struct hdsp *hdsp, int mode)
2214static int snd_hdsp_info_da_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 2214static int snd_hdsp_info_da_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
2215{ 2215{
2216 static char *texts[] = {"Hi Gain", "+4 dBu", "-10 dbV"}; 2216 static char *texts[] = {"Hi Gain", "+4 dBu", "-10 dbV"};
2217 2217
2218 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 2218 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2219 uinfo->count = 1; 2219 uinfo->count = 1;
2220 uinfo->value.enumerated.items = 3; 2220 uinfo->value.enumerated.items = 3;
@@ -2227,7 +2227,7 @@ static int snd_hdsp_info_da_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_e
2227static int snd_hdsp_get_da_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 2227static int snd_hdsp_get_da_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
2228{ 2228{
2229 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 2229 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
2230 2230
2231 ucontrol->value.enumerated.item[0] = hdsp_da_gain(hdsp); 2231 ucontrol->value.enumerated.item[0] = hdsp_da_gain(hdsp);
2232 return 0; 2232 return 0;
2233} 2233}
@@ -2237,7 +2237,7 @@ static int snd_hdsp_put_da_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_el
2237 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 2237 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
2238 int change; 2238 int change;
2239 int val; 2239 int val;
2240 2240
2241 if (!snd_hdsp_use_is_exclusive(hdsp)) 2241 if (!snd_hdsp_use_is_exclusive(hdsp))
2242 return -EBUSY; 2242 return -EBUSY;
2243 val = ucontrol->value.enumerated.item[0]; 2243 val = ucontrol->value.enumerated.item[0];
@@ -2271,7 +2271,7 @@ static int hdsp_ad_gain(struct hdsp *hdsp)
2271 case HDSP_ADGainLowGain: 2271 case HDSP_ADGainLowGain:
2272 return 2; 2272 return 2;
2273 default: 2273 default:
2274 return 1; 2274 return 1;
2275 } 2275 }
2276} 2276}
2277 2277
@@ -2283,11 +2283,11 @@ static int hdsp_set_ad_gain(struct hdsp *hdsp, int mode)
2283 hdsp->control_register |= HDSP_ADGainMinus10dBV; 2283 hdsp->control_register |= HDSP_ADGainMinus10dBV;
2284 break; 2284 break;
2285 case 1: 2285 case 1:
2286 hdsp->control_register |= HDSP_ADGainPlus4dBu; 2286 hdsp->control_register |= HDSP_ADGainPlus4dBu;
2287 break; 2287 break;
2288 case 2: 2288 case 2:
2289 hdsp->control_register |= HDSP_ADGainLowGain; 2289 hdsp->control_register |= HDSP_ADGainLowGain;
2290 break; 2290 break;
2291 default: 2291 default:
2292 return -1; 2292 return -1;
2293 2293
@@ -2299,7 +2299,7 @@ static int hdsp_set_ad_gain(struct hdsp *hdsp, int mode)
2299static int snd_hdsp_info_ad_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 2299static int snd_hdsp_info_ad_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
2300{ 2300{
2301 static char *texts[] = {"-10 dBV", "+4 dBu", "Lo Gain"}; 2301 static char *texts[] = {"-10 dBV", "+4 dBu", "Lo Gain"};
2302 2302
2303 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 2303 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2304 uinfo->count = 1; 2304 uinfo->count = 1;
2305 uinfo->value.enumerated.items = 3; 2305 uinfo->value.enumerated.items = 3;
@@ -2312,7 +2312,7 @@ static int snd_hdsp_info_ad_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_e
2312static int snd_hdsp_get_ad_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 2312static int snd_hdsp_get_ad_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
2313{ 2313{
2314 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 2314 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
2315 2315
2316 ucontrol->value.enumerated.item[0] = hdsp_ad_gain(hdsp); 2316 ucontrol->value.enumerated.item[0] = hdsp_ad_gain(hdsp);
2317 return 0; 2317 return 0;
2318} 2318}
@@ -2322,7 +2322,7 @@ static int snd_hdsp_put_ad_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_el
2322 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 2322 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
2323 int change; 2323 int change;
2324 int val; 2324 int val;
2325 2325
2326 if (!snd_hdsp_use_is_exclusive(hdsp)) 2326 if (!snd_hdsp_use_is_exclusive(hdsp))
2327 return -EBUSY; 2327 return -EBUSY;
2328 val = ucontrol->value.enumerated.item[0]; 2328 val = ucontrol->value.enumerated.item[0];
@@ -2356,7 +2356,7 @@ static int hdsp_phone_gain(struct hdsp *hdsp)
2356 case HDSP_PhoneGainMinus12dB: 2356 case HDSP_PhoneGainMinus12dB:
2357 return 2; 2357 return 2;
2358 default: 2358 default:
2359 return 0; 2359 return 0;
2360 } 2360 }
2361} 2361}
2362 2362
@@ -2368,11 +2368,11 @@ static int hdsp_set_phone_gain(struct hdsp *hdsp, int mode)
2368 hdsp->control_register |= HDSP_PhoneGain0dB; 2368 hdsp->control_register |= HDSP_PhoneGain0dB;
2369 break; 2369 break;
2370 case 1: 2370 case 1:
2371 hdsp->control_register |= HDSP_PhoneGainMinus6dB; 2371 hdsp->control_register |= HDSP_PhoneGainMinus6dB;
2372 break; 2372 break;
2373 case 2: 2373 case 2:
2374 hdsp->control_register |= HDSP_PhoneGainMinus12dB; 2374 hdsp->control_register |= HDSP_PhoneGainMinus12dB;
2375 break; 2375 break;
2376 default: 2376 default:
2377 return -1; 2377 return -1;
2378 2378
@@ -2384,7 +2384,7 @@ static int hdsp_set_phone_gain(struct hdsp *hdsp, int mode)
2384static int snd_hdsp_info_phone_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 2384static int snd_hdsp_info_phone_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
2385{ 2385{
2386 static char *texts[] = {"0 dB", "-6 dB", "-12 dB"}; 2386 static char *texts[] = {"0 dB", "-6 dB", "-12 dB"};
2387 2387
2388 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 2388 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2389 uinfo->count = 1; 2389 uinfo->count = 1;
2390 uinfo->value.enumerated.items = 3; 2390 uinfo->value.enumerated.items = 3;
@@ -2397,7 +2397,7 @@ static int snd_hdsp_info_phone_gain(struct snd_kcontrol *kcontrol, struct snd_ct
2397static int snd_hdsp_get_phone_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 2397static int snd_hdsp_get_phone_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
2398{ 2398{
2399 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 2399 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
2400 2400
2401 ucontrol->value.enumerated.item[0] = hdsp_phone_gain(hdsp); 2401 ucontrol->value.enumerated.item[0] = hdsp_phone_gain(hdsp);
2402 return 0; 2402 return 0;
2403} 2403}
@@ -2407,7 +2407,7 @@ static int snd_hdsp_put_phone_gain(struct snd_kcontrol *kcontrol, struct snd_ctl
2407 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 2407 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
2408 int change; 2408 int change;
2409 int val; 2409 int val;
2410 2410
2411 if (!snd_hdsp_use_is_exclusive(hdsp)) 2411 if (!snd_hdsp_use_is_exclusive(hdsp))
2412 return -EBUSY; 2412 return -EBUSY;
2413 val = ucontrol->value.enumerated.item[0]; 2413 val = ucontrol->value.enumerated.item[0];
@@ -2453,7 +2453,7 @@ static int hdsp_set_xlr_breakout_cable(struct hdsp *hdsp, int mode)
2453static int snd_hdsp_get_xlr_breakout_cable(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 2453static int snd_hdsp_get_xlr_breakout_cable(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
2454{ 2454{
2455 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 2455 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
2456 2456
2457 ucontrol->value.enumerated.item[0] = hdsp_xlr_breakout_cable(hdsp); 2457 ucontrol->value.enumerated.item[0] = hdsp_xlr_breakout_cable(hdsp);
2458 return 0; 2458 return 0;
2459} 2459}
@@ -2463,7 +2463,7 @@ static int snd_hdsp_put_xlr_breakout_cable(struct snd_kcontrol *kcontrol, struct
2463 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 2463 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
2464 int change; 2464 int change;
2465 int val; 2465 int val;
2466 2466
2467 if (!snd_hdsp_use_is_exclusive(hdsp)) 2467 if (!snd_hdsp_use_is_exclusive(hdsp))
2468 return -EBUSY; 2468 return -EBUSY;
2469 val = ucontrol->value.integer.value[0] & 1; 2469 val = ucontrol->value.integer.value[0] & 1;
@@ -2509,7 +2509,7 @@ static int hdsp_set_aeb(struct hdsp *hdsp, int mode)
2509static int snd_hdsp_get_aeb(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 2509static int snd_hdsp_get_aeb(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
2510{ 2510{
2511 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 2511 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
2512 2512
2513 ucontrol->value.enumerated.item[0] = hdsp_aeb(hdsp); 2513 ucontrol->value.enumerated.item[0] = hdsp_aeb(hdsp);
2514 return 0; 2514 return 0;
2515} 2515}
@@ -2519,7 +2519,7 @@ static int snd_hdsp_put_aeb(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v
2519 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 2519 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
2520 int change; 2520 int change;
2521 int val; 2521 int val;
2522 2522
2523 if (!snd_hdsp_use_is_exclusive(hdsp)) 2523 if (!snd_hdsp_use_is_exclusive(hdsp))
2524 return -EBUSY; 2524 return -EBUSY;
2525 val = ucontrol->value.integer.value[0] & 1; 2525 val = ucontrol->value.integer.value[0] & 1;
@@ -2597,7 +2597,7 @@ static int snd_hdsp_info_pref_sync_ref(struct snd_kcontrol *kcontrol, struct snd
2597{ 2597{
2598 static char *texts[] = {"Word", "IEC958", "ADAT1", "ADAT Sync", "ADAT2", "ADAT3" }; 2598 static char *texts[] = {"Word", "IEC958", "ADAT1", "ADAT Sync", "ADAT2", "ADAT3" };
2599 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 2599 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
2600 2600
2601 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 2601 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2602 uinfo->count = 1; 2602 uinfo->count = 1;
2603 2603
@@ -2616,7 +2616,7 @@ static int snd_hdsp_info_pref_sync_ref(struct snd_kcontrol *kcontrol, struct snd
2616 uinfo->value.enumerated.items = 0; 2616 uinfo->value.enumerated.items = 0;
2617 break; 2617 break;
2618 } 2618 }
2619 2619
2620 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) 2620 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
2621 uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; 2621 uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
2622 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); 2622 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
@@ -2626,7 +2626,7 @@ static int snd_hdsp_info_pref_sync_ref(struct snd_kcontrol *kcontrol, struct snd
2626static int snd_hdsp_get_pref_sync_ref(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 2626static int snd_hdsp_get_pref_sync_ref(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
2627{ 2627{
2628 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 2628 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
2629 2629
2630 ucontrol->value.enumerated.item[0] = hdsp_pref_sync_ref(hdsp); 2630 ucontrol->value.enumerated.item[0] = hdsp_pref_sync_ref(hdsp);
2631 return 0; 2631 return 0;
2632} 2632}
@@ -2636,7 +2636,7 @@ static int snd_hdsp_put_pref_sync_ref(struct snd_kcontrol *kcontrol, struct snd_
2636 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 2636 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
2637 int change, max; 2637 int change, max;
2638 unsigned int val; 2638 unsigned int val;
2639 2639
2640 if (!snd_hdsp_use_is_exclusive(hdsp)) 2640 if (!snd_hdsp_use_is_exclusive(hdsp))
2641 return -EBUSY; 2641 return -EBUSY;
2642 2642
@@ -2685,7 +2685,7 @@ static int hdsp_autosync_ref(struct hdsp *hdsp)
2685 case HDSP_SelSyncRef_SPDIF: 2685 case HDSP_SelSyncRef_SPDIF:
2686 return HDSP_AUTOSYNC_FROM_SPDIF; 2686 return HDSP_AUTOSYNC_FROM_SPDIF;
2687 case HDSP_SelSyncRefMask: 2687 case HDSP_SelSyncRefMask:
2688 return HDSP_AUTOSYNC_FROM_NONE; 2688 return HDSP_AUTOSYNC_FROM_NONE;
2689 case HDSP_SelSyncRef_ADAT1: 2689 case HDSP_SelSyncRef_ADAT1:
2690 return HDSP_AUTOSYNC_FROM_ADAT1; 2690 return HDSP_AUTOSYNC_FROM_ADAT1;
2691 case HDSP_SelSyncRef_ADAT2: 2691 case HDSP_SelSyncRef_ADAT2:
@@ -2701,7 +2701,7 @@ static int hdsp_autosync_ref(struct hdsp *hdsp)
2701static int snd_hdsp_info_autosync_ref(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 2701static int snd_hdsp_info_autosync_ref(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
2702{ 2702{
2703 static char *texts[] = {"Word", "ADAT Sync", "IEC958", "None", "ADAT1", "ADAT2", "ADAT3" }; 2703 static char *texts[] = {"Word", "ADAT Sync", "IEC958", "None", "ADAT1", "ADAT2", "ADAT3" };
2704 2704
2705 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 2705 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2706 uinfo->count = 1; 2706 uinfo->count = 1;
2707 uinfo->value.enumerated.items = 7; 2707 uinfo->value.enumerated.items = 7;
@@ -2714,7 +2714,7 @@ static int snd_hdsp_info_autosync_ref(struct snd_kcontrol *kcontrol, struct snd_
2714static int snd_hdsp_get_autosync_ref(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 2714static int snd_hdsp_get_autosync_ref(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
2715{ 2715{
2716 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 2716 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
2717 2717
2718 ucontrol->value.enumerated.item[0] = hdsp_autosync_ref(hdsp); 2718 ucontrol->value.enumerated.item[0] = hdsp_autosync_ref(hdsp);
2719 return 0; 2719 return 0;
2720} 2720}
@@ -2748,7 +2748,7 @@ static int hdsp_set_line_output(struct hdsp *hdsp, int out)
2748static int snd_hdsp_get_line_out(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 2748static int snd_hdsp_get_line_out(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
2749{ 2749{
2750 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 2750 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
2751 2751
2752 spin_lock_irq(&hdsp->lock); 2752 spin_lock_irq(&hdsp->lock);
2753 ucontrol->value.integer.value[0] = hdsp_line_out(hdsp); 2753 ucontrol->value.integer.value[0] = hdsp_line_out(hdsp);
2754 spin_unlock_irq(&hdsp->lock); 2754 spin_unlock_irq(&hdsp->lock);
@@ -2760,7 +2760,7 @@ static int snd_hdsp_put_line_out(struct snd_kcontrol *kcontrol, struct snd_ctl_e
2760 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 2760 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
2761 int change; 2761 int change;
2762 unsigned int val; 2762 unsigned int val;
2763 2763
2764 if (!snd_hdsp_use_is_exclusive(hdsp)) 2764 if (!snd_hdsp_use_is_exclusive(hdsp))
2765 return -EBUSY; 2765 return -EBUSY;
2766 val = ucontrol->value.integer.value[0] & 1; 2766 val = ucontrol->value.integer.value[0] & 1;
@@ -2794,7 +2794,7 @@ static int hdsp_set_precise_pointer(struct hdsp *hdsp, int precise)
2794static int snd_hdsp_get_precise_pointer(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 2794static int snd_hdsp_get_precise_pointer(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
2795{ 2795{
2796 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 2796 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
2797 2797
2798 spin_lock_irq(&hdsp->lock); 2798 spin_lock_irq(&hdsp->lock);
2799 ucontrol->value.integer.value[0] = hdsp->precise_ptr; 2799 ucontrol->value.integer.value[0] = hdsp->precise_ptr;
2800 spin_unlock_irq(&hdsp->lock); 2800 spin_unlock_irq(&hdsp->lock);
@@ -2806,7 +2806,7 @@ static int snd_hdsp_put_precise_pointer(struct snd_kcontrol *kcontrol, struct sn
2806 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 2806 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
2807 int change; 2807 int change;
2808 unsigned int val; 2808 unsigned int val;
2809 2809
2810 if (!snd_hdsp_use_is_exclusive(hdsp)) 2810 if (!snd_hdsp_use_is_exclusive(hdsp))
2811 return -EBUSY; 2811 return -EBUSY;
2812 val = ucontrol->value.integer.value[0] & 1; 2812 val = ucontrol->value.integer.value[0] & 1;
@@ -2840,7 +2840,7 @@ static int hdsp_set_use_midi_tasklet(struct hdsp *hdsp, int use_tasklet)
2840static int snd_hdsp_get_use_midi_tasklet(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 2840static int snd_hdsp_get_use_midi_tasklet(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
2841{ 2841{
2842 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 2842 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
2843 2843
2844 spin_lock_irq(&hdsp->lock); 2844 spin_lock_irq(&hdsp->lock);
2845 ucontrol->value.integer.value[0] = hdsp->use_midi_tasklet; 2845 ucontrol->value.integer.value[0] = hdsp->use_midi_tasklet;
2846 spin_unlock_irq(&hdsp->lock); 2846 spin_unlock_irq(&hdsp->lock);
@@ -2852,7 +2852,7 @@ static int snd_hdsp_put_use_midi_tasklet(struct snd_kcontrol *kcontrol, struct s
2852 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 2852 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
2853 int change; 2853 int change;
2854 unsigned int val; 2854 unsigned int val;
2855 2855
2856 if (!snd_hdsp_use_is_exclusive(hdsp)) 2856 if (!snd_hdsp_use_is_exclusive(hdsp))
2857 return -EBUSY; 2857 return -EBUSY;
2858 val = ucontrol->value.integer.value[0] & 1; 2858 val = ucontrol->value.integer.value[0] & 1;
@@ -2894,12 +2894,12 @@ static int snd_hdsp_get_mixer(struct snd_kcontrol *kcontrol, struct snd_ctl_elem
2894 2894
2895 source = ucontrol->value.integer.value[0]; 2895 source = ucontrol->value.integer.value[0];
2896 destination = ucontrol->value.integer.value[1]; 2896 destination = ucontrol->value.integer.value[1];
2897 2897
2898 if (source >= hdsp->max_channels) 2898 if (source >= hdsp->max_channels)
2899 addr = hdsp_playback_to_output_key(hdsp,source-hdsp->max_channels,destination); 2899 addr = hdsp_playback_to_output_key(hdsp,source-hdsp->max_channels,destination);
2900 else 2900 else
2901 addr = hdsp_input_to_output_key(hdsp,source, destination); 2901 addr = hdsp_input_to_output_key(hdsp,source, destination);
2902 2902
2903 spin_lock_irq(&hdsp->lock); 2903 spin_lock_irq(&hdsp->lock);
2904 ucontrol->value.integer.value[2] = hdsp_read_gain (hdsp, addr); 2904 ucontrol->value.integer.value[2] = hdsp_read_gain (hdsp, addr);
2905 spin_unlock_irq(&hdsp->lock); 2905 spin_unlock_irq(&hdsp->lock);
@@ -2947,7 +2947,7 @@ static int snd_hdsp_put_mixer(struct snd_kcontrol *kcontrol, struct snd_ctl_elem
2947 2947
2948static int snd_hdsp_info_sync_check(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 2948static int snd_hdsp_info_sync_check(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
2949{ 2949{
2950 static char *texts[] = {"No Lock", "Lock", "Sync" }; 2950 static char *texts[] = {"No Lock", "Lock", "Sync" };
2951 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 2951 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2952 uinfo->count = 1; 2952 uinfo->count = 1;
2953 uinfo->value.enumerated.items = 3; 2953 uinfo->value.enumerated.items = 3;
@@ -2992,7 +2992,7 @@ static int hdsp_spdif_sync_check(struct hdsp *hdsp)
2992 int status = hdsp_read(hdsp, HDSP_statusRegister); 2992 int status = hdsp_read(hdsp, HDSP_statusRegister);
2993 if (status & HDSP_SPDIFErrorFlag) 2993 if (status & HDSP_SPDIFErrorFlag)
2994 return 0; 2994 return 0;
2995 else { 2995 else {
2996 if (status & HDSP_SPDIFSync) 2996 if (status & HDSP_SPDIFSync)
2997 return 2; 2997 return 2;
2998 else 2998 else
@@ -3028,7 +3028,7 @@ static int hdsp_adatsync_sync_check(struct hdsp *hdsp)
3028 return 1; 3028 return 1;
3029 } else 3029 } else
3030 return 0; 3030 return 0;
3031} 3031}
3032 3032
3033static int snd_hdsp_get_adatsync_sync_check(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 3033static int snd_hdsp_get_adatsync_sync_check(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
3034{ 3034{
@@ -3046,17 +3046,17 @@ static int snd_hdsp_get_adatsync_sync_check(struct snd_kcontrol *kcontrol, struc
3046} 3046}
3047 3047
3048static int hdsp_adat_sync_check(struct hdsp *hdsp, int idx) 3048static int hdsp_adat_sync_check(struct hdsp *hdsp, int idx)
3049{ 3049{
3050 int status = hdsp_read(hdsp, HDSP_statusRegister); 3050 int status = hdsp_read(hdsp, HDSP_statusRegister);
3051 3051
3052 if (status & (HDSP_Lock0>>idx)) { 3052 if (status & (HDSP_Lock0>>idx)) {
3053 if (status & (HDSP_Sync0>>idx)) 3053 if (status & (HDSP_Sync0>>idx))
3054 return 2; 3054 return 2;
3055 else 3055 else
3056 return 1; 3056 return 1;
3057 } else 3057 } else
3058 return 0; 3058 return 0;
3059} 3059}
3060 3060
3061static int snd_hdsp_get_adat_sync_check(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 3061static int snd_hdsp_get_adat_sync_check(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
3062{ 3062{
@@ -3074,7 +3074,7 @@ static int snd_hdsp_get_adat_sync_check(struct snd_kcontrol *kcontrol, struct sn
3074 break; 3074 break;
3075 case Multiface: 3075 case Multiface:
3076 case H9632: 3076 case H9632:
3077 if (offset >= 1) 3077 if (offset >= 1)
3078 return -EINVAL; 3078 return -EINVAL;
3079 break; 3079 break;
3080 default: 3080 default:
@@ -3136,7 +3136,7 @@ static int snd_hdsp_info_dds_offset(struct snd_kcontrol *kcontrol, struct snd_ct
3136static int snd_hdsp_get_dds_offset(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 3136static int snd_hdsp_get_dds_offset(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
3137{ 3137{
3138 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 3138 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
3139 3139
3140 ucontrol->value.enumerated.item[0] = hdsp_dds_offset(hdsp); 3140 ucontrol->value.enumerated.item[0] = hdsp_dds_offset(hdsp);
3141 return 0; 3141 return 0;
3142} 3142}
@@ -3146,7 +3146,7 @@ static int snd_hdsp_put_dds_offset(struct snd_kcontrol *kcontrol, struct snd_ctl
3146 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 3146 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol);
3147 int change; 3147 int change;
3148 int val; 3148 int val;
3149 3149
3150 if (!snd_hdsp_use_is_exclusive(hdsp)) 3150 if (!snd_hdsp_use_is_exclusive(hdsp))
3151 return -EBUSY; 3151 return -EBUSY;
3152 val = ucontrol->value.enumerated.item[0]; 3152 val = ucontrol->value.enumerated.item[0];
@@ -3191,7 +3191,7 @@ static struct snd_kcontrol_new snd_hdsp_controls[] = {
3191 .get = snd_hdsp_control_spdif_mask_get, 3191 .get = snd_hdsp_control_spdif_mask_get,
3192 .private_value = IEC958_AES0_NONAUDIO | 3192 .private_value = IEC958_AES0_NONAUDIO |
3193 IEC958_AES0_PROFESSIONAL | 3193 IEC958_AES0_PROFESSIONAL |
3194 IEC958_AES0_CON_EMPHASIS, 3194 IEC958_AES0_CON_EMPHASIS,
3195}, 3195},
3196{ 3196{
3197 .access = SNDRV_CTL_ELEM_ACCESS_READ, 3197 .access = SNDRV_CTL_ELEM_ACCESS_READ,
@@ -3209,7 +3209,7 @@ HDSP_SPDIF_OUT("IEC958 Output also on ADAT1", 0),
3209HDSP_SPDIF_PROFESSIONAL("IEC958 Professional Bit", 0), 3209HDSP_SPDIF_PROFESSIONAL("IEC958 Professional Bit", 0),
3210HDSP_SPDIF_EMPHASIS("IEC958 Emphasis Bit", 0), 3210HDSP_SPDIF_EMPHASIS("IEC958 Emphasis Bit", 0),
3211HDSP_SPDIF_NON_AUDIO("IEC958 Non-audio Bit", 0), 3211HDSP_SPDIF_NON_AUDIO("IEC958 Non-audio Bit", 0),
3212/* 'Sample Clock Source' complies with the alsa control naming scheme */ 3212/* 'Sample Clock Source' complies with the alsa control naming scheme */
3213HDSP_CLOCK_SOURCE("Sample Clock Source", 0), 3213HDSP_CLOCK_SOURCE("Sample Clock Source", 0),
3214{ 3214{
3215 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 3215 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -3261,7 +3261,7 @@ static int snd_hdsp_create_controls(struct snd_card *card, struct hdsp *hdsp)
3261 return err; 3261 return err;
3262 } 3262 }
3263 } 3263 }
3264 3264
3265 /* DA, AD and Phone gain and XLR breakout cable controls for H9632 cards */ 3265 /* DA, AD and Phone gain and XLR breakout cable controls for H9632 cards */
3266 if (hdsp->io_type == H9632) { 3266 if (hdsp->io_type == H9632) {
3267 for (idx = 0; idx < ARRAY_SIZE(snd_hdsp_9632_controls); idx++) { 3267 for (idx = 0; idx < ARRAY_SIZE(snd_hdsp_9632_controls); idx++) {
@@ -3280,7 +3280,7 @@ static int snd_hdsp_create_controls(struct snd_card *card, struct hdsp *hdsp)
3280} 3280}
3281 3281
3282/*------------------------------------------------------------ 3282/*------------------------------------------------------------
3283 /proc interface 3283 /proc interface
3284 ------------------------------------------------------------*/ 3284 ------------------------------------------------------------*/
3285 3285
3286static void 3286static void
@@ -3319,7 +3319,7 @@ snd_hdsp_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
3319 } 3319 }
3320 } 3320 }
3321 } 3321 }
3322 3322
3323 status = hdsp_read(hdsp, HDSP_statusRegister); 3323 status = hdsp_read(hdsp, HDSP_statusRegister);
3324 status2 = hdsp_read(hdsp, HDSP_status2Register); 3324 status2 = hdsp_read(hdsp, HDSP_status2Register);
3325 3325
@@ -3383,17 +3383,17 @@ snd_hdsp_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
3383 break; 3383 break;
3384 case HDSP_CLOCK_SOURCE_INTERNAL_192KHZ: 3384 case HDSP_CLOCK_SOURCE_INTERNAL_192KHZ:
3385 clock_source = "Internal 192 kHz"; 3385 clock_source = "Internal 192 kHz";
3386 break; 3386 break;
3387 default: 3387 default:
3388 clock_source = "Error"; 3388 clock_source = "Error";
3389 } 3389 }
3390 snd_iprintf (buffer, "Sample Clock Source: %s\n", clock_source); 3390 snd_iprintf (buffer, "Sample Clock Source: %s\n", clock_source);
3391 3391
3392 if (hdsp_system_clock_mode(hdsp)) 3392 if (hdsp_system_clock_mode(hdsp))
3393 system_clock_mode = "Slave"; 3393 system_clock_mode = "Slave";
3394 else 3394 else
3395 system_clock_mode = "Master"; 3395 system_clock_mode = "Master";
3396 3396
3397 switch (hdsp_pref_sync_ref (hdsp)) { 3397 switch (hdsp_pref_sync_ref (hdsp)) {
3398 case HDSP_SYNC_FROM_WORD: 3398 case HDSP_SYNC_FROM_WORD:
3399 pref_sync_ref = "Word Clock"; 3399 pref_sync_ref = "Word Clock";
@@ -3418,7 +3418,7 @@ snd_hdsp_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
3418 break; 3418 break;
3419 } 3419 }
3420 snd_iprintf (buffer, "Preferred Sync Reference: %s\n", pref_sync_ref); 3420 snd_iprintf (buffer, "Preferred Sync Reference: %s\n", pref_sync_ref);
3421 3421
3422 switch (hdsp_autosync_ref (hdsp)) { 3422 switch (hdsp_autosync_ref (hdsp)) {
3423 case HDSP_AUTOSYNC_FROM_WORD: 3423 case HDSP_AUTOSYNC_FROM_WORD:
3424 autosync_ref = "Word Clock"; 3424 autosync_ref = "Word Clock";
@@ -3431,7 +3431,7 @@ snd_hdsp_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
3431 break; 3431 break;
3432 case HDSP_AUTOSYNC_FROM_NONE: 3432 case HDSP_AUTOSYNC_FROM_NONE:
3433 autosync_ref = "None"; 3433 autosync_ref = "None";
3434 break; 3434 break;
3435 case HDSP_AUTOSYNC_FROM_ADAT1: 3435 case HDSP_AUTOSYNC_FROM_ADAT1:
3436 autosync_ref = "ADAT1"; 3436 autosync_ref = "ADAT1";
3437 break; 3437 break;
@@ -3446,14 +3446,14 @@ snd_hdsp_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
3446 break; 3446 break;
3447 } 3447 }
3448 snd_iprintf (buffer, "AutoSync Reference: %s\n", autosync_ref); 3448 snd_iprintf (buffer, "AutoSync Reference: %s\n", autosync_ref);
3449 3449
3450 snd_iprintf (buffer, "AutoSync Frequency: %d\n", hdsp_external_sample_rate(hdsp)); 3450 snd_iprintf (buffer, "AutoSync Frequency: %d\n", hdsp_external_sample_rate(hdsp));
3451 3451
3452 snd_iprintf (buffer, "System Clock Mode: %s\n", system_clock_mode); 3452 snd_iprintf (buffer, "System Clock Mode: %s\n", system_clock_mode);
3453 3453
3454 snd_iprintf (buffer, "System Clock Frequency: %d\n", hdsp->system_sample_rate); 3454 snd_iprintf (buffer, "System Clock Frequency: %d\n", hdsp->system_sample_rate);
3455 snd_iprintf (buffer, "System Clock Locked: %s\n", hdsp->clock_source_locked ? "Yes" : "No"); 3455 snd_iprintf (buffer, "System Clock Locked: %s\n", hdsp->clock_source_locked ? "Yes" : "No");
3456 3456
3457 snd_iprintf(buffer, "\n"); 3457 snd_iprintf(buffer, "\n");
3458 3458
3459 switch (hdsp_spdif_in(hdsp)) { 3459 switch (hdsp_spdif_in(hdsp)) {
@@ -3473,7 +3473,7 @@ snd_hdsp_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
3473 snd_iprintf(buffer, "IEC958 input: ???\n"); 3473 snd_iprintf(buffer, "IEC958 input: ???\n");
3474 break; 3474 break;
3475 } 3475 }
3476 3476
3477 if (hdsp->control_register & HDSP_SPDIFOpticalOut) 3477 if (hdsp->control_register & HDSP_SPDIFOpticalOut)
3478 snd_iprintf(buffer, "IEC958 output: Coaxial & ADAT1\n"); 3478 snd_iprintf(buffer, "IEC958 output: Coaxial & ADAT1\n");
3479 else 3479 else
@@ -3531,13 +3531,13 @@ snd_hdsp_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
3531 snd_iprintf (buffer, "SPDIF: No Lock\n"); 3531 snd_iprintf (buffer, "SPDIF: No Lock\n");
3532 else 3532 else
3533 snd_iprintf (buffer, "SPDIF: %s\n", x ? "Sync" : "Lock"); 3533 snd_iprintf (buffer, "SPDIF: %s\n", x ? "Sync" : "Lock");
3534 3534
3535 x = status2 & HDSP_wc_sync; 3535 x = status2 & HDSP_wc_sync;
3536 if (status2 & HDSP_wc_lock) 3536 if (status2 & HDSP_wc_lock)
3537 snd_iprintf (buffer, "Word Clock: %s\n", x ? "Sync" : "Lock"); 3537 snd_iprintf (buffer, "Word Clock: %s\n", x ? "Sync" : "Lock");
3538 else 3538 else
3539 snd_iprintf (buffer, "Word Clock: No Lock\n"); 3539 snd_iprintf (buffer, "Word Clock: No Lock\n");
3540 3540
3541 x = status & HDSP_TimecodeSync; 3541 x = status & HDSP_TimecodeSync;
3542 if (status & HDSP_TimecodeLock) 3542 if (status & HDSP_TimecodeLock)
3543 snd_iprintf(buffer, "ADAT Sync: %s\n", x ? "Sync" : "Lock"); 3543 snd_iprintf(buffer, "ADAT Sync: %s\n", x ? "Sync" : "Lock");
@@ -3545,11 +3545,11 @@ snd_hdsp_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
3545 snd_iprintf(buffer, "ADAT Sync: No Lock\n"); 3545 snd_iprintf(buffer, "ADAT Sync: No Lock\n");
3546 3546
3547 snd_iprintf(buffer, "\n"); 3547 snd_iprintf(buffer, "\n");
3548 3548
3549 /* Informations about H9632 specific controls */ 3549 /* Informations about H9632 specific controls */
3550 if (hdsp->io_type == H9632) { 3550 if (hdsp->io_type == H9632) {
3551 char *tmp; 3551 char *tmp;
3552 3552
3553 switch (hdsp_ad_gain(hdsp)) { 3553 switch (hdsp_ad_gain(hdsp)) {
3554 case 0: 3554 case 0:
3555 tmp = "-10 dBV"; 3555 tmp = "-10 dBV";
@@ -3575,7 +3575,7 @@ snd_hdsp_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
3575 break; 3575 break;
3576 } 3576 }
3577 snd_iprintf(buffer, "DA Gain : %s\n", tmp); 3577 snd_iprintf(buffer, "DA Gain : %s\n", tmp);
3578 3578
3579 switch (hdsp_phone_gain(hdsp)) { 3579 switch (hdsp_phone_gain(hdsp)) {
3580 case 0: 3580 case 0:
3581 tmp = "0 dB"; 3581 tmp = "0 dB";
@@ -3589,8 +3589,8 @@ snd_hdsp_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
3589 } 3589 }
3590 snd_iprintf(buffer, "Phones Gain : %s\n", tmp); 3590 snd_iprintf(buffer, "Phones Gain : %s\n", tmp);
3591 3591
3592 snd_iprintf(buffer, "XLR Breakout Cable : %s\n", hdsp_xlr_breakout_cable(hdsp) ? "yes" : "no"); 3592 snd_iprintf(buffer, "XLR Breakout Cable : %s\n", hdsp_xlr_breakout_cable(hdsp) ? "yes" : "no");
3593 3593
3594 if (hdsp->control_register & HDSP_AnalogExtensionBoard) 3594 if (hdsp->control_register & HDSP_AnalogExtensionBoard)
3595 snd_iprintf(buffer, "AEB : on (ADAT1 internal)\n"); 3595 snd_iprintf(buffer, "AEB : on (ADAT1 internal)\n");
3596 else 3596 else
@@ -3653,18 +3653,18 @@ static int snd_hdsp_set_defaults(struct hdsp *hdsp)
3653 3653
3654 /* set defaults: 3654 /* set defaults:
3655 3655
3656 SPDIF Input via Coax 3656 SPDIF Input via Coax
3657 Master clock mode 3657 Master clock mode
3658 maximum latency (7 => 2^7 = 8192 samples, 64Kbyte buffer, 3658 maximum latency (7 => 2^7 = 8192 samples, 64Kbyte buffer,
3659 which implies 2 4096 sample, 32Kbyte periods). 3659 which implies 2 4096 sample, 32Kbyte periods).
3660 Enable line out. 3660 Enable line out.
3661 */ 3661 */
3662 3662
3663 hdsp->control_register = HDSP_ClockModeMaster | 3663 hdsp->control_register = HDSP_ClockModeMaster |
3664 HDSP_SPDIFInputCoaxial | 3664 HDSP_SPDIFInputCoaxial |
3665 hdsp_encode_latency(7) | 3665 hdsp_encode_latency(7) |
3666 HDSP_LineOut; 3666 HDSP_LineOut;
3667 3667
3668 3668
3669 hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register); 3669 hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register);
3670 3670
@@ -3682,7 +3682,7 @@ static int snd_hdsp_set_defaults(struct hdsp *hdsp)
3682 hdsp_compute_period_size(hdsp); 3682 hdsp_compute_period_size(hdsp);
3683 3683
3684 /* silence everything */ 3684 /* silence everything */
3685 3685
3686 for (i = 0; i < HDSP_MATRIX_MIXER_SIZE; ++i) 3686 for (i = 0; i < HDSP_MATRIX_MIXER_SIZE; ++i)
3687 hdsp->mixer_matrix[i] = MINUS_INFINITY_GAIN; 3687 hdsp->mixer_matrix[i] = MINUS_INFINITY_GAIN;
3688 3688
@@ -3690,7 +3690,7 @@ static int snd_hdsp_set_defaults(struct hdsp *hdsp)
3690 if (hdsp_write_gain (hdsp, i, MINUS_INFINITY_GAIN)) 3690 if (hdsp_write_gain (hdsp, i, MINUS_INFINITY_GAIN))
3691 return -EIO; 3691 return -EIO;
3692 } 3692 }
3693 3693
3694 /* H9632 specific defaults */ 3694 /* H9632 specific defaults */
3695 if (hdsp->io_type == H9632) { 3695 if (hdsp->io_type == H9632) {
3696 hdsp->control_register |= (HDSP_DAGainPlus4dBu | HDSP_ADGainPlus4dBu | HDSP_PhoneGain0dB); 3696 hdsp->control_register |= (HDSP_DAGainPlus4dBu | HDSP_ADGainPlus4dBu | HDSP_PhoneGain0dB);
@@ -3708,12 +3708,12 @@ static int snd_hdsp_set_defaults(struct hdsp *hdsp)
3708static void hdsp_midi_tasklet(unsigned long arg) 3708static void hdsp_midi_tasklet(unsigned long arg)
3709{ 3709{
3710 struct hdsp *hdsp = (struct hdsp *)arg; 3710 struct hdsp *hdsp = (struct hdsp *)arg;
3711 3711
3712 if (hdsp->midi[0].pending) 3712 if (hdsp->midi[0].pending)
3713 snd_hdsp_midi_input_read (&hdsp->midi[0]); 3713 snd_hdsp_midi_input_read (&hdsp->midi[0]);
3714 if (hdsp->midi[1].pending) 3714 if (hdsp->midi[1].pending)
3715 snd_hdsp_midi_input_read (&hdsp->midi[1]); 3715 snd_hdsp_midi_input_read (&hdsp->midi[1]);
3716} 3716}
3717 3717
3718static irqreturn_t snd_hdsp_interrupt(int irq, void *dev_id) 3718static irqreturn_t snd_hdsp_interrupt(int irq, void *dev_id)
3719{ 3719{
@@ -3725,7 +3725,7 @@ static irqreturn_t snd_hdsp_interrupt(int irq, void *dev_id)
3725 unsigned int midi0status; 3725 unsigned int midi0status;
3726 unsigned int midi1status; 3726 unsigned int midi1status;
3727 int schedule = 0; 3727 int schedule = 0;
3728 3728
3729 status = hdsp_read(hdsp, HDSP_statusRegister); 3729 status = hdsp_read(hdsp, HDSP_statusRegister);
3730 3730
3731 audio = status & HDSP_audioIRQPending; 3731 audio = status & HDSP_audioIRQPending;
@@ -3739,15 +3739,15 @@ static irqreturn_t snd_hdsp_interrupt(int irq, void *dev_id)
3739 3739
3740 midi0status = hdsp_read (hdsp, HDSP_midiStatusIn0) & 0xff; 3740 midi0status = hdsp_read (hdsp, HDSP_midiStatusIn0) & 0xff;
3741 midi1status = hdsp_read (hdsp, HDSP_midiStatusIn1) & 0xff; 3741 midi1status = hdsp_read (hdsp, HDSP_midiStatusIn1) & 0xff;
3742 3742
3743 if (audio) { 3743 if (audio) {
3744 if (hdsp->capture_substream) 3744 if (hdsp->capture_substream)
3745 snd_pcm_period_elapsed(hdsp->pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream); 3745 snd_pcm_period_elapsed(hdsp->pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream);
3746 3746
3747 if (hdsp->playback_substream) 3747 if (hdsp->playback_substream)
3748 snd_pcm_period_elapsed(hdsp->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream); 3748 snd_pcm_period_elapsed(hdsp->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream);
3749 } 3749 }
3750 3750
3751 if (midi0 && midi0status) { 3751 if (midi0 && midi0status) {
3752 if (hdsp->use_midi_tasklet) { 3752 if (hdsp->use_midi_tasklet) {
3753 /* we disable interrupts for this input until processing is done */ 3753 /* we disable interrupts for this input until processing is done */
@@ -3790,10 +3790,10 @@ static char *hdsp_channel_buffer_location(struct hdsp *hdsp,
3790 3790
3791 if (snd_BUG_ON(channel < 0 || channel >= hdsp->max_channels)) 3791 if (snd_BUG_ON(channel < 0 || channel >= hdsp->max_channels))
3792 return NULL; 3792 return NULL;
3793 3793
3794 if ((mapped_channel = hdsp->channel_map[channel]) < 0) 3794 if ((mapped_channel = hdsp->channel_map[channel]) < 0)
3795 return NULL; 3795 return NULL;
3796 3796
3797 if (stream == SNDRV_PCM_STREAM_CAPTURE) 3797 if (stream == SNDRV_PCM_STREAM_CAPTURE)
3798 return hdsp->capture_buffer + (mapped_channel * HDSP_CHANNEL_BUFFER_BYTES); 3798 return hdsp->capture_buffer + (mapped_channel * HDSP_CHANNEL_BUFFER_BYTES);
3799 else 3799 else
@@ -3986,7 +3986,7 @@ static int snd_hdsp_trigger(struct snd_pcm_substream *substream, int cmd)
3986 struct hdsp *hdsp = snd_pcm_substream_chip(substream); 3986 struct hdsp *hdsp = snd_pcm_substream_chip(substream);
3987 struct snd_pcm_substream *other; 3987 struct snd_pcm_substream *other;
3988 int running; 3988 int running;
3989 3989
3990 if (hdsp_check_for_iobox (hdsp)) 3990 if (hdsp_check_for_iobox (hdsp))
3991 return -EIO; 3991 return -EIO;
3992 3992
@@ -4080,10 +4080,10 @@ static struct snd_pcm_hardware snd_hdsp_playback_subinfo =
4080 .formats = SNDRV_PCM_FMTBIT_S32_LE, 4080 .formats = SNDRV_PCM_FMTBIT_S32_LE,
4081#endif 4081#endif
4082 .rates = (SNDRV_PCM_RATE_32000 | 4082 .rates = (SNDRV_PCM_RATE_32000 |
4083 SNDRV_PCM_RATE_44100 | 4083 SNDRV_PCM_RATE_44100 |
4084 SNDRV_PCM_RATE_48000 | 4084 SNDRV_PCM_RATE_48000 |
4085 SNDRV_PCM_RATE_64000 | 4085 SNDRV_PCM_RATE_64000 |
4086 SNDRV_PCM_RATE_88200 | 4086 SNDRV_PCM_RATE_88200 |
4087 SNDRV_PCM_RATE_96000), 4087 SNDRV_PCM_RATE_96000),
4088 .rate_min = 32000, 4088 .rate_min = 32000,
4089 .rate_max = 96000, 4089 .rate_max = 96000,
@@ -4109,10 +4109,10 @@ static struct snd_pcm_hardware snd_hdsp_capture_subinfo =
4109 .formats = SNDRV_PCM_FMTBIT_S32_LE, 4109 .formats = SNDRV_PCM_FMTBIT_S32_LE,
4110#endif 4110#endif
4111 .rates = (SNDRV_PCM_RATE_32000 | 4111 .rates = (SNDRV_PCM_RATE_32000 |
4112 SNDRV_PCM_RATE_44100 | 4112 SNDRV_PCM_RATE_44100 |
4113 SNDRV_PCM_RATE_48000 | 4113 SNDRV_PCM_RATE_48000 |
4114 SNDRV_PCM_RATE_64000 | 4114 SNDRV_PCM_RATE_64000 |
4115 SNDRV_PCM_RATE_88200 | 4115 SNDRV_PCM_RATE_88200 |
4116 SNDRV_PCM_RATE_96000), 4116 SNDRV_PCM_RATE_96000),
4117 .rate_min = 32000, 4117 .rate_min = 32000,
4118 .rate_max = 96000, 4118 .rate_max = 96000,
@@ -4191,7 +4191,7 @@ static int snd_hdsp_hw_rule_in_channels_rate(struct snd_pcm_hw_params *params,
4191 .max = hdsp->qs_in_channels, 4191 .max = hdsp->qs_in_channels,
4192 .integer = 1, 4192 .integer = 1,
4193 }; 4193 };
4194 return snd_interval_refine(c, &t); 4194 return snd_interval_refine(c, &t);
4195 } else if (r->min > 48000 && r->max <= 96000) { 4195 } else if (r->min > 48000 && r->max <= 96000) {
4196 struct snd_interval t = { 4196 struct snd_interval t = {
4197 .min = hdsp->ds_in_channels, 4197 .min = hdsp->ds_in_channels,
@@ -4222,7 +4222,7 @@ static int snd_hdsp_hw_rule_out_channels_rate(struct snd_pcm_hw_params *params,
4222 .max = hdsp->qs_out_channels, 4222 .max = hdsp->qs_out_channels,
4223 .integer = 1, 4223 .integer = 1,
4224 }; 4224 };
4225 return snd_interval_refine(c, &t); 4225 return snd_interval_refine(c, &t);
4226 } else if (r->min > 48000 && r->max <= 96000) { 4226 } else if (r->min > 48000 && r->max <= 96000) {
4227 struct snd_interval t = { 4227 struct snd_interval t = {
4228 .min = hdsp->ds_out_channels, 4228 .min = hdsp->ds_out_channels,
@@ -4339,8 +4339,8 @@ static int snd_hdsp_playback_open(struct snd_pcm_substream *substream)
4339 if (hdsp->io_type == H9632) { 4339 if (hdsp->io_type == H9632) {
4340 runtime->hw.channels_min = hdsp->qs_out_channels; 4340 runtime->hw.channels_min = hdsp->qs_out_channels;
4341 runtime->hw.channels_max = hdsp->ss_out_channels; 4341 runtime->hw.channels_max = hdsp->ss_out_channels;
4342 } 4342 }
4343 4343
4344 snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, 4344 snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS,
4345 snd_hdsp_hw_rule_out_channels, hdsp, 4345 snd_hdsp_hw_rule_out_channels, hdsp,
4346 SNDRV_PCM_HW_PARAM_CHANNELS, -1); 4346 SNDRV_PCM_HW_PARAM_CHANNELS, -1);
@@ -4550,7 +4550,7 @@ static int hdsp_get_peak(struct hdsp *hdsp, struct hdsp_peak_rms __user *peak_rm
4550 hdsp->iobase + HDSP_playbackRmsLevel + i * 8 + 4, 4550 hdsp->iobase + HDSP_playbackRmsLevel + i * 8 + 4,
4551 hdsp->iobase + HDSP_playbackRmsLevel + i * 8)) 4551 hdsp->iobase + HDSP_playbackRmsLevel + i * 8))
4552 return -EFAULT; 4552 return -EFAULT;
4553 if (copy_u64_le(&peak_rms->input_rms[i], 4553 if (copy_u64_le(&peak_rms->input_rms[i],
4554 hdsp->iobase + HDSP_inputRmsLevel + i * 8 + 4, 4554 hdsp->iobase + HDSP_inputRmsLevel + i * 8 + 4,
4555 hdsp->iobase + HDSP_inputRmsLevel + i * 8)) 4555 hdsp->iobase + HDSP_inputRmsLevel + i * 8))
4556 return -EFAULT; 4556 return -EFAULT;
@@ -4560,7 +4560,7 @@ static int hdsp_get_peak(struct hdsp *hdsp, struct hdsp_peak_rms __user *peak_rm
4560 4560
4561static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigned int cmd, unsigned long arg) 4561static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigned int cmd, unsigned long arg)
4562{ 4562{
4563 struct hdsp *hdsp = (struct hdsp *)hw->private_data; 4563 struct hdsp *hdsp = (struct hdsp *)hw->private_data;
4564 void __user *argp = (void __user *)arg; 4564 void __user *argp = (void __user *)arg;
4565 int err; 4565 int err;
4566 4566
@@ -4594,7 +4594,7 @@ static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigne
4594 struct hdsp_config_info info; 4594 struct hdsp_config_info info;
4595 unsigned long flags; 4595 unsigned long flags;
4596 int i; 4596 int i;
4597 4597
4598 err = hdsp_check_for_iobox(hdsp); 4598 err = hdsp_check_for_iobox(hdsp);
4599 if (err < 0) 4599 if (err < 0)
4600 return err; 4600 return err;
@@ -4628,7 +4628,7 @@ static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigne
4628 info.ad_gain = (unsigned char)hdsp_ad_gain(hdsp); 4628 info.ad_gain = (unsigned char)hdsp_ad_gain(hdsp);
4629 info.phone_gain = (unsigned char)hdsp_phone_gain(hdsp); 4629 info.phone_gain = (unsigned char)hdsp_phone_gain(hdsp);
4630 info.xlr_breakout_cable = (unsigned char)hdsp_xlr_breakout_cable(hdsp); 4630 info.xlr_breakout_cable = (unsigned char)hdsp_xlr_breakout_cable(hdsp);
4631 4631
4632 } 4632 }
4633 if (hdsp->io_type == H9632 || hdsp->io_type == H9652) 4633 if (hdsp->io_type == H9632 || hdsp->io_type == H9652)
4634 info.analog_extension_board = (unsigned char)hdsp_aeb(hdsp); 4634 info.analog_extension_board = (unsigned char)hdsp_aeb(hdsp);
@@ -4639,7 +4639,7 @@ static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigne
4639 } 4639 }
4640 case SNDRV_HDSP_IOCTL_GET_9632_AEB: { 4640 case SNDRV_HDSP_IOCTL_GET_9632_AEB: {
4641 struct hdsp_9632_aeb h9632_aeb; 4641 struct hdsp_9632_aeb h9632_aeb;
4642 4642
4643 if (hdsp->io_type != H9632) return -EINVAL; 4643 if (hdsp->io_type != H9632) return -EINVAL;
4644 h9632_aeb.aebi = hdsp->ss_in_channels - H9632_SS_CHANNELS; 4644 h9632_aeb.aebi = hdsp->ss_in_channels - H9632_SS_CHANNELS;
4645 h9632_aeb.aebo = hdsp->ss_out_channels - H9632_SS_CHANNELS; 4645 h9632_aeb.aebo = hdsp->ss_out_channels - H9632_SS_CHANNELS;
@@ -4650,7 +4650,7 @@ static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigne
4650 case SNDRV_HDSP_IOCTL_GET_VERSION: { 4650 case SNDRV_HDSP_IOCTL_GET_VERSION: {
4651 struct hdsp_version hdsp_version; 4651 struct hdsp_version hdsp_version;
4652 int err; 4652 int err;
4653 4653
4654 if (hdsp->io_type == H9652 || hdsp->io_type == H9632) return -EINVAL; 4654 if (hdsp->io_type == H9652 || hdsp->io_type == H9632) return -EINVAL;
4655 if (hdsp->io_type == Undefined) { 4655 if (hdsp->io_type == Undefined) {
4656 if ((err = hdsp_get_iobox_version(hdsp)) < 0) 4656 if ((err = hdsp_get_iobox_version(hdsp)) < 0)
@@ -4666,7 +4666,7 @@ static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigne
4666 struct hdsp_firmware __user *firmware; 4666 struct hdsp_firmware __user *firmware;
4667 u32 __user *firmware_data; 4667 u32 __user *firmware_data;
4668 int err; 4668 int err;
4669 4669
4670 if (hdsp->io_type == H9652 || hdsp->io_type == H9632) return -EINVAL; 4670 if (hdsp->io_type == H9652 || hdsp->io_type == H9632) return -EINVAL;
4671 /* SNDRV_HDSP_IOCTL_GET_VERSION must have been called */ 4671 /* SNDRV_HDSP_IOCTL_GET_VERSION must have been called */
4672 if (hdsp->io_type == Undefined) return -EINVAL; 4672 if (hdsp->io_type == Undefined) return -EINVAL;
@@ -4679,25 +4679,25 @@ static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigne
4679 4679
4680 if (get_user(firmware_data, &firmware->firmware_data)) 4680 if (get_user(firmware_data, &firmware->firmware_data))
4681 return -EFAULT; 4681 return -EFAULT;
4682 4682
4683 if (hdsp_check_for_iobox (hdsp)) 4683 if (hdsp_check_for_iobox (hdsp))
4684 return -EIO; 4684 return -EIO;
4685 4685
4686 if (copy_from_user(hdsp->firmware_cache, firmware_data, sizeof(hdsp->firmware_cache)) != 0) 4686 if (copy_from_user(hdsp->firmware_cache, firmware_data, sizeof(hdsp->firmware_cache)) != 0)
4687 return -EFAULT; 4687 return -EFAULT;
4688 4688
4689 hdsp->state |= HDSP_FirmwareCached; 4689 hdsp->state |= HDSP_FirmwareCached;
4690 4690
4691 if ((err = snd_hdsp_load_firmware_from_cache(hdsp)) < 0) 4691 if ((err = snd_hdsp_load_firmware_from_cache(hdsp)) < 0)
4692 return err; 4692 return err;
4693 4693
4694 if (!(hdsp->state & HDSP_InitializationComplete)) { 4694 if (!(hdsp->state & HDSP_InitializationComplete)) {
4695 if ((err = snd_hdsp_enable_io(hdsp)) < 0) 4695 if ((err = snd_hdsp_enable_io(hdsp)) < 0)
4696 return err; 4696 return err;
4697 4697
4698 snd_hdsp_initialize_channels(hdsp); 4698 snd_hdsp_initialize_channels(hdsp);
4699 snd_hdsp_initialize_midi_flush(hdsp); 4699 snd_hdsp_initialize_midi_flush(hdsp);
4700 4700
4701 if ((err = snd_hdsp_create_alsa_devices(hdsp->card, hdsp)) < 0) { 4701 if ((err = snd_hdsp_create_alsa_devices(hdsp->card, hdsp)) < 0) {
4702 snd_printk(KERN_ERR "Hammerfall-DSP: error creating alsa devices\n"); 4702 snd_printk(KERN_ERR "Hammerfall-DSP: error creating alsa devices\n");
4703 return err; 4703 return err;
@@ -4744,16 +4744,16 @@ static int snd_hdsp_create_hwdep(struct snd_card *card, struct hdsp *hdsp)
4744{ 4744{
4745 struct snd_hwdep *hw; 4745 struct snd_hwdep *hw;
4746 int err; 4746 int err;
4747 4747
4748 if ((err = snd_hwdep_new(card, "HDSP hwdep", 0, &hw)) < 0) 4748 if ((err = snd_hwdep_new(card, "HDSP hwdep", 0, &hw)) < 0)
4749 return err; 4749 return err;
4750 4750
4751 hdsp->hwdep = hw; 4751 hdsp->hwdep = hw;
4752 hw->private_data = hdsp; 4752 hw->private_data = hdsp;
4753 strcpy(hw->name, "HDSP hwdep interface"); 4753 strcpy(hw->name, "HDSP hwdep interface");
4754 4754
4755 hw->ops.ioctl = snd_hdsp_hwdep_ioctl; 4755 hw->ops.ioctl = snd_hdsp_hwdep_ioctl;
4756 4756
4757 return 0; 4757 return 0;
4758} 4758}
4759 4759
@@ -4786,24 +4786,24 @@ static void snd_hdsp_9652_enable_mixer (struct hdsp *hdsp)
4786static int snd_hdsp_enable_io (struct hdsp *hdsp) 4786static int snd_hdsp_enable_io (struct hdsp *hdsp)
4787{ 4787{
4788 int i; 4788 int i;
4789 4789
4790 if (hdsp_fifo_wait (hdsp, 0, 100)) { 4790 if (hdsp_fifo_wait (hdsp, 0, 100)) {
4791 snd_printk(KERN_ERR "Hammerfall-DSP: enable_io fifo_wait failed\n"); 4791 snd_printk(KERN_ERR "Hammerfall-DSP: enable_io fifo_wait failed\n");
4792 return -EIO; 4792 return -EIO;
4793 } 4793 }
4794 4794
4795 for (i = 0; i < hdsp->max_channels; ++i) { 4795 for (i = 0; i < hdsp->max_channels; ++i) {
4796 hdsp_write (hdsp, HDSP_inputEnable + (4 * i), 1); 4796 hdsp_write (hdsp, HDSP_inputEnable + (4 * i), 1);
4797 hdsp_write (hdsp, HDSP_outputEnable + (4 * i), 1); 4797 hdsp_write (hdsp, HDSP_outputEnable + (4 * i), 1);
4798 } 4798 }
4799 4799
4800 return 0; 4800 return 0;
4801} 4801}
4802 4802
4803static void snd_hdsp_initialize_channels(struct hdsp *hdsp) 4803static void snd_hdsp_initialize_channels(struct hdsp *hdsp)
4804{ 4804{
4805 int status, aebi_channels, aebo_channels; 4805 int status, aebi_channels, aebo_channels;
4806 4806
4807 switch (hdsp->io_type) { 4807 switch (hdsp->io_type) {
4808 case Digiface: 4808 case Digiface:
4809 hdsp->card_name = "RME Hammerfall DSP + Digiface"; 4809 hdsp->card_name = "RME Hammerfall DSP + Digiface";
@@ -4816,7 +4816,7 @@ static void snd_hdsp_initialize_channels(struct hdsp *hdsp)
4816 hdsp->ss_in_channels = hdsp->ss_out_channels = H9652_SS_CHANNELS; 4816 hdsp->ss_in_channels = hdsp->ss_out_channels = H9652_SS_CHANNELS;
4817 hdsp->ds_in_channels = hdsp->ds_out_channels = H9652_DS_CHANNELS; 4817 hdsp->ds_in_channels = hdsp->ds_out_channels = H9652_DS_CHANNELS;
4818 break; 4818 break;
4819 4819
4820 case H9632: 4820 case H9632:
4821 status = hdsp_read(hdsp, HDSP_statusRegister); 4821 status = hdsp_read(hdsp, HDSP_statusRegister);
4822 /* HDSP_AEBx bits are low when AEB are connected */ 4822 /* HDSP_AEBx bits are low when AEB are connected */
@@ -4836,7 +4836,7 @@ static void snd_hdsp_initialize_channels(struct hdsp *hdsp)
4836 hdsp->ss_in_channels = hdsp->ss_out_channels = MULTIFACE_SS_CHANNELS; 4836 hdsp->ss_in_channels = hdsp->ss_out_channels = MULTIFACE_SS_CHANNELS;
4837 hdsp->ds_in_channels = hdsp->ds_out_channels = MULTIFACE_DS_CHANNELS; 4837 hdsp->ds_in_channels = hdsp->ds_out_channels = MULTIFACE_DS_CHANNELS;
4838 break; 4838 break;
4839 4839
4840 default: 4840 default:
4841 /* should never get here */ 4841 /* should never get here */
4842 break; 4842 break;
@@ -4852,12 +4852,12 @@ static void snd_hdsp_initialize_midi_flush (struct hdsp *hdsp)
4852static int snd_hdsp_create_alsa_devices(struct snd_card *card, struct hdsp *hdsp) 4852static int snd_hdsp_create_alsa_devices(struct snd_card *card, struct hdsp *hdsp)
4853{ 4853{
4854 int err; 4854 int err;
4855 4855
4856 if ((err = snd_hdsp_create_pcm(card, hdsp)) < 0) { 4856 if ((err = snd_hdsp_create_pcm(card, hdsp)) < 0) {
4857 snd_printk(KERN_ERR "Hammerfall-DSP: Error creating pcm interface\n"); 4857 snd_printk(KERN_ERR "Hammerfall-DSP: Error creating pcm interface\n");
4858 return err; 4858 return err;
4859 } 4859 }
4860 4860
4861 4861
4862 if ((err = snd_hdsp_create_midi(card, hdsp, 0)) < 0) { 4862 if ((err = snd_hdsp_create_midi(card, hdsp, 0)) < 0) {
4863 snd_printk(KERN_ERR "Hammerfall-DSP: Error creating first midi interface\n"); 4863 snd_printk(KERN_ERR "Hammerfall-DSP: Error creating first midi interface\n");
@@ -4888,19 +4888,19 @@ static int snd_hdsp_create_alsa_devices(struct snd_card *card, struct hdsp *hdsp
4888 snd_printk(KERN_ERR "Hammerfall-DSP: Error setting default values\n"); 4888 snd_printk(KERN_ERR "Hammerfall-DSP: Error setting default values\n");
4889 return err; 4889 return err;
4890 } 4890 }
4891 4891
4892 if (!(hdsp->state & HDSP_InitializationComplete)) { 4892 if (!(hdsp->state & HDSP_InitializationComplete)) {
4893 strcpy(card->shortname, "Hammerfall DSP"); 4893 strcpy(card->shortname, "Hammerfall DSP");
4894 sprintf(card->longname, "%s at 0x%lx, irq %d", hdsp->card_name, 4894 sprintf(card->longname, "%s at 0x%lx, irq %d", hdsp->card_name,
4895 hdsp->port, hdsp->irq); 4895 hdsp->port, hdsp->irq);
4896 4896
4897 if ((err = snd_card_register(card)) < 0) { 4897 if ((err = snd_card_register(card)) < 0) {
4898 snd_printk(KERN_ERR "Hammerfall-DSP: error registering card\n"); 4898 snd_printk(KERN_ERR "Hammerfall-DSP: error registering card\n");
4899 return err; 4899 return err;
4900 } 4900 }
4901 hdsp->state |= HDSP_InitializationComplete; 4901 hdsp->state |= HDSP_InitializationComplete;
4902 } 4902 }
4903 4903
4904 return 0; 4904 return 0;
4905} 4905}
4906 4906
@@ -4911,7 +4911,7 @@ static int hdsp_request_fw_loader(struct hdsp *hdsp)
4911 const char *fwfile; 4911 const char *fwfile;
4912 const struct firmware *fw; 4912 const struct firmware *fw;
4913 int err; 4913 int err;
4914 4914
4915 if (hdsp->io_type == H9652 || hdsp->io_type == H9632) 4915 if (hdsp->io_type == H9652 || hdsp->io_type == H9632)
4916 return 0; 4916 return 0;
4917 if (hdsp->io_type == Undefined) { 4917 if (hdsp->io_type == Undefined) {
@@ -4920,7 +4920,7 @@ static int hdsp_request_fw_loader(struct hdsp *hdsp)
4920 if (hdsp->io_type == H9652 || hdsp->io_type == H9632) 4920 if (hdsp->io_type == H9652 || hdsp->io_type == H9632)
4921 return 0; 4921 return 0;
4922 } 4922 }
4923 4923
4924 /* caution: max length of firmware filename is 30! */ 4924 /* caution: max length of firmware filename is 30! */
4925 switch (hdsp->io_type) { 4925 switch (hdsp->io_type) {
4926 case Multiface: 4926 case Multiface:
@@ -4954,12 +4954,12 @@ static int hdsp_request_fw_loader(struct hdsp *hdsp)
4954 memcpy(hdsp->firmware_cache, fw->data, sizeof(hdsp->firmware_cache)); 4954 memcpy(hdsp->firmware_cache, fw->data, sizeof(hdsp->firmware_cache));
4955 4955
4956 release_firmware(fw); 4956 release_firmware(fw);
4957 4957
4958 hdsp->state |= HDSP_FirmwareCached; 4958 hdsp->state |= HDSP_FirmwareCached;
4959 4959
4960 if ((err = snd_hdsp_load_firmware_from_cache(hdsp)) < 0) 4960 if ((err = snd_hdsp_load_firmware_from_cache(hdsp)) < 0)
4961 return err; 4961 return err;
4962 4962
4963 if (!(hdsp->state & HDSP_InitializationComplete)) { 4963 if (!(hdsp->state & HDSP_InitializationComplete)) {
4964 if ((err = snd_hdsp_enable_io(hdsp)) < 0) 4964 if ((err = snd_hdsp_enable_io(hdsp)) < 0)
4965 return err; 4965 return err;
@@ -5006,14 +5006,14 @@ static int __devinit snd_hdsp_create(struct snd_card *card,
5006 hdsp->max_channels = 26; 5006 hdsp->max_channels = 26;
5007 5007
5008 hdsp->card = card; 5008 hdsp->card = card;
5009 5009
5010 spin_lock_init(&hdsp->lock); 5010 spin_lock_init(&hdsp->lock);
5011 5011
5012 tasklet_init(&hdsp->midi_tasklet, hdsp_midi_tasklet, (unsigned long)hdsp); 5012 tasklet_init(&hdsp->midi_tasklet, hdsp_midi_tasklet, (unsigned long)hdsp);
5013 5013
5014 pci_read_config_word(hdsp->pci, PCI_CLASS_REVISION, &hdsp->firmware_rev); 5014 pci_read_config_word(hdsp->pci, PCI_CLASS_REVISION, &hdsp->firmware_rev);
5015 hdsp->firmware_rev &= 0xff; 5015 hdsp->firmware_rev &= 0xff;
5016 5016
5017 /* From Martin Bjoernsen : 5017 /* From Martin Bjoernsen :
5018 "It is important that the card's latency timer register in 5018 "It is important that the card's latency timer register in
5019 the PCI configuration space is set to a value much larger 5019 the PCI configuration space is set to a value much larger
@@ -5022,7 +5022,7 @@ static int __devinit snd_hdsp_create(struct snd_card *card,
5022 to its maximum 255 to avoid problems with some computers." 5022 to its maximum 255 to avoid problems with some computers."
5023 */ 5023 */
5024 pci_write_config_byte(hdsp->pci, PCI_LATENCY_TIMER, 0xFF); 5024 pci_write_config_byte(hdsp->pci, PCI_LATENCY_TIMER, 0xFF);
5025 5025
5026 strcpy(card->driver, "H-DSP"); 5026 strcpy(card->driver, "H-DSP");
5027 strcpy(card->mixername, "Xilinx FPGA"); 5027 strcpy(card->mixername, "Xilinx FPGA");
5028 5028
@@ -5036,7 +5036,7 @@ static int __devinit snd_hdsp_create(struct snd_card *card,
5036 } else { 5036 } else {
5037 hdsp->card_name = "RME HDSP 9632"; 5037 hdsp->card_name = "RME HDSP 9632";
5038 hdsp->max_channels = 16; 5038 hdsp->max_channels = 16;
5039 is_9632 = 1; 5039 is_9632 = 1;
5040 } 5040 }
5041 5041
5042 if ((err = pci_enable_device(pci)) < 0) 5042 if ((err = pci_enable_device(pci)) < 0)
@@ -5065,7 +5065,7 @@ static int __devinit snd_hdsp_create(struct snd_card *card,
5065 5065
5066 if ((err = snd_hdsp_initialize_memory(hdsp)) < 0) 5066 if ((err = snd_hdsp_initialize_memory(hdsp)) < 0)
5067 return err; 5067 return err;
5068 5068
5069 if (!is_9652 && !is_9632) { 5069 if (!is_9652 && !is_9632) {
5070 /* we wait a maximum of 10 seconds to let freshly 5070 /* we wait a maximum of 10 seconds to let freshly
5071 * inserted cardbus cards do their hardware init */ 5071 * inserted cardbus cards do their hardware init */
@@ -5092,35 +5092,35 @@ static int __devinit snd_hdsp_create(struct snd_card *card,
5092 return err; 5092 return err;
5093 return 0; 5093 return 0;
5094 } else { 5094 } else {
5095 snd_printk(KERN_INFO "Hammerfall-DSP: Firmware already present, initializing card.\n"); 5095 snd_printk(KERN_INFO "Hammerfall-DSP: Firmware already present, initializing card.\n");
5096 if (hdsp_read(hdsp, HDSP_status2Register) & HDSP_version1) 5096 if (hdsp_read(hdsp, HDSP_status2Register) & HDSP_version1)
5097 hdsp->io_type = Multiface; 5097 hdsp->io_type = Multiface;
5098 else 5098 else
5099 hdsp->io_type = Digiface; 5099 hdsp->io_type = Digiface;
5100 } 5100 }
5101 } 5101 }
5102 5102
5103 if ((err = snd_hdsp_enable_io(hdsp)) != 0) 5103 if ((err = snd_hdsp_enable_io(hdsp)) != 0)
5104 return err; 5104 return err;
5105 5105
5106 if (is_9652) 5106 if (is_9652)
5107 hdsp->io_type = H9652; 5107 hdsp->io_type = H9652;
5108 5108
5109 if (is_9632) 5109 if (is_9632)
5110 hdsp->io_type = H9632; 5110 hdsp->io_type = H9632;
5111 5111
5112 if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) 5112 if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0)
5113 return err; 5113 return err;
5114 5114
5115 snd_hdsp_initialize_channels(hdsp); 5115 snd_hdsp_initialize_channels(hdsp);
5116 snd_hdsp_initialize_midi_flush(hdsp); 5116 snd_hdsp_initialize_midi_flush(hdsp);
5117 5117
5118 hdsp->state |= HDSP_FirmwareLoaded; 5118 hdsp->state |= HDSP_FirmwareLoaded;
5119 5119
5120 if ((err = snd_hdsp_create_alsa_devices(card, hdsp)) < 0) 5120 if ((err = snd_hdsp_create_alsa_devices(card, hdsp)) < 0)
5121 return err; 5121 return err;
5122 5122
5123 return 0; 5123 return 0;
5124} 5124}
5125 5125
5126static int snd_hdsp_free(struct hdsp *hdsp) 5126static int snd_hdsp_free(struct hdsp *hdsp)
@@ -5136,13 +5136,13 @@ static int snd_hdsp_free(struct hdsp *hdsp)
5136 free_irq(hdsp->irq, (void *)hdsp); 5136 free_irq(hdsp->irq, (void *)hdsp);
5137 5137
5138 snd_hdsp_free_buffers(hdsp); 5138 snd_hdsp_free_buffers(hdsp);
5139 5139
5140 if (hdsp->iobase) 5140 if (hdsp->iobase)
5141 iounmap(hdsp->iobase); 5141 iounmap(hdsp->iobase);
5142 5142
5143 if (hdsp->port) 5143 if (hdsp->port)
5144 pci_release_regions(hdsp->pci); 5144 pci_release_regions(hdsp->pci);
5145 5145
5146 pci_disable_device(hdsp->pci); 5146 pci_disable_device(hdsp->pci);
5147 return 0; 5147 return 0;
5148} 5148}
@@ -5187,7 +5187,7 @@ static int __devinit snd_hdsp_probe(struct pci_dev *pci,
5187 } 5187 }
5188 5188
5189 strcpy(card->shortname, "Hammerfall DSP"); 5189 strcpy(card->shortname, "Hammerfall DSP");
5190 sprintf(card->longname, "%s at 0x%lx, irq %d", hdsp->card_name, 5190 sprintf(card->longname, "%s at 0x%lx, irq %d", hdsp->card_name,
5191 hdsp->port, hdsp->irq); 5191 hdsp->port, hdsp->irq);
5192 5192
5193 if ((err = snd_card_register(card)) < 0) { 5193 if ((err = snd_card_register(card)) < 0) {