Skip to contentSkip to conversation

au88x0_mpu401 init / fail first open

PATCH Alan Horstmann 3 participants 11 messages May 5, 2006 – May 18, 2006 1 message not in the archive Kbuild

lore
Share & tools
lore
#0 lore raw

I've noticed that au88x0 has an error on the first use of the midi port only. With 1.0.11 midi play continues OK anyway; with the later 'fix-hang' patch it results in failled I/O.

Sprinkling with printks has enabled me to trace it. It seems that when the port is sent 'ENTER_UART' ACK (0xfe) can be read, but the following command does not result in ACK, even though on it's own it would. In its init, au88x0_mpu401 sends 'RESET' then 'ENTER_UART'. Subsequently, when playng midi, mpu401_uart attempts output_open and also sends 'RESET' and expects ACK -but 0xf9 is read instead. A second attempt to play is successful. During normal use, when the output is closed, 'RESET' is sent again, but not tested for ACK (which would fail) and the next output_open is sucessful.

Any comments?? A hacked diff is attached which shows the affected bits of code, and additional writes and reads in au88x0_mpu401 which demonstrate the behaviour. Result is: Temp1 0xfe, Temp2 0xfe, Temp3 0xf9, Temp4 0xfe, Temp5 0xf9.

To fix (though not necessarily the solution) either omit the 'ENTER_UART' in au88x0_mpu401, or add an extra 'RESET' afterwards.

Regards Alan

drivers/mpu401/mpu401_uart.c renamed from usr/share/alsa1.0.11/alsa-driver-1.0.11-orig/alsa-kernel/drivers/mpu401/mpu401_uart.c +24 -6
diff -ru /usr/share/alsa1.0.11/alsa-driver-1.0.11-orig/alsa-kernel/drivers/mpu401/mpu401_uart.c alsa-kernel/drivers/mpu401/mpu401_uart.c
@@ -204,23 +205,29 @@
 	}
 	mpu->write(mpu, cmd, MPU401C(mpu));
 	if (ack) {
+		printk("ACK\n");
 		ok = 0;
 		timeout = 10000;
 		while (!ok && timeout-- > 0) {
-			if (snd_mpu401_input_avail(mpu)) {
+			if (timeout == 5000)  printk("%i",timeout);
+//			if (snd_mpu401_input_avail(mpu)) {
+//				printk("InAv\n");
 				if (mpu->read(mpu, MPU401D(mpu)) == MPU401_ACK)
 					ok = 1;
-			}
+//			}
 		}
 		if (!ok && mpu->read(mpu, MPU401D(mpu)) == MPU401_ACK)
 			ok = 1;
 	} else {
 		ok = 1;
 	}
+	printk("OK %i \n", ok);
 	spin_unlock_irqrestore(&mpu->input_lock, flags);
-	if (! ok)
+	if (!ok) {
 		snd_printk("cmd: 0x%x failed at 0x%lx (status = 0x%x, data = 0x%x)\n", cmd, mpu->port, mpu->read(mpu, MPU401C(mpu)), mpu->read(mpu, MPU401D(mpu)));
+		return 1;
+	}
+	return 0;
 }
 
 /*
@@ -252,39 +266,53 @@
 	if (mpu->open_output && (err = mpu->open_output(mpu)) < 0)
 		return err;
 	if (! test_bit(MPU401_MODE_BIT_INPUT, &mpu->mode)) {
-		snd_mpu401_uart_cmd(mpu, MPU401_RESET, 1);
-		snd_mpu401_uart_cmd(mpu, MPU401_ENTER_UART, 1);
+//		snd_mpu401_uart_cmd(mpu, MPU401_RESET, 0);
+		if (snd_mpu401_uart_cmd(mpu, MPU401_RESET, 1))
+			goto error_out;
+		if (snd_mpu401_uart_cmd(mpu, MPU401_ENTER_UART, 1))
+			goto error_out;
 	}
 	mpu->substream_output = substream;
 	set_bit(MPU401_MODE_BIT_OUTPUT, &mpu->mode);
 	return 0;
+
+error_out:
+	if (mpu->open_output && mpu->close_output)
+		mpu->close_output(mpu);
+	return -EIO;
 }
 
 
 static int snd_mpu401_uart_output_close(struct snd_rawmidi_substream *substream)
 {
 	struct snd_mpu401 *mpu;
+	int err = 0;
 
 	mpu = substream->rmidi->private_data;
 	clear_bit(MPU401_MODE_BIT_OUTPUT, &mpu->mode);
 	mpu->substream_output = NULL;
 	if (! test_bit(MPU401_MODE_BIT_INPUT, &mpu->mode))
-		snd_mpu401_uart_cmd(mpu, MPU401_RESET, 0);
+		err = snd_mpu401_uart_cmd(mpu, MPU401_RESET, 0);
 	if (mpu->close_output)
 		mpu->close_output(mpu);
+	if (err)
+		return -EIO;
 	return 0;
 }
 
pci/au88x0/au88x0_mpu401.c renamed from usr/share/alsa1.0.11/alsa-driver-1.0.11-orig/alsa-kernel/pci/au88x0/au88x0_mpu401.c +21 -0
diff -ru /usr/share/alsa1.0.11/alsa-driver-1.0.11-orig/alsa-kernel/pci/au88x0/au88x0_mpu401.c alsa-kernel/pci/au88x0/au88x0_mpu401.c
@@ -65,24 +65,45 @@
 	hwwrite(vortex->mmio, VORTEX_CTRL, temp);
 #endif
 	/* Mpu401UartInit() */
+	printk("401 init");
 	mode = 1;
 	temp = hwread(vortex->mmio, VORTEX_CTRL2) & 0xffff00cf;
 	temp |= (MIDI_CLOCK_DIV << 8) | ((mode >> 24) & 0xff) << 4;
 	hwwrite(vortex->mmio, VORTEX_CTRL2, temp);
 	hwwrite(vortex->mmio, VORTEX_MIDI_CMD, MPU401_RESET);
+
+	temp = hwread(vortex->mmio, VORTEX_MIDI_DATA);
+	printk("Temp1 0x%x\n", temp);
+
 	/* Set some kind of mode */
 	if (mode)
 		hwwrite(vortex->mmio, VORTEX_MIDI_CMD, MPU401_ENTER_UART);
 
 	/* Check if anything is OK. */
 	temp = hwread(vortex->mmio, VORTEX_MIDI_DATA);
+	printk("Temp2 0x%x\n", temp);
 	if (temp != MPU401_ACK /*0xfe */ ) {
 		printk(KERN_ERR "midi port doesn't acknowledge!\n");
 		return -ENODEV;
 	}
+
+	hwwrite(vortex->mmio, VORTEX_MIDI_CMD, MPU401_RESET);
+	temp = hwread(vortex->mmio, VORTEX_MIDI_DATA);
+	printk("Temp3 0x%x\n", temp);
+
+	hwwrite(vortex->mmio, VORTEX_MIDI_CMD, MPU401_ENTER_UART);
+	temp = hwread(vortex->mmio, VORTEX_MIDI_DATA);
+	printk("Temp4 0x%x\n", temp);
+
+	hwwrite(vortex->mmio, VORTEX_MIDI_CMD, MPU401_RESET);
+	temp = hwread(vortex->mmio, VORTEX_MIDI_DATA);
+	printk("Temp5 0x%x\n", temp);
+
+
 	/* Enable MPU401 interrupts. */
 	hwwrite(vortex->mmio, VORTEX_IRQ_CTRL,
 		hwread(vortex->mmio, VORTEX_IRQ_CTRL) | IRQ_MIDI);
+//	hwwrite(vortex->mmio, VORTEX_MIDI_CMD, MPU401_RESET);
 
 	/* Create MPU401 instance. */
 #ifdef VORTEX_MPU401_LEGACY
#1 lore raw
Quoted 14 lines · On Friday 05 May 2006 11:39, I wrote:

I've noticed that au88x0 has an error on the first use of the midi port only. With 1.0.11 midi play continues OK anyway; with the later 'fix-hang' patch it results in failled I/O.

Sprinkling with printks has enabled me to trace it. It seems that when the port is sent 'ENTER_UART' ACK (0xfe) can be read, but the following command does not result in ACK, even though on it's own it would. In its init, au88x0_mpu401 sends 'RESET' then 'ENTER_UART'. Subsequently, when playng midi, mpu401_uart attempts output_open and also sends 'RESET' and expects ACK -but 0xf9 is read instead. A second attempt to play is successful. During normal use, when the output is closed, 'RESET' is sent again, but not tested for ACK (which would fail) and the next output_open is sucessful.

Quoted 7 lines

Any comments?? A hacked diff is attached which shows the affected bits of code, and additional writes and reads in au88x0_mpu401 which demonstrate the behaviour. Result is: Temp1 0xfe, Temp2 0xfe, Temp3 0xf9, Temp4 0xfe, Temp5 0xf9.

To fix (though not necessarily the solution) either omit the 'ENTER_UART' in au88x0_mpu401, or add an extra 'RESET' afterwards.

Perhaps I didn't explain it very well. Raymond has confirmed the behaviour. I could not find any info on the mpu401 commands; do you have a better idea?

It seems that the behaviour of ENTER_UART is the same with other cards. What is different is that au88x0_mpu401 sends it during init, which for example ice1712 doesn't. The extra ENTER_UART then fouls up the first output_open in mpu401_uart. Removing it as per attached diff is successful. Is this a reasonable thing to do?

Regards Alan

alsa-kernel/pci/au88x0/au88x0_mpu401.c +3 -3
@@ -70,9 +70,9 @@
 	temp |= (MIDI_CLOCK_DIV << 8) | ((mode >> 24) & 0xff) << 4;
 	hwwrite(vortex->mmio, VORTEX_CTRL2, temp);
 	hwwrite(vortex->mmio, VORTEX_MIDI_CMD, MPU401_RESET);
-	/* Set some kind of mode */
-	if (mode)
-		hwwrite(vortex->mmio, VORTEX_MIDI_CMD, MPU401_ENTER_UART);
+//	/* Set some kind of mode */
+//	if (mode)                    Removed as fouls mpu401_uart.c: snd_mpu401_uart_output_open
+//		hwwrite(vortex->mmio, VORTEX_MIDI_CMD, MPU401_ENTER_UART);
 
 	/* Check if anything is OK. */
 	temp = hwread(vortex->mmio, VORTEX_MIDI_DATA);
#2 lore raw

At Wed, 10 May 2006 16:53:21 +0100,

Quoted 24 lines · Alan Horstmann
Quoted 14 lines · On Friday 05 May 2006 11:39, I wrote:

I've noticed that au88x0 has an error on the first use of the midi port only. With 1.0.11 midi play continues OK anyway; with the later 'fix-hang' patch it results in failled I/O.

Sprinkling with printks has enabled me to trace it. It seems that when the port is sent 'ENTER_UART' ACK (0xfe) can be read, but the following command does not result in ACK, even though on it's own it would. In its init, au88x0_mpu401 sends 'RESET' then 'ENTER_UART'. Subsequently, when playng midi, mpu401_uart attempts output_open and also sends 'RESET' and expects ACK -but 0xf9 is read instead. A second attempt to play is successful. During normal use, when the output is closed, 'RESET' is sent again, but not tested for ACK (which would fail) and the next output_open is sucessful.

Quoted 7 lines

Any comments?? A hacked diff is attached which shows the affected bits of code, and additional writes and reads in au88x0_mpu401 which demonstrate the behaviour. Result is: Temp1 0xfe, Temp2 0xfe, Temp3 0xf9, Temp4 0xfe, Temp5 0xf9.

To fix (though not necessarily the solution) either omit the 'ENTER_UART' in au88x0_mpu401, or add an extra 'RESET' afterwards.

Quoted 8 lines

Perhaps I didn't explain it very well. Raymond has confirmed the behaviour. I could not find any info on the mpu401 commands; do you have a better idea?

It seems that the behaviour of ENTER_UART is the same with other cards. What is different is that au88x0_mpu401 sends it during init, which for example ice1712 doesn't. The extra ENTER_UART then fouls up the first output_open in mpu401_uart. Removing it as per attached diff is successful. Is this a reasonable thing to do?

Actually, both RESET and ENTER_UART are issued at open in mpu401_uart.c, so they are basically unnecessary to be called here...

Takashi

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

At Thu, 11 May 2006 15:52:15 +0100,

Quoted 14 lines · Alan Horstmann
Quoted 11 lines · you

At Wed, 10 May 2006 16:53:21 +0100,

Quoted 6 lines · Alan Horstmann

It seems that the behaviour of ENTER_UART is the same with other cards. What is different is that au88x0_mpu401 sends it during init, which for example ice1712 doesn't. The extra ENTER_UART then fouls up the first output_open in mpu401_uart. Removing it as per attached diff is successful. Is this a reasonable thing to do?

Actually, both RESET and ENTER_UART are issued at open in mpu401_uart.c, so they are basically unnecessary to be called here...

Quoted 7 lines

Thanks for the confirmation. The au88x0 init uses the ACK received to check the port is functioning OK so it seemed best to leave RESET as it caused no problems.

In the diff I attached, the lines are just //out so it can be seen what has been taken out in case of breaking something else. Is it preferable to remove them altogether instead?

Yes but only if the patched code is confirmed to work :)

Takashi

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

#5 lore raw
Quoted 20 lines · you

At Thu, 11 May 2006 15:52:15 +0100,

Quoted 17 lines · Alan Horstmann
Quoted 11 lines · you

At Wed, 10 May 2006 16:53:21 +0100,

Quoted 5 lines · Alan Horstmann

It seems that the behaviour of ENTER_UART is the same with other cards. What is different is that au88x0_mpu401 sends it during init, which for example ice1712 doesn't. The extra ENTER_UART then fouls up the first output_open in mpu401_uart. Removing it as per attached diff is successful. Is this a reasonable thing to do?

Actually, both RESET and ENTER_UART are issued at open in mpu401_uart.c, so they are basically unnecessary to be called here...

Thanks for the confirmation. The au88x0 init uses the ACK received to check the port is functioning OK so it seemed best to leave RESET as it caused no problems.

Quoted 5 lines
Quoted 3 lines

In the diff I attached, the lines are just //out so it can be seen what has been taken out in case of breaking something else. Is it preferable to remove them altogether instead?

Yes but only if the patched code is confirmed to work :)

It works fine for me; perhaps another au88x0 user could confirm also by applying the diff (attached again)?

Alan

alsa-kernel/pci/au88x0/au88x0_mpu401.c +3 -3
@@ -70,9 +70,9 @@
 	temp |= (MIDI_CLOCK_DIV << 8) | ((mode >> 24) & 0xff) << 4;
 	hwwrite(vortex->mmio, VORTEX_CTRL2, temp);
 	hwwrite(vortex->mmio, VORTEX_MIDI_CMD, MPU401_RESET);
-	/* Set some kind of mode */
-	if (mode)
-		hwwrite(vortex->mmio, VORTEX_MIDI_CMD, MPU401_ENTER_UART);
+//	/* Set some kind of mode */
+//	if (mode)                    Removed as fouls mpu401_uart.c: snd_mpu401_uart_output_open
+//		hwwrite(vortex->mmio, VORTEX_MIDI_CMD, MPU401_ENTER_UART);
 
 	/* Check if anything is OK. */
 	temp = hwread(vortex->mmio, VORTEX_MIDI_DATA);
#6 lore raw

At Mon, 15 May 2006 22:50:45 +0100,

Quoted 23 lines · Alan Horstmann

[1 <text/plain; iso-8859-1 (7bit)>]

Quoted 20 lines · you

At Thu, 11 May 2006 15:52:15 +0100,

Quoted 17 lines · Alan Horstmann
Quoted 11 lines · you

At Wed, 10 May 2006 16:53:21 +0100,

Quoted 5 lines · Alan Horstmann

It seems that the behaviour of ENTER_UART is the same with other cards. What is different is that au88x0_mpu401 sends it during init, which for example ice1712 doesn't. The extra ENTER_UART then fouls up the first output_open in mpu401_uart. Removing it as per attached diff is successful. Is this a reasonable thing to do?

Actually, both RESET and ENTER_UART are issued at open in mpu401_uart.c, so they are basically unnecessary to be called here...

Thanks for the confirmation. The au88x0 init uses the ACK received to check the port is functioning OK so it seemed best to leave RESET as it caused no problems.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

In the diff I attached, the lines are just //out so it can be seen what has been taken out in case of breaking something else. Is it preferable to remove them altogether instead?

Yes but only if the patched code is confirmed to work :)

It works fine for me; perhaps another au88x0 user could confirm also by applying the diff (attached again)?

What happens if you remove MPU401_RESET there, too? It's anyway issued in mpu401_uart.c later.

Takashi

Quoted 8 lines

Alan
[2 au88x0_mpu401.c-remove-enter_uart.diff <text/x-diff; iso-8859-1 (7bit)>]

alsa-kernel/pci/au88x0/au88x0_mpu401.c +0 -0
@@ -70,9 +70,9 @@
 	temp |= (MIDI_CLOCK_DIV << 8) | ((mode >> 24) & 0xff) << 4;
 	hwwrite(vortex->mmio, VORTEX_CTRL2, temp);

alsa-kernel/pci/au88x0/au88x0_mpu401.c line 78

Quoted 10 lines
alsa-kernel/pci/au88x0/au88x0_mpu401.c +3 -3
 	hwwrite(vortex->mmio, VORTEX_MIDI_CMD, MPU401_RESET);
-	/* Set some kind of mode */
-	if (mode)
-		hwwrite(vortex->mmio, VORTEX_MIDI_CMD, MPU401_ENTER_UART);
+//	/* Set some kind of mode */
+//	if (mode)                    Removed as fouls mpu401_uart.c: snd_mpu401_uart_output_open
+//		hwwrite(vortex->mmio, VORTEX_MIDI_CMD, MPU401_ENTER_UART);
 
 	/* Check if anything is OK. */
 	temp = hwread(vortex->mmio, VORTEX_MIDI_DATA);

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

#7 lore raw
Quoted 32 lines · Takashi Iwai

At Mon, 15 May 2006 22:50:45 +0100,

Quoted 29 lines · Alan Horstmann

[1 <text/plain; iso-8859-1 (7bit)>]

Quoted 26 lines · you

At Thu, 11 May 2006 15:52:15 +0100,

Quoted 22 lines · Alan Horstmann
Quoted 10 lines · you

At Wed, 10 May 2006 16:53:21 +0100,

Quoted 6 lines · Alan Horstmann

It seems that the behaviour of ENTER_UART is the same with other cards. What is different is that au88x0_mpu401 sends it during init, which for example ice1712 doesn't. The extra ENTER_UART then fouls up the first output_open in mpu401_uart. Removing it as per attached diff is successful. Is this a reasonable thing to do?

Quoted 3 lines

Actually, both RESET and ENTER_UART are issued at open in mpu401_uart.c, so they are basically unnecessary to be called here...

Thanks for the confirmation. The au88x0 init uses the ACK received to check the port is functioning OK so it seemed best to leave RESET as it caused no problems.

In the diff I attached, the lines are just //out so it can be seen what has been taken out in case of breaking something else. Is it preferable to remove them altogether instead?

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Yes but only if the patched code is confirmed to work :)

It works fine for me; perhaps another au88x0 user could confirm also by applying the diff (attached again)?

What happens if you remove MPU401_RESET there, too? It's anyway issued in mpu401_uart.c later.

Well, if just the MPU401_RESET line is removed, the value subsequently read to check if OK is not 0xfe (ACK) and so the check fails and halts loading the driver. However the whole 6 lines of the check can be removed and the port seems to continue to function OK, but it is unnecessarily drastic to solve the original problem caused by the ENTER_UART, and then there is no check at init of the port operating OK.

Alan

Quoted 17 lines
Quoted 17 lines

[2 au88x0_mpu401.c-remove-enter_uart.diff <text/x-diff; iso-8859-1 (7bit)>] ---
alsa-driver-1.0.11-orig/alsa-kernel/pci/au88x0/au88x0_mpu401.c 2006-01-13
17:16:29.000000000 +0000 +++
alsa-driver-1.0.11/alsa-kernel/pci/au88x0/au88x0_mpu401.c 2006-05-10
16:17:10.000000000 +0100 @@ -70,9 +70,9 @@

alsa-kernel/pci/au88x0/au88x0_mpu401.c +2 -3
 	temp |= (MIDI_CLOCK_DIV << 8) | ((mode >> 24) & 0xff) << 4;
 	hwwrite(vortex->mmio, VORTEX_CTRL2, temp);
 	hwwrite(vortex->mmio, VORTEX_MIDI_CMD, MPU401_RESET);
-	/* Set some kind of mode */
-	if (mode)
-		hwwrite(vortex->mmio, VORTEX_MIDI_CMD, MPU401_ENTER_UART);
+//	/* Set some kind of mode */
+//	if (mode)                    Removed as fouls mpu401_uart.c:

snd_mpu401_uart_output_open +// hwwrite(vortex->mmio, VORTEX_MIDI_CMD,
MPU401_ENTER_UART);

Quoted 13 lines

alsa-kernel/pci/au88x0/au88x0_mpu401.c line 78

Quoted 2 lines
alsa-kernel/pci/au88x0/au88x0_mpu401.c +0 -0
 	/* Check if anything is OK. */
 	temp = hwread(vortex->mmio, VORTEX_MIDI_DATA);

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

#8 lore raw
Quoted 13 lines · Alan Horstmann

Well, if just the MPU401_RESET line is removed, the value subsequently read to
check if OK is not 0xfe (ACK) and so the check fails and halts loading the
driver. However the whole 6 lines of the check can be removed and the port
seems to continue to function OK, but it is unnecessarily drastic to solve
the original problem caused by the ENTER_UART, and then there is no check at
init of the port operating OK.

Quoted 2 lines

Alan

Alan,

How exactly does this relate to bug #1833? The bug report is all over the place and I can't make sense of it.

Lee

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

#9 lore raw
Quoted 13 lines · you
Quoted 12 lines · Alan Horstmann

Well, if just the MPU401_RESET line is removed, the value subsequently read to
check if OK is not 0xfe (ACK) and so the check fails and halts loading the
driver. However the whole 6 lines of the check can be removed and the port
seems to continue to function OK, but it is unnecessarily drastic to solve
the original problem caused by the ENTER_UART, and then there is no check at
init of the port operating OK.

Quoted 6 lines
Quoted 1 line

Alan

Alan,

How exactly does this relate to bug #1833? The bug report is all over the place and I can't make sense of it.

Really it is not related (and hence I have kept my postings to the devel ML not BTS), except that in testing au88x0 regarding the bug 1833 both Raymond and myself separately noticed the 'fail first open' issue, which I have traced as this thread shows. I think Raymond writes all his comments unfortunately through one bug log or another, whether directly related or not. Perhaps I should have opened another bug log, but as I had identified the problem, it seemed better to post findings on devel ML.

To respond to your question in 1833, my reading is that there probably was a patch that solved the original bug, but it has not been posted to devel ML, and I don't think it is even uploaded to that bug log, rather its a link to somewhere?

Hope this helps!

Alan

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

#10 lore raw
In reply to Alan Horstmann
Quoted 39 lines · you
Quoted 30 lines · Takashi Iwai

At Mon, 15 May 2006 22:50:45 +0100,

Quoted 27 lines · Alan Horstmann
Quoted 26 lines · you

At Thu, 11 May 2006 15:52:15 +0100,

Quoted 22 lines · Alan Horstmann
Quoted 10 lines · you

At Wed, 10 May 2006 16:53:21 +0100,

Quoted 6 lines · Alan Horstmann

It seems that the behaviour of ENTER_UART is the same with other cards. What is different is that au88x0_mpu401 sends it during init, which for example ice1712 doesn't. The extra ENTER_UART then fouls up the first output_open in mpu401_uart. Removing it as per attached diff is successful. Is this a reasonable thing to do?

Quoted 3 lines

Actually, both RESET and ENTER_UART are issued at open in mpu401_uart.c, so they are basically unnecessary to be called here...

Thanks for the confirmation. The au88x0 init uses the ACK received to check the port is functioning OK so it seemed best to leave RESET as it caused no problems.

In the diff I attached, the lines are just //out so it can be seen what has been taken out in case of breaking something else. Is it preferable to remove them altogether instead?

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Yes but only if the patched code is confirmed to work :)

It works fine for me; perhaps another au88x0 user could confirm also by applying the diff (attached again)?

What happens if you remove MPU401_RESET there, too? It's anyway issued in mpu401_uart.c later.

Quoted 6 lines

Well, if just the MPU401_RESET line is removed, the value subsequently read to check if OK is not 0xfe (ACK) and so the check fails and halts loading the driver. However the whole 6 lines of the check can be removed and the port seems to continue to function OK, but it is unnecessarily drastic to solve the original problem caused by the ENTER_UART, and then there is no check at init of the port operating OK.

...So this is my proposal to try to conclude this one -solve the init /fail first open problem with the minimum of alterations:

Alan

au88x0_mpu401.c-remove-enter_uart.patch

Summary: Remove ENTER_UART from au88x0 init

Remove an unnecessary ENTER_UART instruction during au88x0 init as it makes the first/subsequent midi open to fail.

alsa-kernel/pci/au88x0/au88x0_mpu401.c +0 -3
@@ -70,9 +70,6 @@
 	temp |= (MIDI_CLOCK_DIV << 8) | ((mode >> 24) & 0xff) << 4;
 	hwwrite(vortex->mmio, VORTEX_CTRL2, temp);
 	hwwrite(vortex->mmio, VORTEX_MIDI_CMD, MPU401_RESET);
-	/* Set some kind of mode */
-	if (mode)
-		hwwrite(vortex->mmio, VORTEX_MIDI_CMD, MPU401_ENTER_UART);
 
 	/* Check if anything is OK. */
 	temp = hwread(vortex->mmio, VORTEX_MIDI_DATA);
#11 lore raw

At Thu, 18 May 2006 10:35:02 +0100,

Quoted 54 lines · Alan Horstmann
Quoted 39 lines · you
Quoted 30 lines · Takashi Iwai

At Mon, 15 May 2006 22:50:45 +0100,

Quoted 27 lines · Alan Horstmann
Quoted 26 lines · you

At Thu, 11 May 2006 15:52:15 +0100,

Quoted 22 lines · Alan Horstmann
Quoted 10 lines · you

At Wed, 10 May 2006 16:53:21 +0100,

Quoted 6 lines · Alan Horstmann

It seems that the behaviour of ENTER_UART is the same with other cards. What is different is that au88x0_mpu401 sends it during init, which for example ice1712 doesn't. The extra ENTER_UART then fouls up the first output_open in mpu401_uart. Removing it as per attached diff is successful. Is this a reasonable thing to do?

Quoted 3 lines

Actually, both RESET and ENTER_UART are issued at open in mpu401_uart.c, so they are basically unnecessary to be called here...

Thanks for the confirmation. The au88x0 init uses the ACK received to check the port is functioning OK so it seemed best to leave RESET as it caused no problems.

In the diff I attached, the lines are just //out so it can be seen what has been taken out in case of breaking something else. Is it preferable to remove them altogether instead?

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Yes but only if the patched code is confirmed to work :)

It works fine for me; perhaps another au88x0 user could confirm also by applying the diff (attached again)?

What happens if you remove MPU401_RESET there, too? It's anyway issued in mpu401_uart.c later.

Quoted 6 lines

Well, if just the MPU401_RESET line is removed, the value subsequently read to check if OK is not 0xfe (ACK) and so the check fails and halts loading the driver. However the whole 6 lines of the check can be removed and the port seems to continue to function OK, but it is unnecessarily drastic to solve the original problem caused by the ENTER_UART, and then there is no check at init of the port operating OK.

...So this is my proposal to try to conclude this one -solve the init /fail first open problem with the minimum of alterations:

Alan

Quoted 8 lines

au88x0_mpu401.c-remove-enter_uart.patch

Summary: Remove ENTER_UART from au88x0 init

Remove an unnecessary ENTER_UART instruction during au88x0 init as it makes the first/subsequent midi open to fail.

Thanks, now applied to HG repo.

Takashi

-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642