aboutsummaryrefslogtreecommitdiffstats
path: root/sound/drivers/mpu401/mpu401_uart.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/drivers/mpu401/mpu401_uart.c')
-rw-r--r--sound/drivers/mpu401/mpu401_uart.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/sound/drivers/mpu401/mpu401_uart.c b/sound/drivers/mpu401/mpu401_uart.c
index 2af09996a3d0..9d01c181feca 100644
--- a/sound/drivers/mpu401/mpu401_uart.c
+++ b/sound/drivers/mpu401/mpu401_uart.c
@@ -3,7 +3,7 @@
3 * Routines for control of MPU-401 in UART mode 3 * Routines for control of MPU-401 in UART mode
4 * 4 *
5 * MPU-401 supports UART mode which is not capable generate transmit 5 * MPU-401 supports UART mode which is not capable generate transmit
6 * interrupts thus output is done via polling. Also, if irq < 0, then 6 * interrupts thus output is done via polling. Without interrupt,
7 * input is done also via polling. Do not expect good performance. 7 * input is done also via polling. Do not expect good performance.
8 * 8 *
9 * 9 *
@@ -374,7 +374,7 @@ snd_mpu401_uart_input_trigger(struct snd_rawmidi_substream *substream, int up)
374 /* first time - flush FIFO */ 374 /* first time - flush FIFO */
375 while (max-- > 0) 375 while (max-- > 0)
376 mpu->read(mpu, MPU401D(mpu)); 376 mpu->read(mpu, MPU401D(mpu));
377 if (mpu->irq < 0) 377 if (mpu->info_flags & MPU401_INFO_USE_TIMER)
378 snd_mpu401_uart_add_timer(mpu, 1); 378 snd_mpu401_uart_add_timer(mpu, 1);
379 } 379 }
380 380
@@ -383,7 +383,7 @@ snd_mpu401_uart_input_trigger(struct snd_rawmidi_substream *substream, int up)
383 snd_mpu401_uart_input_read(mpu); 383 snd_mpu401_uart_input_read(mpu);
384 spin_unlock_irqrestore(&mpu->input_lock, flags); 384 spin_unlock_irqrestore(&mpu->input_lock, flags);
385 } else { 385 } else {
386 if (mpu->irq < 0) 386 if (mpu->info_flags & MPU401_INFO_USE_TIMER)
387 snd_mpu401_uart_remove_timer(mpu, 1); 387 snd_mpu401_uart_remove_timer(mpu, 1);
388 clear_bit(MPU401_MODE_BIT_INPUT_TRIGGER, &mpu->mode); 388 clear_bit(MPU401_MODE_BIT_INPUT_TRIGGER, &mpu->mode);
389 } 389 }
@@ -496,7 +496,7 @@ static struct snd_rawmidi_ops snd_mpu401_uart_input =
496static void snd_mpu401_uart_free(struct snd_rawmidi *rmidi) 496static void snd_mpu401_uart_free(struct snd_rawmidi *rmidi)
497{ 497{
498 struct snd_mpu401 *mpu = rmidi->private_data; 498 struct snd_mpu401 *mpu = rmidi->private_data;
499 if (mpu->irq_flags && mpu->irq >= 0) 499 if (mpu->irq >= 0)
500 free_irq(mpu->irq, (void *) mpu); 500 free_irq(mpu->irq, (void *) mpu);
501 release_and_free_resource(mpu->res); 501 release_and_free_resource(mpu->res);
502 kfree(mpu); 502 kfree(mpu);
@@ -509,8 +509,7 @@ static void snd_mpu401_uart_free(struct snd_rawmidi *rmidi)
509 * @hardware: the hardware type, MPU401_HW_XXXX 509 * @hardware: the hardware type, MPU401_HW_XXXX
510 * @port: the base address of MPU401 port 510 * @port: the base address of MPU401 port
511 * @info_flags: bitflags MPU401_INFO_XXX 511 * @info_flags: bitflags MPU401_INFO_XXX
512 * @irq: the irq number, -1 if no interrupt for mpu 512 * @irq: the ISA irq number, -1 if not to be allocated
513 * @irq_flags: the irq request flags (SA_XXX), 0 if irq was already reserved.
514 * @rrawmidi: the pointer to store the new rawmidi instance 513 * @rrawmidi: the pointer to store the new rawmidi instance
515 * 514 *
516 * Creates a new MPU-401 instance. 515 * Creates a new MPU-401 instance.
@@ -525,7 +524,7 @@ int snd_mpu401_uart_new(struct snd_card *card, int device,
525 unsigned short hardware, 524 unsigned short hardware,
526 unsigned long port, 525 unsigned long port,
527 unsigned int info_flags, 526 unsigned int info_flags,
528 int irq, int irq_flags, 527 int irq,
529 struct snd_rawmidi ** rrawmidi) 528 struct snd_rawmidi ** rrawmidi)
530{ 529{
531 struct snd_mpu401 *mpu; 530 struct snd_mpu401 *mpu;
@@ -577,8 +576,8 @@ int snd_mpu401_uart_new(struct snd_card *card, int device,
577 mpu->cport = port + 2; 576 mpu->cport = port + 2;
578 else 577 else
579 mpu->cport = port + 1; 578 mpu->cport = port + 1;
580 if (irq >= 0 && irq_flags) { 579 if (irq >= 0) {
581 if (request_irq(irq, snd_mpu401_uart_interrupt, irq_flags, 580 if (request_irq(irq, snd_mpu401_uart_interrupt, IRQF_DISABLED,
582 "MPU401 UART", (void *) mpu)) { 581 "MPU401 UART", (void *) mpu)) {
583 snd_printk(KERN_ERR "mpu401_uart: " 582 snd_printk(KERN_ERR "mpu401_uart: "
584 "unable to grab IRQ %d\n", irq); 583 "unable to grab IRQ %d\n", irq);
@@ -586,9 +585,10 @@ int snd_mpu401_uart_new(struct snd_card *card, int device,
586 return -EBUSY; 585 return -EBUSY;
587 } 586 }
588 } 587 }
588 if (irq < 0 && !(info_flags & MPU401_INFO_IRQ_HOOK))
589 info_flags |= MPU401_INFO_USE_TIMER;
589 mpu->info_flags = info_flags; 590 mpu->info_flags = info_flags;
590 mpu->irq = irq; 591 mpu->irq = irq;
591 mpu->irq_flags = irq_flags;
592 if (card->shortname[0]) 592 if (card->shortname[0])
593 snprintf(rmidi->name, sizeof(rmidi->name), "%s MIDI", 593 snprintf(rmidi->name, sizeof(rmidi->name), "%s MIDI",
594 card->shortname); 594 card->shortname);