diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-24 08:41:44 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-24 08:41:44 -0700 |
commit | 38ccc197eb85cad594eb5863ba5a408655da0062 (patch) | |
tree | 0066a0160e5dd28280a8db2a5814af7111ae3e1b /sound/drivers/mpu401/mpu401_uart.c | |
parent | d02aacff4467806ee56f147ac8eff6911d95811a (diff) | |
parent | 3a841d519f91463361bbbe7addc24a0c1b2e9f99 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6: (250 commits)
[ALSA] ice1724 - Fix IRQ lock-up with MPU access
[ALSA] Define MPU401 registers in sound/mpu401_uart.h
[ALSA] pcsp: fix wording in DEBUG_PAGEALLOC warning
[ALSA] pcsp - Fix dependency in Kconfig
[ALSA] soc - ac97 - Clean up checkpatch warnings
[ALSA] soc - wm8750 - Clean up checkpatch warnings
[ALSA] soc - wm8731 - Clean up checkpatch warnings
[ALSA] soc - pxa2xx-pcm - Fix checkpatch warnings
[ALSA] soc - spitz - Fix checkpatch warnings
[ALSA] soc - poodle - Fix checkpatch warnings
[ALSA] soc - corgi - Fix checkpatch warnings
[ALSA] soc - s3c24xx-i2s - Add missing spaces
[ALSA] soc - s3c24xx-i2s - Fix tab/space breakage
[ALSA] soc - s3c24xx-i2s - Use linux/io.h
[ALSA] hda - Fix Thinkpad X300 digital mic
pcsp - Don't build pcspkr when snd-pcsp is enabled
[ALSA] hda - Fix model for Acer Aspire 5720z
[ALSA] soc - s3c24xx - Declare suspend and resume static
[ALSA] soc - s3c24xx - Improve diagnostic output
[ALSA] Fix possible races at free_irq in PCI drivers
...
Diffstat (limited to 'sound/drivers/mpu401/mpu401_uart.c')
-rw-r--r-- | sound/drivers/mpu401/mpu401_uart.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/sound/drivers/mpu401/mpu401_uart.c b/sound/drivers/mpu401/mpu401_uart.c index 5993864acbd..18cca2457d4 100644 --- a/sound/drivers/mpu401/mpu401_uart.c +++ b/sound/drivers/mpu401/mpu401_uart.c @@ -49,12 +49,10 @@ static void snd_mpu401_uart_output_write(struct snd_mpu401 * mpu); */ -#define snd_mpu401_input_avail(mpu) (!(mpu->read(mpu, MPU401C(mpu)) & 0x80)) -#define snd_mpu401_output_ready(mpu) (!(mpu->read(mpu, MPU401C(mpu)) & 0x40)) - -#define MPU401_RESET 0xff -#define MPU401_ENTER_UART 0x3f -#define MPU401_ACK 0xfe +#define snd_mpu401_input_avail(mpu) \ + (!(mpu->read(mpu, MPU401C(mpu)) & MPU401_RX_EMPTY)) +#define snd_mpu401_output_ready(mpu) \ + (!(mpu->read(mpu, MPU401C(mpu)) & MPU401_TX_FULL)) /* Build in lowlevel io */ static void mpu401_write_port(struct snd_mpu401 *mpu, unsigned char data, @@ -425,16 +423,17 @@ static void snd_mpu401_uart_input_read(struct snd_mpu401 * mpu) static void snd_mpu401_uart_output_write(struct snd_mpu401 * mpu) { unsigned char byte; - int max = 256, timeout; + int max = 256; do { if (snd_rawmidi_transmit_peek(mpu->substream_output, &byte, 1) == 1) { - for (timeout = 100; timeout > 0; timeout--) { - if (snd_mpu401_output_ready(mpu)) - break; - } - if (timeout == 0) + /* + * Try twice because there is hardware that insists on + * setting the output busy bit after each write. + */ + if (!snd_mpu401_output_ready(mpu) && + !snd_mpu401_output_ready(mpu)) break; /* Tx FIFO full - try again later */ mpu->write(mpu, byte, MPU401D(mpu)); snd_rawmidi_transmit_ack(mpu->substream_output, 1); |