Lines Matching refs:tty

571 static int mxser_set_baud(struct tty_struct *tty, long newspd)  in mxser_set_baud()  argument
573 struct mxser_port *info = tty->driver_data; in mxser_set_baud()
585 tty_encode_baud_rate(tty, 134, 134); in mxser_set_baud()
591 tty_encode_baud_rate(tty, baud, baud); in mxser_set_baud()
617 if (C_BAUD(tty) == BOTHER) { in mxser_set_baud()
638 static int mxser_change_speed(struct tty_struct *tty, in mxser_change_speed() argument
641 struct mxser_port *info = tty->driver_data; in mxser_change_speed()
646 cflag = tty->termios.c_cflag; in mxser_change_speed()
650 if (mxser_set_baud_method[tty->index] == 0) in mxser_change_speed()
651 mxser_set_baud(tty, tty_get_baud_rate(tty)); in mxser_change_speed()
720 if (tty->hw_stopped) { in mxser_change_speed()
722 tty->hw_stopped = 0; in mxser_change_speed()
732 tty_wakeup(tty); in mxser_change_speed()
736 tty->hw_stopped = 1; in mxser_change_speed()
762 if (I_INPCK(tty)) in mxser_change_speed()
764 if (I_BRKINT(tty) || I_PARMRK(tty)) in mxser_change_speed()
769 if (I_IGNBRK(tty)) { in mxser_change_speed()
776 if (I_IGNPAR(tty)) { in mxser_change_speed()
788 mxser_set_must_xon1_value(info->ioaddr, START_CHAR(tty)); in mxser_change_speed()
789 mxser_set_must_xoff1_value(info->ioaddr, STOP_CHAR(tty)); in mxser_change_speed()
790 if (I_IXON(tty)) { in mxser_change_speed()
797 if (I_IXOFF(tty)) { in mxser_change_speed()
813 static void mxser_check_modem_status(struct tty_struct *tty, in mxser_check_modem_status() argument
834 if (tty->hw_stopped) { in mxser_check_modem_status()
836 tty->hw_stopped = 0; in mxser_check_modem_status()
846 tty_wakeup(tty); in mxser_check_modem_status()
850 tty->hw_stopped = 1; in mxser_check_modem_status()
862 static int mxser_activate(struct tty_port *port, struct tty_struct *tty) in mxser_activate() argument
875 set_bit(TTY_IO_ERROR, &tty->flags); in mxser_activate()
902 set_bit(TTY_IO_ERROR, &tty->flags); in mxser_activate()
940 clear_bit(TTY_IO_ERROR, &tty->flags); in mxser_activate()
946 mxser_change_speed(tty, NULL); in mxser_activate()
1004 static int mxser_open(struct tty_struct *tty, struct file *filp) in mxser_open() argument
1009 line = tty->index; in mxser_open()
1016 tty->driver_data = info; in mxser_open()
1017 return tty_port_open(&info->port, tty, filp); in mxser_open()
1020 static void mxser_flush_buffer(struct tty_struct *tty) in mxser_flush_buffer() argument
1022 struct mxser_port *info = tty->driver_data; in mxser_flush_buffer()
1037 tty_wakeup(tty); in mxser_flush_buffer()
1075 static void mxser_close(struct tty_struct *tty, struct file *filp) in mxser_close() argument
1077 struct mxser_port *info = tty->driver_data; in mxser_close()
1080 if (tty->index == MXSER_PORTS || info == NULL) in mxser_close()
1082 if (tty_port_close_start(port, tty, filp) == 0) in mxser_close()
1086 mxser_flush_buffer(tty); in mxser_close()
1088 if (C_HUPCL(tty)) in mxser_close()
1096 tty_port_close_end(port, tty); in mxser_close()
1100 static int mxser_write(struct tty_struct *tty, const unsigned char *buf, int count) in mxser_write() argument
1103 struct mxser_port *info = tty->driver_data; in mxser_write()
1127 if (info->xmit_cnt && !tty->stopped) { in mxser_write()
1128 if (!tty->hw_stopped || in mxser_write()
1142 static int mxser_put_char(struct tty_struct *tty, unsigned char ch) in mxser_put_char() argument
1144 struct mxser_port *info = tty->driver_data; in mxser_put_char()
1158 if (!tty->stopped) { in mxser_put_char()
1159 if (!tty->hw_stopped || in mxser_put_char()
1173 static void mxser_flush_chars(struct tty_struct *tty) in mxser_flush_chars() argument
1175 struct mxser_port *info = tty->driver_data; in mxser_flush_chars()
1178 if (info->xmit_cnt <= 0 || tty->stopped || !info->port.xmit_buf || in mxser_flush_chars()
1179 (tty->hw_stopped && info->type != PORT_16550A && in mxser_flush_chars()
1192 static int mxser_write_room(struct tty_struct *tty) in mxser_write_room() argument
1194 struct mxser_port *info = tty->driver_data; in mxser_write_room()
1201 static int mxser_chars_in_buffer(struct tty_struct *tty) in mxser_chars_in_buffer() argument
1203 struct mxser_port *info = tty->driver_data; in mxser_chars_in_buffer()
1212 static int mxser_get_serial_info(struct tty_struct *tty, in mxser_get_serial_info() argument
1215 struct mxser_port *info = tty->driver_data; in mxser_get_serial_info()
1218 .line = tty->index, in mxser_get_serial_info()
1233 static int mxser_set_serial_info(struct tty_struct *tty, in mxser_set_serial_info() argument
1236 struct mxser_port *info = tty->driver_data; in mxser_set_serial_info()
1279 tty_encode_baud_rate(tty, baud, baud); in mxser_set_serial_info()
1290 mxser_change_speed(tty, NULL); in mxser_set_serial_info()
1294 retval = mxser_activate(port, tty); in mxser_set_serial_info()
1325 static int mxser_tiocmget(struct tty_struct *tty) in mxser_tiocmget() argument
1327 struct mxser_port *info = tty->driver_data; in mxser_tiocmget()
1332 if (tty->index == MXSER_PORTS) in mxser_tiocmget()
1334 if (test_bit(TTY_IO_ERROR, &tty->flags)) in mxser_tiocmget()
1342 mxser_check_modem_status(tty, info, status); in mxser_tiocmget()
1352 static int mxser_tiocmset(struct tty_struct *tty, in mxser_tiocmset() argument
1355 struct mxser_port *info = tty->driver_data; in mxser_tiocmset()
1359 if (tty->index == MXSER_PORTS) in mxser_tiocmset()
1361 if (test_bit(TTY_IO_ERROR, &tty->flags)) in mxser_tiocmset()
1488 struct tty_struct *tty; in mxser_ioctl_special() local
1525 tty = tty_port_tty_get(port); in mxser_ioctl_special()
1527 if (!tty) in mxser_ioctl_special()
1530 ms.cflag = tty->termios.c_cflag; in mxser_ioctl_special()
1531 tty_kref_put(tty); in mxser_ioctl_special()
1594 tty = tty_port_tty_get(&ip->port); in mxser_ioctl_special()
1596 if (!tty) { in mxser_ioctl_special()
1601 cflag = tty->termios.c_cflag; in mxser_ioctl_special()
1602 iflag = tty->termios.c_iflag; in mxser_ioctl_special()
1603 me->baudrate[p] = tty_get_baud_rate(tty); in mxser_ioctl_special()
1605 tty_kref_put(tty); in mxser_ioctl_special()
1663 static int mxser_ioctl(struct tty_struct *tty, in mxser_ioctl() argument
1666 struct mxser_port *info = tty->driver_data; in mxser_ioctl()
1673 if (tty->index == MXSER_PORTS) in mxser_ioctl()
1686 p = tty->index % 4; in mxser_ioctl()
1716 test_bit(TTY_IO_ERROR, &tty->flags)) in mxser_ioctl()
1722 retval = mxser_get_serial_info(tty, argp); in mxser_ioctl()
1727 retval = mxser_set_serial_info(tty, argp); in mxser_ioctl()
1757 len = mxser_chars_in_buffer(tty); in mxser_ioctl()
1769 status = mxser_get_msr(info->ioaddr, 1, tty->index); in mxser_ioctl()
1770 mxser_check_modem_status(tty, info, status); in mxser_ioctl()
1785 if (tty->hw_stopped) in mxser_ioctl()
1808 mxser_set_baud_method[tty->index] = method; in mxser_ioctl()
1824 static int mxser_get_icount(struct tty_struct *tty, in mxser_get_icount() argument
1828 struct mxser_port *info = tty->driver_data; in mxser_get_icount()
1850 static void mxser_stoprx(struct tty_struct *tty) in mxser_stoprx() argument
1852 struct mxser_port *info = tty->driver_data; in mxser_stoprx()
1855 if (I_IXOFF(tty)) { in mxser_stoprx()
1860 info->x_char = STOP_CHAR(tty); in mxser_stoprx()
1867 if (tty->termios.c_cflag & CRTSCTS) { in mxser_stoprx()
1877 static void mxser_throttle(struct tty_struct *tty) in mxser_throttle() argument
1879 mxser_stoprx(tty); in mxser_throttle()
1882 static void mxser_unthrottle(struct tty_struct *tty) in mxser_unthrottle() argument
1884 struct mxser_port *info = tty->driver_data; in mxser_unthrottle()
1888 if (I_IXOFF(tty)) { in mxser_unthrottle()
1896 info->x_char = START_CHAR(tty); in mxser_unthrottle()
1904 if (tty->termios.c_cflag & CRTSCTS) { in mxser_unthrottle()
1916 static void mxser_stop(struct tty_struct *tty) in mxser_stop() argument
1918 struct mxser_port *info = tty->driver_data; in mxser_stop()
1929 static void mxser_start(struct tty_struct *tty) in mxser_start() argument
1931 struct mxser_port *info = tty->driver_data; in mxser_start()
1943 static void mxser_set_termios(struct tty_struct *tty, struct ktermios *old_termios) in mxser_set_termios() argument
1945 struct mxser_port *info = tty->driver_data; in mxser_set_termios()
1949 mxser_change_speed(tty, old_termios); in mxser_set_termios()
1953 !(tty->termios.c_cflag & CRTSCTS)) { in mxser_set_termios()
1954 tty->hw_stopped = 0; in mxser_set_termios()
1955 mxser_start(tty); in mxser_set_termios()
1960 !(tty->termios.c_iflag & IXON)) { in mxser_set_termios()
1961 tty->stopped = 0; in mxser_set_termios()
1970 mxser_start(tty); in mxser_set_termios()
1977 static void mxser_wait_until_sent(struct tty_struct *tty, int timeout) in mxser_wait_until_sent() argument
1979 struct mxser_port *info = tty->driver_data; in mxser_wait_until_sent()
2034 static void mxser_hangup(struct tty_struct *tty) in mxser_hangup() argument
2036 struct mxser_port *info = tty->driver_data; in mxser_hangup()
2038 mxser_flush_buffer(tty); in mxser_hangup()
2045 static int mxser_rs_break(struct tty_struct *tty, int break_state) in mxser_rs_break() argument
2047 struct mxser_port *info = tty->driver_data; in mxser_rs_break()
2061 static void mxser_receive_chars(struct tty_struct *tty, in mxser_receive_chars() argument
2070 recv_room = tty->receive_room; in mxser_receive_chars()
2072 mxser_stoprx(tty); in mxser_receive_chars()
2089 mxser_stoprx(tty); in mxser_receive_chars()
2119 do_SAK(tty); in mxser_receive_chars()
2136 mxser_stoprx(tty); in mxser_receive_chars()
2149 mxvar_log.rxcnt[tty->index] += cnt; in mxser_receive_chars()
2163 static void mxser_transmit_chars(struct tty_struct *tty, struct mxser_port *port) in mxser_transmit_chars() argument
2170 mxvar_log.txcnt[tty->index]++; in mxser_transmit_chars()
2180 if (port->xmit_cnt <= 0 || tty->stopped || in mxser_transmit_chars()
2181 (tty->hw_stopped && in mxser_transmit_chars()
2198 mxvar_log.txcnt[tty->index] += (cnt - port->xmit_cnt); in mxser_transmit_chars()
2205 tty_wakeup(tty); in mxser_transmit_chars()
2224 struct tty_struct *tty; in mxser_interrupt() local
2257 tty = tty_port_tty_get(&port->port); in mxser_interrupt()
2258 if (!tty || in mxser_interrupt()
2265 tty_kref_put(tty); in mxser_interrupt()
2286 mxser_receive_chars(tty, port, in mxser_interrupt()
2292 mxser_receive_chars(tty, port, in mxser_interrupt()
2297 mxser_check_modem_status(tty, port, msr); in mxser_interrupt()
2302 mxser_transmit_chars(tty, port); in mxser_interrupt()
2305 mxser_transmit_chars(tty, port); in mxser_interrupt()
2307 tty_kref_put(tty); in mxser_interrupt()