aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/cmipci.c
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2007-08-24 03:18:04 -0400
committerJaroslav Kysela <perex@perex.cz>2007-10-16 09:59:27 -0400
commitc9116ae45bd10eabe1e5cf88798092e184d8dbc2 (patch)
tree1931f6fb0296626bc8883e7e38d8b1d988d017fa /sound/pci/cmipci.c
parentdfe495d0a51e20325b51760f34a2f53bfe1f3b52 (diff)
[ALSA] cmipci: make the test for integrated MIDI port address more robust
Unused bytes in the I/O register range are likely to have the value 0x00 instead of 0xff, so test against both values when checking for the presence of the integrated MIDI port. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pci/cmipci.c')
-rw-r--r--sound/pci/cmipci.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
index 9d394c7c221d..6021e5c402ea 100644
--- a/sound/pci/cmipci.c
+++ b/sound/pci/cmipci.c
@@ -2827,7 +2827,7 @@ static int __devinit snd_cmipci_create(struct snd_card *card, struct pci_dev *pc
2827 }; 2827 };
2828 unsigned int val = 0; 2828 unsigned int val = 0;
2829 long iomidi; 2829 long iomidi;
2830 int integrated_midi; 2830 int integrated_midi = 0;
2831 int pcm_index, pcm_spdif_index; 2831 int pcm_index, pcm_spdif_index;
2832 static struct pci_device_id intel_82437vx[] = { 2832 static struct pci_device_id intel_82437vx[] = {
2833 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82437VX) }, 2833 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82437VX) },
@@ -2939,11 +2939,14 @@ static int __devinit snd_cmipci_create(struct snd_card *card, struct pci_dev *pc
2939 return err; 2939 return err;
2940 } 2940 }
2941 2941
2942 integrated_midi = cm->chip_version > 33 && 2942 if (cm->chip_version > 33 && mpu_port[dev] == 1) {
2943 snd_cmipci_read_b(cm, CM_REG_MPU_PCI + 1) != 0xff; 2943 val = snd_cmipci_read_b(cm, CM_REG_MPU_PCI + 1);
2944 if (integrated_midi && mpu_port[dev] == 1) 2944 if (val != 0x00 && val != 0xff) {
2945 iomidi = cm->iobase + CM_REG_MPU_PCI; 2945 iomidi = cm->iobase + CM_REG_MPU_PCI;
2946 else { 2946 integrated_midi = 1;
2947 }
2948 }
2949 if (!integrated_midi) {
2947 iomidi = mpu_port[dev]; 2950 iomidi = mpu_port[dev];
2948 switch (iomidi) { 2951 switch (iomidi) {
2949 case 0x320: val = CM_VMPU_320; break; 2952 case 0x320: val = CM_VMPU_320; break;