Lines Matching refs:tty

470 static int mxser_set_baud(struct tty_struct *tty, speed_t newspd)  in mxser_set_baud()  argument
472 struct mxser_port *info = tty->driver_data; in mxser_set_baud()
482 tty_encode_baud_rate(tty, 134, 134); in mxser_set_baud()
488 tty_encode_baud_rate(tty, baud, baud); in mxser_set_baud()
519 if (C_BAUD(tty) == BOTHER) { in mxser_set_baud()
536 static void mxser_handle_cts(struct tty_struct *tty, struct mxser_port *info, in mxser_handle_cts() argument
541 if (tty->hw_stopped) { in mxser_handle_cts()
543 tty->hw_stopped = 0; in mxser_handle_cts()
547 tty_wakeup(tty); in mxser_handle_cts()
553 tty->hw_stopped = 1; in mxser_handle_cts()
562 static void mxser_change_speed(struct tty_struct *tty) in mxser_change_speed() argument
564 struct mxser_port *info = tty->driver_data; in mxser_change_speed()
567 cflag = tty->termios.c_cflag; in mxser_change_speed()
569 mxser_set_baud(tty, tty_get_baud_rate(tty)); in mxser_change_speed()
636 mxser_handle_cts(tty, info, in mxser_change_speed()
650 if (I_INPCK(tty)) in mxser_change_speed()
652 if (I_BRKINT(tty) || I_PARMRK(tty)) in mxser_change_speed()
657 if (I_IGNBRK(tty)) { in mxser_change_speed()
664 if (I_IGNPAR(tty)) { in mxser_change_speed()
676 mxser_set_must_xon1_value(info->ioaddr, START_CHAR(tty)); in mxser_change_speed()
677 mxser_set_must_xoff1_value(info->ioaddr, STOP_CHAR(tty)); in mxser_change_speed()
678 mxser_must_set_rx_sw_flow_control(info->ioaddr, I_IXON(tty)); in mxser_change_speed()
679 mxser_must_set_tx_sw_flow_control(info->ioaddr, I_IXOFF(tty)); in mxser_change_speed()
687 static void mxser_check_modem_status(struct tty_struct *tty, in mxser_check_modem_status() argument
707 mxser_handle_cts(tty, port, status); in mxser_check_modem_status()
710 static int mxser_activate(struct tty_port *port, struct tty_struct *tty) in mxser_activate() argument
723 set_bit(TTY_IO_ERROR, &tty->flags); in mxser_activate()
750 set_bit(TTY_IO_ERROR, &tty->flags); in mxser_activate()
788 clear_bit(TTY_IO_ERROR, &tty->flags); in mxser_activate()
794 mxser_change_speed(tty); in mxser_activate()
852 static int mxser_open(struct tty_struct *tty, struct file *filp) in mxser_open() argument
854 struct tty_port *tport = tty->port; in mxser_open()
857 tty->driver_data = port; in mxser_open()
859 return tty_port_open(tport, tty, filp); in mxser_open()
862 static void mxser_flush_buffer(struct tty_struct *tty) in mxser_flush_buffer() argument
864 struct mxser_port *info = tty->driver_data; in mxser_flush_buffer()
879 tty_wakeup(tty); in mxser_flush_buffer()
917 static void mxser_close(struct tty_struct *tty, struct file *filp) in mxser_close() argument
919 struct mxser_port *info = tty->driver_data; in mxser_close()
924 if (tty_port_close_start(port, tty, filp) == 0) in mxser_close()
929 mxser_flush_buffer(tty); in mxser_close()
930 if (tty_port_initialized(port) && C_HUPCL(tty)) in mxser_close()
938 tty_port_close_end(port, tty); in mxser_close()
942 static int mxser_write(struct tty_struct *tty, const unsigned char *buf, int count) in mxser_write() argument
945 struct mxser_port *info = tty->driver_data; in mxser_write()
969 if (info->xmit_cnt && !tty->flow.stopped) in mxser_write()
970 if (!tty->hw_stopped || mxser_16550A_or_MUST(info)) in mxser_write()
976 static int mxser_put_char(struct tty_struct *tty, unsigned char ch) in mxser_put_char() argument
978 struct mxser_port *info = tty->driver_data; in mxser_put_char()
997 static void mxser_flush_chars(struct tty_struct *tty) in mxser_flush_chars() argument
999 struct mxser_port *info = tty->driver_data; in mxser_flush_chars()
1001 if (!info->xmit_cnt || tty->flow.stopped || !info->port.xmit_buf || in mxser_flush_chars()
1002 (tty->hw_stopped && !mxser_16550A_or_MUST(info))) in mxser_flush_chars()
1008 static unsigned int mxser_write_room(struct tty_struct *tty) in mxser_write_room() argument
1010 struct mxser_port *info = tty->driver_data; in mxser_write_room()
1017 static unsigned int mxser_chars_in_buffer(struct tty_struct *tty) in mxser_chars_in_buffer() argument
1019 struct mxser_port *info = tty->driver_data; in mxser_chars_in_buffer()
1028 static int mxser_get_serial_info(struct tty_struct *tty, in mxser_get_serial_info() argument
1031 struct mxser_port *info = tty->driver_data; in mxser_get_serial_info()
1043 ss->line = tty->index; in mxser_get_serial_info()
1055 static int mxser_set_serial_info(struct tty_struct *tty, in mxser_set_serial_info() argument
1058 struct mxser_port *info = tty->driver_data; in mxser_set_serial_info()
1065 if (tty_io_error(tty)) in mxser_set_serial_info()
1111 tty_encode_baud_rate(tty, baud, baud); in mxser_set_serial_info()
1122 mxser_change_speed(tty); in mxser_set_serial_info()
1126 retval = mxser_activate(port, tty); in mxser_set_serial_info()
1158 static int mxser_tiocmget(struct tty_struct *tty) in mxser_tiocmget() argument
1160 struct mxser_port *info = tty->driver_data; in mxser_tiocmget()
1164 if (tty_io_error(tty)) in mxser_tiocmget()
1171 mxser_check_modem_status(tty, info, status); in mxser_tiocmget()
1182 static int mxser_tiocmset(struct tty_struct *tty, in mxser_tiocmset() argument
1185 struct mxser_port *info = tty->driver_data; in mxser_tiocmset()
1188 if (tty_io_error(tty)) in mxser_tiocmset()
1264 static int mxser_ioctl(struct tty_struct *tty, in mxser_ioctl() argument
1267 struct mxser_port *info = tty->driver_data; in mxser_ioctl()
1273 return mxser_ioctl_op_mode(info, tty->index, in mxser_ioctl()
1276 if (cmd != TIOCMIWAIT && tty_io_error(tty)) in mxser_ioctl()
1308 static int mxser_get_icount(struct tty_struct *tty, in mxser_get_icount() argument
1312 struct mxser_port *info = tty->driver_data; in mxser_get_icount()
1334 static void mxser_stoprx(struct tty_struct *tty) in mxser_stoprx() argument
1336 struct mxser_port *info = tty->driver_data; in mxser_stoprx()
1339 if (I_IXOFF(tty)) { in mxser_stoprx()
1344 info->x_char = STOP_CHAR(tty); in mxser_stoprx()
1351 if (C_CRTSCTS(tty)) { in mxser_stoprx()
1361 static void mxser_throttle(struct tty_struct *tty) in mxser_throttle() argument
1363 mxser_stoprx(tty); in mxser_throttle()
1366 static void mxser_unthrottle(struct tty_struct *tty) in mxser_unthrottle() argument
1368 struct mxser_port *info = tty->driver_data; in mxser_unthrottle()
1372 if (I_IXOFF(tty)) { in mxser_unthrottle()
1380 info->x_char = START_CHAR(tty); in mxser_unthrottle()
1388 if (C_CRTSCTS(tty)) { in mxser_unthrottle()
1400 static void mxser_stop(struct tty_struct *tty) in mxser_stop() argument
1402 struct mxser_port *info = tty->driver_data; in mxser_stop()
1411 static void mxser_start(struct tty_struct *tty) in mxser_start() argument
1413 struct mxser_port *info = tty->driver_data; in mxser_start()
1422 static void mxser_set_termios(struct tty_struct *tty, struct ktermios *old_termios) in mxser_set_termios() argument
1424 struct mxser_port *info = tty->driver_data; in mxser_set_termios()
1428 mxser_change_speed(tty); in mxser_set_termios()
1431 if ((old_termios->c_cflag & CRTSCTS) && !C_CRTSCTS(tty)) { in mxser_set_termios()
1432 tty->hw_stopped = 0; in mxser_set_termios()
1433 mxser_start(tty); in mxser_set_termios()
1437 if ((old_termios->c_iflag & IXON) && !I_IXON(tty)) { in mxser_set_termios()
1438 tty->flow.stopped = 0; in mxser_set_termios()
1446 mxser_start(tty); in mxser_set_termios()
1453 static void mxser_wait_until_sent(struct tty_struct *tty, int timeout) in mxser_wait_until_sent() argument
1455 struct mxser_port *info = tty->driver_data; in mxser_wait_until_sent()
1510 static void mxser_hangup(struct tty_struct *tty) in mxser_hangup() argument
1512 struct mxser_port *info = tty->driver_data; in mxser_hangup()
1514 mxser_flush_buffer(tty); in mxser_hangup()
1521 static int mxser_rs_break(struct tty_struct *tty, int break_state) in mxser_rs_break() argument
1523 struct mxser_port *info = tty->driver_data; in mxser_rs_break()
1539 static bool mxser_receive_chars_new(struct tty_struct *tty, in mxser_receive_chars_new() argument
1558 if (gdl >= tty->receive_room && !port->ldisc_stop_rx) in mxser_receive_chars_new()
1559 mxser_stoprx(tty); in mxser_receive_chars_new()
1569 static u8 mxser_receive_chars_old(struct tty_struct *tty, in mxser_receive_chars_old() argument
1573 int recv_room = tty->receive_room; in mxser_receive_chars_old()
1600 do_SAK(tty); in mxser_receive_chars_old()
1616 mxser_stoprx(tty); in mxser_receive_chars_old()
1631 static u8 mxser_receive_chars(struct tty_struct *tty, in mxser_receive_chars() argument
1634 if (tty->receive_room == 0 && !port->ldisc_stop_rx) in mxser_receive_chars()
1635 mxser_stoprx(tty); in mxser_receive_chars()
1637 if (!mxser_receive_chars_new(tty, port, status)) in mxser_receive_chars()
1638 status = mxser_receive_chars_old(tty, port, status); in mxser_receive_chars()
1645 static void mxser_transmit_chars(struct tty_struct *tty, struct mxser_port *port) in mxser_transmit_chars() argument
1659 if (!port->xmit_cnt || tty->flow.stopped || in mxser_transmit_chars()
1660 (tty->hw_stopped && !mxser_16550A_or_MUST(port))) { in mxser_transmit_chars()
1678 tty_wakeup(tty); in mxser_transmit_chars()
1686 struct tty_struct *tty; in mxser_port_isr() local
1695 tty = tty_port_tty_get(&port->port); in mxser_port_isr()
1696 if (!tty || port->closing || !tty_port_initialized(&port->port)) { in mxser_port_isr()
1714 status = mxser_receive_chars(tty, port, status); in mxser_port_isr()
1718 status = mxser_receive_chars(tty, port, status); in mxser_port_isr()
1723 mxser_check_modem_status(tty, port, msr); in mxser_port_isr()
1727 mxser_transmit_chars(tty, port); in mxser_port_isr()
1730 mxser_transmit_chars(tty, port); in mxser_port_isr()
1734 tty_kref_put(tty); in mxser_port_isr()