]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[ALSA] snd-emu10k1:Support for ADAT and S/PDIF.
authorJames Courtier-Dutton <James@superbug.co.uk>
Mon, 23 Jul 2007 19:30:22 +0000 (20:30 +0100)
committerJaroslav Kysela <perex@perex.cz>
Tue, 16 Oct 2007 13:57:53 +0000 (15:57 +0200)
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>
sound/pci/emu10k1/emu10k1_main.c
sound/pci/emu10k1/emumixer.c

index 800d6348de718f468c8a21c133e31e2629274064..b985e660c60bedebedf883e8e34f3b4a57a2da6f 100644 (file)
@@ -872,8 +872,8 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 * emu)
        snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg );
        snd_printk(KERN_INFO "emu1010: Card options=0x%x\n",reg);
        snd_emu1010_fpga_read(emu, EMU_HANA_OPTICAL_TYPE, &tmp ); 
-       /* ADAT input. */
-       snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, 0x01 );
+       /* Optical -> ADAT I/O  */
+       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 );
        /* Set no attenuation on Audio Dock pads. */
        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;
 
        /* 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 */
        snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, 0x0); /* Mute all */
index 6c26319430d7046472c00f8333ad5d31d573b702..692b871bff570422737185b85ef39134499784b2 100644 (file)
@@ -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,
                                          struct snd_ctl_elem_info *uinfo)
 {
-       static char *texts[2] = {
-               "44100", "48000"
+       static char *texts[4] = {
+               "44100", "48000", "SPDIF", "ADAT"
        };
-
+               
        uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
        uinfo->count = 1;
-       uinfo->value.enumerated.items = 2;
-       if (uinfo->value.enumerated.item > 1)
-                uinfo->value.enumerated.item = 1;
+       uinfo->value.enumerated.items = 4;
+       if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
+               uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
        strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
        return 0;
+       
+       
 }
 
 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 */
                        snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE );
                        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;