29 #include <linux/pci.h>
30 #include <linux/module.h>
52 "{RME,Digi96/8 PAD}}");
70 #define RME96_SPDIF_NCHANNELS 2
73 #define RME96_BUFFER_SIZE 0x10000
76 #define RME96_IO_SIZE 0x60000
79 #define RME96_IO_PLAY_BUFFER 0x0
80 #define RME96_IO_REC_BUFFER 0x10000
81 #define RME96_IO_CONTROL_REGISTER 0x20000
82 #define RME96_IO_ADDITIONAL_REG 0x20004
83 #define RME96_IO_CONFIRM_PLAY_IRQ 0x20008
84 #define RME96_IO_CONFIRM_REC_IRQ 0x2000C
85 #define RME96_IO_SET_PLAY_POS 0x40000
86 #define RME96_IO_RESET_PLAY_POS 0x4FFFC
87 #define RME96_IO_SET_REC_POS 0x50000
88 #define RME96_IO_RESET_REC_POS 0x5FFFC
89 #define RME96_IO_GET_PLAY_POS 0x20000
90 #define RME96_IO_GET_REC_POS 0x30000
93 #define RME96_WCR_START (1 << 0)
94 #define RME96_WCR_START_2 (1 << 1)
95 #define RME96_WCR_GAIN_0 (1 << 2)
96 #define RME96_WCR_GAIN_1 (1 << 3)
97 #define RME96_WCR_MODE24 (1 << 4)
98 #define RME96_WCR_MODE24_2 (1 << 5)
99 #define RME96_WCR_BM (1 << 6)
100 #define RME96_WCR_BM_2 (1 << 7)
101 #define RME96_WCR_ADAT (1 << 8)
102 #define RME96_WCR_FREQ_0 (1 << 9)
103 #define RME96_WCR_FREQ_1 (1 << 10)
104 #define RME96_WCR_DS (1 << 11)
105 #define RME96_WCR_PRO (1 << 12)
106 #define RME96_WCR_EMP (1 << 13)
107 #define RME96_WCR_SEL (1 << 14)
108 #define RME96_WCR_MASTER (1 << 15)
109 #define RME96_WCR_PD (1 << 16)
110 #define RME96_WCR_INP_0 (1 << 17)
111 #define RME96_WCR_INP_1 (1 << 18)
112 #define RME96_WCR_THRU_0 (1 << 19)
113 #define RME96_WCR_THRU_1 (1 << 20)
114 #define RME96_WCR_THRU_2 (1 << 21)
115 #define RME96_WCR_THRU_3 (1 << 22)
116 #define RME96_WCR_THRU_4 (1 << 23)
117 #define RME96_WCR_THRU_5 (1 << 24)
118 #define RME96_WCR_THRU_6 (1 << 25)
119 #define RME96_WCR_THRU_7 (1 << 26)
120 #define RME96_WCR_DOLBY (1 << 27)
121 #define RME96_WCR_MONITOR_0 (1 << 28)
122 #define RME96_WCR_MONITOR_1 (1 << 29)
123 #define RME96_WCR_ISEL (1 << 30)
124 #define RME96_WCR_IDIS (1 << 31)
126 #define RME96_WCR_BITPOS_GAIN_0 2
127 #define RME96_WCR_BITPOS_GAIN_1 3
128 #define RME96_WCR_BITPOS_FREQ_0 9
129 #define RME96_WCR_BITPOS_FREQ_1 10
130 #define RME96_WCR_BITPOS_INP_0 17
131 #define RME96_WCR_BITPOS_INP_1 18
132 #define RME96_WCR_BITPOS_MONITOR_0 28
133 #define RME96_WCR_BITPOS_MONITOR_1 29
136 #define RME96_RCR_AUDIO_ADDR_MASK 0xFFFF
137 #define RME96_RCR_IRQ_2 (1 << 16)
138 #define RME96_RCR_T_OUT (1 << 17)
139 #define RME96_RCR_DEV_ID_0 (1 << 21)
140 #define RME96_RCR_DEV_ID_1 (1 << 22)
141 #define RME96_RCR_LOCK (1 << 23)
142 #define RME96_RCR_VERF (1 << 26)
143 #define RME96_RCR_F0 (1 << 27)
144 #define RME96_RCR_F1 (1 << 28)
145 #define RME96_RCR_F2 (1 << 29)
146 #define RME96_RCR_AUTOSYNC (1 << 30)
147 #define RME96_RCR_IRQ (1 << 31)
149 #define RME96_RCR_BITPOS_F0 27
150 #define RME96_RCR_BITPOS_F1 28
151 #define RME96_RCR_BITPOS_F2 29
154 #define RME96_AR_WSEL (1 << 0)
155 #define RME96_AR_ANALOG (1 << 1)
156 #define RME96_AR_FREQPAD_0 (1 << 2)
157 #define RME96_AR_FREQPAD_1 (1 << 3)
158 #define RME96_AR_FREQPAD_2 (1 << 4)
159 #define RME96_AR_PD2 (1 << 5)
160 #define RME96_AR_DAC_EN (1 << 6)
161 #define RME96_AR_CLATCH (1 << 7)
162 #define RME96_AR_CCLK (1 << 8)
163 #define RME96_AR_CDATA (1 << 9)
165 #define RME96_AR_BITPOS_F0 2
166 #define RME96_AR_BITPOS_F1 3
167 #define RME96_AR_BITPOS_F2 4
170 #define RME96_MONITOR_TRACKS_1_2 0
171 #define RME96_MONITOR_TRACKS_3_4 1
172 #define RME96_MONITOR_TRACKS_5_6 2
173 #define RME96_MONITOR_TRACKS_7_8 3
176 #define RME96_ATTENUATION_0 0
177 #define RME96_ATTENUATION_6 1
178 #define RME96_ATTENUATION_12 2
179 #define RME96_ATTENUATION_18 3
182 #define RME96_INPUT_OPTICAL 0
183 #define RME96_INPUT_COAXIAL 1
184 #define RME96_INPUT_INTERNAL 2
185 #define RME96_INPUT_XLR 3
186 #define RME96_INPUT_ANALOG 4
189 #define RME96_CLOCKMODE_SLAVE 0
190 #define RME96_CLOCKMODE_MASTER 1
191 #define RME96_CLOCKMODE_WORDCLOCK 2
194 #define RME96_SMALL_BLOCK_SIZE 2048
195 #define RME96_LARGE_BLOCK_SIZE 8192
198 #define RME96_AD1852_VOL_BITS 14
199 #define RME96_AD1855_VOL_BITS 10
243 #define RME96_ISPLAYING(rme96) ((rme96)->wcreg & RME96_WCR_START)
244 #define RME96_ISRECORDING(rme96) ((rme96)->wcreg & RME96_WCR_START_2)
245 #define RME96_HAS_ANALOG_IN(rme96) ((rme96)->pci->device == PCI_DEVICE_ID_RME_DIGI96_8_PAD_OR_PST)
246 #define RME96_HAS_ANALOG_OUT(rme96) ((rme96)->pci->device == PCI_DEVICE_ID_RME_DIGI96_8_PRO || \
247 (rme96)->pci->device == PCI_DEVICE_ID_RME_DIGI96_8_PAD_OR_PST)
248 #define RME96_DAC_IS_1852(rme96) (RME96_HAS_ANALOG_OUT(rme96) && (rme96)->rev >= 4)
249 #define RME96_DAC_IS_1855(rme96) (((rme96)->pci->device == PCI_DEVICE_ID_RME_DIGI96_8_PAD_OR_PST && (rme96)->rev < 4) || \
250 ((rme96)->pci->device == PCI_DEVICE_ID_RME_DIGI96_8_PRO && (rme96)->rev == 2))
251 #define RME96_185X_MAX_OUT(rme96) ((1 << (RME96_DAC_IS_1852(rme96) ? RME96_AD1852_VOL_BITS : RME96_AD1855_VOL_BITS)) - 1)
283 static inline unsigned int
290 static inline unsigned int
291 snd_rme96_capture_ptr(
struct rme96 *rme96)
462 snd_rme96_write_SPI(
struct rme96 *rme96,
u16 val)
466 for (i = 0; i < 16; i++) {
489 snd_rme96_apply_dac_volume(
struct rme96 *rme96)
492 snd_rme96_write_SPI(rme96, (rme96->
vol[0] << 2) | 0x0);
493 snd_rme96_write_SPI(rme96, (rme96->
vol[1] << 2) | 0x2);
495 snd_rme96_write_SPI(rme96, (rme96->
vol[0] & 0x3FF) | 0x000);
496 snd_rme96_write_SPI(rme96, (rme96->
vol[1] & 0x3FF) | 0x400);
501 snd_rme96_reset_dac(
struct rme96 *rme96)
509 snd_rme96_getmontracks(
struct rme96 *rme96)
516 snd_rme96_setmontracks(
struct rme96 *rme96,
534 snd_rme96_getattenuation(
struct rme96 *rme96)
541 snd_rme96_setattenuation(
struct rme96 *rme96,
544 switch (attenuation) {
569 snd_rme96_capture_getrate(
struct rme96 *rme96,
620 case 3:
return 96000;
621 case 4:
return 88200;
622 case 5:
return 48000;
623 case 6:
return 44100;
624 case 7:
return 32000;
632 snd_rme96_playback_getrate(
struct rme96 *rme96)
638 (rate = snd_rme96_capture_getrate(rme96, &dummy)) > 0)
662 snd_rme96_playback_setrate(
struct rme96 *rme96,
706 snd_rme96_reset_dac(rme96);
714 snd_rme96_capture_analog_setrate(
struct rme96 *rme96,
731 if (rme96->
rev < 4) {
738 if (rme96->
rev < 4) {
756 snd_rme96_setclockmode(
struct rme96 *rme96,
784 snd_rme96_getclockmode(
struct rme96 *rme96)
794 snd_rme96_setinputtype(
struct rme96 *rme96,
830 if (rme96->
rev < 4) {
835 if (snd_rme96_capture_getrate(rme96, &n) == 88200) {
836 snd_rme96_capture_analog_setrate(rme96, 44100);
838 if (snd_rme96_capture_getrate(rme96, &n) == 64000) {
839 snd_rme96_capture_analog_setrate(rme96, 32000);
855 snd_rme96_getinputtype(
struct rme96 *rme96)
865 snd_rme96_setframelog(
struct rme96 *rme96,
871 if (n_channels == 2) {
887 snd_rme96_playback_setformat(
struct rme96 *rme96,
905 snd_rme96_capture_setformat(
struct rme96 *rme96,
923 snd_rme96_set_period_properties(
struct rme96 *rme96,
926 switch (period_bytes) {
954 spin_lock_irq(&rme96->
lock);
957 (rate = snd_rme96_capture_getrate(rme96, &dummy)) > 0)
961 spin_unlock_irq(&rme96->
lock);
964 }
else if ((err = snd_rme96_playback_setrate(rme96,
params_rate(params))) < 0) {
965 spin_unlock_irq(&rme96->
lock);
968 if ((err = snd_rme96_playback_setformat(rme96,
params_format(params))) < 0) {
969 spin_unlock_irq(&rme96->
lock);
977 spin_unlock_irq(&rme96->
lock);
989 spin_unlock_irq(&rme96->
lock);
1007 spin_lock_irq(&rme96->
lock);
1008 if ((err = snd_rme96_capture_setformat(rme96,
params_format(params))) < 0) {
1009 spin_unlock_irq(&rme96->
lock);
1013 if ((err = snd_rme96_capture_analog_setrate(rme96,
1016 spin_unlock_irq(&rme96->
lock);
1019 }
else if ((rate = snd_rme96_capture_getrate(rme96, &isadat)) > 0) {
1021 spin_unlock_irq(&rme96->
lock);
1024 if ((isadat && runtime->
hw.channels_min == 2) ||
1025 (!isadat && runtime->
hw.channels_min == 8))
1027 spin_unlock_irq(&rme96->
lock);
1036 spin_unlock_irq(&rme96->
lock);
1043 spin_unlock_irq(&rme96->
lock);
1049 snd_rme96_playback_start(
struct rme96 *rme96,
1061 snd_rme96_capture_start(
struct rme96 *rme96,
1073 snd_rme96_playback_stop(
struct rme96 *rme96)
1088 snd_rme96_capture_stop(
struct rme96 *rme96)
1099 snd_rme96_interrupt(
int irq,
1102 struct rme96 *rme96 = (
struct rme96 *)dev_id;
1129 .list = period_bytes,
1134 rme96_set_buffer_size_constraint(
struct rme96 *rme96,
1149 &hw_constraints_period_bytes);
1159 spin_lock_irq(&rme96->
lock);
1161 spin_unlock_irq(&rme96->
lock);
1167 spin_unlock_irq(&rme96->
lock);
1169 runtime->
hw = snd_rme96_playback_spdif_info;
1172 (rate = snd_rme96_capture_getrate(rme96, &dummy)) > 0)
1176 runtime->
hw.rate_min =
rate;
1177 runtime->
hw.rate_max =
rate;
1179 rme96_set_buffer_size_constraint(rme96, runtime);
1195 runtime->
hw = snd_rme96_capture_spdif_info;
1197 (rate = snd_rme96_capture_getrate(rme96, &isadat)) > 0)
1203 runtime->
hw.rate_min =
rate;
1204 runtime->
hw.rate_max =
rate;
1207 spin_lock_irq(&rme96->
lock);
1209 spin_unlock_irq(&rme96->
lock);
1213 spin_unlock_irq(&rme96->
lock);
1215 rme96_set_buffer_size_constraint(rme96, runtime);
1226 spin_lock_irq(&rme96->
lock);
1228 spin_unlock_irq(&rme96->
lock);
1234 spin_unlock_irq(&rme96->
lock);
1236 runtime->
hw = snd_rme96_playback_adat_info;
1239 (rate = snd_rme96_capture_getrate(rme96, &dummy)) > 0)
1243 runtime->
hw.rate_min =
rate;
1244 runtime->
hw.rate_max =
rate;
1246 rme96_set_buffer_size_constraint(rme96, runtime);
1257 runtime->
hw = snd_rme96_capture_adat_info;
1263 if ((rate = snd_rme96_capture_getrate(rme96, &isadat)) > 0) {
1268 runtime->
hw.rate_min =
rate;
1269 runtime->
hw.rate_max =
rate;
1272 spin_lock_irq(&rme96->
lock);
1274 spin_unlock_irq(&rme96->
lock);
1278 spin_unlock_irq(&rme96->
lock);
1280 rme96_set_buffer_size_constraint(rme96, runtime);
1290 spin_lock_irq(&rme96->
lock);
1292 snd_rme96_playback_stop(rme96);
1297 spin_unlock_irq(&rme96->
lock);
1311 spin_lock_irq(&rme96->
lock);
1313 snd_rme96_capture_stop(rme96);
1317 spin_unlock_irq(&rme96->
lock);
1326 spin_lock_irq(&rme96->
lock);
1328 snd_rme96_playback_stop(rme96);
1331 spin_unlock_irq(&rme96->
lock);
1340 spin_lock_irq(&rme96->
lock);
1342 snd_rme96_capture_stop(rme96);
1345 spin_unlock_irq(&rme96->
lock);
1361 snd_rme96_playback_start(rme96, 0);
1370 snd_rme96_playback_stop(rme96);
1376 snd_rme96_playback_stop(rme96);
1382 snd_rme96_playback_start(rme96, 1);
1404 snd_rme96_capture_start(rme96, 0);
1413 snd_rme96_capture_stop(rme96);
1419 snd_rme96_capture_stop(rme96);
1425 snd_rme96_capture_start(rme96, 1);
1440 return snd_rme96_playback_ptr(rme96);
1447 return snd_rme96_capture_ptr(rme96);
1450 static struct snd_pcm_ops snd_rme96_playback_spdif_ops = {
1451 .open = snd_rme96_playback_spdif_open,
1452 .close = snd_rme96_playback_close,
1454 .hw_params = snd_rme96_playback_hw_params,
1455 .prepare = snd_rme96_playback_prepare,
1456 .trigger = snd_rme96_playback_trigger,
1457 .pointer = snd_rme96_playback_pointer,
1458 .copy = snd_rme96_playback_copy,
1459 .silence = snd_rme96_playback_silence,
1463 static struct snd_pcm_ops snd_rme96_capture_spdif_ops = {
1464 .open = snd_rme96_capture_spdif_open,
1465 .close = snd_rme96_capture_close,
1467 .hw_params = snd_rme96_capture_hw_params,
1468 .prepare = snd_rme96_capture_prepare,
1469 .trigger = snd_rme96_capture_trigger,
1470 .pointer = snd_rme96_capture_pointer,
1471 .copy = snd_rme96_capture_copy,
1475 static struct snd_pcm_ops snd_rme96_playback_adat_ops = {
1476 .open = snd_rme96_playback_adat_open,
1477 .close = snd_rme96_playback_close,
1479 .hw_params = snd_rme96_playback_hw_params,
1480 .prepare = snd_rme96_playback_prepare,
1481 .trigger = snd_rme96_playback_trigger,
1482 .pointer = snd_rme96_playback_pointer,
1483 .copy = snd_rme96_playback_copy,
1484 .silence = snd_rme96_playback_silence,
1488 static struct snd_pcm_ops snd_rme96_capture_adat_ops = {
1489 .open = snd_rme96_capture_adat_open,
1490 .close = snd_rme96_capture_close,
1492 .hw_params = snd_rme96_capture_hw_params,
1493 .prepare = snd_rme96_capture_prepare,
1494 .trigger = snd_rme96_capture_trigger,
1495 .pointer = snd_rme96_capture_pointer,
1496 .copy = snd_rme96_capture_copy,
1503 struct rme96 *rme96 = (
struct rme96 *)private_data;
1505 if (rme96 ==
NULL) {
1508 if (rme96->
irq >= 0) {
1509 snd_rme96_playback_stop(rme96);
1510 snd_rme96_capture_stop(rme96);
1528 snd_rme96_free_spdif_pcm(
struct snd_pcm *pcm)
1535 snd_rme96_free_adat_pcm(
struct snd_pcm *pcm)
1542 snd_rme96_create(
struct rme96 *rme96)
1564 KBUILD_MODNAME, rme96)) {
1571 pci_read_config_byte(pci, 8, &rme96->
rev);
1580 rme96->
spdif_pcm->private_free = snd_rme96_free_spdif_pcm;
1597 rme96->
adat_pcm->private_data = rme96;
1598 rme96->
adat_pcm->private_free = snd_rme96_free_adat_pcm;
1610 snd_rme96_playback_stop(rme96);
1611 snd_rme96_capture_stop(rme96);
1631 snd_rme96_reset_dac(rme96);
1640 rme96->
vol[0] = rme96->
vol[1] = 0;
1642 snd_rme96_apply_dac_volume(rme96);
1646 if ((err = snd_rme96_create_switches(rme96->
card, rme96)) < 0) {
1651 snd_rme96_proc_init(rme96);
1668 snd_iprintf(buffer, rme96->
card->longname);
1669 snd_iprintf(buffer,
" (index #%d)\n", rme96->
card->number + 1);
1671 snd_iprintf(buffer,
"\nGeneral settings\n");
1673 snd_iprintf(buffer,
" period size: N/A (interrupts "
1676 snd_iprintf(buffer,
" period size: 2048 bytes\n");
1678 snd_iprintf(buffer,
" period size: 8192 bytes\n");
1680 snd_iprintf(buffer,
"\nInput settings\n");
1681 switch (snd_rme96_getinputtype(rme96)) {
1683 snd_iprintf(buffer,
" input: optical");
1686 snd_iprintf(buffer,
" input: coaxial");
1689 snd_iprintf(buffer,
" input: internal");
1692 snd_iprintf(buffer,
" input: XLR");
1695 snd_iprintf(buffer,
" input: analog");
1698 if (snd_rme96_capture_getrate(rme96, &n) < 0) {
1699 snd_iprintf(buffer,
"\n sample rate: no valid signal\n");
1702 snd_iprintf(buffer,
" (8 channels)\n");
1704 snd_iprintf(buffer,
" (2 channels)\n");
1706 snd_iprintf(buffer,
" sample rate: %d Hz\n",
1707 snd_rme96_capture_getrate(rme96, &n));
1710 snd_iprintf(buffer,
" sample format: 24 bit\n");
1712 snd_iprintf(buffer,
" sample format: 16 bit\n");
1715 snd_iprintf(buffer,
"\nOutput settings\n");
1717 snd_iprintf(buffer,
" output signal: normal playback\n");
1719 snd_iprintf(buffer,
" output signal: same as input\n");
1721 snd_iprintf(buffer,
" sample rate: %d Hz\n",
1722 snd_rme96_playback_getrate(rme96));
1724 snd_iprintf(buffer,
" sample format: 24 bit\n");
1726 snd_iprintf(buffer,
" sample format: 16 bit\n");
1729 snd_iprintf(buffer,
" sample clock source: word clock\n");
1731 snd_iprintf(buffer,
" sample clock source: internal\n");
1733 snd_iprintf(buffer,
" sample clock source: autosync (internal anyway due to analog input setting)\n");
1734 }
else if (snd_rme96_capture_getrate(rme96, &n) < 0) {
1735 snd_iprintf(buffer,
" sample clock source: autosync (internal anyway due to no valid signal)\n");
1737 snd_iprintf(buffer,
" sample clock source: autosync\n");
1740 snd_iprintf(buffer,
" format: AES/EBU (professional)\n");
1742 snd_iprintf(buffer,
" format: IEC958 (consumer)\n");
1745 snd_iprintf(buffer,
" emphasis: on\n");
1747 snd_iprintf(buffer,
" emphasis: off\n");
1750 snd_iprintf(buffer,
" non-audio (dolby): on\n");
1752 snd_iprintf(buffer,
" non-audio (dolby): off\n");
1755 snd_iprintf(buffer,
"\nAnalog output settings\n");
1756 switch (snd_rme96_getmontracks(rme96)) {
1758 snd_iprintf(buffer,
" monitored ADAT tracks: 1+2\n");
1761 snd_iprintf(buffer,
" monitored ADAT tracks: 3+4\n");
1764 snd_iprintf(buffer,
" monitored ADAT tracks: 5+6\n");
1767 snd_iprintf(buffer,
" monitored ADAT tracks: 7+8\n");
1770 switch (snd_rme96_getattenuation(rme96)) {
1772 snd_iprintf(buffer,
" attenuation: 0 dB\n");
1775 snd_iprintf(buffer,
" attenuation: -6 dB\n");
1778 snd_iprintf(buffer,
" attenuation: -12 dB\n");
1781 snd_iprintf(buffer,
" attenuation: -18 dB\n");
1784 snd_iprintf(buffer,
" volume left: %u\n", rme96->
vol[0]);
1785 snd_iprintf(buffer,
" volume right: %u\n", rme96->
vol[1]);
1790 snd_rme96_proc_init(
struct rme96 *rme96)
1794 if (! snd_card_proc_new(rme96->
card,
"rme96", &entry))
1795 snd_info_set_text_ops(entry, rme96, snd_rme96_proc_read);
1802 #define snd_rme96_info_loopback_control snd_ctl_boolean_mono_info
1809 spin_lock_irq(&rme96->
lock);
1811 spin_unlock_irq(&rme96->
lock);
1822 spin_lock_irq(&rme96->
lock);
1824 change = val != rme96->
wcreg;
1827 spin_unlock_irq(&rme96->
lock);
1834 static char *_texts[5] = {
"Optical",
"Coaxial",
"Internal",
"XLR",
"Analog" };
1836 char *texts[5] = { _texts[0], _texts[1], _texts[2], _texts[3], _texts[4] };
1840 switch (rme96->
pci->device) {
1849 if (rme96->
rev > 4) {
1852 texts[3] = _texts[4];
1872 unsigned int items = 3;
1874 spin_lock_irq(&rme96->
lock);
1875 ucontrol->
value.enumerated.item[0] = snd_rme96_getinputtype(rme96);
1877 switch (rme96->
pci->device) {
1886 if (rme96->
rev > 4) {
1900 if (ucontrol->
value.enumerated.item[0] >= items) {
1901 ucontrol->
value.enumerated.item[0] = items - 1;
1904 spin_unlock_irq(&rme96->
lock);
1912 int change, items = 3;
1914 switch (rme96->
pci->device) {
1923 if (rme96->
rev > 4) {
1933 val = ucontrol->
value.enumerated.item[0] % items;
1942 spin_lock_irq(&rme96->
lock);
1943 change = (
int)val != snd_rme96_getinputtype(rme96);
1944 snd_rme96_setinputtype(rme96, val);
1945 spin_unlock_irq(&rme96->
lock);
1952 static char *texts[3] = {
"AutoSync",
"Internal",
"Word" };
1968 spin_lock_irq(&rme96->
lock);
1969 ucontrol->
value.enumerated.item[0] = snd_rme96_getclockmode(rme96);
1970 spin_unlock_irq(&rme96->
lock);
1980 val = ucontrol->
value.enumerated.item[0] % 3;
1981 spin_lock_irq(&rme96->
lock);
1982 change = (
int)val != snd_rme96_getclockmode(rme96);
1983 snd_rme96_setclockmode(rme96, val);
1984 spin_unlock_irq(&rme96->
lock);
1991 static char *texts[4] = {
"0 dB",
"-6 dB",
"-12 dB",
"-18 dB" };
2007 spin_lock_irq(&rme96->
lock);
2008 ucontrol->
value.enumerated.item[0] = snd_rme96_getattenuation(rme96);
2009 spin_unlock_irq(&rme96->
lock);
2019 val = ucontrol->
value.enumerated.item[0] % 4;
2020 spin_lock_irq(&rme96->
lock);
2022 change = (
int)val != snd_rme96_getattenuation(rme96);
2023 snd_rme96_setattenuation(rme96, val);
2024 spin_unlock_irq(&rme96->
lock);
2031 static char *texts[4] = {
"1+2",
"3+4",
"5+6",
"7+8" };
2047 spin_lock_irq(&rme96->
lock);
2048 ucontrol->
value.enumerated.item[0] = snd_rme96_getmontracks(rme96);
2049 spin_unlock_irq(&rme96->
lock);
2059 val = ucontrol->
value.enumerated.item[0] % 4;
2060 spin_lock_irq(&rme96->
lock);
2061 change = (
int)val != snd_rme96_getmontracks(rme96);
2062 snd_rme96_setmontracks(rme96, val);
2063 spin_unlock_irq(&rme96->
lock);
2110 val = snd_rme96_convert_from_aes(&ucontrol->
value.iec958);
2111 spin_lock_irq(&rme96->
lock);
2114 spin_unlock_irq(&rme96->
lock);
2139 val = snd_rme96_convert_from_aes(&ucontrol->
value.iec958);
2140 spin_lock_irq(&rme96->
lock);
2146 spin_unlock_irq(&rme96->
lock);
2180 spin_lock_irq(&rme96->
lock);
2181 u->
value.integer.value[0] = rme96->
vol[0];
2182 u->
value.integer.value[1] = rme96->
vol[1];
2183 spin_unlock_irq(&rme96->
lock);
2193 unsigned int vol, maxvol;
2199 spin_lock_irq(&rme96->
lock);
2200 vol = u->
value.integer.value[0];
2201 if (vol != rme96->
vol[0] && vol <= maxvol) {
2205 vol = u->
value.integer.value[1];
2206 if (vol != rme96->
vol[1] && vol <= maxvol) {
2211 snd_rme96_apply_dac_volume(rme96);
2212 spin_unlock_irq(&rme96->
lock);
2221 .info = snd_rme96_control_spdif_info,
2222 .get = snd_rme96_control_spdif_get,
2223 .put = snd_rme96_control_spdif_put
2229 .info = snd_rme96_control_spdif_stream_info,
2230 .get = snd_rme96_control_spdif_stream_get,
2231 .put = snd_rme96_control_spdif_stream_put
2237 .info = snd_rme96_control_spdif_mask_info,
2238 .get = snd_rme96_control_spdif_mask_get,
2239 .private_value = IEC958_AES0_NONAUDIO |
2247 .info = snd_rme96_control_spdif_mask_info,
2248 .get = snd_rme96_control_spdif_mask_get,
2249 .private_value = IEC958_AES0_NONAUDIO |
2255 .name =
"Input Connector",
2256 .info = snd_rme96_info_inputtype_control,
2257 .get = snd_rme96_get_inputtype_control,
2258 .put = snd_rme96_put_inputtype_control
2262 .name =
"Loopback Input",
2264 .get = snd_rme96_get_loopback_control,
2265 .put = snd_rme96_put_loopback_control
2269 .name =
"Sample Clock Source",
2270 .info = snd_rme96_info_clockmode_control,
2271 .get = snd_rme96_get_clockmode_control,
2272 .put = snd_rme96_put_clockmode_control
2276 .name =
"Monitor Tracks",
2277 .info = snd_rme96_info_montracks_control,
2278 .get = snd_rme96_get_montracks_control,
2279 .put = snd_rme96_put_montracks_control
2283 .name =
"Attenuation",
2284 .info = snd_rme96_info_attenuation_control,
2285 .get = snd_rme96_get_attenuation_control,
2286 .put = snd_rme96_put_attenuation_control
2290 .name =
"DAC Playback Volume",
2291 .info = snd_rme96_dac_volume_info,
2292 .get = snd_rme96_dac_volume_get,
2293 .put = snd_rme96_dac_volume_put
2299 struct rme96 *rme96)
2304 for (idx = 0; idx < 7; idx++) {
2312 for (idx = 7; idx < 10; idx++)
2324 static void snd_rme96_card_free(
struct snd_card *card)
2330 snd_rme96_probe(
struct pci_dev *pci,
2334 struct rme96 *rme96;
2347 sizeof(
struct rme96), &card);
2355 if ((err = snd_rme96_create(rme96)) < 0) {
2361 switch (rme96->
pci->device) {
2372 pci_read_config_byte(rme96->
pci, 8, &val);
2387 pci_set_drvdata(pci, card);
2395 pci_set_drvdata(pci,
NULL);
2399 .name = KBUILD_MODNAME,
2400 .id_table = snd_rme96_ids,
2401 .probe = snd_rme96_probe,