diff options
author | James Courtier-Dutton <James@superbug.co.uk> | 2007-07-23 15:30:22 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2007-10-16 09:57:53 -0400 |
commit | edec7bbb22dafdab5f8eae4f049ad9d0f615abc4 (patch) | |
tree | 42d4bd8e1714d68b126a5266eb14e6f520e39ed7 /sound/pci/emu10k1 | |
parent | aaccf54f638dfd39ebd1220936b0ce261e5fced7 (diff) |
[ALSA] snd-emu10k1:Support for ADAT and S/PDIF.
Patch submitted by Ctirad Fertr
<c.fertr@volny.cz>
Signed-off-by: James Courtier-Dutton <James@superbug.co.uk>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pci/emu10k1')
-rw-r--r-- | sound/pci/emu10k1/emu10k1_main.c | 6 | ||||
-rw-r--r-- | sound/pci/emu10k1/emumixer.c | 52 |
2 files changed, 49 insertions, 9 deletions
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c index 800d6348de71..b985e660c60b 100644 --- a/sound/pci/emu10k1/emu10k1_main.c +++ b/sound/pci/emu10k1/emu10k1_main.c | |||
@@ -872,8 +872,8 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu) | |||
872 | snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, ® ); | 872 | snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, ® ); |
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 | /* ADAT input. */ | 875 | /* Optical -> ADAT I/O */ |
876 | snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, 0x01 ); | 876 | snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, EMU_HANA_OPTICAL_IN_ADAT | EMU_HANA_OPTICAL_OUT_ADAT ); |
877 | snd_emu1010_fpga_read(emu, EMU_HANA_ADC_PADS, &tmp ); | 877 | snd_emu1010_fpga_read(emu, EMU_HANA_ADC_PADS, &tmp ); |
878 | /* Set no attenuation on Audio Dock pads. */ | 878 | /* Set no attenuation on Audio Dock pads. */ |
879 | snd_emu1010_fpga_write(emu, EMU_HANA_ADC_PADS, 0x00 ); | 879 | snd_emu1010_fpga_write(emu, EMU_HANA_ADC_PADS, 0x00 ); |
@@ -1150,7 +1150,7 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu) | |||
1150 | emu->emu1010.output_source[23] = 28; | 1150 | emu->emu1010.output_source[23] = 28; |
1151 | 1151 | ||
1152 | /* TEMP: Select SPDIF in/out */ | 1152 | /* TEMP: Select SPDIF in/out */ |
1153 | snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, 0x0); /* Output spdif */ | 1153 | //snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, 0x0); /* Output spdif */ |
1154 | 1154 | ||
1155 | /* TEMP: Select 48kHz SPDIF out */ | 1155 | /* TEMP: Select 48kHz SPDIF out */ |
1156 | snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, 0x0); /* Mute all */ | 1156 | snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, 0x0); /* Mute all */ |
diff --git a/sound/pci/emu10k1/emumixer.c b/sound/pci/emu10k1/emumixer.c index 6c26319430d7..692b871bff57 100644 --- a/sound/pci/emu10k1/emumixer.c +++ b/sound/pci/emu10k1/emumixer.c | |||
@@ -501,17 +501,19 @@ static struct snd_kcontrol_new snd_emu1010_dac_pads[] __devinitdata = { | |||
501 | static int snd_emu1010_internal_clock_info(struct snd_kcontrol *kcontrol, | 501 | static int snd_emu1010_internal_clock_info(struct snd_kcontrol *kcontrol, |
502 | struct snd_ctl_elem_info *uinfo) | 502 | struct snd_ctl_elem_info *uinfo) |
503 | { | 503 | { |
504 | static char *texts[2] = { | 504 | static char *texts[4] = { |
505 | "44100", "48000" | 505 | "44100", "48000", "SPDIF", "ADAT" |
506 | }; | 506 | }; |
507 | 507 | ||
508 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 508 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
509 | uinfo->count = 1; | 509 | uinfo->count = 1; |
510 | uinfo->value.enumerated.items = 2; | 510 | uinfo->value.enumerated.items = 4; |
511 | if (uinfo->value.enumerated.item > 1) | 511 | if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) |
512 | uinfo->value.enumerated.item = 1; | 512 | uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; |
513 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | 513 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
514 | return 0; | 514 | return 0; |
515 | |||
516 | |||
515 | } | 517 | } |
516 | 518 | ||
517 | static int snd_emu1010_internal_clock_get(struct snd_kcontrol *kcontrol, | 519 | static int snd_emu1010_internal_clock_get(struct snd_kcontrol *kcontrol, |
@@ -569,6 +571,44 @@ static int snd_emu1010_internal_clock_put(struct snd_kcontrol *kcontrol, | |||
569 | /* Unmute all */ | 571 | /* Unmute all */ |
570 | snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE ); | 572 | snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE ); |
571 | break; | 573 | break; |
574 | |||
575 | case 2: /* Take clock from S/PDIF IN */ | ||
576 | /* Mute all */ | ||
577 | snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_MUTE ); | ||
578 | /* Default fallback clock 48kHz */ | ||
579 | snd_emu1010_fpga_write(emu, EMU_HANA_DEFCLOCK, EMU_HANA_DEFCLOCK_48K ); | ||
580 | /* Word Clock source, sync to S/PDIF input */ | ||
581 | snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, | ||
582 | EMU_HANA_WCLOCK_HANA_SPDIF_IN | EMU_HANA_WCLOCK_1X ); | ||
583 | /* Set LEDs on Audio Dock */ | ||
584 | snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2, | ||
585 | EMU_HANA_DOCK_LEDS_2_EXT | EMU_HANA_DOCK_LEDS_2_LOCK ); | ||
586 | /* FIXME: We should set EMU_HANA_DOCK_LEDS_2_LOCK only when clock signal is present and valid */ | ||
587 | /* Allow DLL to settle */ | ||
588 | msleep(10); | ||
589 | /* Unmute all */ | ||
590 | snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE ); | ||
591 | break; | ||
592 | |||
593 | case 3: | ||
594 | /* Take clock from ADAT IN */ | ||
595 | /* Mute all */ | ||
596 | snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_MUTE ); | ||
597 | /* Default fallback clock 48kHz */ | ||
598 | snd_emu1010_fpga_write(emu, EMU_HANA_DEFCLOCK, EMU_HANA_DEFCLOCK_48K ); | ||
599 | /* Word Clock source, sync to ADAT input */ | ||
600 | snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, | ||
601 | EMU_HANA_WCLOCK_HANA_ADAT_IN | EMU_HANA_WCLOCK_1X ); | ||
602 | /* Set LEDs on Audio Dock */ | ||
603 | snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2, EMU_HANA_DOCK_LEDS_2_EXT | EMU_HANA_DOCK_LEDS_2_LOCK ); | ||
604 | /* FIXME: We should set EMU_HANA_DOCK_LEDS_2_LOCK only when clock signal is present and valid */ | ||
605 | /* Allow DLL to settle */ | ||
606 | msleep(10); | ||
607 | /* Unmute all */ | ||
608 | snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE ); | ||
609 | |||
610 | |||
611 | break; | ||
572 | } | 612 | } |
573 | } | 613 | } |
574 | return change; | 614 | return change; |