Lines Matching refs:tty
95 static void change_speed(struct tty_struct *tty, struct serial_state *info,
97 static void rs_wait_until_sent(struct tty_struct *tty, int timeout);
132 static void rs_stop(struct tty_struct *tty) in rs_stop() argument
134 struct serial_state *info = tty->driver_data; in rs_stop()
149 static void rs_start(struct tty_struct *tty) in rs_start() argument
151 struct serial_state *info = tty->driver_data; in rs_start()
242 do_SAK(info->tport.tty); in receive_chars()
276 || info->tport.tty->flow.stopped in transmit_chars()
277 || info->tport.tty->hw_stopped) { in transmit_chars()
292 tty_wakeup(info->tport.tty); in transmit_chars()
339 if (port->tty) in check_modem_status()
340 tty_hangup(port->tty); in check_modem_status()
344 if (port->tty->hw_stopped) { in check_modem_status()
349 port->tty->hw_stopped = 0; in check_modem_status()
356 tty_wakeup(port->tty); in check_modem_status()
364 port->tty->hw_stopped = 1; in check_modem_status()
397 if (!info->tport.tty) in ser_rx_int()
416 if (!info->tport.tty) in ser_tx_int()
442 static int startup(struct tty_struct *tty, struct serial_state *info) in startup() argument
477 set_bit(TTY_IO_ERROR, &tty->flags); in startup()
492 if (C_BAUD(tty)) in startup()
496 clear_bit(TTY_IO_ERROR, &tty->flags); in startup()
502 change_speed(tty, info, NULL); in startup()
517 static void shutdown(struct tty_struct *tty, struct serial_state *info) in shutdown() argument
554 if (C_HUPCL(tty)) in shutdown()
558 set_bit(TTY_IO_ERROR, &tty->flags); in shutdown()
569 static void change_speed(struct tty_struct *tty, struct serial_state *info, in change_speed() argument
578 cflag = tty->termios.c_cflag; in change_speed()
599 baud = tty_get_baud_rate(tty); in change_speed()
615 tty->termios.c_cflag &= ~CBAUD; in change_speed()
616 tty->termios.c_cflag |= (old_termios->c_cflag & CBAUD); in change_speed()
617 baud = tty_get_baud_rate(tty); in change_speed()
657 if (I_INPCK(tty)) in change_speed()
659 if (I_BRKINT(tty) || I_PARMRK(tty)) in change_speed()
666 if (I_IGNPAR(tty)) in change_speed()
668 if (I_IGNBRK(tty)) { in change_speed()
674 if (I_IGNPAR(tty)) in change_speed()
702 static int rs_put_char(struct tty_struct *tty, unsigned char ch) in rs_put_char() argument
707 info = tty->driver_data; in rs_put_char()
726 static void rs_flush_chars(struct tty_struct *tty) in rs_flush_chars() argument
728 struct serial_state *info = tty->driver_data; in rs_flush_chars()
732 || tty->flow.stopped in rs_flush_chars()
733 || tty->hw_stopped in rs_flush_chars()
747 static int rs_write(struct tty_struct * tty, const unsigned char *buf, int count) in rs_write() argument
750 struct serial_state *info = tty->driver_data; in rs_write()
776 && !tty->flow.stopped in rs_write()
777 && !tty->hw_stopped in rs_write()
791 static unsigned int rs_write_room(struct tty_struct *tty) in rs_write_room() argument
793 struct serial_state *info = tty->driver_data; in rs_write_room()
798 static unsigned int rs_chars_in_buffer(struct tty_struct *tty) in rs_chars_in_buffer() argument
800 struct serial_state *info = tty->driver_data; in rs_chars_in_buffer()
805 static void rs_flush_buffer(struct tty_struct *tty) in rs_flush_buffer() argument
807 struct serial_state *info = tty->driver_data; in rs_flush_buffer()
813 tty_wakeup(tty); in rs_flush_buffer()
820 static void rs_send_xchar(struct tty_struct *tty, char ch) in rs_send_xchar() argument
822 struct serial_state *info = tty->driver_data; in rs_send_xchar()
852 static void rs_throttle(struct tty_struct * tty) in rs_throttle() argument
854 struct serial_state *info = tty->driver_data; in rs_throttle()
857 printk("throttle %s ....\n", tty_name(tty)); in rs_throttle()
860 if (I_IXOFF(tty)) in rs_throttle()
861 rs_send_xchar(tty, STOP_CHAR(tty)); in rs_throttle()
863 if (C_CRTSCTS(tty)) in rs_throttle()
871 static void rs_unthrottle(struct tty_struct * tty) in rs_unthrottle() argument
873 struct serial_state *info = tty->driver_data; in rs_unthrottle()
876 printk("unthrottle %s ....\n", tty_name(tty)); in rs_unthrottle()
879 if (I_IXOFF(tty)) { in rs_unthrottle()
883 rs_send_xchar(tty, START_CHAR(tty)); in rs_unthrottle()
885 if (C_CRTSCTS(tty)) in rs_unthrottle()
898 static int get_serial_info(struct tty_struct *tty, struct serial_struct *ss) in get_serial_info() argument
900 struct serial_state *state = tty->driver_data; in get_serial_info()
903 tty_lock(tty); in get_serial_info()
909 ss->line = tty->index; in get_serial_info()
917 tty_unlock(tty); in get_serial_info()
921 static int set_serial_info(struct tty_struct *tty, struct serial_struct *ss) in set_serial_info() argument
923 struct serial_state *state = tty->driver_data; in set_serial_info()
929 tty_lock(tty); in set_serial_info()
934 tty_unlock(tty); in set_serial_info()
949 tty_unlock(tty); in set_serial_info()
959 tty_unlock(tty); in set_serial_info()
980 dev_warn_ratelimited(tty->dev, "use of SPD flags is deprecated\n"); in set_serial_info()
981 change_speed(tty, state, NULL); in set_serial_info()
984 retval = startup(tty, state); in set_serial_info()
985 tty_unlock(tty); in set_serial_info()
1016 static int rs_tiocmget(struct tty_struct *tty) in rs_tiocmget() argument
1018 struct serial_state *info = tty->driver_data; in rs_tiocmget()
1022 if (tty_io_error(tty)) in rs_tiocmget()
1036 static int rs_tiocmset(struct tty_struct *tty, unsigned int set, in rs_tiocmset() argument
1039 struct serial_state *info = tty->driver_data; in rs_tiocmset()
1042 if (tty_io_error(tty)) in rs_tiocmset()
1062 static int rs_break(struct tty_struct *tty, int break_state) in rs_break() argument
1082 static int rs_get_icount(struct tty_struct *tty, in rs_get_icount() argument
1085 struct serial_state *info = tty->driver_data; in rs_get_icount()
1107 static int rs_ioctl(struct tty_struct *tty, in rs_ioctl() argument
1110 struct serial_state *info = tty->driver_data; in rs_ioctl()
1119 if (tty_io_error(tty)) in rs_ioctl()
1176 static void rs_set_termios(struct tty_struct *tty, struct ktermios *old_termios) in rs_set_termios() argument
1178 struct serial_state *info = tty->driver_data; in rs_set_termios()
1180 unsigned int cflag = tty->termios.c_cflag; in rs_set_termios()
1182 change_speed(tty, info, old_termios); in rs_set_termios()
1195 if (!C_CRTSCTS(tty) || !tty_throttled(tty)) in rs_set_termios()
1203 if ((old_termios->c_cflag & CRTSCTS) && !C_CRTSCTS(tty)) { in rs_set_termios()
1204 tty->hw_stopped = 0; in rs_set_termios()
1205 rs_start(tty); in rs_set_termios()
1215 if (!(old_termios->c_cflag & CLOCAL) && C_CLOCAL(tty)) in rs_set_termios()
1230 static void rs_close(struct tty_struct *tty, struct file * filp) in rs_close() argument
1232 struct serial_state *state = tty->driver_data; in rs_close()
1235 if (tty_port_close_start(port, tty, filp) == 0) in rs_close()
1258 rs_wait_until_sent(tty, state->timeout); in rs_close()
1260 shutdown(tty, state); in rs_close()
1261 rs_flush_buffer(tty); in rs_close()
1263 tty_ldisc_flush(tty); in rs_close()
1264 port->tty = NULL; in rs_close()
1266 tty_port_close_end(port, tty); in rs_close()
1272 static void rs_wait_until_sent(struct tty_struct *tty, int timeout) in rs_wait_until_sent() argument
1274 struct serial_state *info = tty->driver_data; in rs_wait_until_sent()
1329 static void rs_hangup(struct tty_struct *tty) in rs_hangup() argument
1331 struct serial_state *info = tty->driver_data; in rs_hangup()
1333 rs_flush_buffer(tty); in rs_hangup()
1334 shutdown(tty, info); in rs_hangup()
1337 info->tport.tty = NULL; in rs_hangup()
1347 static int rs_open(struct tty_struct *tty, struct file * filp) in rs_open() argument
1349 struct tty_port *port = tty->port; in rs_open()
1355 port->tty = tty; in rs_open()
1356 tty->driver_data = info; in rs_open()
1358 retval = startup(tty, info); in rs_open()
1363 return tty_port_block_til_ready(port, tty, filp); in rs_open()