diff options
-rw-r--r-- | include/sound/emu10k1.h | 8 | ||||
-rw-r--r-- | sound/pci/emu10k1/emu10k1_main.c | 10 | ||||
-rw-r--r-- | sound/pci/emu10k1/emuproc.c | 48 | ||||
-rw-r--r-- | sound/pci/emu10k1/io.c | 10 |
4 files changed, 58 insertions, 18 deletions
diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h index d6c8c54d49e0..acc4277dd383 100644 --- a/include/sound/emu10k1.h +++ b/include/sound/emu10k1.h | |||
@@ -1456,6 +1456,8 @@ struct snd_emu1010 { | |||
1456 | unsigned int adc_pads; /* bit mask */ | 1456 | unsigned int adc_pads; /* bit mask */ |
1457 | unsigned int dac_pads; /* bit mask */ | 1457 | unsigned int dac_pads; /* bit mask */ |
1458 | unsigned int internal_clock; /* 44100 or 48000 */ | 1458 | unsigned int internal_clock; /* 44100 or 48000 */ |
1459 | unsigned int optical_in; /* 0:SPDIF, 1:ADAT */ | ||
1460 | unsigned int optical_out; /* 0:SPDIF, 1:ADAT */ | ||
1459 | struct task_struct *firmware_thread; | 1461 | struct task_struct *firmware_thread; |
1460 | }; | 1462 | }; |
1461 | 1463 | ||
@@ -1600,9 +1602,9 @@ unsigned int snd_emu10k1_ptr20_read(struct snd_emu10k1 * emu, unsigned int reg, | |||
1600 | void snd_emu10k1_ptr20_write(struct snd_emu10k1 *emu, unsigned int reg, unsigned int chn, unsigned int data); | 1602 | void snd_emu10k1_ptr20_write(struct snd_emu10k1 *emu, unsigned int reg, unsigned int chn, unsigned int data); |
1601 | int snd_emu10k1_spi_write(struct snd_emu10k1 * emu, unsigned int data); | 1603 | int snd_emu10k1_spi_write(struct snd_emu10k1 * emu, unsigned int data); |
1602 | int snd_emu10k1_i2c_write(struct snd_emu10k1 *emu, u32 reg, u32 value); | 1604 | int snd_emu10k1_i2c_write(struct snd_emu10k1 *emu, u32 reg, u32 value); |
1603 | int snd_emu1010_fpga_write(struct snd_emu10k1 * emu, int reg, int value); | 1605 | int snd_emu1010_fpga_write(struct snd_emu10k1 * emu, u32 reg, u32 value); |
1604 | int snd_emu1010_fpga_read(struct snd_emu10k1 * emu, int reg, int *value); | 1606 | int snd_emu1010_fpga_read(struct snd_emu10k1 * emu, u32 reg, u32 *value); |
1605 | int snd_emu1010_fpga_link_dst_src_write(struct snd_emu10k1 * emu, int dst, int src); | 1607 | int snd_emu1010_fpga_link_dst_src_write(struct snd_emu10k1 * emu, u32 dst, u32 src); |
1606 | unsigned int snd_emu10k1_efx_read(struct snd_emu10k1 *emu, unsigned int pc); | 1608 | unsigned int snd_emu10k1_efx_read(struct snd_emu10k1 *emu, unsigned int pc); |
1607 | void snd_emu10k1_intr_enable(struct snd_emu10k1 *emu, unsigned int intrenb); | 1609 | void snd_emu10k1_intr_enable(struct snd_emu10k1 *emu, unsigned int intrenb); |
1608 | void snd_emu10k1_intr_disable(struct snd_emu10k1 *emu, unsigned int intrenb); | 1610 | void snd_emu10k1_intr_disable(struct snd_emu10k1 *emu, unsigned int intrenb); |
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c index b985e660c60b..e22bb717e96a 100644 --- a/sound/pci/emu10k1/emu10k1_main.c +++ b/sound/pci/emu10k1/emu10k1_main.c | |||
@@ -873,7 +873,15 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu) | |||
873 | snd_printk(KERN_INFO "emu1010: Card options=0x%x\n",reg); | 873 | snd_printk(KERN_INFO "emu1010: Card options=0x%x\n",reg); |
874 | snd_emu1010_fpga_read(emu, EMU_HANA_OPTICAL_TYPE, &tmp ); | 874 | snd_emu1010_fpga_read(emu, EMU_HANA_OPTICAL_TYPE, &tmp ); |
875 | /* Optical -> ADAT I/O */ | 875 | /* Optical -> ADAT I/O */ |
876 | snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, EMU_HANA_OPTICAL_IN_ADAT | EMU_HANA_OPTICAL_OUT_ADAT ); | 876 | /* 0 : SPDIF |
877 | * 1 : ADAT | ||
878 | */ | ||
879 | emu->emu1010.optical_in = 1; /* IN_ADAT */ | ||
880 | emu->emu1010.optical_out = 1; /* IN_ADAT */ | ||
881 | tmp = 0; | ||
882 | tmp = (emu->emu1010.optical_in ? EMU_HANA_OPTICAL_IN_ADAT : 0) | | ||
883 | (emu->emu1010.optical_out ? EMU_HANA_OPTICAL_OUT_ADAT : 0); | ||
884 | snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, tmp ); | ||
877 | snd_emu1010_fpga_read(emu, EMU_HANA_ADC_PADS, &tmp ); | 885 | snd_emu1010_fpga_read(emu, EMU_HANA_ADC_PADS, &tmp ); |
878 | /* Set no attenuation on Audio Dock pads. */ | 886 | /* Set no attenuation on Audio Dock pads. */ |
879 | snd_emu1010_fpga_write(emu, EMU_HANA_ADC_PADS, 0x00 ); | 887 | snd_emu1010_fpga_write(emu, EMU_HANA_ADC_PADS, 0x00 ); |
diff --git a/sound/pci/emu10k1/emuproc.c b/sound/pci/emu10k1/emuproc.c index a0dae0d916cb..3e2ed1d9d5fe 100644 --- a/sound/pci/emu10k1/emuproc.c +++ b/sound/pci/emu10k1/emuproc.c | |||
@@ -240,8 +240,42 @@ static void snd_emu10k1_proc_spdif_read(struct snd_info_entry *entry, | |||
240 | struct snd_info_buffer *buffer) | 240 | struct snd_info_buffer *buffer) |
241 | { | 241 | { |
242 | struct snd_emu10k1 *emu = entry->private_data; | 242 | struct snd_emu10k1 *emu = entry->private_data; |
243 | snd_emu10k1_proc_spdif_status(emu, buffer, "CD-ROM S/PDIF In", CDCS, CDSRCS); | 243 | u32 value; |
244 | snd_emu10k1_proc_spdif_status(emu, buffer, "Optical or Coax S/PDIF In", GPSCS, GPSRCS); | 244 | u32 value2; |
245 | unsigned long flags; | ||
246 | u32 rate; | ||
247 | |||
248 | if (emu->card_capabilities->emu1010) { | ||
249 | spin_lock_irqsave(&emu->emu_lock, flags); | ||
250 | snd_emu1010_fpga_read(emu, 0x38, &value); | ||
251 | spin_unlock_irqrestore(&emu->emu_lock, flags); | ||
252 | if ((value & 0x1) == 0) { | ||
253 | spin_lock_irqsave(&emu->emu_lock, flags); | ||
254 | snd_emu1010_fpga_read(emu, 0x2a, &value); | ||
255 | snd_emu1010_fpga_read(emu, 0x2b, &value2); | ||
256 | spin_unlock_irqrestore(&emu->emu_lock, flags); | ||
257 | rate = 0x1770000 / (((value << 5) | value2)+1); | ||
258 | snd_iprintf(buffer, "ADAT Locked : %u\n", rate); | ||
259 | } else { | ||
260 | snd_iprintf(buffer, "ADAT Unlocked\n"); | ||
261 | } | ||
262 | spin_lock_irqsave(&emu->emu_lock, flags); | ||
263 | snd_emu1010_fpga_read(emu, 0x20, &value); | ||
264 | spin_unlock_irqrestore(&emu->emu_lock, flags); | ||
265 | if ((value & 0x4) == 0) { | ||
266 | spin_lock_irqsave(&emu->emu_lock, flags); | ||
267 | snd_emu1010_fpga_read(emu, 0x28, &value); | ||
268 | snd_emu1010_fpga_read(emu, 0x29, &value2); | ||
269 | spin_unlock_irqrestore(&emu->emu_lock, flags); | ||
270 | rate = 0x1770000 / (((value << 5) | value2)+1); | ||
271 | snd_iprintf(buffer, "SPDIF Locked : %d\n", rate); | ||
272 | } else { | ||
273 | snd_iprintf(buffer, "SPDIF Unlocked\n"); | ||
274 | } | ||
275 | } else { | ||
276 | snd_emu10k1_proc_spdif_status(emu, buffer, "CD-ROM S/PDIF In", CDCS, CDSRCS); | ||
277 | snd_emu10k1_proc_spdif_status(emu, buffer, "Optical or Coax S/PDIF In", GPSCS, GPSRCS); | ||
278 | } | ||
245 | #if 0 | 279 | #if 0 |
246 | val = snd_emu10k1_ptr_read(emu, ZVSRCS, 0); | 280 | val = snd_emu10k1_ptr_read(emu, ZVSRCS, 0); |
247 | snd_iprintf(buffer, "\nZoomed Video\n"); | 281 | snd_iprintf(buffer, "\nZoomed Video\n"); |
@@ -379,20 +413,16 @@ static void snd_emu_proc_emu1010_reg_read(struct snd_info_entry *entry, | |||
379 | struct snd_info_buffer *buffer) | 413 | struct snd_info_buffer *buffer) |
380 | { | 414 | { |
381 | struct snd_emu10k1 *emu = entry->private_data; | 415 | struct snd_emu10k1 *emu = entry->private_data; |
382 | unsigned long value; | 416 | int value; |
383 | unsigned long flags; | 417 | unsigned long flags; |
384 | unsigned long regs; | ||
385 | int i; | 418 | int i; |
386 | snd_iprintf(buffer, "EMU1010 Registers:\n\n"); | 419 | snd_iprintf(buffer, "EMU1010 Registers:\n\n"); |
387 | 420 | ||
388 | for(i = 0; i < 0x40; i+=1) { | 421 | for(i = 0; i < 0x40; i+=1) { |
389 | spin_lock_irqsave(&emu->emu_lock, flags); | 422 | spin_lock_irqsave(&emu->emu_lock, flags); |
390 | regs=i+0x40; /* 0x40 upwards are registers. */ | 423 | snd_emu1010_fpga_read(emu, i, &value); |
391 | outl(regs, emu->port + A_IOCFG); | ||
392 | outl(regs | 0x80, emu->port + A_IOCFG); /* High bit clocks the value into the fpga. */ | ||
393 | value = inl(emu->port + A_IOCFG); | ||
394 | spin_unlock_irqrestore(&emu->emu_lock, flags); | 424 | spin_unlock_irqrestore(&emu->emu_lock, flags); |
395 | snd_iprintf(buffer, "%02X: %08lX, %02lX\n", i, value, (value >> 8) & 0x7f); | 425 | snd_iprintf(buffer, "%02X: %08X, %02X\n", i, value, (value >> 8) & 0x7f); |
396 | } | 426 | } |
397 | } | 427 | } |
398 | 428 | ||
diff --git a/sound/pci/emu10k1/io.c b/sound/pci/emu10k1/io.c index 116e1c8d9361..971458b45944 100644 --- a/sound/pci/emu10k1/io.c +++ b/sound/pci/emu10k1/io.c | |||
@@ -226,9 +226,9 @@ int snd_emu10k1_i2c_write(struct snd_emu10k1 *emu, | |||
226 | return 0; | 226 | return 0; |
227 | } | 227 | } |
228 | 228 | ||
229 | int snd_emu1010_fpga_write(struct snd_emu10k1 * emu, int reg, int value) | 229 | int snd_emu1010_fpga_write(struct snd_emu10k1 * emu, u32 reg, u32 value) |
230 | { | 230 | { |
231 | if (reg < 0 || reg > 0x3f) | 231 | if (reg > 0x3f) |
232 | return 1; | 232 | return 1; |
233 | reg += 0x40; /* 0x40 upwards are registers. */ | 233 | reg += 0x40; /* 0x40 upwards are registers. */ |
234 | if (value < 0 || value > 0x3f) /* 0 to 0x3f are values */ | 234 | if (value < 0 || value > 0x3f) /* 0 to 0x3f are values */ |
@@ -244,9 +244,9 @@ int snd_emu1010_fpga_write(struct snd_emu10k1 * emu, int reg, int value) | |||
244 | return 0; | 244 | return 0; |
245 | } | 245 | } |
246 | 246 | ||
247 | int snd_emu1010_fpga_read(struct snd_emu10k1 * emu, int reg, int *value) | 247 | int snd_emu1010_fpga_read(struct snd_emu10k1 * emu, u32 reg, u32 *value) |
248 | { | 248 | { |
249 | if (reg < 0 || reg > 0x3f) | 249 | if (reg > 0x3f) |
250 | return 1; | 250 | return 1; |
251 | reg += 0x40; /* 0x40 upwards are registers. */ | 251 | reg += 0x40; /* 0x40 upwards are registers. */ |
252 | outl(reg, emu->port + A_IOCFG); | 252 | outl(reg, emu->port + A_IOCFG); |
@@ -261,7 +261,7 @@ int snd_emu1010_fpga_read(struct snd_emu10k1 * emu, int reg, int *value) | |||
261 | /* Each Destination has one and only one Source, | 261 | /* Each Destination has one and only one Source, |
262 | * but one Source can feed any number of Destinations simultaneously. | 262 | * but one Source can feed any number of Destinations simultaneously. |
263 | */ | 263 | */ |
264 | int snd_emu1010_fpga_link_dst_src_write(struct snd_emu10k1 * emu, int dst, int src) | 264 | int snd_emu1010_fpga_link_dst_src_write(struct snd_emu10k1 * emu, u32 dst, u32 src) |
265 | { | 265 | { |
266 | snd_emu1010_fpga_write(emu, 0x00, ((dst >> 8) & 0x3f) ); | 266 | snd_emu1010_fpga_write(emu, 0x00, ((dst >> 8) & 0x3f) ); |
267 | snd_emu1010_fpga_write(emu, 0x01, (dst & 0x3f) ); | 267 | snd_emu1010_fpga_write(emu, 0x01, (dst & 0x3f) ); |