]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - sound/pci/ca0106/ca0106_main.c
PCI: Change all drivers to use pci_device->revision
[linux-2.6-omap-h63xx.git] / sound / pci / ca0106 / ca0106_main.c
index f61f052f6d14d01cb88933c014cc9a945acbaba8..9fd7b8a5b75ec00ae24675789805debdc92849bc 100644 (file)
@@ -775,7 +775,6 @@ static int snd_ca0106_pcm_trigger_playback(struct snd_pcm_substream *substream,
        struct snd_ca0106_pcm *epcm;
        int channel;
        int result = 0;
-       struct list_head *pos;
         struct snd_pcm_substream *s;
        u32 basic = 0;
        u32 extended = 0;
@@ -790,8 +789,7 @@ static int snd_ca0106_pcm_trigger_playback(struct snd_pcm_substream *substream,
                running=0;
                break;
        }
-        snd_pcm_group_for_each(pos, substream) {
-                s = snd_pcm_group_substream_entry(pos);
+        snd_pcm_group_for_each_entry(s, substream) {
                runtime = s->runtime;
                epcm = runtime->private_data;
                channel = epcm->channel_id;
@@ -1295,13 +1293,12 @@ static int __devinit snd_ca0106_create(int dev, struct snd_card *card,
        }
 
        pci_set_master(pci);
-       /* read revision & serial */
-       pci_read_config_byte(pci, PCI_REVISION_ID, &chip->revision);
+       /* read serial */
        pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &chip->serial);
        pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &chip->model);
 #if 1
        printk(KERN_INFO "snd-ca0106: Model %04x Rev %08x Serial %08x\n", chip->model,
-              chip->revision, chip->serial);
+              pci->revision, chip->serial);
 #endif
        strcpy(card->driver, "CA0106");
        strcpy(card->shortname, "CA0106");
@@ -1382,7 +1379,6 @@ static int __devinit snd_ca0106_create(int dev, struct snd_card *card,
        snd_ca0106_ptr_write(chip, SPDIF_SELECT1, 0, 0xf);
        snd_ca0106_ptr_write(chip, SPDIF_SELECT2, 0, 0x000f0000); /* 0x0b000000 for digital, 0x000b0000 for analog, from win2000 drivers. Use 0x000f0000 for surround71 */
        chip->spdif_enable = 0; /* Set digital SPDIF output off */
-       chip->capture_source = 3; /* Set CAPTURE_SOURCE */
        //snd_ca0106_ptr_write(chip, 0x45, 0, 0); /* Analogue out */
        //snd_ca0106_ptr_write(chip, 0x45, 0, 0xf00); /* Digital out */
 
@@ -1402,8 +1398,22 @@ static int __devinit snd_ca0106_create(int dev, struct snd_card *card,
                snd_ca0106_ptr_write(chip, PLAYBACK_VOLUME1, ch, 0xffffffff); /* Mute */
                snd_ca0106_ptr_write(chip, PLAYBACK_VOLUME2, ch, 0xffffffff); /* Mute */
        }
-        snd_ca0106_ptr_write(chip, CAPTURE_SOURCE, 0x0, 0x333300e4); /* Select MIC, Line in, TAD in, AUX in */
-       chip->capture_source = 3; /* Set CAPTURE_SOURCE */
+       if (chip->details->i2c_adc == 1) {
+               /* Select MIC, Line in, TAD in, AUX in */
+               snd_ca0106_ptr_write(chip, CAPTURE_SOURCE, 0x0, 0x333300e4);
+               /* Default to CAPTURE_SOURCE to i2s in */
+               chip->capture_source = 3;
+       } else if (chip->details->ac97 == 1) {
+               /* Default to AC97 in */
+               snd_ca0106_ptr_write(chip, CAPTURE_SOURCE, 0x0, 0x444400e4);
+               /* Default to CAPTURE_SOURCE to AC97 in */
+               chip->capture_source = 4;
+       } else {
+               /* Select MIC, Line in, TAD in, AUX in */
+               snd_ca0106_ptr_write(chip, CAPTURE_SOURCE, 0x0, 0x333300e4);
+               /* Default to Set CAPTURE_SOURCE to i2s in */
+               chip->capture_source = 3;
+       }
 
         if (chip->details->gpio_type == 2) { /* The SB0438 use GPIO differently. */
                /* FIXME: Still need to find out what the other GPIO bits do. E.g. For digital spdif out. */
@@ -1605,6 +1615,8 @@ static int __devinit snd_ca0106_probe(struct pci_dev *pci,
        snd_ca0106_proc_init(chip);
 #endif
 
+       snd_card_set_dev(card, &pci->dev);
+
        if ((err = snd_card_register(card)) < 0) {
                snd_card_free(card);
                return err;