Lines Matching +full:- +full:uart
1 // SPDX-License-Identifier: GPL-2.0-or-later
12 * Added support for the Midiator MS-124T and for the MS-124W in
17 * More documentation can be found in serial-u16550.txt.
39 #define SNDRV_SERIAL_MS124T 1 /* Midiator MS-124T */
40 #define SNDRV_SERIAL_MS124W_SA 2 /* Midiator MS-124W in S/A mode */
41 #define SNDRV_SERIAL_MS124W_MB 3 /* Midiator MS-124W in M/B mode */
46 "MS-124T",
47 "MS-124W S/A",
48 "MS-124W M/B",
53 #define SNDRV_SERIAL_DROPBUFF 1 /* Non-blocking discard operation */
55 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
60 static int speed[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 38400}; /* 9600,19200,38400,57600,1152…
61 static int base[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 115200}; /* baud base */
62 static int outs[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; /* 1 to 16 */
63 static int ins[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; /* 1 to 16 */
64 static int adaptor[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = SNDRV_SERIAL_SOUNDCANVAS};
65 static bool droponfull[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS -1)] = SNDRV_SERIAL_NORMALBUFF };
86 MODULE_PARM_DESC(droponfull, "Flag to enable drop-on-full buffer mode");
91 /*#define SNDRV_SERIAL_MS124W_MB_NOCOMBO 1*/ /* Address outs as 0-3 instead of bitmap */
97 #define TX_BUFF_MASK (TX_BUFF_SIZE - 1)
157 static inline void snd_uart16550_add_timer(struct snd_uart16550 *uart) in snd_uart16550_add_timer() argument
159 if (!uart->timer_running) { in snd_uart16550_add_timer()
161 mod_timer(&uart->buffer_timer, jiffies + (HZ + 255) / 256); in snd_uart16550_add_timer()
162 uart->timer_running = 1; in snd_uart16550_add_timer()
166 static inline void snd_uart16550_del_timer(struct snd_uart16550 *uart) in snd_uart16550_del_timer() argument
168 if (uart->timer_running) { in snd_uart16550_del_timer()
169 del_timer(&uart->buffer_timer); in snd_uart16550_del_timer()
170 uart->timer_running = 0; in snd_uart16550_del_timer()
175 static inline void snd_uart16550_buffer_output(struct snd_uart16550 *uart) in snd_uart16550_buffer_output() argument
177 unsigned short buff_out = uart->buff_out; in snd_uart16550_buffer_output()
178 if (uart->buff_in_count > 0) { in snd_uart16550_buffer_output()
179 outb(uart->tx_buff[buff_out], uart->base + UART_TX); in snd_uart16550_buffer_output()
180 uart->fifo_count++; in snd_uart16550_buffer_output()
183 uart->buff_out = buff_out; in snd_uart16550_buffer_output()
184 uart->buff_in_count--; in snd_uart16550_buffer_output()
192 static void snd_uart16550_io_loop(struct snd_uart16550 * uart) in snd_uart16550_io_loop() argument
198 substream = uart->prev_in; in snd_uart16550_io_loop()
201 while ((status = inb(uart->base + UART_LSR)) & UART_LSR_DR) { in snd_uart16550_io_loop()
203 c = inb(uart->base + UART_RX); in snd_uart16550_io_loop()
207 uart->rstatus = c; in snd_uart16550_io_loop()
210 if (uart->adaptor == SNDRV_SERIAL_GENERIC) { in snd_uart16550_io_loop()
211 if (uart->rstatus == 0xf5) { in snd_uart16550_io_loop()
213 substream = c - 1; in snd_uart16550_io_loop()
217 uart->rstatus = 0; in snd_uart16550_io_loop()
218 } else if ((uart->filemode & SERIAL_MODE_INPUT_OPEN) in snd_uart16550_io_loop()
219 && uart->midi_input[substream]) in snd_uart16550_io_loop()
220 snd_rawmidi_receive(uart->midi_input[substream], in snd_uart16550_io_loop()
222 } else if ((uart->filemode & SERIAL_MODE_INPUT_OPEN) && in snd_uart16550_io_loop()
223 uart->midi_input[substream]) in snd_uart16550_io_loop()
224 snd_rawmidi_receive(uart->midi_input[substream], &c, 1); in snd_uart16550_io_loop()
229 uart->rmidi->name, uart->base); in snd_uart16550_io_loop()
233 uart->prev_in = substream; in snd_uart16550_io_loop()
239 uart->fifo_count = 0; in snd_uart16550_io_loop()
240 if (uart->adaptor == SNDRV_SERIAL_MS124W_SA in snd_uart16550_io_loop()
241 || uart->adaptor == SNDRV_SERIAL_GENERIC) { in snd_uart16550_io_loop()
243 status = inb(uart->base + UART_MSR); in snd_uart16550_io_loop()
244 while (uart->fifo_count == 0 && (status & UART_MSR_CTS) && in snd_uart16550_io_loop()
245 uart->buff_in_count > 0) { in snd_uart16550_io_loop()
246 snd_uart16550_buffer_output(uart); in snd_uart16550_io_loop()
247 status = inb(uart->base + UART_MSR); in snd_uart16550_io_loop()
251 while (uart->fifo_count < uart->fifo_limit /* Can we write ? */ in snd_uart16550_io_loop()
252 && uart->buff_in_count > 0) /* Do we want to? */ in snd_uart16550_io_loop()
253 snd_uart16550_buffer_output(uart); in snd_uart16550_io_loop()
255 if (uart->irq < 0 && uart->buff_in_count > 0) in snd_uart16550_io_loop()
256 snd_uart16550_add_timer(uart); in snd_uart16550_io_loop()
260 * ---------------------------
261 * After receiving a interrupt, it is important to indicate to the UART that
277 * interrupts at all. (Possibly tied to an internal pull-up on CTS?)
281 struct snd_uart16550 *uart; in snd_uart16550_interrupt() local
283 uart = dev_id; in snd_uart16550_interrupt()
284 spin_lock(&uart->open_lock); in snd_uart16550_interrupt()
285 if (uart->filemode == SERIAL_MODE_NOT_OPENED) { in snd_uart16550_interrupt()
286 spin_unlock(&uart->open_lock); in snd_uart16550_interrupt()
289 /* indicate to the UART that the interrupt has been serviced */ in snd_uart16550_interrupt()
290 inb(uart->base + UART_IIR); in snd_uart16550_interrupt()
291 snd_uart16550_io_loop(uart); in snd_uart16550_interrupt()
292 spin_unlock(&uart->open_lock); in snd_uart16550_interrupt()
300 struct snd_uart16550 *uart; in snd_uart16550_buffer_timer() local
302 uart = from_timer(uart, t, buffer_timer); in snd_uart16550_buffer_timer()
303 spin_lock_irqsave(&uart->open_lock, flags); in snd_uart16550_buffer_timer()
304 snd_uart16550_del_timer(uart); in snd_uart16550_buffer_timer()
305 snd_uart16550_io_loop(uart); in snd_uart16550_buffer_timer()
306 spin_unlock_irqrestore(&uart->open_lock, flags); in snd_uart16550_buffer_timer()
310 * this method probes, if an uart sits on given port
314 static int snd_uart16550_detect(struct snd_uart16550 *uart) in snd_uart16550_detect() argument
316 unsigned long io_base = uart->base; in snd_uart16550_detect()
320 /* Do some vague tests for the presence of the uart */ in snd_uart16550_detect()
322 return -ENODEV; /* Not configured */ in snd_uart16550_detect()
325 if (!devm_request_region(uart->card->dev, io_base, 8, "Serial MIDI")) { in snd_uart16550_detect()
327 return -EBUSY; in snd_uart16550_detect()
330 /* uart detected unless one of the following tests should fail */ in snd_uart16550_detect()
332 /* 8 data-bits, 1 stop-bit, parity off, DLAB = 0 */ in snd_uart16550_detect()
356 static void snd_uart16550_do_open(struct snd_uart16550 * uart) in snd_uart16550_do_open() argument
361 uart->buff_in_count = 0; in snd_uart16550_do_open()
362 uart->buff_in = 0; in snd_uart16550_do_open()
363 uart->buff_out = 0; in snd_uart16550_do_open()
364 uart->fifo_limit = 1; in snd_uart16550_do_open()
365 uart->fifo_count = 0; in snd_uart16550_do_open()
366 uart->timer_running = 0; in snd_uart16550_do_open()
371 | UART_FCR_TRIGGER_4 /* Set FIFO trigger at 4-bytes */ in snd_uart16550_do_open()
372 /* NOTE: interrupt generated after T=(time)4-bytes in snd_uart16550_do_open()
375 ,uart->base + UART_FCR); /* FIFO Control Register */ in snd_uart16550_do_open()
377 if ((inb(uart->base + UART_IIR) & 0xf0) == 0xc0) in snd_uart16550_do_open()
378 uart->fifo_limit = 16; in snd_uart16550_do_open()
379 if (uart->divisor != 0) { in snd_uart16550_do_open()
380 uart->old_line_ctrl_reg = inb(uart->base + UART_LCR); in snd_uart16550_do_open()
382 ,uart->base + UART_LCR); /* Line Control Register */ in snd_uart16550_do_open()
383 uart->old_divisor_lsb = inb(uart->base + UART_DLL); in snd_uart16550_do_open()
384 uart->old_divisor_msb = inb(uart->base + UART_DLM); in snd_uart16550_do_open()
386 outb(uart->divisor in snd_uart16550_do_open()
387 ,uart->base + UART_DLL); /* Divisor Latch Low */ in snd_uart16550_do_open()
389 ,uart->base + UART_DLM); /* Divisor Latch High */ in snd_uart16550_do_open()
393 outb(UART_LCR_WLEN8 /* 8 data-bits */ in snd_uart16550_do_open()
394 | 0 /* 1 stop-bit */ in snd_uart16550_do_open()
397 ,uart->base + UART_LCR); /* Line Control Register */ in snd_uart16550_do_open()
399 switch (uart->adaptor) { in snd_uart16550_do_open()
401 outb(UART_MCR_RTS /* Set Request-To-Send line active */ in snd_uart16550_do_open()
402 | UART_MCR_DTR /* Set Data-Terminal-Ready line active */ in snd_uart16550_do_open()
403 | UART_MCR_OUT2 /* Set OUT2 - not always required, but when in snd_uart16550_do_open()
406 ,uart->base + UART_MCR); /* Modem Control Register */ in snd_uart16550_do_open()
410 /* MS-124W can draw power from RTS and DTR if they in snd_uart16550_do_open()
413 uart->base + UART_MCR); in snd_uart16550_do_open()
416 /* MS-124T can draw power from RTS and/or DTR (preferably in snd_uart16550_do_open()
419 uart->base + UART_MCR); in snd_uart16550_do_open()
423 if (uart->irq < 0) { in snd_uart16550_do_open()
427 } else if (uart->adaptor == SNDRV_SERIAL_MS124W_SA) { in snd_uart16550_do_open()
431 } else if (uart->adaptor == SNDRV_SERIAL_GENERIC) { in snd_uart16550_do_open()
441 outb(byte, uart->base + UART_IER); /* Interrupt enable Register */ in snd_uart16550_do_open()
443 inb(uart->base + UART_LSR); /* Clear any pre-existing overrun indication */ in snd_uart16550_do_open()
444 inb(uart->base + UART_IIR); /* Clear any pre-existing transmit interrupt */ in snd_uart16550_do_open()
445 inb(uart->base + UART_RX); /* Clear any pre-existing receive interrupt */ in snd_uart16550_do_open()
448 static void snd_uart16550_do_close(struct snd_uart16550 * uart) in snd_uart16550_do_close() argument
450 if (uart->irq < 0) in snd_uart16550_do_close()
451 snd_uart16550_del_timer(uart); in snd_uart16550_do_close()
453 /* NOTE: may need to disable interrupts before de-registering out handler. in snd_uart16550_do_close()
459 ,uart->base + UART_IER); /* Interrupt enable Register */ in snd_uart16550_do_close()
461 switch (uart->adaptor) { in snd_uart16550_do_close()
463 outb((0 & UART_MCR_RTS) /* Deactivate Request-To-Send line */ in snd_uart16550_do_close()
464 |(0 & UART_MCR_DTR) /* Deactivate Data-Terminal-Ready line */ in snd_uart16550_do_close()
466 ,uart->base + UART_MCR); /* Modem Control Register */ in snd_uart16550_do_close()
470 /* MS-124W can draw power from RTS and DTR if they in snd_uart16550_do_close()
473 uart->base + UART_MCR); in snd_uart16550_do_close()
476 /* MS-124T can draw power from RTS and/or DTR (preferably in snd_uart16550_do_close()
479 uart->base + UART_MCR); in snd_uart16550_do_close()
483 inb(uart->base + UART_IIR); /* Clear any outstanding interrupts */ in snd_uart16550_do_close()
486 if (uart->divisor != 0) { in snd_uart16550_do_close()
488 ,uart->base + UART_LCR); /* Line Control Register */ in snd_uart16550_do_close()
489 outb(uart->old_divisor_lsb in snd_uart16550_do_close()
490 ,uart->base + UART_DLL); /* Divisor Latch Low */ in snd_uart16550_do_close()
491 outb(uart->old_divisor_msb in snd_uart16550_do_close()
492 ,uart->base + UART_DLM); /* Divisor Latch High */ in snd_uart16550_do_close()
494 outb(uart->old_line_ctrl_reg in snd_uart16550_do_close()
495 ,uart->base + UART_LCR); /* Line Control Register */ in snd_uart16550_do_close()
502 struct snd_uart16550 *uart = substream->rmidi->private_data; in snd_uart16550_input_open() local
504 spin_lock_irqsave(&uart->open_lock, flags); in snd_uart16550_input_open()
505 if (uart->filemode == SERIAL_MODE_NOT_OPENED) in snd_uart16550_input_open()
506 snd_uart16550_do_open(uart); in snd_uart16550_input_open()
507 uart->filemode |= SERIAL_MODE_INPUT_OPEN; in snd_uart16550_input_open()
508 uart->midi_input[substream->number] = substream; in snd_uart16550_input_open()
509 spin_unlock_irqrestore(&uart->open_lock, flags); in snd_uart16550_input_open()
516 struct snd_uart16550 *uart = substream->rmidi->private_data; in snd_uart16550_input_close() local
518 spin_lock_irqsave(&uart->open_lock, flags); in snd_uart16550_input_close()
519 uart->filemode &= ~SERIAL_MODE_INPUT_OPEN; in snd_uart16550_input_close()
520 uart->midi_input[substream->number] = NULL; in snd_uart16550_input_close()
521 if (uart->filemode == SERIAL_MODE_NOT_OPENED) in snd_uart16550_input_close()
522 snd_uart16550_do_close(uart); in snd_uart16550_input_close()
523 spin_unlock_irqrestore(&uart->open_lock, flags); in snd_uart16550_input_close()
531 struct snd_uart16550 *uart = substream->rmidi->private_data; in snd_uart16550_input_trigger() local
533 spin_lock_irqsave(&uart->open_lock, flags); in snd_uart16550_input_trigger()
535 uart->filemode |= SERIAL_MODE_INPUT_TRIGGERED; in snd_uart16550_input_trigger()
537 uart->filemode &= ~SERIAL_MODE_INPUT_TRIGGERED; in snd_uart16550_input_trigger()
538 spin_unlock_irqrestore(&uart->open_lock, flags); in snd_uart16550_input_trigger()
544 struct snd_uart16550 *uart = substream->rmidi->private_data; in snd_uart16550_output_open() local
546 spin_lock_irqsave(&uart->open_lock, flags); in snd_uart16550_output_open()
547 if (uart->filemode == SERIAL_MODE_NOT_OPENED) in snd_uart16550_output_open()
548 snd_uart16550_do_open(uart); in snd_uart16550_output_open()
549 uart->filemode |= SERIAL_MODE_OUTPUT_OPEN; in snd_uart16550_output_open()
550 uart->midi_output[substream->number] = substream; in snd_uart16550_output_open()
551 spin_unlock_irqrestore(&uart->open_lock, flags); in snd_uart16550_output_open()
558 struct snd_uart16550 *uart = substream->rmidi->private_data; in snd_uart16550_output_close() local
560 spin_lock_irqsave(&uart->open_lock, flags); in snd_uart16550_output_close()
561 uart->filemode &= ~SERIAL_MODE_OUTPUT_OPEN; in snd_uart16550_output_close()
562 uart->midi_output[substream->number] = NULL; in snd_uart16550_output_close()
563 if (uart->filemode == SERIAL_MODE_NOT_OPENED) in snd_uart16550_output_close()
564 snd_uart16550_do_close(uart); in snd_uart16550_output_close()
565 spin_unlock_irqrestore(&uart->open_lock, flags); in snd_uart16550_output_close()
569 static inline int snd_uart16550_buffer_can_write(struct snd_uart16550 *uart, in snd_uart16550_buffer_can_write() argument
572 if (uart->buff_in_count + Num < TX_BUFF_SIZE) in snd_uart16550_buffer_can_write()
578 static inline int snd_uart16550_write_buffer(struct snd_uart16550 *uart, in snd_uart16550_write_buffer() argument
581 unsigned short buff_in = uart->buff_in; in snd_uart16550_write_buffer()
582 if (uart->buff_in_count < TX_BUFF_SIZE) { in snd_uart16550_write_buffer()
583 uart->tx_buff[buff_in] = byte; in snd_uart16550_write_buffer()
586 uart->buff_in = buff_in; in snd_uart16550_write_buffer()
587 uart->buff_in_count++; in snd_uart16550_write_buffer()
588 if (uart->irq < 0) /* polling mode */ in snd_uart16550_write_buffer()
589 snd_uart16550_add_timer(uart); in snd_uart16550_write_buffer()
595 static int snd_uart16550_output_byte(struct snd_uart16550 *uart, in snd_uart16550_output_byte() argument
599 if (uart->buff_in_count == 0 /* Buffer empty? */ in snd_uart16550_output_byte()
600 && ((uart->adaptor != SNDRV_SERIAL_MS124W_SA && in snd_uart16550_output_byte()
601 uart->adaptor != SNDRV_SERIAL_GENERIC) || in snd_uart16550_output_byte()
602 (uart->fifo_count == 0 /* FIFO empty? */ in snd_uart16550_output_byte()
603 && (inb(uart->base + UART_MSR) & UART_MSR_CTS)))) { /* CTS? */ in snd_uart16550_output_byte()
605 /* Tx Buffer Empty - try to write immediately */ in snd_uart16550_output_byte()
606 if ((inb(uart->base + UART_LSR) & UART_LSR_THRE) != 0) { in snd_uart16550_output_byte()
608 uart->fifo_count = 1; in snd_uart16550_output_byte()
609 outb(midi_byte, uart->base + UART_TX); in snd_uart16550_output_byte()
611 if (uart->fifo_count < uart->fifo_limit) { in snd_uart16550_output_byte()
612 uart->fifo_count++; in snd_uart16550_output_byte()
613 outb(midi_byte, uart->base + UART_TX); in snd_uart16550_output_byte()
615 /* Cannot write (buffer empty) - in snd_uart16550_output_byte()
617 snd_uart16550_write_buffer(uart, midi_byte); in snd_uart16550_output_byte()
621 if (!snd_uart16550_write_buffer(uart, midi_byte)) { in snd_uart16550_output_byte()
624 uart->rmidi->name, uart->base); in snd_uart16550_output_byte()
636 struct snd_uart16550 *uart = substream->rmidi->private_data; in snd_uart16550_output_write() local
645 spin_lock_irqsave(&uart->open_lock, flags); in snd_uart16550_output_write()
647 if (uart->irq < 0) /* polling */ in snd_uart16550_output_write()
648 snd_uart16550_io_loop(uart); in snd_uart16550_output_write()
650 if (uart->adaptor == SNDRV_SERIAL_MS124W_MB) { in snd_uart16550_output_write()
654 if (uart->buff_in_count > TX_BUFF_SIZE - 2) in snd_uart16550_output_write()
660 addr_byte = (1 << (substream->number + 4)) | 0x08; in snd_uart16550_output_write()
663 addr_byte = (substream->number << 4) | 0x08; in snd_uart16550_output_write()
668 snd_uart16550_output_byte(uart, substream, addr_byte); in snd_uart16550_output_write()
670 snd_uart16550_output_byte(uart, substream, midi_byte); in snd_uart16550_output_write()
678 (uart->adaptor == SNDRV_SERIAL_SOUNDCANVAS || in snd_uart16550_output_write()
679 uart->adaptor == SNDRV_SERIAL_GENERIC) && in snd_uart16550_output_write()
680 (uart->prev_out != substream->number || in snd_uart16550_output_write()
683 if (snd_uart16550_buffer_can_write(uart, 3)) { in snd_uart16550_output_write()
687 * in this uart, send the change part in snd_uart16550_output_write()
690 uart->prev_out = substream->number; in snd_uart16550_output_write()
692 snd_uart16550_output_byte(uart, substream, in snd_uart16550_output_write()
695 snd_uart16550_output_byte(uart, substream, in snd_uart16550_output_write()
696 uart->prev_out + 1); in snd_uart16550_output_write()
700 uart->adaptor == SNDRV_SERIAL_SOUNDCANVAS) in snd_uart16550_output_write()
701 snd_uart16550_output_byte(uart, substream, uart->prev_status[uart->prev_out]); in snd_uart16550_output_write()
702 } else if (!uart->drop_on_full) in snd_uart16550_output_write()
708 if (!snd_uart16550_output_byte(uart, substream, midi_byte) && in snd_uart16550_output_write()
709 !uart->drop_on_full ) in snd_uart16550_output_write()
713 uart->prev_status[uart->prev_out] = midi_byte; in snd_uart16550_output_write()
720 spin_unlock_irqrestore(&uart->open_lock, flags); in snd_uart16550_output_write()
727 struct snd_uart16550 *uart = substream->rmidi->private_data; in snd_uart16550_output_trigger() local
729 spin_lock_irqsave(&uart->open_lock, flags); in snd_uart16550_output_trigger()
731 uart->filemode |= SERIAL_MODE_OUTPUT_TRIGGERED; in snd_uart16550_output_trigger()
733 uart->filemode &= ~SERIAL_MODE_OUTPUT_TRIGGERED; in snd_uart16550_output_trigger()
734 spin_unlock_irqrestore(&uart->open_lock, flags); in snd_uart16550_output_trigger()
762 struct snd_uart16550 *uart; in snd_uart16550_create() local
766 uart = devm_kzalloc(card->dev, sizeof(*uart), GFP_KERNEL); in snd_uart16550_create()
767 if (!uart) in snd_uart16550_create()
768 return -ENOMEM; in snd_uart16550_create()
769 uart->adaptor = adaptor; in snd_uart16550_create()
770 uart->card = card; in snd_uart16550_create()
771 spin_lock_init(&uart->open_lock); in snd_uart16550_create()
772 uart->irq = -1; in snd_uart16550_create()
773 uart->base = iobase; in snd_uart16550_create()
774 uart->drop_on_full = droponfull; in snd_uart16550_create()
776 err = snd_uart16550_detect(uart); in snd_uart16550_create()
778 printk(KERN_ERR "no UART detected at 0x%lx\n", iobase); in snd_uart16550_create()
779 return -ENODEV; in snd_uart16550_create()
783 if (devm_request_irq(card->dev, irq, snd_uart16550_interrupt, in snd_uart16550_create()
784 0, "Serial MIDI", uart)) { in snd_uart16550_create()
788 uart->irq = irq; in snd_uart16550_create()
791 uart->divisor = base / speed; in snd_uart16550_create()
792 uart->speed = base / (unsigned int)uart->divisor; in snd_uart16550_create()
793 uart->speed_base = base; in snd_uart16550_create()
794 uart->prev_out = -1; in snd_uart16550_create()
795 uart->prev_in = 0; in snd_uart16550_create()
796 uart->rstatus = 0; in snd_uart16550_create()
797 memset(uart->prev_status, 0x80, sizeof(unsigned char) * SNDRV_SERIAL_MAX_OUTS); in snd_uart16550_create()
798 timer_setup(&uart->buffer_timer, snd_uart16550_buffer_timer, 0); in snd_uart16550_create()
799 uart->timer_running = 0; in snd_uart16550_create()
801 switch (uart->adaptor) { in snd_uart16550_create()
804 /* MS-124W can draw power from RTS and DTR if they in snd_uart16550_create()
806 outb(UART_MCR_RTS | (0&UART_MCR_DTR), uart->base + UART_MCR); in snd_uart16550_create()
809 /* MS-124T can draw power from RTS and/or DTR (preferably in snd_uart16550_create()
811 outb(UART_MCR_RTS | UART_MCR_DTR, uart->base + UART_MCR); in snd_uart16550_create()
818 *ruart = uart; in snd_uart16550_create()
827 list_for_each_entry(substream, &stream->substreams, list) { in snd_uart16550_substreams()
828 sprintf(substream->name, "Serial MIDI %d", substream->number + 1); in snd_uart16550_substreams()
832 static int snd_uart16550_rmidi(struct snd_uart16550 *uart, int device, in snd_uart16550_rmidi() argument
839 err = snd_rawmidi_new(uart->card, "UART Serial MIDI", device, in snd_uart16550_rmidi()
847 strcpy(rrawmidi->name, "Serial MIDI"); in snd_uart16550_rmidi()
848 snd_uart16550_substreams(&rrawmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT]); in snd_uart16550_rmidi()
849 snd_uart16550_substreams(&rrawmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT]); in snd_uart16550_rmidi()
850 rrawmidi->info_flags = SNDRV_RAWMIDI_INFO_OUTPUT | in snd_uart16550_rmidi()
853 rrawmidi->private_data = uart; in snd_uart16550_rmidi()
862 struct snd_uart16550 *uart; in snd_serial_probe() local
864 int dev = devptr->id; in snd_serial_probe()
883 "Adaptor type is out of range 0-%d (%d)\n", in snd_serial_probe()
885 return -ENODEV; in snd_serial_probe()
890 "Count of outputs is out of range 1-%d (%d)\n", in snd_serial_probe()
892 return -ENODEV; in snd_serial_probe()
897 "Count of inputs is out of range 1-%d (%d)\n", in snd_serial_probe()
899 return -ENODEV; in snd_serial_probe()
902 err = snd_devm_card_new(&devptr->dev, index[dev], id[dev], THIS_MODULE, in snd_serial_probe()
907 strcpy(card->driver, "Serial"); in snd_serial_probe()
908 strcpy(card->shortname, "Serial MIDI (UART16550A)"); in snd_serial_probe()
912 &uart); in snd_serial_probe()
916 err = snd_uart16550_rmidi(uart, 0, outs[dev], ins[dev], &uart->rmidi); in snd_serial_probe()
920 sprintf(card->longname, "%s [%s] at %#lx, irq %d", in snd_serial_probe()
921 card->shortname, in snd_serial_probe()
922 adaptor_names[uart->adaptor], in snd_serial_probe()
923 uart->base, in snd_serial_probe()
924 uart->irq); in snd_serial_probe()
981 return -ENODEV; in alsa_card_serial_init()