diff options
author | Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de> | 2011-10-10 11:24:08 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-10-18 16:46:29 -0400 |
commit | c75ccd481258d923216337955930ea49ea1a9a1a (patch) | |
tree | 57f5fddf7372b6962b12258178997cd41601eaed /drivers | |
parent | 8f5d621543cb064d2989fc223d3c2bc61a43981e (diff) |
USB: ftdi_sio.c: Basic icount infrastructure for ftdi_sio
Signed-off-by: Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/serial/ftdi_sio.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index effc43682dc0..4cfc4cd4aae3 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -73,6 +73,7 @@ struct ftdi_private { | |||
73 | */ | 73 | */ |
74 | int flags; /* some ASYNC_xxxx flags are supported */ | 74 | int flags; /* some ASYNC_xxxx flags are supported */ |
75 | unsigned long last_dtr_rts; /* saved modem control outputs */ | 75 | unsigned long last_dtr_rts; /* saved modem control outputs */ |
76 | struct async_icount icount; | ||
76 | wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */ | 77 | wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */ |
77 | char prev_status, diff_status; /* Used for TIOCMIWAIT */ | 78 | char prev_status, diff_status; /* Used for TIOCMIWAIT */ |
78 | char transmit_empty; /* If transmitter is empty or not */ | 79 | char transmit_empty; /* If transmitter is empty or not */ |
@@ -889,6 +890,8 @@ static void ftdi_set_termios(struct tty_struct *tty, | |||
889 | static int ftdi_tiocmget(struct tty_struct *tty); | 890 | static int ftdi_tiocmget(struct tty_struct *tty); |
890 | static int ftdi_tiocmset(struct tty_struct *tty, | 891 | static int ftdi_tiocmset(struct tty_struct *tty, |
891 | unsigned int set, unsigned int clear); | 892 | unsigned int set, unsigned int clear); |
893 | static int ftdi_get_icount(struct tty_struct *tty, | ||
894 | struct serial_icounter_struct *icount); | ||
892 | static int ftdi_ioctl(struct tty_struct *tty, | 895 | static int ftdi_ioctl(struct tty_struct *tty, |
893 | unsigned int cmd, unsigned long arg); | 896 | unsigned int cmd, unsigned long arg); |
894 | static void ftdi_break_ctl(struct tty_struct *tty, int break_state); | 897 | static void ftdi_break_ctl(struct tty_struct *tty, int break_state); |
@@ -923,6 +926,7 @@ static struct usb_serial_driver ftdi_sio_device = { | |||
923 | .prepare_write_buffer = ftdi_prepare_write_buffer, | 926 | .prepare_write_buffer = ftdi_prepare_write_buffer, |
924 | .tiocmget = ftdi_tiocmget, | 927 | .tiocmget = ftdi_tiocmget, |
925 | .tiocmset = ftdi_tiocmset, | 928 | .tiocmset = ftdi_tiocmset, |
929 | .get_icount = ftdi_get_icount, | ||
926 | .ioctl = ftdi_ioctl, | 930 | .ioctl = ftdi_ioctl, |
927 | .set_termios = ftdi_set_termios, | 931 | .set_termios = ftdi_set_termios, |
928 | .break_ctl = ftdi_break_ctl, | 932 | .break_ctl = ftdi_break_ctl, |
@@ -1650,6 +1654,7 @@ static int ftdi_sio_port_probe(struct usb_serial_port *port) | |||
1650 | 1654 | ||
1651 | kref_init(&priv->kref); | 1655 | kref_init(&priv->kref); |
1652 | mutex_init(&priv->cfg_lock); | 1656 | mutex_init(&priv->cfg_lock); |
1657 | memset(&priv->icount, 0x00, sizeof(priv->icount)); | ||
1653 | init_waitqueue_head(&priv->delta_msr_wait); | 1658 | init_waitqueue_head(&priv->delta_msr_wait); |
1654 | 1659 | ||
1655 | priv->flags = ASYNC_LOW_LATENCY; | 1660 | priv->flags = ASYNC_LOW_LATENCY; |
@@ -2281,6 +2286,27 @@ static int ftdi_tiocmset(struct tty_struct *tty, | |||
2281 | return update_mctrl(port, set, clear); | 2286 | return update_mctrl(port, set, clear); |
2282 | } | 2287 | } |
2283 | 2288 | ||
2289 | static int ftdi_get_icount(struct tty_struct *tty, | ||
2290 | struct serial_icounter_struct *icount) | ||
2291 | { | ||
2292 | struct usb_serial_port *port = tty->driver_data; | ||
2293 | struct ftdi_private *priv = usb_get_serial_port_data(port); | ||
2294 | struct async_icount *ic = &priv->icount; | ||
2295 | |||
2296 | icount->cts = ic->cts; | ||
2297 | icount->dsr = ic->dsr; | ||
2298 | icount->rng = ic->rng; | ||
2299 | icount->dcd = ic->dcd; | ||
2300 | icount->tx = ic->tx; | ||
2301 | icount->rx = ic->rx; | ||
2302 | icount->frame = ic->frame; | ||
2303 | icount->parity = ic->parity; | ||
2304 | icount->overrun = ic->overrun; | ||
2305 | icount->brk = ic->brk; | ||
2306 | icount->buf_overrun = ic->buf_overrun; | ||
2307 | return 0; | ||
2308 | } | ||
2309 | |||
2284 | static int ftdi_ioctl(struct tty_struct *tty, | 2310 | static int ftdi_ioctl(struct tty_struct *tty, |
2285 | unsigned int cmd, unsigned long arg) | 2311 | unsigned int cmd, unsigned long arg) |
2286 | { | 2312 | { |