Commit ea6b5828 authored by Clemens Ladisch's avatar Clemens Ladisch Committed by Takashi Iwai

[ALSA] mpu401: reduce tx loop timeout

Reduce the number of times to check for a non-empty Tx FIFO from 100 to
2 because there is no MPU-401 implementation that needs more than one or
two reads to determine the actual FIFO status.
Signed-off-by: default avatarClemens Ladisch <clemens@ladisch.de>
parent 47ba97f8
...@@ -425,16 +425,17 @@ static void snd_mpu401_uart_input_read(struct snd_mpu401 * mpu) ...@@ -425,16 +425,17 @@ static void snd_mpu401_uart_input_read(struct snd_mpu401 * mpu)
static void snd_mpu401_uart_output_write(struct snd_mpu401 * mpu) static void snd_mpu401_uart_output_write(struct snd_mpu401 * mpu)
{ {
unsigned char byte; unsigned char byte;
int max = 256, timeout; int max = 256;
do { do {
if (snd_rawmidi_transmit_peek(mpu->substream_output, if (snd_rawmidi_transmit_peek(mpu->substream_output,
&byte, 1) == 1) { &byte, 1) == 1) {
for (timeout = 100; timeout > 0; timeout--) { /*
if (snd_mpu401_output_ready(mpu)) * Try twice because there is hardware that insists on
break; * setting the output busy bit after each write.
} */
if (timeout == 0) if (!snd_mpu401_output_ready(mpu) &&
!snd_mpu401_output_ready(mpu))
break; /* Tx FIFO full - try again later */ break; /* Tx FIFO full - try again later */
mpu->write(mpu, byte, MPU401D(mpu)); mpu->write(mpu, byte, MPU401D(mpu));
snd_rawmidi_transmit_ack(mpu->substream_output, 1); snd_rawmidi_transmit_ack(mpu->substream_output, 1);
......
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