Commit f7e40ac9 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] cmpci cleanup

cmpci probing partially cleaned up in preparation to mpu401 fixes
Signed-off-by: default avatarAl Viro <viro@parcelfarce.linux.org.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 549b4360
......@@ -3000,6 +3000,7 @@ static int __devinit cm_probe(struct pci_dev *pcidev, const struct pci_device_id
mm_segment_t fs;
int i, val, ret;
unsigned char reg_mask;
int timeout;
struct {
unsigned short deviceid;
char *devicename;
......@@ -3184,54 +3185,50 @@ static int __devinit cm_probe(struct pci_dev *pcidev, const struct pci_device_id
}
#endif
#ifdef CONFIG_SOUND_CMPCI_MIDI
switch (s->iomidi) {
case 0x330:
reg_mask = 0;
break;
case 0x320:
reg_mask = 0x20;
break;
case 0x310:
reg_mask = 0x40;
break;
case 0x300:
reg_mask = 0x60;
break;
default:
s->iomidi = 0;
goto skip_mpu;
}
/* disable MPU-401 */
maskb(s->iobase + CODEC_CMI_FUNCTRL1, ~0x04, 0);
s->mpu_data.name = "cmpci mpu";
s->mpu_data.io_base = s->iomidi;
s->mpu_data.irq = -s->irq; // tell mpu401 to share irq
if (probe_mpu401(&s->mpu_data))
if (probe_mpu401(&s->mpu_data)) {
s->iomidi = 0;
if (s->iomidi) {
/* set IO based at 0x330 */
switch (s->iomidi) {
case 0x330:
reg_mask = 0;
break;
case 0x320:
reg_mask = 0x20;
break;
case 0x310:
reg_mask = 0x40;
break;
case 0x300:
reg_mask = 0x60;
break;
default:
s->iomidi = 0;
goto skip_mpu;
}
maskb(s->iobase + CODEC_CMI_LEGACY_CTRL + 3, ~0x60, reg_mask);
/* enable MPU-401 */
maskb(s->iobase + CODEC_CMI_FUNCTRL1, ~0, 0x04);
/* clear all previously received interrupt */
for (timeout = 900000; timeout > 0; timeout--) {
if ((inb(s->iomidi + 1) && 0x80) == 0)
inb(s->iomidi);
else
break;
}
maskb(s->iobase + CODEC_CMI_LEGACY_CTRL + 3, ~0x60, reg_mask);
/* enable MPU-401 */
if (s->iomidi) {
int timeout;
maskb(s->iobase + CODEC_CMI_FUNCTRL1, ~0, 0x04);
/* clear all previously received interrupt */
for (timeout = 900000; timeout > 0; timeout--) {
if ((inb(s->iomidi + 1) && 0x80) == 0)
inb(s->iomidi);
else
break;
}
if (!probe_mpu401(&s->mpu_data)) {
s->iomidi = 0;
maskb(s->iobase + CODEC_CMI_FUNCTRL1, ~0, 0x04);
} else {
attach_mpu401(&s->mpu_data, THIS_MODULE);
s->midi_devc = s->mpu_data.slots[1];
}
}
}
if (!probe_mpu401(&s->mpu_data)) {
s->iomidi = 0;
maskb(s->iobase + CODEC_CMI_FUNCTRL1, ~0, 0x04);
} else {
attach_mpu401(&s->mpu_data, THIS_MODULE);
s->midi_devc = s->mpu_data.slots[1];
}
skip_mpu:
#endif
#ifdef CONFIG_SOUND_CMPCI_JOYSTICK
/* enable joystick */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment