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>
This commit is contained in:
parent
8f5d621543
commit
c75ccd4812
1 changed files with 26 additions and 0 deletions
|
@ -73,6 +73,7 @@ struct ftdi_private {
|
||||||
*/
|
*/
|
||||||
int flags; /* some ASYNC_xxxx flags are supported */
|
int flags; /* some ASYNC_xxxx flags are supported */
|
||||||
unsigned long last_dtr_rts; /* saved modem control outputs */
|
unsigned long last_dtr_rts; /* saved modem control outputs */
|
||||||
|
struct async_icount icount;
|
||||||
wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */
|
wait_queue_head_t delta_msr_wait; /* Used for TIOCMIWAIT */
|
||||||
char prev_status, diff_status; /* Used for TIOCMIWAIT */
|
char prev_status, diff_status; /* Used for TIOCMIWAIT */
|
||||||
char transmit_empty; /* If transmitter is empty or not */
|
char transmit_empty; /* If transmitter is empty or not */
|
||||||
|
@ -889,6 +890,8 @@ static void ftdi_set_termios(struct tty_struct *tty,
|
||||||
static int ftdi_tiocmget(struct tty_struct *tty);
|
static int ftdi_tiocmget(struct tty_struct *tty);
|
||||||
static int ftdi_tiocmset(struct tty_struct *tty,
|
static int ftdi_tiocmset(struct tty_struct *tty,
|
||||||
unsigned int set, unsigned int clear);
|
unsigned int set, unsigned int clear);
|
||||||
|
static int ftdi_get_icount(struct tty_struct *tty,
|
||||||
|
struct serial_icounter_struct *icount);
|
||||||
static int ftdi_ioctl(struct tty_struct *tty,
|
static int ftdi_ioctl(struct tty_struct *tty,
|
||||||
unsigned int cmd, unsigned long arg);
|
unsigned int cmd, unsigned long arg);
|
||||||
static void ftdi_break_ctl(struct tty_struct *tty, int break_state);
|
static void ftdi_break_ctl(struct tty_struct *tty, int break_state);
|
||||||
|
@ -923,6 +926,7 @@ static struct usb_serial_driver ftdi_sio_device = {
|
||||||
.prepare_write_buffer = ftdi_prepare_write_buffer,
|
.prepare_write_buffer = ftdi_prepare_write_buffer,
|
||||||
.tiocmget = ftdi_tiocmget,
|
.tiocmget = ftdi_tiocmget,
|
||||||
.tiocmset = ftdi_tiocmset,
|
.tiocmset = ftdi_tiocmset,
|
||||||
|
.get_icount = ftdi_get_icount,
|
||||||
.ioctl = ftdi_ioctl,
|
.ioctl = ftdi_ioctl,
|
||||||
.set_termios = ftdi_set_termios,
|
.set_termios = ftdi_set_termios,
|
||||||
.break_ctl = ftdi_break_ctl,
|
.break_ctl = ftdi_break_ctl,
|
||||||
|
@ -1650,6 +1654,7 @@ static int ftdi_sio_port_probe(struct usb_serial_port *port)
|
||||||
|
|
||||||
kref_init(&priv->kref);
|
kref_init(&priv->kref);
|
||||||
mutex_init(&priv->cfg_lock);
|
mutex_init(&priv->cfg_lock);
|
||||||
|
memset(&priv->icount, 0x00, sizeof(priv->icount));
|
||||||
init_waitqueue_head(&priv->delta_msr_wait);
|
init_waitqueue_head(&priv->delta_msr_wait);
|
||||||
|
|
||||||
priv->flags = ASYNC_LOW_LATENCY;
|
priv->flags = ASYNC_LOW_LATENCY;
|
||||||
|
@ -2281,6 +2286,27 @@ static int ftdi_tiocmset(struct tty_struct *tty,
|
||||||
return update_mctrl(port, set, clear);
|
return update_mctrl(port, set, clear);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int ftdi_get_icount(struct tty_struct *tty,
|
||||||
|
struct serial_icounter_struct *icount)
|
||||||
|
{
|
||||||
|
struct usb_serial_port *port = tty->driver_data;
|
||||||
|
struct ftdi_private *priv = usb_get_serial_port_data(port);
|
||||||
|
struct async_icount *ic = &priv->icount;
|
||||||
|
|
||||||
|
icount->cts = ic->cts;
|
||||||
|
icount->dsr = ic->dsr;
|
||||||
|
icount->rng = ic->rng;
|
||||||
|
icount->dcd = ic->dcd;
|
||||||
|
icount->tx = ic->tx;
|
||||||
|
icount->rx = ic->rx;
|
||||||
|
icount->frame = ic->frame;
|
||||||
|
icount->parity = ic->parity;
|
||||||
|
icount->overrun = ic->overrun;
|
||||||
|
icount->brk = ic->brk;
|
||||||
|
icount->buf_overrun = ic->buf_overrun;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int ftdi_ioctl(struct tty_struct *tty,
|
static int ftdi_ioctl(struct tty_struct *tty,
|
||||||
unsigned int cmd, unsigned long arg)
|
unsigned int cmd, unsigned long arg)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue