Lines Matching refs:tty

481 static int mxser_set_baud(struct tty_struct *tty, speed_t newspd)  in mxser_set_baud()  argument
483 struct mxser_port *info = tty->driver_data; in mxser_set_baud()
493 tty_encode_baud_rate(tty, 134, 134); in mxser_set_baud()
499 tty_encode_baud_rate(tty, baud, baud); in mxser_set_baud()
529 if (C_BAUD(tty) == BOTHER) { in mxser_set_baud()
546 static void mxser_handle_cts(struct tty_struct *tty, struct mxser_port *info, in mxser_handle_cts() argument
551 if (tty->hw_stopped) { in mxser_handle_cts()
553 tty->hw_stopped = false; in mxser_handle_cts()
557 tty_wakeup(tty); in mxser_handle_cts()
563 tty->hw_stopped = true; in mxser_handle_cts()
572 static void mxser_change_speed(struct tty_struct *tty, in mxser_change_speed() argument
575 struct mxser_port *info = tty->driver_data; in mxser_change_speed()
578 cflag = tty->termios.c_cflag; in mxser_change_speed()
580 if (mxser_set_baud(tty, tty_get_baud_rate(tty))) { in mxser_change_speed()
584 tty_encode_baud_rate(tty, baud, baud); in mxser_change_speed()
589 cval = UART_LCR_WLEN(tty_get_char_size(tty->termios.c_cflag)); in mxser_change_speed()
632 mxser_handle_cts(tty, info, in mxser_change_speed()
646 if (I_INPCK(tty)) in mxser_change_speed()
648 if (I_BRKINT(tty) || I_PARMRK(tty)) in mxser_change_speed()
653 if (I_IGNBRK(tty)) { in mxser_change_speed()
660 if (I_IGNPAR(tty)) { in mxser_change_speed()
672 mxser_set_must_xon1_value(info->ioaddr, START_CHAR(tty)); in mxser_change_speed()
673 mxser_set_must_xoff1_value(info->ioaddr, STOP_CHAR(tty)); in mxser_change_speed()
674 mxser_must_set_rx_sw_flow_control(info->ioaddr, I_IXON(tty)); in mxser_change_speed()
675 mxser_must_set_tx_sw_flow_control(info->ioaddr, I_IXOFF(tty)); in mxser_change_speed()
683 static u8 mxser_check_modem_status(struct tty_struct *tty, in mxser_check_modem_status() argument
708 mxser_handle_cts(tty, port, msr); in mxser_check_modem_status()
723 static int mxser_activate(struct tty_port *port, struct tty_struct *tty) in mxser_activate() argument
736 set_bit(TTY_IO_ERROR, &tty->flags); in mxser_activate()
756 set_bit(TTY_IO_ERROR, &tty->flags); in mxser_activate()
796 clear_bit(TTY_IO_ERROR, &tty->flags); in mxser_activate()
802 mxser_change_speed(tty, NULL); in mxser_activate()
870 static int mxser_open(struct tty_struct *tty, struct file *filp) in mxser_open() argument
872 struct tty_port *tport = tty->port; in mxser_open()
875 tty->driver_data = port; in mxser_open()
877 return tty_port_open(tport, tty, filp); in mxser_open()
880 static void mxser_flush_buffer(struct tty_struct *tty) in mxser_flush_buffer() argument
882 struct mxser_port *info = tty->driver_data; in mxser_flush_buffer()
893 tty_wakeup(tty); in mxser_flush_buffer()
896 static void mxser_close(struct tty_struct *tty, struct file *filp) in mxser_close() argument
898 tty_port_close(tty->port, tty, filp); in mxser_close()
901 static ssize_t mxser_write(struct tty_struct *tty, const u8 *buf, size_t count) in mxser_write() argument
903 struct mxser_port *info = tty->driver_data; in mxser_write()
913 if (!is_empty && !tty->flow.stopped) in mxser_write()
914 if (!tty->hw_stopped || mxser_16550A_or_MUST(info)) in mxser_write()
920 static int mxser_put_char(struct tty_struct *tty, u8 ch) in mxser_put_char() argument
922 struct mxser_port *info = tty->driver_data; in mxser_put_char()
934 static void mxser_flush_chars(struct tty_struct *tty) in mxser_flush_chars() argument
936 struct mxser_port *info = tty->driver_data; in mxser_flush_chars()
938 if (kfifo_is_empty(&info->port.xmit_fifo) || tty->flow.stopped || in mxser_flush_chars()
939 (tty->hw_stopped && !mxser_16550A_or_MUST(info))) in mxser_flush_chars()
945 static unsigned int mxser_write_room(struct tty_struct *tty) in mxser_write_room() argument
947 struct mxser_port *info = tty->driver_data; in mxser_write_room()
952 static unsigned int mxser_chars_in_buffer(struct tty_struct *tty) in mxser_chars_in_buffer() argument
954 struct mxser_port *info = tty->driver_data; in mxser_chars_in_buffer()
964 static int mxser_get_serial_info(struct tty_struct *tty, in mxser_get_serial_info() argument
967 struct mxser_port *info = tty->driver_data; in mxser_get_serial_info()
979 ss->line = tty->index; in mxser_get_serial_info()
991 static int mxser_set_serial_info(struct tty_struct *tty, in mxser_set_serial_info() argument
994 struct mxser_port *info = tty->driver_data; in mxser_set_serial_info()
1001 if (tty_io_error(tty)) in mxser_set_serial_info()
1047 tty_encode_baud_rate(tty, baud, baud); in mxser_set_serial_info()
1058 mxser_change_speed(tty, NULL); in mxser_set_serial_info()
1062 retval = mxser_activate(port, tty); in mxser_set_serial_info()
1094 static int mxser_tiocmget(struct tty_struct *tty) in mxser_tiocmget() argument
1096 struct mxser_port *info = tty->driver_data; in mxser_tiocmget()
1101 if (tty_io_error(tty)) in mxser_tiocmget()
1106 msr = mxser_check_modem_status(tty, info); in mxser_tiocmget()
1117 static int mxser_tiocmset(struct tty_struct *tty, in mxser_tiocmset() argument
1120 struct mxser_port *info = tty->driver_data; in mxser_tiocmset()
1123 if (tty_io_error(tty)) in mxser_tiocmset()
1199 static int mxser_ioctl(struct tty_struct *tty, in mxser_ioctl() argument
1202 struct mxser_port *info = tty->driver_data; in mxser_ioctl()
1208 return mxser_ioctl_op_mode(info, tty->index, in mxser_ioctl()
1211 if (cmd != TIOCMIWAIT && tty_io_error(tty)) in mxser_ioctl()
1243 static int mxser_get_icount(struct tty_struct *tty, in mxser_get_icount() argument
1247 struct mxser_port *info = tty->driver_data; in mxser_get_icount()
1273 static void mxser_throttle(struct tty_struct *tty) in mxser_throttle() argument
1275 struct mxser_port *info = tty->driver_data; in mxser_throttle()
1277 if (I_IXOFF(tty)) { in mxser_throttle()
1282 info->x_char = STOP_CHAR(tty); in mxser_throttle()
1289 if (C_CRTSCTS(tty)) { in mxser_throttle()
1295 static void mxser_unthrottle(struct tty_struct *tty) in mxser_unthrottle() argument
1297 struct mxser_port *info = tty->driver_data; in mxser_unthrottle()
1300 if (I_IXOFF(tty)) { in mxser_unthrottle()
1308 info->x_char = START_CHAR(tty); in mxser_unthrottle()
1316 if (C_CRTSCTS(tty)) { in mxser_unthrottle()
1328 static void mxser_stop(struct tty_struct *tty) in mxser_stop() argument
1330 struct mxser_port *info = tty->driver_data; in mxser_stop()
1339 static void mxser_start(struct tty_struct *tty) in mxser_start() argument
1341 struct mxser_port *info = tty->driver_data; in mxser_start()
1350 static void mxser_set_termios(struct tty_struct *tty, in mxser_set_termios() argument
1353 struct mxser_port *info = tty->driver_data; in mxser_set_termios()
1357 mxser_change_speed(tty, old_termios); in mxser_set_termios()
1360 if ((old_termios->c_cflag & CRTSCTS) && !C_CRTSCTS(tty)) { in mxser_set_termios()
1361 tty->hw_stopped = false; in mxser_set_termios()
1362 mxser_start(tty); in mxser_set_termios()
1366 if ((old_termios->c_iflag & IXON) && !I_IXON(tty)) { in mxser_set_termios()
1367 tty->flow.stopped = 0; in mxser_set_termios()
1375 mxser_start(tty); in mxser_set_termios()
1394 static void mxser_wait_until_sent(struct tty_struct *tty, int timeout) in mxser_wait_until_sent() argument
1396 struct mxser_port *info = tty->driver_data; in mxser_wait_until_sent()
1448 static void mxser_hangup(struct tty_struct *tty) in mxser_hangup() argument
1450 struct mxser_port *info = tty->driver_data; in mxser_hangup()
1452 mxser_flush_buffer(tty); in mxser_hangup()
1459 static int mxser_rs_break(struct tty_struct *tty, int break_state) in mxser_rs_break() argument
1461 struct mxser_port *info = tty->driver_data; in mxser_rs_break()
1500 static u8 mxser_receive_chars_old(struct tty_struct *tty, in mxser_receive_chars_old() argument
1528 do_SAK(tty); in mxser_receive_chars_old()
1555 static u8 mxser_receive_chars(struct tty_struct *tty, in mxser_receive_chars() argument
1559 status = mxser_receive_chars_old(tty, port, status); in mxser_receive_chars()
1566 static void mxser_transmit_chars(struct tty_struct *tty, struct mxser_port *port) in mxser_transmit_chars() argument
1577 if (kfifo_is_empty(&port->port.xmit_fifo) || tty->flow.stopped || in mxser_transmit_chars()
1578 (tty->hw_stopped && !mxser_16550A_or_MUST(port))) { in mxser_transmit_chars()
1595 tty_wakeup(tty); in mxser_transmit_chars()
1603 struct tty_struct *tty; in mxser_port_isr() local
1612 tty = tty_port_tty_get(&port->port); in mxser_port_isr()
1613 if (!tty) { in mxser_port_isr()
1630 status = mxser_receive_chars(tty, port, status); in mxser_port_isr()
1634 status = mxser_receive_chars(tty, port, status); in mxser_port_isr()
1637 mxser_check_modem_status(tty, port); in mxser_port_isr()
1641 mxser_transmit_chars(tty, port); in mxser_port_isr()
1644 mxser_transmit_chars(tty, port); in mxser_port_isr()
1648 tty_kref_put(tty); in mxser_port_isr()