浏览代码

[ALSA] cmipci: check that the legacy MIDI port works

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>
Clemens Ladisch 18 年之前
父节点
当前提交
88039815d8
共有 1 个文件被更改,包括 7 次插入0 次删除
  1. 7 0
      sound/pci/cmipci.c

+ 7 - 0
sound/pci/cmipci.c

@@ -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);
 			snd_cmipci_write(cm, CM_REG_LEGACY_CTRL, val);
 			/* enable UART */
 			/* enable UART */
 			snd_cmipci_set_bit(cm, CM_REG_FUNCTRL1, CM_UART_EN);
 			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;
+			}
 		}
 		}
 	}
 	}