Update of /cvsroot/alsa/alsa-kernel/pci
In directory sc8-pr-cvs1:/tmp/cvs-serv23441

Modified Files:
        ens1370.c 
Log Message:
Added 'AC97 2ch->4ch Copy Switch' switch for ENS1373

Index: ens1370.c
===================================================================
RCS file: /cvsroot/alsa/alsa-kernel/pci/ens1370.c,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- ens1370.c   7 Jan 2003 13:35:35 -0000       1.33
+++ ens1370.c   17 Jan 2003 11:22:42 -0000      1.34
@@ -150,6 +150,9 @@
 #define ES_REG_STATUS  0x04    /* R/O: Interrupt/Chip select status register */
 #define   ES_INTR               (1<<31)                /* Interrupt is pending */
 #define   ES_1371_ST_AC97_RST  (1<<29)         /* CT5880 AC'97 Reset bit */
+#define   ES_1373_REAR_BIT27   (1<<27)         /* rear bits: 000 - front, 010 - 
+mirror, 101 - separate */
+#define   ES_1373_REAR_BIT26   (1<<26)
+#define   ES_1373_REAR_BIT24   (1<<24)
 #define   ES_1373_GPIO_INT_EN(o)(((o)&0x0f)<<20)/* GPIO [3:0] pins - interrupt enable 
*/
 #define   ES_1373_SPDIF_EN     (1<<18)         /* SPDIF enable */
 #define   ES_1373_SPDIF_TEST   (1<<17)         /* SPDIF test */
@@ -1197,7 +1200,11 @@
        if (err < 0)
                return err;
 
+#ifdef CHIP1370
        snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_ensoniq_playback2_ops);
+#else
+       snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_ensoniq_playback1_ops);
+#endif
        snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_ensoniq_capture_ops);
 
        pcm->private_data = ensoniq;
@@ -1239,8 +1246,11 @@
        if (err < 0)
                return err;
 
+#ifdef CHIP1370
        snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_ensoniq_playback1_ops);
-
+#else
+       snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_ensoniq_playback2_ops);
+#endif
        pcm->private_data = ensoniq;
        pcm->private_free = snd_ensoniq_pcm_free2;
        pcm->info_flags = 0;
@@ -1422,6 +1432,53 @@
 static snd_kcontrol_new_t snd_es1371_mixer_spdif __devinitdata =
 ES1371_SPDIF("IEC958 Playback Switch");
 
+static int snd_es1373_rear_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
+{
+        uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
+        uinfo->count = 1;
+        uinfo->value.integer.min = 0;
+        uinfo->value.integer.max = 1;
+        return 0;
+}
+
+static int snd_es1373_rear_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * 
+ucontrol)
+{
+       ensoniq_t *ensoniq = snd_kcontrol_chip(kcontrol);
+       int val = 0;
+       
+       spin_lock_irq(&ensoniq->reg_lock);
+       if ((ensoniq->cssr & 
+(ES_1373_REAR_BIT27|ES_1373_REAR_BIT26|ES_1373_REAR_BIT24)) == ES_1373_REAR_BIT26)
+               val = 1;
+       ucontrol->value.integer.value[0] = val;
+       spin_unlock_irq(&ensoniq->reg_lock);
+       return 0;
+}
+
+static int snd_es1373_rear_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * 
+ucontrol)
+{
+       ensoniq_t *ensoniq = snd_kcontrol_chip(kcontrol);
+       unsigned int nval1;
+       int change;
+       
+       nval1 = ucontrol->value.integer.value[0] ? ES_1373_REAR_BIT26 : 
+(ES_1373_REAR_BIT27|ES_1373_REAR_BIT24);
+       spin_lock_irq(&ensoniq->reg_lock);
+       change = (ensoniq->cssr & 
+(ES_1373_REAR_BIT27|ES_1373_REAR_BIT26|ES_1373_REAR_BIT24)) != nval1;
+       ensoniq->cssr &= ~(ES_1373_REAR_BIT27|ES_1373_REAR_BIT26|ES_1373_REAR_BIT24);
+       ensoniq->cssr |= nval1;
+       outl(ensoniq->cssr, ES_REG(ensoniq, STATUS));
+       spin_unlock_irq(&ensoniq->reg_lock);
+       return change;
+}
+
+static snd_kcontrol_new_t snd_ens1373_rear __devinitdata =
+{
+       .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,
+       .name =         "AC97 2ch->4ch Copy Switch",
+       .info =         snd_es1373_rear_info,
+       .get =          snd_es1373_rear_get,
+       .put =          snd_es1373_rear_put,
+};
+
 static void snd_ensoniq_mixer_free_ac97(ac97_t *ac97)
 {
        ensoniq_t *ensoniq = snd_magic_cast(ensoniq_t, ac97->private_data, return);
@@ -1432,7 +1489,7 @@
        unsigned short vid;             /* vendor ID */
        unsigned short did;             /* device ID */
        unsigned char rev;              /* revision */
-} __devinitdata es1371_spdif_present[] = {
+} es1371_spdif_present[] __devinitdata = {
        { .vid = PCI_VENDOR_ID_ENSONIQ, .did = PCI_DEVICE_ID_ENSONIQ_CT5880, .rev = 
CT5880REV_CT5880_C },
        { .vid = PCI_VENDOR_ID_ENSONIQ, .did = PCI_DEVICE_ID_ENSONIQ_CT5880, .rev = 
CT5880REV_CT5880_D },
        { .vid = PCI_VENDOR_ID_ENSONIQ, .did = PCI_DEVICE_ID_ENSONIQ_CT5880, .rev = 
CT5880REV_CT5880_E },
@@ -1484,6 +1541,12 @@
                        snd_ctl_add(card, kctl);
                        break;
                }
+       if (ensoniq->u.es1371.ac97->ext_id & AC97_EI_SDAC) {
+               /* mirror rear to front speakers */
+               ensoniq->cssr &= ~(ES_1373_REAR_BIT27|ES_1373_REAR_BIT24);
+               ensoniq->cssr |= ES_1373_REAR_BIT26;
+               snd_ctl_add(card, snd_ctl_new1(&snd_ens1373_rear, ensoniq));
+       }
        return 0;
 }
 



-------------------------------------------------------
This SF.NET email is sponsored by: Thawte.com
Understand how to protect your customers personal information by implementing
SSL on your Apache Web Server. Click here to get our FREE Thawte Apache 
Guide: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0029en
_______________________________________________
Alsa-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-cvslog

Reply via email to