Lines Matching refs:tty
471 static int mxser_set_baud(struct tty_struct *tty, speed_t newspd) in mxser_set_baud() argument
473 struct mxser_port *info = tty->driver_data; in mxser_set_baud()
483 tty_encode_baud_rate(tty, 134, 134); in mxser_set_baud()
489 tty_encode_baud_rate(tty, baud, baud); in mxser_set_baud()
520 if (C_BAUD(tty) == BOTHER) { in mxser_set_baud()
537 static void mxser_handle_cts(struct tty_struct *tty, struct mxser_port *info, in mxser_handle_cts() argument
542 if (tty->hw_stopped) { in mxser_handle_cts()
544 tty->hw_stopped = 0; in mxser_handle_cts()
548 tty_wakeup(tty); in mxser_handle_cts()
554 tty->hw_stopped = 1; in mxser_handle_cts()
563 static void mxser_change_speed(struct tty_struct *tty, struct ktermios *old_termios) in mxser_change_speed() argument
565 struct mxser_port *info = tty->driver_data; in mxser_change_speed()
568 cflag = tty->termios.c_cflag; in mxser_change_speed()
570 if (mxser_set_baud(tty, tty_get_baud_rate(tty))) { in mxser_change_speed()
574 tty_encode_baud_rate(tty, baud, baud); 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()
720 static int mxser_activate(struct tty_port *port, struct tty_struct *tty) in mxser_activate() argument
733 set_bit(TTY_IO_ERROR, &tty->flags); in mxser_activate()
754 set_bit(TTY_IO_ERROR, &tty->flags); in mxser_activate()
792 clear_bit(TTY_IO_ERROR, &tty->flags); in mxser_activate()
798 mxser_change_speed(tty, NULL); in mxser_activate()
850 static int mxser_open(struct tty_struct *tty, struct file *filp) in mxser_open() argument
852 struct tty_port *tport = tty->port; in mxser_open()
855 tty->driver_data = port; in mxser_open()
857 return tty_port_open(tport, tty, filp); in mxser_open()
860 static void mxser_flush_buffer(struct tty_struct *tty) in mxser_flush_buffer() argument
862 struct mxser_port *info = tty->driver_data; in mxser_flush_buffer()
874 tty_wakeup(tty); in mxser_flush_buffer()
912 static void mxser_close(struct tty_struct *tty, struct file *filp) in mxser_close() argument
914 struct mxser_port *info = tty->driver_data; in mxser_close()
919 if (tty_port_close_start(port, tty, filp) == 0) in mxser_close()
924 mxser_flush_buffer(tty); in mxser_close()
925 if (tty_port_initialized(port) && C_HUPCL(tty)) in mxser_close()
933 tty_port_close_end(port, tty); in mxser_close()
937 static int mxser_write(struct tty_struct *tty, const unsigned char *buf, int count) in mxser_write() argument
940 struct mxser_port *info = tty->driver_data; in mxser_write()
964 if (info->xmit_cnt && !tty->flow.stopped) in mxser_write()
965 if (!tty->hw_stopped || mxser_16550A_or_MUST(info)) in mxser_write()
971 static int mxser_put_char(struct tty_struct *tty, unsigned char ch) in mxser_put_char() argument
973 struct mxser_port *info = tty->driver_data; in mxser_put_char()
992 static void mxser_flush_chars(struct tty_struct *tty) in mxser_flush_chars() argument
994 struct mxser_port *info = tty->driver_data; in mxser_flush_chars()
996 if (!info->xmit_cnt || tty->flow.stopped || !info->port.xmit_buf || in mxser_flush_chars()
997 (tty->hw_stopped && !mxser_16550A_or_MUST(info))) in mxser_flush_chars()
1003 static unsigned int mxser_write_room(struct tty_struct *tty) in mxser_write_room() argument
1005 struct mxser_port *info = tty->driver_data; in mxser_write_room()
1012 static unsigned int mxser_chars_in_buffer(struct tty_struct *tty) in mxser_chars_in_buffer() argument
1014 struct mxser_port *info = tty->driver_data; in mxser_chars_in_buffer()
1023 static int mxser_get_serial_info(struct tty_struct *tty, in mxser_get_serial_info() argument
1026 struct mxser_port *info = tty->driver_data; in mxser_get_serial_info()
1038 ss->line = tty->index; in mxser_get_serial_info()
1050 static int mxser_set_serial_info(struct tty_struct *tty, in mxser_set_serial_info() argument
1053 struct mxser_port *info = tty->driver_data; in mxser_set_serial_info()
1060 if (tty_io_error(tty)) in mxser_set_serial_info()
1106 tty_encode_baud_rate(tty, baud, baud); in mxser_set_serial_info()
1117 mxser_change_speed(tty, NULL); in mxser_set_serial_info()
1121 retval = mxser_activate(port, tty); in mxser_set_serial_info()
1153 static int mxser_tiocmget(struct tty_struct *tty) in mxser_tiocmget() argument
1155 struct mxser_port *info = tty->driver_data; in mxser_tiocmget()
1159 if (tty_io_error(tty)) in mxser_tiocmget()
1166 mxser_check_modem_status(tty, info, status); in mxser_tiocmget()
1177 static int mxser_tiocmset(struct tty_struct *tty, in mxser_tiocmset() argument
1180 struct mxser_port *info = tty->driver_data; in mxser_tiocmset()
1183 if (tty_io_error(tty)) in mxser_tiocmset()
1259 static int mxser_ioctl(struct tty_struct *tty, in mxser_ioctl() argument
1262 struct mxser_port *info = tty->driver_data; in mxser_ioctl()
1268 return mxser_ioctl_op_mode(info, tty->index, in mxser_ioctl()
1271 if (cmd != TIOCMIWAIT && tty_io_error(tty)) in mxser_ioctl()
1303 static int mxser_get_icount(struct tty_struct *tty, in mxser_get_icount() argument
1307 struct mxser_port *info = tty->driver_data; in mxser_get_icount()
1329 static void mxser_stoprx(struct tty_struct *tty) in mxser_stoprx() argument
1331 struct mxser_port *info = tty->driver_data; in mxser_stoprx()
1334 if (I_IXOFF(tty)) { in mxser_stoprx()
1339 info->x_char = STOP_CHAR(tty); in mxser_stoprx()
1346 if (C_CRTSCTS(tty)) { in mxser_stoprx()
1356 static void mxser_throttle(struct tty_struct *tty) in mxser_throttle() argument
1358 mxser_stoprx(tty); in mxser_throttle()
1361 static void mxser_unthrottle(struct tty_struct *tty) in mxser_unthrottle() argument
1363 struct mxser_port *info = tty->driver_data; in mxser_unthrottle()
1367 if (I_IXOFF(tty)) { in mxser_unthrottle()
1375 info->x_char = START_CHAR(tty); in mxser_unthrottle()
1383 if (C_CRTSCTS(tty)) { in mxser_unthrottle()
1395 static void mxser_stop(struct tty_struct *tty) in mxser_stop() argument
1397 struct mxser_port *info = tty->driver_data; in mxser_stop()
1406 static void mxser_start(struct tty_struct *tty) in mxser_start() argument
1408 struct mxser_port *info = tty->driver_data; in mxser_start()
1417 static void mxser_set_termios(struct tty_struct *tty, struct ktermios *old_termios) in mxser_set_termios() argument
1419 struct mxser_port *info = tty->driver_data; in mxser_set_termios()
1423 mxser_change_speed(tty, old_termios); in mxser_set_termios()
1426 if ((old_termios->c_cflag & CRTSCTS) && !C_CRTSCTS(tty)) { in mxser_set_termios()
1427 tty->hw_stopped = 0; in mxser_set_termios()
1428 mxser_start(tty); in mxser_set_termios()
1432 if ((old_termios->c_iflag & IXON) && !I_IXON(tty)) { in mxser_set_termios()
1433 tty->flow.stopped = 0; in mxser_set_termios()
1441 mxser_start(tty); in mxser_set_termios()
1448 static void mxser_wait_until_sent(struct tty_struct *tty, int timeout) in mxser_wait_until_sent() argument
1450 struct mxser_port *info = tty->driver_data; in mxser_wait_until_sent()
1505 static void mxser_hangup(struct tty_struct *tty) in mxser_hangup() argument
1507 struct mxser_port *info = tty->driver_data; in mxser_hangup()
1509 mxser_flush_buffer(tty); in mxser_hangup()
1516 static int mxser_rs_break(struct tty_struct *tty, int break_state) in mxser_rs_break() argument
1518 struct mxser_port *info = tty->driver_data; in mxser_rs_break()
1534 static bool mxser_receive_chars_new(struct tty_struct *tty, in mxser_receive_chars_new() argument
1549 if (gdl >= tty->receive_room && !port->ldisc_stop_rx) in mxser_receive_chars_new()
1550 mxser_stoprx(tty); in mxser_receive_chars_new()
1560 static u8 mxser_receive_chars_old(struct tty_struct *tty, in mxser_receive_chars_old() argument
1564 int recv_room = tty->receive_room; in mxser_receive_chars_old()
1590 do_SAK(tty); in mxser_receive_chars_old()
1606 mxser_stoprx(tty); in mxser_receive_chars_old()
1621 static u8 mxser_receive_chars(struct tty_struct *tty, in mxser_receive_chars() argument
1624 if (tty->receive_room == 0 && !port->ldisc_stop_rx) in mxser_receive_chars()
1625 mxser_stoprx(tty); in mxser_receive_chars()
1627 if (!mxser_receive_chars_new(tty, port, status)) in mxser_receive_chars()
1628 status = mxser_receive_chars_old(tty, port, status); in mxser_receive_chars()
1635 static void mxser_transmit_chars(struct tty_struct *tty, struct mxser_port *port) in mxser_transmit_chars() argument
1649 if (!port->xmit_cnt || tty->flow.stopped || in mxser_transmit_chars()
1650 (tty->hw_stopped && !mxser_16550A_or_MUST(port))) { in mxser_transmit_chars()
1668 tty_wakeup(tty); in mxser_transmit_chars()
1676 struct tty_struct *tty; in mxser_port_isr() local
1685 tty = tty_port_tty_get(&port->port); in mxser_port_isr()
1686 if (!tty || port->closing || !tty_port_initialized(&port->port)) { in mxser_port_isr()
1703 status = mxser_receive_chars(tty, port, status); in mxser_port_isr()
1707 status = mxser_receive_chars(tty, port, status); in mxser_port_isr()
1712 mxser_check_modem_status(tty, port, msr); in mxser_port_isr()
1716 mxser_transmit_chars(tty, port); in mxser_port_isr()
1719 mxser_transmit_chars(tty, port); in mxser_port_isr()
1723 tty_kref_put(tty); in mxser_port_isr()