Lines Matching refs:tty

476 static int mxser_set_baud(struct tty_struct *tty, speed_t newspd)  in mxser_set_baud()  argument
478 struct mxser_port *info = tty->driver_data; in mxser_set_baud()
488 tty_encode_baud_rate(tty, 134, 134); in mxser_set_baud()
494 tty_encode_baud_rate(tty, baud, baud); in mxser_set_baud()
524 if (C_BAUD(tty) == BOTHER) { in mxser_set_baud()
541 static void mxser_handle_cts(struct tty_struct *tty, struct mxser_port *info, in mxser_handle_cts() argument
546 if (tty->hw_stopped) { in mxser_handle_cts()
548 tty->hw_stopped = false; in mxser_handle_cts()
552 tty_wakeup(tty); in mxser_handle_cts()
558 tty->hw_stopped = true; in mxser_handle_cts()
567 static void mxser_change_speed(struct tty_struct *tty, in mxser_change_speed() argument
570 struct mxser_port *info = tty->driver_data; in mxser_change_speed()
573 cflag = tty->termios.c_cflag; in mxser_change_speed()
575 if (mxser_set_baud(tty, tty_get_baud_rate(tty))) { in mxser_change_speed()
579 tty_encode_baud_rate(tty, baud, baud); in mxser_change_speed()
584 cval = UART_LCR_WLEN(tty_get_char_size(tty->termios.c_cflag)); in mxser_change_speed()
627 mxser_handle_cts(tty, info, in mxser_change_speed()
641 if (I_INPCK(tty)) in mxser_change_speed()
643 if (I_BRKINT(tty) || I_PARMRK(tty)) in mxser_change_speed()
648 if (I_IGNBRK(tty)) { in mxser_change_speed()
655 if (I_IGNPAR(tty)) { in mxser_change_speed()
667 mxser_set_must_xon1_value(info->ioaddr, START_CHAR(tty)); in mxser_change_speed()
668 mxser_set_must_xoff1_value(info->ioaddr, STOP_CHAR(tty)); in mxser_change_speed()
669 mxser_must_set_rx_sw_flow_control(info->ioaddr, I_IXON(tty)); in mxser_change_speed()
670 mxser_must_set_tx_sw_flow_control(info->ioaddr, I_IXOFF(tty)); in mxser_change_speed()
678 static u8 mxser_check_modem_status(struct tty_struct *tty, in mxser_check_modem_status() argument
703 mxser_handle_cts(tty, port, msr); in mxser_check_modem_status()
718 static int mxser_activate(struct tty_port *port, struct tty_struct *tty) in mxser_activate() argument
731 set_bit(TTY_IO_ERROR, &tty->flags); in mxser_activate()
751 set_bit(TTY_IO_ERROR, &tty->flags); in mxser_activate()
791 clear_bit(TTY_IO_ERROR, &tty->flags); in mxser_activate()
797 mxser_change_speed(tty, NULL); in mxser_activate()
861 static int mxser_open(struct tty_struct *tty, struct file *filp) in mxser_open() argument
863 struct tty_port *tport = tty->port; in mxser_open()
866 tty->driver_data = port; in mxser_open()
868 return tty_port_open(tport, tty, filp); in mxser_open()
871 static void mxser_flush_buffer(struct tty_struct *tty) in mxser_flush_buffer() argument
873 struct mxser_port *info = tty->driver_data; in mxser_flush_buffer()
882 tty_wakeup(tty); in mxser_flush_buffer()
885 static void mxser_close(struct tty_struct *tty, struct file *filp) in mxser_close() argument
887 tty_port_close(tty->port, tty, filp); in mxser_close()
890 static ssize_t mxser_write(struct tty_struct *tty, const u8 *buf, size_t count) in mxser_write() argument
892 struct mxser_port *info = tty->driver_data; in mxser_write()
901 if (!is_empty && !tty->flow.stopped) in mxser_write()
902 if (!tty->hw_stopped || mxser_16550A_or_MUST(info)) in mxser_write()
908 static int mxser_put_char(struct tty_struct *tty, u8 ch) in mxser_put_char() argument
910 struct mxser_port *info = tty->driver_data; in mxser_put_char()
917 static void mxser_flush_chars(struct tty_struct *tty) in mxser_flush_chars() argument
919 struct mxser_port *info = tty->driver_data; in mxser_flush_chars()
921 if (kfifo_is_empty(&info->port.xmit_fifo) || tty->flow.stopped || in mxser_flush_chars()
922 (tty->hw_stopped && !mxser_16550A_or_MUST(info))) in mxser_flush_chars()
928 static unsigned int mxser_write_room(struct tty_struct *tty) in mxser_write_room() argument
930 struct mxser_port *info = tty->driver_data; in mxser_write_room()
935 static unsigned int mxser_chars_in_buffer(struct tty_struct *tty) in mxser_chars_in_buffer() argument
937 struct mxser_port *info = tty->driver_data; in mxser_chars_in_buffer()
947 static int mxser_get_serial_info(struct tty_struct *tty, in mxser_get_serial_info() argument
950 struct mxser_port *info = tty->driver_data; in mxser_get_serial_info()
962 ss->line = tty->index; in mxser_get_serial_info()
974 static int mxser_set_serial_info(struct tty_struct *tty, in mxser_set_serial_info() argument
977 struct mxser_port *info = tty->driver_data; in mxser_set_serial_info()
982 if (tty_io_error(tty)) in mxser_set_serial_info()
1023 tty_encode_baud_rate(tty, baud, baud); in mxser_set_serial_info()
1034 mxser_change_speed(tty, NULL); in mxser_set_serial_info()
1040 int retval = mxser_activate(port, tty); in mxser_set_serial_info()
1069 static int mxser_tiocmget(struct tty_struct *tty) in mxser_tiocmget() argument
1071 struct mxser_port *info = tty->driver_data; in mxser_tiocmget()
1075 if (tty_io_error(tty)) in mxser_tiocmget()
1080 msr = mxser_check_modem_status(tty, info); in mxser_tiocmget()
1091 static int mxser_tiocmset(struct tty_struct *tty, in mxser_tiocmset() argument
1094 struct mxser_port *info = tty->driver_data; in mxser_tiocmset()
1096 if (tty_io_error(tty)) in mxser_tiocmset()
1169 static int mxser_ioctl(struct tty_struct *tty, in mxser_ioctl() argument
1172 struct mxser_port *info = tty->driver_data; in mxser_ioctl()
1177 return mxser_ioctl_op_mode(info, tty->index, in mxser_ioctl()
1180 if (cmd != TIOCMIWAIT && tty_io_error(tty)) in mxser_ioctl()
1212 static int mxser_get_icount(struct tty_struct *tty, in mxser_get_icount() argument
1216 struct mxser_port *info = tty->driver_data; in mxser_get_icount()
1240 static void mxser_throttle(struct tty_struct *tty) in mxser_throttle() argument
1242 struct mxser_port *info = tty->driver_data; in mxser_throttle()
1244 if (I_IXOFF(tty)) { in mxser_throttle()
1249 info->x_char = STOP_CHAR(tty); in mxser_throttle()
1256 if (C_CRTSCTS(tty)) { in mxser_throttle()
1262 static void mxser_unthrottle(struct tty_struct *tty) in mxser_unthrottle() argument
1264 struct mxser_port *info = tty->driver_data; in mxser_unthrottle()
1267 if (I_IXOFF(tty)) { in mxser_unthrottle()
1275 info->x_char = START_CHAR(tty); in mxser_unthrottle()
1283 if (C_CRTSCTS(tty)) { in mxser_unthrottle()
1295 static void mxser_stop(struct tty_struct *tty) in mxser_stop() argument
1297 struct mxser_port *info = tty->driver_data; in mxser_stop()
1304 static void mxser_start(struct tty_struct *tty) in mxser_start() argument
1306 struct mxser_port *info = tty->driver_data; in mxser_start()
1313 static void mxser_set_termios(struct tty_struct *tty, in mxser_set_termios() argument
1316 struct mxser_port *info = tty->driver_data; in mxser_set_termios()
1319 mxser_change_speed(tty, old_termios); in mxser_set_termios()
1321 if ((old_termios->c_cflag & CRTSCTS) && !C_CRTSCTS(tty)) { in mxser_set_termios()
1322 tty->hw_stopped = false; in mxser_set_termios()
1323 mxser_start(tty); in mxser_set_termios()
1327 if ((old_termios->c_iflag & IXON) && !I_IXON(tty)) { in mxser_set_termios()
1328 tty->flow.stopped = 0; in mxser_set_termios()
1335 mxser_start(tty); in mxser_set_termios()
1348 static void mxser_wait_until_sent(struct tty_struct *tty, int timeout) in mxser_wait_until_sent() argument
1350 struct mxser_port *info = tty->driver_data; in mxser_wait_until_sent()
1402 static void mxser_hangup(struct tty_struct *tty) in mxser_hangup() argument
1404 struct mxser_port *info = tty->driver_data; in mxser_hangup()
1406 mxser_flush_buffer(tty); in mxser_hangup()
1413 static int mxser_rs_break(struct tty_struct *tty, int break_state) in mxser_rs_break() argument
1415 struct mxser_port *info = tty->driver_data; in mxser_rs_break()
1452 static u8 mxser_receive_chars_old(struct tty_struct *tty, in mxser_receive_chars_old() argument
1480 do_SAK(tty); in mxser_receive_chars_old()
1507 static u8 mxser_receive_chars(struct tty_struct *tty, in mxser_receive_chars() argument
1511 status = mxser_receive_chars_old(tty, port, status); in mxser_receive_chars()
1518 static void mxser_transmit_chars(struct tty_struct *tty, struct mxser_port *port) in mxser_transmit_chars() argument
1529 if (kfifo_is_empty(&port->port.xmit_fifo) || tty->flow.stopped || in mxser_transmit_chars()
1530 (tty->hw_stopped && !mxser_16550A_or_MUST(port))) { in mxser_transmit_chars()
1547 tty_wakeup(tty); in mxser_transmit_chars()
1564 struct tty_struct *tty = scoped_tty(); in mxser_port_isr() local
1573 status = mxser_receive_chars(tty, port, status); in mxser_port_isr()
1577 status = mxser_receive_chars(tty, port, status); in mxser_port_isr()
1580 mxser_check_modem_status(tty, port); in mxser_port_isr()
1584 mxser_transmit_chars(tty, port); in mxser_port_isr()
1587 mxser_transmit_chars(tty, port); in mxser_port_isr()