Lines Matching defs:tty

14  * The port is registered with the tty driver as minor device 64, and
61 #include <linux/tty.h>
96 static void change_speed(struct tty_struct *tty, struct serial_state *info,
98 static void rs_wait_until_sent(struct tty_struct *tty, int timeout);
129 * This routines are called before setting or resetting tty->flow.stopped.
133 static void rs_stop(struct tty_struct *tty)
135 struct serial_state *info = tty->driver_data;
150 static void rs_start(struct tty_struct *tty)
152 struct serial_state *info = tty->driver_data;
243 do_SAK(info->tport.tty);
277 || info->tport.tty->flow.stopped
278 || info->tport.tty->hw_stopped) {
293 tty_wakeup(info->tport.tty);
340 if (port->tty)
341 tty_hangup(port->tty);
345 if (port->tty->hw_stopped) {
350 port->tty->hw_stopped = false;
357 tty_wakeup(port->tty);
365 port->tty->hw_stopped = true;
398 if (!info->tport.tty)
417 if (!info->tport.tty)
443 static int startup(struct tty_struct *tty, struct serial_state *info)
478 set_bit(TTY_IO_ERROR, &tty->flags);
493 if (C_BAUD(tty))
497 clear_bit(TTY_IO_ERROR, &tty->flags);
503 change_speed(tty, info, NULL);
518 static void shutdown(struct tty_struct *tty, struct serial_state *info)
553 if (C_HUPCL(tty))
557 set_bit(TTY_IO_ERROR, &tty->flags);
568 static void change_speed(struct tty_struct *tty, struct serial_state *info,
577 cflag = tty->termios.c_cflag;
596 baud = tty_get_baud_rate(tty);
611 /* FIXME: Will need updating for new tty in the end */
612 tty->termios.c_cflag &= ~CBAUD;
613 tty->termios.c_cflag |= (old_termios->c_cflag & CBAUD);
614 baud = tty_get_baud_rate(tty);
654 if (I_INPCK(tty))
656 if (I_BRKINT(tty) || I_PARMRK(tty))
663 if (I_IGNPAR(tty))
665 if (I_IGNBRK(tty)) {
671 if (I_IGNPAR(tty))
699 static int rs_put_char(struct tty_struct *tty, u8 ch)
704 info = tty->driver_data;
723 static void rs_flush_chars(struct tty_struct *tty)
725 struct serial_state *info = tty->driver_data;
729 || tty->flow.stopped
730 || tty->hw_stopped
744 static ssize_t rs_write(struct tty_struct * tty, const u8 *buf, size_t count)
747 struct serial_state *info = tty->driver_data;
772 && !tty->flow.stopped
773 && !tty->hw_stopped
787 static unsigned int rs_write_room(struct tty_struct *tty)
789 struct serial_state *info = tty->driver_data;
794 static unsigned int rs_chars_in_buffer(struct tty_struct *tty)
796 struct serial_state *info = tty->driver_data;
801 static void rs_flush_buffer(struct tty_struct *tty)
803 struct serial_state *info = tty->driver_data;
809 tty_wakeup(tty);
816 static void rs_send_xchar(struct tty_struct *tty, char ch)
818 struct serial_state *info = tty->driver_data;
844 * This routine is called by the upper-layer tty layer to signal that
848 static void rs_throttle(struct tty_struct * tty)
850 struct serial_state *info = tty->driver_data;
853 printk("throttle %s ....\n", tty_name(tty));
856 if (I_IXOFF(tty))
857 rs_send_xchar(tty, STOP_CHAR(tty));
859 if (C_CRTSCTS(tty))
867 static void rs_unthrottle(struct tty_struct * tty)
869 struct serial_state *info = tty->driver_data;
872 printk("unthrottle %s ....\n", tty_name(tty));
875 if (I_IXOFF(tty)) {
879 rs_send_xchar(tty, START_CHAR(tty));
881 if (C_CRTSCTS(tty))
894 static int get_serial_info(struct tty_struct *tty, struct serial_struct *ss)
896 struct serial_state *state = tty->driver_data;
899 tty_lock(tty);
905 ss->line = tty->index;
913 tty_unlock(tty);
917 static int set_serial_info(struct tty_struct *tty, struct serial_struct *ss)
919 struct serial_state *state = tty->driver_data;
925 tty_lock(tty);
930 tty_unlock(tty);
945 tty_unlock(tty);
955 tty_unlock(tty);
976 dev_warn_ratelimited(tty->dev, "use of SPD flags is deprecated\n");
977 change_speed(tty, state, NULL);
980 retval = startup(tty, state);
981 tty_unlock(tty);
1012 static int rs_tiocmget(struct tty_struct *tty)
1014 struct serial_state *info = tty->driver_data;
1018 if (tty_io_error(tty))
1032 static int rs_tiocmset(struct tty_struct *tty, unsigned int set,
1035 struct serial_state *info = tty->driver_data;
1038 if (tty_io_error(tty))
1058 static int rs_break(struct tty_struct *tty, int break_state)
1078 static int rs_get_icount(struct tty_struct *tty,
1081 struct serial_state *info = tty->driver_data;
1103 static int rs_ioctl(struct tty_struct *tty,
1106 struct serial_state *info = tty->driver_data;
1115 if (tty_io_error(tty))
1172 static void rs_set_termios(struct tty_struct *tty, const struct ktermios *old_termios)
1174 struct serial_state *info = tty->driver_data;
1176 unsigned int cflag = tty->termios.c_cflag;
1178 change_speed(tty, info, old_termios);
1191 if (!C_CRTSCTS(tty) || !tty_throttled(tty))
1199 if ((old_termios->c_cflag & CRTSCTS) && !C_CRTSCTS(tty)) {
1200 tty->hw_stopped = false;
1201 rs_start(tty);
1211 if (!(old_termios->c_cflag & CLOCAL) && C_CLOCAL(tty))
1226 static void rs_close(struct tty_struct *tty, struct file * filp)
1228 struct serial_state *state = tty->driver_data;
1231 if (tty_port_close_start(port, tty, filp) == 0)
1254 rs_wait_until_sent(tty, state->timeout);
1256 shutdown(tty, state);
1257 rs_flush_buffer(tty);
1259 tty_ldisc_flush(tty);
1260 port->tty = NULL;
1262 tty_port_close_end(port, tty);
1268 static void rs_wait_until_sent(struct tty_struct *tty, int timeout)
1270 struct serial_state *info = tty->driver_data;
1325 static void rs_hangup(struct tty_struct *tty)
1327 struct serial_state *info = tty->driver_data;
1329 rs_flush_buffer(tty);
1330 shutdown(tty, info);
1333 info->tport.tty = NULL;
1341 * initialization for the tty structure.
1343 static int rs_open(struct tty_struct *tty, struct file * filp)
1345 struct tty_port *port = tty->port;
1351 port->tty = tty;
1352 tty->driver_data = info;
1354 retval = startup(tty, info);
1359 return tty_port_block_til_ready(port, tty, filp);