Lines Matching refs:port

196 static int mxuport_prepare_write_buffer(struct usb_serial_port *port,  in mxuport_prepare_write_buffer()  argument
202 count = kfifo_out_locked(&port->write_fifo, buf + HEADER_SIZE, in mxuport_prepare_write_buffer()
204 &port->lock); in mxuport_prepare_write_buffer()
206 put_unaligned_be16(port->port_number, buf); in mxuport_prepare_write_buffer()
209 dev_dbg(&port->dev, "%s - size %zd count %d\n", __func__, in mxuport_prepare_write_buffer()
297 struct usb_serial_port *port = tty->driver_data; in mxuport_throttle() local
298 struct usb_serial *serial = port->serial; in mxuport_throttle()
300 dev_dbg(&port->dev, "%s\n", __func__); in mxuport_throttle()
303 0, port->port_number); in mxuport_throttle()
316 struct usb_serial_port *port = tty->driver_data; in mxuport_unthrottle() local
317 struct usb_serial *serial = port->serial; in mxuport_unthrottle()
319 dev_dbg(&port->dev, "%s\n", __func__); in mxuport_unthrottle()
322 1, port->port_number); in mxuport_unthrottle()
329 static void mxuport_process_read_urb_data(struct usb_serial_port *port, in mxuport_process_read_urb_data() argument
334 if (!port->port.console || !port->sysrq) { in mxuport_process_read_urb_data()
335 tty_insert_flip_string(&port->port, data, size); in mxuport_process_read_urb_data()
338 if (!usb_serial_handle_sysrq_char(port, *data)) in mxuport_process_read_urb_data()
339 tty_insert_flip_char(&port->port, *data, in mxuport_process_read_urb_data()
343 tty_flip_buffer_push(&port->port); in mxuport_process_read_urb_data()
346 static void mxuport_msr_event(struct usb_serial_port *port, u8 buf[4]) in mxuport_msr_event() argument
348 struct mxuport_port *mxport = usb_get_serial_port_data(port); in mxuport_msr_event()
359 dev_dbg(&port->dev, "%s - current MSR status = 0x%x\n", in mxuport_msr_event()
364 dev_dbg(&port->dev, "%s - CTS high\n", __func__); in mxuport_msr_event()
367 dev_dbg(&port->dev, "%s - CTS low\n", __func__); in mxuport_msr_event()
372 dev_dbg(&port->dev, "%s - DSR high\n", __func__); in mxuport_msr_event()
375 dev_dbg(&port->dev, "%s - DSR low\n", __func__); in mxuport_msr_event()
380 dev_dbg(&port->dev, "%s - DCD high\n", __func__); in mxuport_msr_event()
383 dev_dbg(&port->dev, "%s - DCD low\n", __func__); in mxuport_msr_event()
391 port->icount.cts++; in mxuport_msr_event()
392 dev_dbg(&port->dev, "%s - CTS change\n", __func__); in mxuport_msr_event()
396 port->icount.dsr++; in mxuport_msr_event()
397 dev_dbg(&port->dev, "%s - DSR change\n", __func__); in mxuport_msr_event()
401 port->icount.dcd++; in mxuport_msr_event()
402 dev_dbg(&port->dev, "%s - DCD change\n", __func__); in mxuport_msr_event()
404 wake_up_interruptible(&port->port.delta_msr_wait); in mxuport_msr_event()
408 static void mxuport_lsr_event(struct usb_serial_port *port, u8 buf[4]) in mxuport_lsr_event() argument
413 port->icount.brk++; in mxuport_lsr_event()
414 dev_dbg(&port->dev, "%s - break error\n", __func__); in mxuport_lsr_event()
418 port->icount.frame++; in mxuport_lsr_event()
419 dev_dbg(&port->dev, "%s - frame error\n", __func__); in mxuport_lsr_event()
423 port->icount.parity++; in mxuport_lsr_event()
424 dev_dbg(&port->dev, "%s - parity error\n", __func__); in mxuport_lsr_event()
428 port->icount.overrun++; in mxuport_lsr_event()
429 dev_dbg(&port->dev, "%s - overrun error\n", __func__); in mxuport_lsr_event()
437 static void mxuport_process_read_urb_event(struct usb_serial_port *port, in mxuport_process_read_urb_event() argument
440 dev_dbg(&port->dev, "%s - receive event : %04x\n", __func__, event); in mxuport_process_read_urb_event()
450 mxuport_msr_event(port, buf); in mxuport_process_read_urb_event()
453 mxuport_lsr_event(port, buf); in mxuport_process_read_urb_event()
465 dev_dbg(&port->dev, "Unexpected event\n"); in mxuport_process_read_urb_event()
476 struct usb_serial_port *port = urb->context; in mxuport_process_read_urb_demux_data() local
477 struct usb_serial *serial = port->serial; in mxuport_process_read_urb_demux_data()
487 dev_warn(&port->dev, "%s - message with short header\n", in mxuport_process_read_urb_demux_data()
494 dev_warn(&port->dev, "%s - message for invalid port\n", in mxuport_process_read_urb_demux_data()
499 demux_port = serial->port[rcv_port]; in mxuport_process_read_urb_demux_data()
502 dev_warn(&port->dev, "%s - short data\n", __func__); in mxuport_process_read_urb_demux_data()
506 if (test_bit(ASYNCB_INITIALIZED, &demux_port->port.flags)) { in mxuport_process_read_urb_demux_data()
523 struct usb_serial_port *port = urb->context; in mxuport_process_read_urb_demux_event() local
524 struct usb_serial *serial = port->serial; in mxuport_process_read_urb_demux_event()
534 dev_warn(&port->dev, "%s - message with short event\n", in mxuport_process_read_urb_demux_event()
541 dev_warn(&port->dev, "%s - message for invalid port\n", in mxuport_process_read_urb_demux_event()
546 demux_port = serial->port[rcv_port]; in mxuport_process_read_urb_demux_event()
547 if (test_bit(ASYNCB_INITIALIZED, &demux_port->port.flags)) { in mxuport_process_read_urb_demux_event()
567 struct usb_serial_port *port = urb->context; in mxuport_process_read_urb() local
568 struct usb_serial *serial = port->serial; in mxuport_process_read_urb()
570 if (port == serial->port[0]) in mxuport_process_read_urb()
573 if (port == serial->port[1]) in mxuport_process_read_urb()
581 static bool mxuport_tx_empty(struct usb_serial_port *port) in mxuport_tx_empty() argument
583 struct usb_serial *serial = port->serial; in mxuport_tx_empty()
594 port->port_number, len_buf, 4); in mxuport_tx_empty()
599 dev_dbg(&port->dev, "%s - tx len = %u\n", __func__, txlen); in mxuport_tx_empty()
609 static int mxuport_set_mcr(struct usb_serial_port *port, u8 mcr_state) in mxuport_set_mcr() argument
611 struct usb_serial *serial = port->serial; in mxuport_set_mcr()
614 dev_dbg(&port->dev, "%s - %02x\n", __func__, mcr_state); in mxuport_set_mcr()
617 mcr_state, port->port_number); in mxuport_set_mcr()
619 dev_err(&port->dev, "%s - failed to change MCR\n", __func__); in mxuport_set_mcr()
624 static int mxuport_set_dtr(struct usb_serial_port *port, int on) in mxuport_set_dtr() argument
626 struct mxuport_port *mxport = usb_get_serial_port_data(port); in mxuport_set_dtr()
627 struct usb_serial *serial = port->serial; in mxuport_set_dtr()
633 !!on, port->port_number); in mxuport_set_dtr()
646 static int mxuport_set_rts(struct usb_serial_port *port, u8 state) in mxuport_set_rts() argument
648 struct mxuport_port *mxport = usb_get_serial_port_data(port); in mxuport_set_rts()
649 struct usb_serial *serial = port->serial; in mxuport_set_rts()
678 state, port->port_number); in mxuport_set_rts()
688 static void mxuport_dtr_rts(struct usb_serial_port *port, int on) in mxuport_dtr_rts() argument
690 struct mxuport_port *mxport = usb_get_serial_port_data(port); in mxuport_dtr_rts()
702 err = mxuport_set_mcr(port, mcr_state); in mxuport_dtr_rts()
712 struct usb_serial_port *port = tty->driver_data; in mxuport_tiocmset() local
713 struct mxuport_port *mxport = usb_get_serial_port_data(port); in mxuport_tiocmset()
732 err = mxuport_set_mcr(port, mcr_state); in mxuport_tiocmset()
744 struct usb_serial_port *port = tty->driver_data; in mxuport_tiocmget() local
750 mxport = usb_get_serial_port_data(port); in mxuport_tiocmget()
768 dev_dbg(&port->dev, "%s - 0x%04x\n", __func__, result); in mxuport_tiocmget()
775 struct usb_serial_port *port, in mxuport_set_termios_flow() argument
796 0, port->port_number, in mxuport_set_termios_flow()
801 dev_dbg(&port->dev, "%s - XON = 0x%02x, XOFF = 0x%02x\n", in mxuport_set_termios_flow()
808 enable, port->port_number); in mxuport_set_termios_flow()
830 mxuport_set_dtr(port, 1); in mxuport_set_termios_flow()
835 mxuport_set_dtr(port, 0); in mxuport_set_termios_flow()
839 err = mxuport_set_rts(port, rts); in mxuport_set_termios_flow()
847 struct usb_serial_port *port, in mxuport_set_termios() argument
850 struct usb_serial *serial = port->serial; in mxuport_set_termios()
861 dev_dbg(&port->dev, "%s - nothing to change\n", __func__); in mxuport_set_termios()
915 0, port->port_number, buf, 4); in mxuport_set_termios()
919 err = mxuport_set_termios_flow(tty, old_termios, port, serial); in mxuport_set_termios()
931 0, port->port_number, in mxuport_set_termios()
936 dev_dbg(&port->dev, "baud_rate : %d\n", baud); in mxuport_set_termios()
937 dev_dbg(&port->dev, "data_bits : %d\n", data_bits); in mxuport_set_termios()
938 dev_dbg(&port->dev, "parity : %d\n", parity); in mxuport_set_termios()
939 dev_dbg(&port->dev, "stop_bits : %d\n", stop_bits); in mxuport_set_termios()
1110 static int mxuport_port_probe(struct usb_serial_port *port) in mxuport_port_probe() argument
1112 struct usb_serial *serial = port->serial; in mxuport_port_probe()
1116 mxport = devm_kzalloc(&port->dev, sizeof(struct mxuport_port), in mxuport_port_probe()
1125 usb_set_serial_port_data(port, mxport); in mxuport_port_probe()
1129 0, port->port_number); in mxuport_port_probe()
1135 0, port->port_number); in mxuport_port_probe()
1142 port->port_number); in mxuport_port_probe()
1150 struct usb_serial_port *port, in mxuport_alloc_write_urb() argument
1156 set_bit(j, &port->write_urbs_free); in mxuport_alloc_write_urb()
1157 port->write_urbs[j] = usb_alloc_urb(0, GFP_KERNEL); in mxuport_alloc_write_urb()
1158 if (!port->write_urbs[j]) in mxuport_alloc_write_urb()
1161 port->bulk_out_buffers[j] = kmalloc(port0->bulk_out_size, GFP_KERNEL); in mxuport_alloc_write_urb()
1162 if (!port->bulk_out_buffers[j]) in mxuport_alloc_write_urb()
1165 usb_fill_bulk_urb(port->write_urbs[j], dev, in mxuport_alloc_write_urb()
1166 usb_sndbulkpipe(dev, port->bulk_out_endpointAddress), in mxuport_alloc_write_urb()
1167 port->bulk_out_buffers[j], in mxuport_alloc_write_urb()
1168 port->bulk_out_size, in mxuport_alloc_write_urb()
1170 port); in mxuport_alloc_write_urb()
1176 struct usb_serial_port *port, in mxuport_alloc_write_urbs() argument
1182 for (j = 0; j < ARRAY_SIZE(port->write_urbs); ++j) { in mxuport_alloc_write_urbs()
1183 ret = mxuport_alloc_write_urb(serial, port, port0, j); in mxuport_alloc_write_urbs()
1193 struct usb_serial_port *port0 = serial->port[0]; in mxuport_attach()
1194 struct usb_serial_port *port1 = serial->port[1]; in mxuport_attach()
1195 struct usb_serial_port *port; in mxuport_attach() local
1205 port = serial->port[i]; in mxuport_attach()
1206 for (j = 0; j < ARRAY_SIZE(port->write_urbs); ++j) { in mxuport_attach()
1207 usb_free_urb(port->write_urbs[j]); in mxuport_attach()
1208 kfree(port->bulk_out_buffers[j]); in mxuport_attach()
1209 port->write_urbs[j] = NULL; in mxuport_attach()
1210 port->bulk_out_buffers[j] = NULL; in mxuport_attach()
1212 port->write_urbs_free = 0; in mxuport_attach()
1221 port = serial->port[i]; in mxuport_attach()
1222 port->bulk_out_size = port0->bulk_out_size; in mxuport_attach()
1223 port->bulk_out_endpointAddress = in mxuport_attach()
1226 err = mxuport_alloc_write_urbs(serial, port, port0); in mxuport_attach()
1230 port->write_urb = port->write_urbs[0]; in mxuport_attach()
1231 port->bulk_out_buffer = port->bulk_out_buffers[0]; in mxuport_attach()
1238 if (!kfifo_initialized(&port->write_fifo)) { in mxuport_attach()
1239 err = kfifo_alloc(&port->write_fifo, PAGE_SIZE, in mxuport_attach()
1268 struct usb_serial_port *port0 = serial->port[0]; in mxuport_release()
1269 struct usb_serial_port *port1 = serial->port[1]; in mxuport_release()
1275 static int mxuport_open(struct tty_struct *tty, struct usb_serial_port *port) in mxuport_open() argument
1277 struct mxuport_port *mxport = usb_get_serial_port_data(port); in mxuport_open()
1278 struct usb_serial *serial = port->serial; in mxuport_open()
1283 1, port->port_number); in mxuport_open()
1288 1, port->port_number); in mxuport_open()
1291 0, port->port_number); in mxuport_open()
1297 mxuport_set_termios(tty, port, NULL); in mxuport_open()
1308 static void mxuport_close(struct usb_serial_port *port) in mxuport_close() argument
1310 struct usb_serial *serial = port->serial; in mxuport_close()
1313 port->port_number); in mxuport_close()
1316 port->port_number); in mxuport_close()
1322 struct usb_serial_port *port = tty->driver_data; in mxuport_break_ctl() local
1323 struct usb_serial *serial = port->serial; in mxuport_break_ctl()
1328 dev_dbg(&port->dev, "%s - sending break\n", __func__); in mxuport_break_ctl()
1331 dev_dbg(&port->dev, "%s - clearing break\n", __func__); in mxuport_break_ctl()
1335 enable, port->port_number); in mxuport_break_ctl()
1340 struct usb_serial_port *port; in mxuport_resume() local
1346 port = serial->port[i]; in mxuport_resume()
1348 r = usb_serial_generic_submit_read_urbs(port, GFP_NOIO); in mxuport_resume()
1354 port = serial->port[i]; in mxuport_resume()
1355 if (!test_bit(ASYNCB_INITIALIZED, &port->port.flags)) in mxuport_resume()
1358 r = usb_serial_generic_write_start(port, GFP_NOIO); in mxuport_resume()