[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>
This commit is contained in:
parent
aaccf54f63
commit
edec7bbb22
|
@ -872,8 +872,8 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu)
|
||||||
snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, ® );
|
snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, ® );
|
||||||
snd_printk(KERN_INFO "emu1010: Card options=0x%x\n",reg);
|
snd_printk(KERN_INFO "emu1010: Card options=0x%x\n",reg);
|
||||||
snd_emu1010_fpga_read(emu, EMU_HANA_OPTICAL_TYPE, &tmp );
|
snd_emu1010_fpga_read(emu, EMU_HANA_OPTICAL_TYPE, &tmp );
|
||||||
/* ADAT input. */
|
/* Optical -> ADAT I/O */
|
||||||
snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, 0x01 );
|
snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, EMU_HANA_OPTICAL_IN_ADAT | EMU_HANA_OPTICAL_OUT_ADAT );
|
||||||
snd_emu1010_fpga_read(emu, EMU_HANA_ADC_PADS, &tmp );
|
snd_emu1010_fpga_read(emu, EMU_HANA_ADC_PADS, &tmp );
|
||||||
/* Set no attenuation on Audio Dock pads. */
|
/* Set no attenuation on Audio Dock pads. */
|
||||||
snd_emu1010_fpga_write(emu, EMU_HANA_ADC_PADS, 0x00 );
|
snd_emu1010_fpga_write(emu, EMU_HANA_ADC_PADS, 0x00 );
|
||||||
|
@ -1150,7 +1150,7 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu)
|
||||||
emu->emu1010.output_source[23] = 28;
|
emu->emu1010.output_source[23] = 28;
|
||||||
|
|
||||||
/* TEMP: Select SPDIF in/out */
|
/* TEMP: Select SPDIF in/out */
|
||||||
snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, 0x0); /* Output spdif */
|
//snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, 0x0); /* Output spdif */
|
||||||
|
|
||||||
/* TEMP: Select 48kHz SPDIF out */
|
/* TEMP: Select 48kHz SPDIF out */
|
||||||
snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, 0x0); /* Mute all */
|
snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, 0x0); /* Mute all */
|
||||||
|
|
|
@ -501,17 +501,19 @@ static struct snd_kcontrol_new snd_emu1010_dac_pads[] __devinitdata = {
|
||||||
static int snd_emu1010_internal_clock_info(struct snd_kcontrol *kcontrol,
|
static int snd_emu1010_internal_clock_info(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_info *uinfo)
|
struct snd_ctl_elem_info *uinfo)
|
||||||
{
|
{
|
||||||
static char *texts[2] = {
|
static char *texts[4] = {
|
||||||
"44100", "48000"
|
"44100", "48000", "SPDIF", "ADAT"
|
||||||
};
|
};
|
||||||
|
|
||||||
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
|
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
|
||||||
uinfo->count = 1;
|
uinfo->count = 1;
|
||||||
uinfo->value.enumerated.items = 2;
|
uinfo->value.enumerated.items = 4;
|
||||||
if (uinfo->value.enumerated.item > 1)
|
if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
|
||||||
uinfo->value.enumerated.item = 1;
|
uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
|
||||||
strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
|
strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int snd_emu1010_internal_clock_get(struct snd_kcontrol *kcontrol,
|
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,
|
||||||
/* Unmute all */
|
/* Unmute all */
|
||||||
snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE );
|
snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 2: /* Take clock from S/PDIF IN */
|
||||||
|
/* Mute all */
|
||||||
|
snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_MUTE );
|
||||||
|
/* Default fallback clock 48kHz */
|
||||||
|
snd_emu1010_fpga_write(emu, EMU_HANA_DEFCLOCK, EMU_HANA_DEFCLOCK_48K );
|
||||||
|
/* Word Clock source, sync to S/PDIF input */
|
||||||
|
snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK,
|
||||||
|
EMU_HANA_WCLOCK_HANA_SPDIF_IN | EMU_HANA_WCLOCK_1X );
|
||||||
|
/* Set LEDs on Audio Dock */
|
||||||
|
snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2,
|
||||||
|
EMU_HANA_DOCK_LEDS_2_EXT | EMU_HANA_DOCK_LEDS_2_LOCK );
|
||||||
|
/* FIXME: We should set EMU_HANA_DOCK_LEDS_2_LOCK only when clock signal is present and valid */
|
||||||
|
/* Allow DLL to settle */
|
||||||
|
msleep(10);
|
||||||
|
/* Unmute all */
|
||||||
|
snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
/* Take clock from ADAT IN */
|
||||||
|
/* Mute all */
|
||||||
|
snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_MUTE );
|
||||||
|
/* Default fallback clock 48kHz */
|
||||||
|
snd_emu1010_fpga_write(emu, EMU_HANA_DEFCLOCK, EMU_HANA_DEFCLOCK_48K );
|
||||||
|
/* Word Clock source, sync to ADAT input */
|
||||||
|
snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK,
|
||||||
|
EMU_HANA_WCLOCK_HANA_ADAT_IN | EMU_HANA_WCLOCK_1X );
|
||||||
|
/* Set LEDs on Audio Dock */
|
||||||
|
snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_LEDS_2, EMU_HANA_DOCK_LEDS_2_EXT | EMU_HANA_DOCK_LEDS_2_LOCK );
|
||||||
|
/* FIXME: We should set EMU_HANA_DOCK_LEDS_2_LOCK only when clock signal is present and valid */
|
||||||
|
/* Allow DLL to settle */
|
||||||
|
msleep(10);
|
||||||
|
/* Unmute all */
|
||||||
|
snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE );
|
||||||
|
|
||||||
|
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return change;
|
return change;
|
||||||
|
|
Loading…
Reference in a new issue