Lines Matching refs:tty

54 static void uart_change_speed(struct tty_struct *tty, struct uart_state *state,
56 static void uart_wait_until_sent(struct tty_struct *tty, int timeout);
79 tty_wakeup(state->port.tty); in uart_write_wakeup()
82 static void uart_stop(struct tty_struct *tty) in uart_stop() argument
84 struct uart_state *state = tty->driver_data; in uart_stop()
93 static void __uart_start(struct tty_struct *tty) in __uart_start() argument
95 struct uart_state *state = tty->driver_data; in __uart_start()
102 static void uart_start(struct tty_struct *tty) in uart_start() argument
104 struct uart_state *state = tty->driver_data; in uart_start()
109 __uart_start(tty); in uart_start()
134 static int uart_port_startup(struct tty_struct *tty, struct uart_state *state, in uart_port_startup() argument
166 tty->termios.c_cflag = uport->cons->cflag; in uart_port_startup()
172 uart_change_speed(tty, state, NULL); in uart_port_startup()
179 if (tty->termios.c_cflag & CBAUD) in uart_port_startup()
195 static int uart_startup(struct tty_struct *tty, struct uart_state *state, in uart_startup() argument
208 set_bit(TTY_IO_ERROR, &tty->flags); in uart_startup()
210 retval = uart_port_startup(tty, state, init_hw); in uart_startup()
213 clear_bit(TTY_IO_ERROR, &tty->flags); in uart_startup()
225 static void uart_shutdown(struct tty_struct *tty, struct uart_state *state) in uart_shutdown() argument
233 if (tty) in uart_shutdown()
234 set_bit(TTY_IO_ERROR, &tty->flags); in uart_shutdown()
240 if (uart_console(uport) && tty) in uart_shutdown()
241 uport->cons->cflag = tty->termios.c_cflag; in uart_shutdown()
243 if (!tty || (tty->termios.c_cflag & HUPCL)) in uart_shutdown()
432 static void uart_change_speed(struct tty_struct *tty, struct uart_state *state, in uart_change_speed() argument
443 if (!tty || uport->type == PORT_UNKNOWN) in uart_change_speed()
446 termios = &tty->termios; in uart_change_speed()
472 __uart_start(tty); in uart_change_speed()
496 static int uart_put_char(struct tty_struct *tty, unsigned char ch) in uart_put_char() argument
498 struct uart_state *state = tty->driver_data; in uart_put_char()
503 static void uart_flush_chars(struct tty_struct *tty) in uart_flush_chars() argument
505 uart_start(tty); in uart_flush_chars()
508 static int uart_write(struct tty_struct *tty, in uart_write() argument
511 struct uart_state *state = tty->driver_data; in uart_write()
546 __uart_start(tty); in uart_write()
552 static int uart_write_room(struct tty_struct *tty) in uart_write_room() argument
554 struct uart_state *state = tty->driver_data; in uart_write_room()
564 static int uart_chars_in_buffer(struct tty_struct *tty) in uart_chars_in_buffer() argument
566 struct uart_state *state = tty->driver_data; in uart_chars_in_buffer()
576 static void uart_flush_buffer(struct tty_struct *tty) in uart_flush_buffer() argument
578 struct uart_state *state = tty->driver_data; in uart_flush_buffer()
592 pr_debug("uart_flush_buffer(%d) called\n", tty->index); in uart_flush_buffer()
599 tty_wakeup(tty); in uart_flush_buffer()
606 static void uart_send_xchar(struct tty_struct *tty, char ch) in uart_send_xchar() argument
608 struct uart_state *state = tty->driver_data; in uart_send_xchar()
623 static void uart_throttle(struct tty_struct *tty) in uart_throttle() argument
625 struct uart_state *state = tty->driver_data; in uart_throttle()
629 if (I_IXOFF(tty)) in uart_throttle()
631 if (tty->termios.c_cflag & CRTSCTS) in uart_throttle()
640 uart_send_xchar(tty, STOP_CHAR(tty)); in uart_throttle()
646 static void uart_unthrottle(struct tty_struct *tty) in uart_unthrottle() argument
648 struct uart_state *state = tty->driver_data; in uart_unthrottle()
652 if (I_IXOFF(tty)) in uart_unthrottle()
654 if (tty->termios.c_cflag & CRTSCTS) in uart_unthrottle()
663 uart_send_xchar(tty, START_CHAR(tty)); in uart_unthrottle()
718 static int uart_set_info(struct tty_struct *tty, struct tty_port *port, in uart_set_info() argument
802 uart_shutdown(tty, state); in uart_set_info()
902 tty_name(port->tty, buf)); in uart_set_info()
904 uart_change_speed(tty, state, NULL); in uart_set_info()
907 retval = uart_startup(tty, state, 1); in uart_set_info()
912 static int uart_set_info_user(struct tty_struct *tty, struct uart_state *state, in uart_set_info_user() argument
930 retval = uart_set_info(tty, port, state, &new_serial); in uart_set_info_user()
943 static int uart_get_lsr_info(struct tty_struct *tty, in uart_get_lsr_info() argument
965 static int uart_tiocmget(struct tty_struct *tty) in uart_tiocmget() argument
967 struct uart_state *state = tty->driver_data; in uart_tiocmget()
973 if (!(tty->flags & (1 << TTY_IO_ERROR))) { in uart_tiocmget()
985 uart_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) in uart_tiocmset() argument
987 struct uart_state *state = tty->driver_data; in uart_tiocmset()
993 if (!(tty->flags & (1 << TTY_IO_ERROR))) { in uart_tiocmset()
1001 static int uart_break_ctl(struct tty_struct *tty, int break_state) in uart_break_ctl() argument
1003 struct uart_state *state = tty->driver_data; in uart_break_ctl()
1016 static int uart_do_autoconfig(struct tty_struct *tty,struct uart_state *state) in uart_do_autoconfig() argument
1035 uart_shutdown(tty, state); in uart_do_autoconfig()
1054 ret = uart_startup(tty, state, 1); in uart_do_autoconfig()
1133 static int uart_get_icount(struct tty_struct *tty, in uart_get_icount() argument
1136 struct uart_state *state = tty->driver_data; in uart_get_icount()
1204 uart_ioctl(struct tty_struct *tty, unsigned int cmd, in uart_ioctl() argument
1207 struct uart_state *state = tty->driver_data; in uart_ioctl()
1222 down_write(&tty->termios_rwsem); in uart_ioctl()
1223 ret = uart_set_info_user(tty, state, uarg); in uart_ioctl()
1224 up_write(&tty->termios_rwsem); in uart_ioctl()
1228 down_write(&tty->termios_rwsem); in uart_ioctl()
1229 ret = uart_do_autoconfig(tty, state); in uart_ioctl()
1230 up_write(&tty->termios_rwsem); in uart_ioctl()
1242 if (tty->flags & (1 << TTY_IO_ERROR)) { in uart_ioctl()
1261 if (tty->flags & (1 << TTY_IO_ERROR)) { in uart_ioctl()
1273 ret = uart_get_lsr_info(tty, state, uarg); in uart_ioctl()
1296 static void uart_set_ldisc(struct tty_struct *tty) in uart_set_ldisc() argument
1298 struct uart_state *state = tty->driver_data; in uart_set_ldisc()
1303 uport->ops->set_ldisc(uport, &tty->termios); in uart_set_ldisc()
1308 static void uart_set_termios(struct tty_struct *tty, in uart_set_termios() argument
1311 struct uart_state *state = tty->driver_data; in uart_set_termios()
1313 unsigned int cflag = tty->termios.c_cflag; in uart_set_termios()
1324 tty->termios.c_cc[VSTART] != old_termios->c_cc[VSTART] || in uart_set_termios()
1325 tty->termios.c_cc[VSTOP] != old_termios->c_cc[VSTOP]; in uart_set_termios()
1335 tty->termios.c_ospeed == old_termios->c_ospeed && in uart_set_termios()
1336 tty->termios.c_ispeed == old_termios->c_ispeed && in uart_set_termios()
1337 ((tty->termios.c_iflag ^ old_termios->c_iflag) & iflag_mask) == 0 && in uart_set_termios()
1343 uart_change_speed(tty, state, old_termios); in uart_set_termios()
1346 cflag = tty->termios.c_cflag; in uart_set_termios()
1354 if (!(cflag & CRTSCTS) || !test_bit(TTY_THROTTLED, &tty->flags)) in uart_set_termios()
1366 static void uart_close(struct tty_struct *tty, struct file *filp) in uart_close() argument
1368 struct uart_state *state = tty->driver_data; in uart_close()
1374 struct uart_driver *drv = tty->driver->driver_state; in uart_close()
1376 state = drv->state + tty->index; in uart_close()
1389 if (!port->count || tty_port_close_start(port, tty, filp) == 0) in uart_close()
1406 uart_wait_until_sent(tty, uport->timeout); in uart_close()
1410 uart_shutdown(tty, state); in uart_close()
1437 tty_ldisc_flush(tty); in uart_close()
1438 tty->closing = 0; in uart_close()
1441 static void uart_wait_until_sent(struct tty_struct *tty, int timeout) in uart_wait_until_sent() argument
1443 struct uart_state *state = tty->driver_data; in uart_wait_until_sent()
1501 static void uart_hangup(struct tty_struct *tty) in uart_hangup() argument
1503 struct uart_state *state = tty->driver_data; in uart_hangup()
1511 uart_flush_buffer(tty); in uart_hangup()
1512 uart_shutdown(tty, state); in uart_hangup()
1526 static int uart_port_activate(struct tty_port *port, struct tty_struct *tty) in uart_port_activate() argument
1591 static int uart_open(struct tty_struct *tty, struct file *filp) in uart_open() argument
1593 struct uart_driver *drv = (struct uart_driver *)tty->driver->driver_state; in uart_open()
1594 int retval, line = tty->index; in uart_open()
1621 tty->driver_data = state; in uart_open()
1625 tty_port_tty_set(port, tty); in uart_open()
1630 retval = uart_startup(tty, state, 0); in uart_open()
1637 retval = tty_port_block_til_ready(port, tty, filp); in uart_open()
2119 if (port->tty && termios.c_cflag == 0) in uart_resume_port()
2120 termios = port->tty->termios; in uart_resume_port()
2139 struct tty_struct *tty = port->tty; in uart_resume_port() local
2142 if (tty) in uart_resume_port()
2143 uart_change_speed(tty, state, NULL); in uart_resume_port()
2155 uart_shutdown(tty, state); in uart_resume_port()
2753 struct tty_struct *tty; in uart_remove_one_port() local
2782 tty = tty_port_tty_get(port); in uart_remove_one_port()
2783 if (tty) { in uart_remove_one_port()
2784 tty_vhangup(port->tty); in uart_remove_one_port()
2785 tty_kref_put(tty); in uart_remove_one_port()
2848 struct tty_struct *tty = port->tty; in uart_handle_dcd_change() local
2853 if (tty) { in uart_handle_dcd_change()
2854 ld = tty_ldisc_ref(tty); in uart_handle_dcd_change()
2857 ld->ops->dcd_change(tty, status); in uart_handle_dcd_change()
2867 else if (tty) in uart_handle_dcd_change()
2868 tty_hangup(tty); in uart_handle_dcd_change()