aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl29
-rw-r--r--include/sound/mpu401.h14
-rw-r--r--sound/drivers/mpu401/mpu401_uart.c96
-rw-r--r--sound/isa/sscape.c3
-rw-r--r--sound/pci/als4000.c4
-rw-r--r--sound/pci/au88x0/au88x0_mpu401.c3
-rw-r--r--sound/pci/azt3328.c4
-rw-r--r--sound/pci/cmipci.c4
-rw-r--r--sound/pci/cs5535audio/cs5535audio.c21
-rw-r--r--sound/pci/es1938.c3
-rw-r--r--sound/pci/es1968.c3
-rw-r--r--sound/pci/fm801.c3
-rw-r--r--sound/pci/ice1712/ice1712.c6
-rw-r--r--sound/pci/ice1712/ice1724.c3
-rw-r--r--sound/pci/maestro3.c3
-rw-r--r--sound/pci/sonicvibes.c2
-rw-r--r--sound/pci/trident/trident.c3
-rw-r--r--sound/pci/via82xx.c2
-rw-r--r--sound/pci/ymfpci/ymfpci.c3
19 files changed, 147 insertions, 62 deletions
diff --git a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
index 23c6c7cde4e6..635cbb94357c 100644
--- a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
+++ b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
@@ -4215,7 +4215,7 @@ struct _snd_pcm_runtime {
4215 <programlisting> 4215 <programlisting>
4216<![CDATA[ 4216<![CDATA[
4217 struct snd_rawmidi *rmidi; 4217 struct snd_rawmidi *rmidi;
4218 snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, port, integrated, 4218 snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, port, info_flags,
4219 irq, irq_flags, &rmidi); 4219 irq, irq_flags, &rmidi);
4220]]> 4220]]>
4221 </programlisting> 4221 </programlisting>
@@ -4242,15 +4242,36 @@ struct _snd_pcm_runtime {
4242 </para> 4242 </para>
4243 4243
4244 <para> 4244 <para>
4245 The 5th argument is bitflags for additional information.
4245 When the i/o port address above is a part of the PCI i/o 4246 When the i/o port address above is a part of the PCI i/o
4246 region, the MPU401 i/o port might have been already allocated 4247 region, the MPU401 i/o port might have been already allocated
4247 (reserved) by the driver itself. In such a case, pass non-zero 4248 (reserved) by the driver itself. In such a case, pass a bit flag
4248 to the 5th argument 4249 <constant>MPU401_INFO_INTEGRATED</constant>,
4249 (<parameter>integrated</parameter>). Otherwise, pass 0 to it,
4250 and 4250 and
4251 the mpu401-uart layer will allocate the i/o ports by itself. 4251 the mpu401-uart layer will allocate the i/o ports by itself.
4252 </para> 4252 </para>
4253 4253
4254 <para>
4255 When the controller supports only the input or output MIDI stream,
4256 pass <constant>MPU401_INFO_INPUT</constant> or
4257 <constant>MPU401_INFO_OUTPUT</constant> bitflag, respectively.
4258 Then the rawmidi instance is created as a single stream.
4259 </para>
4260
4261 <para>
4262 <constant>MPU401_INFO_MMIO</constant> bitflag is used to change
4263 the access method to MMIO (via readb and writeb) instead of
4264 iob and outb. In this case, you have to pass the iomapped address
4265 to <function>snd_mpu401_uart_new()</function>.
4266 </para>
4267
4268 <para>
4269 When <constant>MPU401_INFO_TX_IRQ</constant> is set, the output
4270 stream isn't checked in the default interrupt handler. The driver
4271 needs to call <function>snd_mpu401_uart_interrupt_tx()</function>
4272 by itself to start processing the output stream in irq handler.
4273 </para>
4274
4254 <para> 4275 <para>
4255 Usually, the port address corresponds to the command port and 4276 Usually, the port address corresponds to the command port and
4256 port + 1 corresponds to the data port. If not, you may change 4277 port + 1 corresponds to the data port. If not, you may change
diff --git a/include/sound/mpu401.h b/include/sound/mpu401.h
index 8e97ace78f16..ac504321ea56 100644
--- a/include/sound/mpu401.h
+++ b/include/sound/mpu401.h
@@ -45,6 +45,12 @@
45#define MPU401_HW_PC98II 18 /* Roland PC98II */ 45#define MPU401_HW_PC98II 18 /* Roland PC98II */
46#define MPU401_HW_AUREAL 19 /* Aureal Vortex */ 46#define MPU401_HW_AUREAL 19 /* Aureal Vortex */
47 47
48#define MPU401_INFO_INPUT (1 << 0) /* input stream */
49#define MPU401_INFO_OUTPUT (1 << 1) /* output stream */
50#define MPU401_INFO_INTEGRATED (1 << 2) /* integrated h/w port */
51#define MPU401_INFO_MMIO (1 << 3) /* MMIO access */
52#define MPU401_INFO_TX_IRQ (1 << 4) /* independent TX irq */
53
48#define MPU401_MODE_BIT_INPUT 0 54#define MPU401_MODE_BIT_INPUT 0
49#define MPU401_MODE_BIT_OUTPUT 1 55#define MPU401_MODE_BIT_OUTPUT 1
50#define MPU401_MODE_BIT_INPUT_TRIGGER 2 56#define MPU401_MODE_BIT_INPUT_TRIGGER 2
@@ -62,6 +68,7 @@ struct snd_mpu401 {
62 struct snd_rawmidi *rmidi; 68 struct snd_rawmidi *rmidi;
63 69
64 unsigned short hardware; /* MPU401_HW_XXXX */ 70 unsigned short hardware; /* MPU401_HW_XXXX */
71 unsigned int info_flags; /* MPU401_INFO_XXX */
65 unsigned long port; /* base port of MPU-401 chip */ 72 unsigned long port; /* base port of MPU-401 chip */
66 unsigned long cport; /* port + 1 (usually) */ 73 unsigned long cport; /* port + 1 (usually) */
67 struct resource *res; /* port resource */ 74 struct resource *res; /* port resource */
@@ -99,13 +106,16 @@ struct snd_mpu401 {
99 106
100 */ 107 */
101 108
102irqreturn_t snd_mpu401_uart_interrupt(int irq, void *dev_id, struct pt_regs *regs); 109irqreturn_t snd_mpu401_uart_interrupt(int irq, void *dev_id,
110 struct pt_regs *regs);
111irqreturn_t snd_mpu401_uart_interrupt_tx(int irq, void *dev_id,
112 struct pt_regs *regs);
103 113
104int snd_mpu401_uart_new(struct snd_card *card, 114int snd_mpu401_uart_new(struct snd_card *card,
105 int device, 115 int device,
106 unsigned short hardware, 116 unsigned short hardware,
107 unsigned long port, 117 unsigned long port,
108 int integrated, 118 unsigned int info_flags,
109 int irq, 119 int irq,
110 int irq_flags, 120 int irq_flags,
111 struct snd_rawmidi ** rrawmidi); 121 struct snd_rawmidi ** rrawmidi);
diff --git a/sound/drivers/mpu401/mpu401_uart.c b/sound/drivers/mpu401/mpu401_uart.c
index cd64d3eb9ec8..4bf07ca9b17d 100644
--- a/sound/drivers/mpu401/mpu401_uart.c
+++ b/sound/drivers/mpu401/mpu401_uart.c
@@ -95,17 +95,8 @@ static void snd_mpu401_uart_clear_rx(struct snd_mpu401 *mpu)
95#endif 95#endif
96} 96}
97 97
98static void _snd_mpu401_uart_interrupt(struct snd_mpu401 *mpu) 98static void uart_interrupt_tx(struct snd_mpu401 *mpu)
99{ 99{
100 spin_lock(&mpu->input_lock);
101 if (test_bit(MPU401_MODE_BIT_INPUT, &mpu->mode))
102 snd_mpu401_uart_input_read(mpu);
103 else
104 snd_mpu401_uart_clear_rx(mpu);
105 spin_unlock(&mpu->input_lock);
106 /* ok. for better Tx performance try do some output when
107 * input is done
108 */
109 if (test_bit(MPU401_MODE_BIT_OUTPUT, &mpu->mode) && 100 if (test_bit(MPU401_MODE_BIT_OUTPUT, &mpu->mode) &&
110 test_bit(MPU401_MODE_BIT_OUTPUT_TRIGGER, &mpu->mode)) { 101 test_bit(MPU401_MODE_BIT_OUTPUT_TRIGGER, &mpu->mode)) {
111 spin_lock(&mpu->output_lock); 102 spin_lock(&mpu->output_lock);
@@ -114,6 +105,22 @@ static void _snd_mpu401_uart_interrupt(struct snd_mpu401 *mpu)
114 } 105 }
115} 106}
116 107
108static void _snd_mpu401_uart_interrupt(struct snd_mpu401 *mpu)
109{
110 if (mpu->info_flags & MPU401_INFO_INPUT) {
111 spin_lock(&mpu->input_lock);
112 if (test_bit(MPU401_MODE_BIT_INPUT, &mpu->mode))
113 snd_mpu401_uart_input_read(mpu);
114 else
115 snd_mpu401_uart_clear_rx(mpu);
116 spin_unlock(&mpu->input_lock);
117 }
118 if (! (mpu->info_flags & MPU401_INFO_TX_IRQ))
119 /* ok. for better Tx performance try do some output
120 when input is done */
121 uart_interrupt_tx(mpu);
122}
123
117/** 124/**
118 * snd_mpu401_uart_interrupt - generic MPU401-UART interrupt handler 125 * snd_mpu401_uart_interrupt - generic MPU401-UART interrupt handler
119 * @irq: the irq number 126 * @irq: the irq number
@@ -135,6 +142,27 @@ irqreturn_t snd_mpu401_uart_interrupt(int irq, void *dev_id,
135 142
136EXPORT_SYMBOL(snd_mpu401_uart_interrupt); 143EXPORT_SYMBOL(snd_mpu401_uart_interrupt);
137 144
145/**
146 * snd_mpu401_uart_interrupt_tx - generic MPU401-UART transmit irq handler
147 * @irq: the irq number
148 * @dev_id: mpu401 instance
149 * @regs: the reigster
150 *
151 * Processes the interrupt for MPU401-UART output.
152 */
153irqreturn_t snd_mpu401_uart_interrupt_tx(int irq, void *dev_id,
154 struct pt_regs *regs)
155{
156 struct snd_mpu401 *mpu = dev_id;
157
158 if (mpu == NULL)
159 return IRQ_NONE;
160 uart_interrupt_tx(mpu);
161 return IRQ_HANDLED;
162}
163
164EXPORT_SYMBOL(snd_mpu401_uart_interrupt_tx);
165
138/* 166/*
139 * timer callback 167 * timer callback
140 * reprogram the timer and call the interrupt job 168 * reprogram the timer and call the interrupt job
@@ -430,14 +458,16 @@ snd_mpu401_uart_output_trigger(struct snd_rawmidi_substream *substream, int up)
430 * since the output timer might have been removed in 458 * since the output timer might have been removed in
431 * snd_mpu401_uart_output_write(). 459 * snd_mpu401_uart_output_write().
432 */ 460 */
433 snd_mpu401_uart_add_timer(mpu, 0); 461 if (! (mpu->info_flags & MPU401_INFO_TX_IRQ))
462 snd_mpu401_uart_add_timer(mpu, 0);
434 463
435 /* output pending data */ 464 /* output pending data */
436 spin_lock_irqsave(&mpu->output_lock, flags); 465 spin_lock_irqsave(&mpu->output_lock, flags);
437 snd_mpu401_uart_output_write(mpu); 466 snd_mpu401_uart_output_write(mpu);
438 spin_unlock_irqrestore(&mpu->output_lock, flags); 467 spin_unlock_irqrestore(&mpu->output_lock, flags);
439 } else { 468 } else {
440 snd_mpu401_uart_remove_timer(mpu, 0); 469 if (! (mpu->info_flags & MPU401_INFO_TX_IRQ))
470 snd_mpu401_uart_remove_timer(mpu, 0);
441 clear_bit(MPU401_MODE_BIT_OUTPUT_TRIGGER, &mpu->mode); 471 clear_bit(MPU401_MODE_BIT_OUTPUT_TRIGGER, &mpu->mode);
442 } 472 }
443} 473}
@@ -475,7 +505,7 @@ static void snd_mpu401_uart_free(struct snd_rawmidi *rmidi)
475 * @device: the device index, zero-based 505 * @device: the device index, zero-based
476 * @hardware: the hardware type, MPU401_HW_XXXX 506 * @hardware: the hardware type, MPU401_HW_XXXX
477 * @port: the base address of MPU401 port 507 * @port: the base address of MPU401 port
478 * @integrated: non-zero if the port was already reserved by the chip 508 * @info_flags: bitflags MPU401_INFO_XXX
479 * @irq: the irq number, -1 if no interrupt for mpu 509 * @irq: the irq number, -1 if no interrupt for mpu
480 * @irq_flags: the irq request flags (SA_XXX), 0 if irq was already reserved. 510 * @irq_flags: the irq request flags (SA_XXX), 0 if irq was already reserved.
481 * @rrawmidi: the pointer to store the new rawmidi instance 511 * @rrawmidi: the pointer to store the new rawmidi instance
@@ -490,17 +520,24 @@ static void snd_mpu401_uart_free(struct snd_rawmidi *rmidi)
490 */ 520 */
491int snd_mpu401_uart_new(struct snd_card *card, int device, 521int snd_mpu401_uart_new(struct snd_card *card, int device,
492 unsigned short hardware, 522 unsigned short hardware,
493 unsigned long port, int integrated, 523 unsigned long port,
524 unsigned int info_flags,
494 int irq, int irq_flags, 525 int irq, int irq_flags,
495 struct snd_rawmidi ** rrawmidi) 526 struct snd_rawmidi ** rrawmidi)
496{ 527{
497 struct snd_mpu401 *mpu; 528 struct snd_mpu401 *mpu;
498 struct snd_rawmidi *rmidi; 529 struct snd_rawmidi *rmidi;
530 int in_enable, out_enable;
499 int err; 531 int err;
500 532
501 if (rrawmidi) 533 if (rrawmidi)
502 *rrawmidi = NULL; 534 *rrawmidi = NULL;
503 if ((err = snd_rawmidi_new(card, "MPU-401U", device, 1, 1, &rmidi)) < 0) 535 if (! (info_flags & (MPU401_INFO_INPUT | MPU401_INFO_OUTPUT)))
536 info_flags |= MPU401_INFO_INPUT | MPU401_INFO_OUTPUT;
537 in_enable = (info_flags & MPU401_INFO_INPUT) ? 1 : 0;
538 out_enable = (info_flags & MPU401_INFO_OUTPUT) ? 1 : 0;
539 if ((err = snd_rawmidi_new(card, "MPU-401U", device,
540 out_enable, in_enable, &rmidi)) < 0)
504 return err; 541 return err;
505 mpu = kzalloc(sizeof(*mpu), GFP_KERNEL); 542 mpu = kzalloc(sizeof(*mpu), GFP_KERNEL);
506 if (mpu == NULL) { 543 if (mpu == NULL) {
@@ -514,7 +551,7 @@ int snd_mpu401_uart_new(struct snd_card *card, int device,
514 spin_lock_init(&mpu->output_lock); 551 spin_lock_init(&mpu->output_lock);
515 spin_lock_init(&mpu->timer_lock); 552 spin_lock_init(&mpu->timer_lock);
516 mpu->hardware = hardware; 553 mpu->hardware = hardware;
517 if (!integrated) { 554 if (! (info_flags & MPU401_INFO_INTEGRATED)) {
518 int res_size = hardware == MPU401_HW_PC98II ? 4 : 2; 555 int res_size = hardware == MPU401_HW_PC98II ? 4 : 2;
519 mpu->res = request_region(port, res_size, "MPU401 UART"); 556 mpu->res = request_region(port, res_size, "MPU401 UART");
520 if (mpu->res == NULL) { 557 if (mpu->res == NULL) {
@@ -525,15 +562,12 @@ int snd_mpu401_uart_new(struct snd_card *card, int device,
525 return -EBUSY; 562 return -EBUSY;
526 } 563 }
527 } 564 }
528 switch (hardware) { 565 if (info_flags & MPU401_INFO_MMIO) {
529 case MPU401_HW_AUREAL:
530 mpu->write = mpu401_write_mmio; 566 mpu->write = mpu401_write_mmio;
531 mpu->read = mpu401_read_mmio; 567 mpu->read = mpu401_read_mmio;
532 break; 568 } else {
533 default:
534 mpu->write = mpu401_write_port; 569 mpu->write = mpu401_write_port;
535 mpu->read = mpu401_read_port; 570 mpu->read = mpu401_read_port;
536 break;
537 } 571 }
538 mpu->port = port; 572 mpu->port = port;
539 if (hardware == MPU401_HW_PC98II) 573 if (hardware == MPU401_HW_PC98II)
@@ -549,6 +583,7 @@ int snd_mpu401_uart_new(struct snd_card *card, int device,
549 return -EBUSY; 583 return -EBUSY;
550 } 584 }
551 } 585 }
586 mpu->info_flags = info_flags;
552 mpu->irq = irq; 587 mpu->irq = irq;
553 mpu->irq_flags = irq_flags; 588 mpu->irq_flags = irq_flags;
554 if (card->shortname[0]) 589 if (card->shortname[0])
@@ -556,13 +591,18 @@ int snd_mpu401_uart_new(struct snd_card *card, int device,
556 card->shortname); 591 card->shortname);
557 else 592 else
558 sprintf(rmidi->name, "MPU-401 MIDI %d-%d",card->number, device); 593 sprintf(rmidi->name, "MPU-401 MIDI %d-%d",card->number, device);
559 snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, 594 if (out_enable) {
560 &snd_mpu401_uart_output); 595 snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT,
561 snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, 596 &snd_mpu401_uart_output);
562 &snd_mpu401_uart_input); 597 rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT;
563 rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | 598 }
564 SNDRV_RAWMIDI_INFO_INPUT | 599 if (in_enable) {
565 SNDRV_RAWMIDI_INFO_DUPLEX; 600 snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT,
601 &snd_mpu401_uart_input);
602 rmidi->info_flags |= SNDRV_RAWMIDI_INFO_INPUT;
603 if (out_enable)
604 rmidi->info_flags |= SNDRV_RAWMIDI_INFO_DUPLEX;
605 }
566 mpu->rmidi = rmidi; 606 mpu->rmidi = rmidi;
567 if (rrawmidi) 607 if (rrawmidi)
568 *rrawmidi = rmidi; 608 *rrawmidi = rmidi;
diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c
index d2a856f0fde2..27271c9446dc 100644
--- a/sound/isa/sscape.c
+++ b/sound/isa/sscape.c
@@ -897,10 +897,9 @@ static int __devinit create_mpu401(struct snd_card *card, int devnum, unsigned l
897 struct snd_rawmidi *rawmidi; 897 struct snd_rawmidi *rawmidi;
898 int err; 898 int err;
899 899
900#define MPU401_SHARE_HARDWARE 1
901 if ((err = snd_mpu401_uart_new(card, devnum, 900 if ((err = snd_mpu401_uart_new(card, devnum,
902 MPU401_HW_MPU401, 901 MPU401_HW_MPU401,
903 port, MPU401_SHARE_HARDWARE, 902 port, MPU401_INFO_INTEGRATED,
904 irq, SA_INTERRUPT, 903 irq, SA_INTERRUPT,
905 &rawmidi)) == 0) { 904 &rawmidi)) == 0) {
906 struct snd_mpu401 *mpu = (struct snd_mpu401 *) rawmidi->private_data; 905 struct snd_mpu401 *mpu = (struct snd_mpu401 *) rawmidi->private_data;
diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c
index 60423b1c678b..a9f08066459a 100644
--- a/sound/pci/als4000.c
+++ b/sound/pci/als4000.c
@@ -746,8 +746,8 @@ static int __devinit snd_card_als4000_probe(struct pci_dev *pci,
746 card->shortname, chip->alt_port, chip->irq); 746 card->shortname, chip->alt_port, chip->irq);
747 747
748 if ((err = snd_mpu401_uart_new( card, 0, MPU401_HW_ALS4000, 748 if ((err = snd_mpu401_uart_new( card, 0, MPU401_HW_ALS4000,
749 gcr+0x30, 1, pci->irq, 0, 749 gcr+0x30, MPU401_INFO_INTEGRATED,
750 &chip->rmidi)) < 0) { 750 pci->irq, 0, &chip->rmidi)) < 0) {
751 printk(KERN_ERR "als4000: no MPU-401 device at 0x%lx?\n", gcr+0x30); 751 printk(KERN_ERR "als4000: no MPU-401 device at 0x%lx?\n", gcr+0x30);
752 goto out_err; 752 goto out_err;
753 } 753 }
diff --git a/sound/pci/au88x0/au88x0_mpu401.c b/sound/pci/au88x0/au88x0_mpu401.c
index 1e128a3c8d89..5a0c53530fae 100644
--- a/sound/pci/au88x0/au88x0_mpu401.c
+++ b/sound/pci/au88x0/au88x0_mpu401.c
@@ -95,7 +95,8 @@ static int __devinit snd_vortex_midi(vortex_t * vortex)
95 port = (unsigned long)(vortex->mmio + VORTEX_MIDI_DATA); 95 port = (unsigned long)(vortex->mmio + VORTEX_MIDI_DATA);
96 if ((temp = 96 if ((temp =
97 snd_mpu401_uart_new(vortex->card, 0, MPU401_HW_AUREAL, port, 97 snd_mpu401_uart_new(vortex->card, 0, MPU401_HW_AUREAL, port,
98 1, 0, 0, &rmidi)) != 0) { 98 MPU401_INFO_INTEGRATED | MPU401_INFO_MMIO,
99 0, 0, &rmidi)) != 0) {
99 hwwrite(vortex->mmio, VORTEX_CTRL, 100 hwwrite(vortex->mmio, VORTEX_CTRL,
100 (hwread(vortex->mmio, VORTEX_CTRL) & 101 (hwread(vortex->mmio, VORTEX_CTRL) &
101 ~CTRL_MIDI_PORT) & ~CTRL_MIDI_EN); 102 ~CTRL_MIDI_PORT) & ~CTRL_MIDI_EN);
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c
index e68056c81580..6e62dafb66cd 100644
--- a/sound/pci/azt3328.c
+++ b/sound/pci/azt3328.c
@@ -1806,8 +1806,8 @@ snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
1806 card->private_data = chip; 1806 card->private_data = chip;
1807 1807
1808 if ((err = snd_mpu401_uart_new( card, 0, MPU401_HW_MPU401, 1808 if ((err = snd_mpu401_uart_new( card, 0, MPU401_HW_MPU401,
1809 chip->mpu_port, 1, pci->irq, 0, 1809 chip->mpu_port, MPU401_INFO_INTEGRATED,
1810 &chip->rmidi)) < 0) { 1810 pci->irq, 0, &chip->rmidi)) < 0) {
1811 snd_printk(KERN_ERR "azf3328: no MPU-401 device at 0x%lx?\n", chip->mpu_port); 1811 snd_printk(KERN_ERR "azf3328: no MPU-401 device at 0x%lx?\n", chip->mpu_port);
1812 goto out_err; 1812 goto out_err;
1813 } 1813 }
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
index cb475ada2ef1..79bc60a5204e 100644
--- a/sound/pci/cmipci.c
+++ b/sound/pci/cmipci.c
@@ -2981,7 +2981,9 @@ static int __devinit snd_cmipci_create(struct snd_card *card, struct pci_dev *pc
2981 2981
2982 if (iomidi > 0) { 2982 if (iomidi > 0) {
2983 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_CMIPCI, 2983 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_CMIPCI,
2984 iomidi, integrated_midi, 2984 iomidi,
2985 (integrated_midi ?
2986 MPU401_INFO_INTEGRATED : 0),
2985 cm->irq, 0, &cm->rmidi)) < 0) { 2987 cm->irq, 0, &cm->rmidi)) < 0) {
2986 printk(KERN_ERR "cmipci: no UART401 device at 0x%lx\n", iomidi); 2988 printk(KERN_ERR "cmipci: no UART401 device at 0x%lx\n", iomidi);
2987 } 2989 }
diff --git a/sound/pci/cs5535audio/cs5535audio.c b/sound/pci/cs5535audio/cs5535audio.c
index 8f46190f24ad..f61c4fa4ed62 100644
--- a/sound/pci/cs5535audio/cs5535audio.c
+++ b/sound/pci/cs5535audio/cs5535audio.c
@@ -56,17 +56,16 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = {
56 {} 56 {}
57}; 57};
58 58
59static int index = SNDRV_DEFAULT_IDX1; 59static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
60static char *id = SNDRV_DEFAULT_STR1; 60static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
61/* for backward compatibility */ 61static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
62static int enable;
63 62
64module_param(index, int, 0444); 63module_param_array(index, int, NULL, 0444);
65MODULE_PARM_DESC(index, "Index value for " DRIVER_NAME); 64MODULE_PARM_DESC(index, "Index value for " DRIVER_NAME);
66module_param(id, charp, 0444); 65module_param_array(id, charp, NULL, 0444);
67MODULE_PARM_DESC(id, "ID string for " DRIVER_NAME); 66MODULE_PARM_DESC(id, "ID string for " DRIVER_NAME);
68module_param(enable, bool, 0444); 67module_param_array(enable, bool, NULL, 0444);
69MODULE_PARM_DESC(enable, "Enable for " DRIVER_NAME); 68MODULE_PARM_DESC(enable, "Enable " DRIVER_NAME);
70 69
71static struct pci_device_id snd_cs5535audio_ids[] __devinitdata = { 70static struct pci_device_id snd_cs5535audio_ids[] __devinitdata = {
72 { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_CS5535_AUDIO) }, 71 { PCI_DEVICE(PCI_VENDOR_ID_NS, PCI_DEVICE_ID_NS_CS5535_AUDIO) },
@@ -358,8 +357,12 @@ static int __devinit snd_cs5535audio_probe(struct pci_dev *pci,
358 357
359 if (dev >= SNDRV_CARDS) 358 if (dev >= SNDRV_CARDS)
360 return -ENODEV; 359 return -ENODEV;
360 if (!enable[dev]) {
361 dev++;
362 return -ENOENT;
363 }
361 364
362 card = snd_card_new(index, id, THIS_MODULE, 0); 365 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
363 if (card == NULL) 366 if (card == NULL)
364 return -ENOMEM; 367 return -ENOMEM;
365 368
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c
index 6f9094ca4fb4..ca6603fe0b11 100644
--- a/sound/pci/es1938.c
+++ b/sound/pci/es1938.c
@@ -1756,7 +1756,8 @@ static int __devinit snd_es1938_probe(struct pci_dev *pci,
1756 } 1756 }
1757 } 1757 }
1758 if (snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, 1758 if (snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401,
1759 chip->mpu_port, 1, chip->irq, 0, &chip->rmidi) < 0) { 1759 chip->mpu_port, MPU401_INFO_INTEGRATED,
1760 chip->irq, 0, &chip->rmidi) < 0) {
1760 printk(KERN_ERR "es1938: unable to initialize MPU-401\n"); 1761 printk(KERN_ERR "es1938: unable to initialize MPU-401\n");
1761 } else { 1762 } else {
1762 // this line is vital for MIDI interrupt handling on ess-solo1 1763 // this line is vital for MIDI interrupt handling on ess-solo1
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c
index f43bd380ac28..bfa0876e715e 100644
--- a/sound/pci/es1968.c
+++ b/sound/pci/es1968.c
@@ -2727,7 +2727,8 @@ static int __devinit snd_es1968_probe(struct pci_dev *pci,
2727 } 2727 }
2728 if (enable_mpu[dev]) { 2728 if (enable_mpu[dev]) {
2729 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, 2729 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401,
2730 chip->io_port + ESM_MPU401_PORT, 1, 2730 chip->io_port + ESM_MPU401_PORT,
2731 MPU401_INFO_INTEGRATED,
2731 chip->irq, 0, &chip->rmidi)) < 0) { 2732 chip->irq, 0, &chip->rmidi)) < 0) {
2732 printk(KERN_WARNING "es1968: skipping MPU-401 MIDI support..\n"); 2733 printk(KERN_WARNING "es1968: skipping MPU-401 MIDI support..\n");
2733 } 2734 }
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c
index 0ec90f377319..0afa573dd244 100644
--- a/sound/pci/fm801.c
+++ b/sound/pci/fm801.c
@@ -1448,7 +1448,8 @@ static int __devinit snd_card_fm801_probe(struct pci_dev *pci,
1448 return err; 1448 return err;
1449 } 1449 }
1450 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_FM801, 1450 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_FM801,
1451 FM801_REG(chip, MPU401_DATA), 1, 1451 FM801_REG(chip, MPU401_DATA),
1452 MPU401_INFO_INTEGRATED,
1452 chip->irq, 0, &chip->rmidi)) < 0) { 1453 chip->irq, 0, &chip->rmidi)) < 0) {
1453 snd_card_free(card); 1454 snd_card_free(card);
1454 return err; 1455 return err;
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c
index 52de85e21b95..00e565e1db3a 100644
--- a/sound/pci/ice1712/ice1712.c
+++ b/sound/pci/ice1712/ice1712.c
@@ -2737,7 +2737,8 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci,
2737 2737
2738 if (! c->no_mpu401) { 2738 if (! c->no_mpu401) {
2739 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_ICE1712, 2739 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_ICE1712,
2740 ICEREG(ice, MPU1_CTRL), 1, 2740 ICEREG(ice, MPU1_CTRL),
2741 MPU401_INFO_INTEGRATED,
2741 ice->irq, 0, 2742 ice->irq, 0,
2742 &ice->rmidi[0])) < 0) { 2743 &ice->rmidi[0])) < 0) {
2743 snd_card_free(card); 2744 snd_card_free(card);
@@ -2752,7 +2753,8 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci,
2752 if (ice->eeprom.data[ICE_EEP1_CODEC] & ICE1712_CFG_2xMPU401) { 2753 if (ice->eeprom.data[ICE_EEP1_CODEC] & ICE1712_CFG_2xMPU401) {
2753 /* 2nd port used */ 2754 /* 2nd port used */
2754 if ((err = snd_mpu401_uart_new(card, 1, MPU401_HW_ICE1712, 2755 if ((err = snd_mpu401_uart_new(card, 1, MPU401_HW_ICE1712,
2755 ICEREG(ice, MPU2_CTRL), 1, 2756 ICEREG(ice, MPU2_CTRL),
2757 MPU401_INFO_INTEGRATED,
2756 ice->irq, 0, 2758 ice->irq, 0,
2757 &ice->rmidi[1])) < 0) { 2759 &ice->rmidi[1])) < 0) {
2758 snd_card_free(card); 2760 snd_card_free(card);
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c
index 1031bcbf7064..34a58c629f47 100644
--- a/sound/pci/ice1712/ice1724.c
+++ b/sound/pci/ice1712/ice1724.c
@@ -2388,7 +2388,8 @@ static int __devinit snd_vt1724_probe(struct pci_dev *pci,
2388 if (! c->no_mpu401) { 2388 if (! c->no_mpu401) {
2389 if (ice->eeprom.data[ICE_EEP2_SYSCONF] & VT1724_CFG_MPU401) { 2389 if (ice->eeprom.data[ICE_EEP2_SYSCONF] & VT1724_CFG_MPU401) {
2390 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_ICE1712, 2390 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_ICE1712,
2391 ICEREG1724(ice, MPU_CTRL), 1, 2391 ICEREG1724(ice, MPU_CTRL),
2392 MPU401_INFO_INTEGRATED,
2392 ice->irq, 0, 2393 ice->irq, 0,
2393 &ice->rmidi[0])) < 0) { 2394 &ice->rmidi[0])) < 0) {
2394 snd_card_free(card); 2395 snd_card_free(card);
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c
index 1928e06b6d82..1c344fbd964d 100644
--- a/sound/pci/maestro3.c
+++ b/sound/pci/maestro3.c
@@ -2861,7 +2861,8 @@ snd_m3_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
2861#if 0 /* TODO: not supported yet */ 2861#if 0 /* TODO: not supported yet */
2862 /* TODO enable MIDI IRQ and I/O */ 2862 /* TODO enable MIDI IRQ and I/O */
2863 err = snd_mpu401_uart_new(chip->card, 0, MPU401_HW_MPU401, 2863 err = snd_mpu401_uart_new(chip->card, 0, MPU401_HW_MPU401,
2864 chip->iobase + MPU401_DATA_PORT, 1, 2864 chip->iobase + MPU401_DATA_PORT,
2865 MPU401_INFO_INTEGRATED,
2865 chip->irq, 0, &chip->rmidi); 2866 chip->irq, 0, &chip->rmidi);
2866 if (err < 0) 2867 if (err < 0)
2867 printk(KERN_WARNING "maestro3: no MIDI support.\n"); 2868 printk(KERN_WARNING "maestro3: no MIDI support.\n");
diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c
index 51775706c843..dcf402948347 100644
--- a/sound/pci/sonicvibes.c
+++ b/sound/pci/sonicvibes.c
@@ -1456,7 +1456,7 @@ static int __devinit snd_sonic_probe(struct pci_dev *pci,
1456 return err; 1456 return err;
1457 } 1457 }
1458 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_SONICVIBES, 1458 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_SONICVIBES,
1459 sonic->midi_port, 1, 1459 sonic->midi_port, MPU401_INFO_INTEGRATED,
1460 sonic->irq, 0, 1460 sonic->irq, 0,
1461 &midi_uart)) < 0) { 1461 &midi_uart)) < 0) {
1462 snd_card_free(card); 1462 snd_card_free(card);
diff --git a/sound/pci/trident/trident.c b/sound/pci/trident/trident.c
index 9624a5f2b875..5629b7eba96d 100644
--- a/sound/pci/trident/trident.c
+++ b/sound/pci/trident/trident.c
@@ -148,7 +148,8 @@ static int __devinit snd_trident_probe(struct pci_dev *pci,
148 } 148 }
149 if (trident->device != TRIDENT_DEVICE_ID_SI7018 && 149 if (trident->device != TRIDENT_DEVICE_ID_SI7018 &&
150 (err = snd_mpu401_uart_new(card, 0, MPU401_HW_TRID4DWAVE, 150 (err = snd_mpu401_uart_new(card, 0, MPU401_HW_TRID4DWAVE,
151 trident->midi_port, 1, 151 trident->midi_port,
152 MPU401_INFO_INTEGRATED,
152 trident->irq, 0, &trident->rmidi)) < 0) { 153 trident->irq, 0, &trident->rmidi)) < 0) {
153 snd_card_free(card); 154 snd_card_free(card);
154 return err; 155 return err;
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
index a1b777e79c59..12ce22ef16e3 100644
--- a/sound/pci/via82xx.c
+++ b/sound/pci/via82xx.c
@@ -1973,7 +1973,7 @@ static int __devinit snd_via686_init_misc(struct via82xx *chip)
1973 pci_write_config_byte(chip->pci, VIA_PNP_CONTROL, legacy_cfg); 1973 pci_write_config_byte(chip->pci, VIA_PNP_CONTROL, legacy_cfg);
1974 if (chip->mpu_res) { 1974 if (chip->mpu_res) {
1975 if (snd_mpu401_uart_new(chip->card, 0, MPU401_HW_VIA686A, 1975 if (snd_mpu401_uart_new(chip->card, 0, MPU401_HW_VIA686A,
1976 mpu_port, 1, 1976 mpu_port, MPU401_INFO_INTEGRATED,
1977 chip->irq, 0, &chip->rmidi) < 0) { 1977 chip->irq, 0, &chip->rmidi) < 0) {
1978 printk(KERN_WARNING "unable to initialize MPU-401" 1978 printk(KERN_WARNING "unable to initialize MPU-401"
1979 " at 0x%lx, skipping\n", mpu_port); 1979 " at 0x%lx, skipping\n", mpu_port);
diff --git a/sound/pci/ymfpci/ymfpci.c b/sound/pci/ymfpci/ymfpci.c
index 65ebf5f1933a..26aa775b7b69 100644
--- a/sound/pci/ymfpci/ymfpci.c
+++ b/sound/pci/ymfpci/ymfpci.c
@@ -308,7 +308,8 @@ static int __devinit snd_card_ymfpci_probe(struct pci_dev *pci,
308 } 308 }
309 if (chip->mpu_res) { 309 if (chip->mpu_res) {
310 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_YMFPCI, 310 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_YMFPCI,
311 mpu_port[dev], 1, 311 mpu_port[dev],
312 MPU401_INFO_INTEGRATED,
312 pci->irq, 0, &chip->rawmidi)) < 0) { 313 pci->irq, 0, &chip->rawmidi)) < 0) {
313 printk(KERN_WARNING "ymfpci: cannot initialize MPU401 at 0x%lx, skipping...\n", mpu_port[dev]); 314 printk(KERN_WARNING "ymfpci: cannot initialize MPU401 at 0x%lx, skipping...\n", mpu_port[dev]);
314 legacy_ctrl &= ~YMFPCI_LEGACY_MIEN; /* disable MPU401 irq */ 315 legacy_ctrl &= ~YMFPCI_LEGACY_MIEN; /* disable MPU401 irq */