[ALSA] cmipci: remove invalid channels constraint
[powerpc.git] / sound / pci / cmipci.c
index cc0977a..6d3a0ab 100644 (file)
@@ -424,7 +424,6 @@ struct cmipci {
 
        int chip_version;
        int max_channels;
-       unsigned int has_dual_dac: 1;
        unsigned int can_ac3_sw: 1;
        unsigned int can_ac3_hw: 1;
        unsigned int can_multi_ch: 1;
@@ -1515,7 +1514,6 @@ static int snd_cmipci_playback_open(struct snd_pcm_substream *substream)
        if ((err = open_device_check(cm, CM_OPEN_PLAYBACK, substream)) < 0)
                return err;
        runtime->hw = snd_cmipci_playback;
-       runtime->hw.channels_max = cm->max_channels;
        snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_SIZE, 0, 0x10000);
        cm->dig_pcm_status = cm->dig_status;
        return 0;
@@ -2643,7 +2641,6 @@ static void __devinit query_chip(struct cmipci *cm)
                        break;
                }
                cm->max_channels = 2;
-               cm->has_dual_dac = 1;
        } else {
                if (detect & CM_CHIP_039) {
                        cm->chip_version = 39;
@@ -2659,7 +2656,6 @@ static void __devinit query_chip(struct cmipci *cm)
                        cm->max_channels = 6;
                }
                cm->can_ac3_hw = 1;
-               cm->has_dual_dac = 1;
                cm->can_multi_ch = 1;
        }
 }
@@ -2821,7 +2817,7 @@ static int __devinit snd_cmipci_create(struct snd_card *card, struct pci_dev *pc
        static struct snd_device_ops ops = {
                .dev_free =     snd_cmipci_dev_free,
        };
-       unsigned int val = 0;
+       unsigned int val;
        long iomidi;
        int integrated_midi = 0;
        int pcm_index, pcm_spdif_index;
@@ -2923,18 +2919,46 @@ static int __devinit snd_cmipci_create(struct snd_card *card, struct pci_dev *pc
                break;
        }
 
-       sprintf(card->shortname, "C-Media PCI %s", card->driver);
-       sprintf(card->longname, "%s (model %d) at 0x%lx, irq %i",
-               card->shortname,
-               cm->chip_version,
-               cm->iobase,
-               cm->irq);
+       sprintf(card->shortname, "C-Media %s", card->driver);
+       if (cm->chip_version < 68) {
+               val = pci->device < 0x110 ? 8338 : 8738;
+               sprintf(card->longname,
+                       "C-Media CMI%d (model %d) at 0x%lx, irq %i",
+                       val, cm->chip_version, cm->iobase, cm->irq);
+       } else {
+               switch (snd_cmipci_read_b(cm, CM_REG_INT_HLDCLR + 3) & 0x03) {
+               case 0:
+                       val = 8769;
+                       break;
+               case 2:
+                       val = 8762;
+                       break;
+               default:
+                       switch ((pci->subsystem_vendor << 16) |
+                               pci->subsystem_device) {
+                       case 0x13f69761:
+                       case 0x584d3741:
+                       case 0x584d3751:
+                       case 0x584d3761:
+                       case 0x584d3771:
+                       case 0x72848384:
+                               val = 8770;
+                               break;
+                       default:
+                               val = 8768;
+                               break;
+                       }
+               }
+               sprintf(card->longname, "C-Media CMI%d at 0x%lx, irq %i",
+                       val, cm->iobase, cm->irq);
+       }
 
        if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, cm, &ops)) < 0) {
                snd_cmipci_free(cm);
                return err;
        }
 
+       val = 0;
        if (cm->chip_version > 33 && mpu_port[dev] == 1) {
                val = snd_cmipci_read_b(cm, CM_REG_MPU_PCI + 1);
                if (val != 0x00 && val != 0xff) {
@@ -2975,11 +2999,9 @@ static int __devinit snd_cmipci_create(struct snd_card *card, struct pci_dev *pc
        if ((err = snd_cmipci_pcm_new(cm, pcm_index)) < 0)
                return err;
        pcm_index++;
-       if (cm->has_dual_dac) {
-               if ((err = snd_cmipci_pcm2_new(cm, pcm_index)) < 0)
-                       return err;
-               pcm_index++;
-       }
+       if ((err = snd_cmipci_pcm2_new(cm, pcm_index)) < 0)
+               return err;
+       pcm_index++;
        if (cm->can_ac3_hw || cm->can_ac3_sw) {
                pcm_spdif_index = pcm_index;
                if ((err = snd_cmipci_pcm_spdif_new(cm, pcm_index)) < 0)