[ALSA] cmipci: check that the legacy MIDI port works
authorClemens Ladisch <clemens@ladisch.de>
Mon, 3 Sep 2007 07:56:23 +0000 (09:56 +0200)
committerJaroslav Kysela <perex@perex.cz>
Tue, 16 Oct 2007 13:59:45 +0000 (15:59 +0200)
Check that the UART_EN bit actually enabled the MPU-401 port.
Apparently, C-Media thinks that it is a good idea to be paranoid here.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
sound/pci/cmipci.c

index fdc4615ea0e7a8ed3c1ba24af1a66afea77e4ab2..9149d00d1ad5354e698a6ae6555c61b99243c089 100644 (file)
@@ -3012,6 +3012,13 @@ static int __devinit snd_cmipci_create(struct snd_card *card, struct pci_dev *pc
                        snd_cmipci_write(cm, CM_REG_LEGACY_CTRL, val);
                        /* enable UART */
                        snd_cmipci_set_bit(cm, CM_REG_FUNCTRL1, CM_UART_EN);
+                       if (inb(iomidi + 1) == 0xff) {
+                               snd_printk(KERN_ERR "cannot enable MPU-401 port"
+                                          " at %#lx\n", iomidi);
+                               snd_cmipci_clear_bit(cm, CM_REG_FUNCTRL1,
+                                                    CM_UART_EN);
+                               iomidi = 0;
+                       }
                }
        }