29 #include <linux/module.h>
30 #include <linux/kernel.h>
31 #include <linux/slab.h>
32 #include <linux/tty.h>
34 #include <asm/uaccess.h>
44 static int qos_mtt_bits = 0x03;
60 static int irtty_chars_in_buffer(
struct sir_dev *
dev)
85 #define USBSERIAL_TX_DONE_DELAY 60
87 static void irtty_wait_until_sent(
struct sir_dev *dev)
96 if (tty->
ops->wait_until_sent) {
114 static int irtty_change_speed(
struct sir_dev *dev,
unsigned speed)
127 old_termios = tty->termios;
128 cflag = tty->termios.c_cflag;
130 if (tty->
ops->set_termios)
131 tty->
ops->set_termios(tty, &old_termios);
145 static int irtty_set_dtr_rts(
struct sir_dev *dev,
int dtr,
int rts)
170 priv->
tty->ops->tiocmset(priv->
tty,
set, clear);
182 static int irtty_do_write(
struct sir_dev *dev,
const unsigned char *
ptr,
size_t len)
192 if (!tty->
ops->write)
198 return tty->
ops->write(tty, ptr, writelen);
219 static void irtty_receive_buf(
struct tty_struct *tty,
const unsigned char *
cp,
238 for (i = 0; i <
count; i++) {
259 static void irtty_write_wakeup(
struct tty_struct *tty)
278 static inline void irtty_stop_receiver(
struct tty_struct *tty,
int stop)
284 old_termios = tty->termios;
285 cflag = tty->termios.c_cflag;
292 tty->termios.c_cflag =
cflag;
293 if (tty->
ops->set_termios)
294 tty->
ops->set_termios(tty, &old_termios);
305 static int irtty_start_dev(
struct sir_dev *dev)
322 tty->
ops->start(tty);
324 irtty_stop_receiver(tty,
FALSE);
332 static int irtty_stop_dev(
struct sir_dev *dev)
349 irtty_stop_receiver(tty,
TRUE);
362 .driver_name =
"sir_tty",
363 .start_dev = irtty_start_dev,
364 .stop_dev = irtty_stop_dev,
365 .do_write = irtty_do_write,
366 .chars_in_buffer = irtty_chars_in_buffer,
367 .wait_until_sent = irtty_wait_until_sent,
368 .set_speed = irtty_change_speed,
369 .set_dtr_rts = irtty_set_dtr_rts,
382 struct irtty_info {
char name[6]; }
info;
390 IRDA_DEBUG(3,
"%s(cmd=0x%X)\n", __func__, cmd);
444 irtty_stop_receiver(tty,
TRUE);
480 IRDA_DEBUG(0,
"%s - %s: irda line discipline opened\n", __func__, tty->
name);
497 static void irtty_close(
struct tty_struct *tty)
525 irtty_stop_receiver(tty,
TRUE);
532 IRDA_DEBUG(0,
"%s - %s: irda line discipline closed\n", __func__, tty->
name);
542 .close = irtty_close,
545 .ioctl = irtty_ioctl,
547 .receive_buf = irtty_receive_buf,
548 .write_wakeup = irtty_write_wakeup,
554 static int __init irtty_sir_init(
void)
559 IRDA_ERROR(
"IrDA: can't register line discipline (err = %d)\n",
564 static void __exit irtty_sir_cleanup(
void)
569 IRDA_ERROR(
"%s(), can't unregister line discipline (err = %d)\n",