diff options
author | Takashi Iwai <tiwai@suse.de> | 2007-02-22 10:07:21 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2007-05-11 10:55:43 -0400 |
commit | 8f7ba051d2abb3d3bde9b95e47246c60b704d2b4 (patch) | |
tree | 6b1fcd728b520ca24c99672c873ed17b43ac3b9f /sound/drivers/mpu401/mpu401_uart.c | |
parent | 76e630677419ecf2cf8c0b738536eee34dc048e6 (diff) |
[ALSA] mpu401 - Add MPU401_INFO_UART_ONLY bitflag
Added MPU401_INFO_UART_ONLY bitflag to avoid issueing UART_ENTER command
at opening streams. Some devices support only UART mode and give errors
to UART_ENTER.
A new module option, uart_enter, is added to snd-mpu401 driver.
For UART-only devices, set uart_enter=0.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/drivers/mpu401/mpu401_uart.c')
-rw-r--r-- | sound/drivers/mpu401/mpu401_uart.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/sound/drivers/mpu401/mpu401_uart.c b/sound/drivers/mpu401/mpu401_uart.c index 3daa9fa56c0b..85aedc348e2d 100644 --- a/sound/drivers/mpu401/mpu401_uart.c +++ b/sound/drivers/mpu401/mpu401_uart.c | |||
@@ -266,6 +266,16 @@ static int snd_mpu401_uart_cmd(struct snd_mpu401 * mpu, unsigned char cmd, | |||
266 | return 0; | 266 | return 0; |
267 | } | 267 | } |
268 | 268 | ||
269 | static int snd_mpu401_do_reset(struct snd_mpu401 *mpu) | ||
270 | { | ||
271 | if (snd_mpu401_uart_cmd(mpu, MPU401_RESET, 1)) | ||
272 | return -EIO; | ||
273 | if (!(mpu->info_flags & MPU401_INFO_UART_ONLY) && | ||
274 | snd_mpu401_uart_cmd(mpu, MPU401_ENTER_UART, 1)) | ||
275 | return -EIO; | ||
276 | return 0; | ||
277 | } | ||
278 | |||
269 | /* | 279 | /* |
270 | * input/output open/close - protected by open_mutex in rawmidi.c | 280 | * input/output open/close - protected by open_mutex in rawmidi.c |
271 | */ | 281 | */ |
@@ -278,9 +288,7 @@ static int snd_mpu401_uart_input_open(struct snd_rawmidi_substream *substream) | |||
278 | if (mpu->open_input && (err = mpu->open_input(mpu)) < 0) | 288 | if (mpu->open_input && (err = mpu->open_input(mpu)) < 0) |
279 | return err; | 289 | return err; |
280 | if (! test_bit(MPU401_MODE_BIT_OUTPUT, &mpu->mode)) { | 290 | if (! test_bit(MPU401_MODE_BIT_OUTPUT, &mpu->mode)) { |
281 | if (snd_mpu401_uart_cmd(mpu, MPU401_RESET, 1)) | 291 | if (snd_mpu401_do_reset(mpu) < 0) |
282 | goto error_out; | ||
283 | if (snd_mpu401_uart_cmd(mpu, MPU401_ENTER_UART, 1)) | ||
284 | goto error_out; | 292 | goto error_out; |
285 | } | 293 | } |
286 | mpu->substream_input = substream; | 294 | mpu->substream_input = substream; |
@@ -302,9 +310,7 @@ static int snd_mpu401_uart_output_open(struct snd_rawmidi_substream *substream) | |||
302 | if (mpu->open_output && (err = mpu->open_output(mpu)) < 0) | 310 | if (mpu->open_output && (err = mpu->open_output(mpu)) < 0) |
303 | return err; | 311 | return err; |
304 | if (! test_bit(MPU401_MODE_BIT_INPUT, &mpu->mode)) { | 312 | if (! test_bit(MPU401_MODE_BIT_INPUT, &mpu->mode)) { |
305 | if (snd_mpu401_uart_cmd(mpu, MPU401_RESET, 1)) | 313 | if (snd_mpu401_do_reset(mpu) < 0) |
306 | goto error_out; | ||
307 | if (snd_mpu401_uart_cmd(mpu, MPU401_ENTER_UART, 1)) | ||
308 | goto error_out; | 314 | goto error_out; |
309 | } | 315 | } |
310 | mpu->substream_output = substream; | 316 | mpu->substream_output = substream; |