aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/ark3116.c
diff options
context:
space:
mode:
authorbart.hartgers@gmail.com <bart.hartgers@gmail.com>2009-10-28 05:43:28 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-12-11 14:55:21 -0500
commit546b742968e7789c60efe0eec71896c45eeb6893 (patch)
treef3c230960935aed818dfb65aed9d8ffbff214ca4 /drivers/usb/serial/ark3116.c
parent1f719105131010cdb9a4b5a3bace21f6b2e095ea (diff)
USB: ark3116: Add cmset and break
Signed-off-by: Bart Hartgers <bart.hartgers@gmail.com> Cc: Mike McCormack <mikem@ring3k.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial/ark3116.c')
-rw-r--r--drivers/usb/serial/ark3116.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c
index d8f0267a2d56..a7c26990ec67 100644
--- a/drivers/usb/serial/ark3116.c
+++ b/drivers/usb/serial/ark3116.c
@@ -551,6 +551,60 @@ static int ark3116_tiocmget(struct tty_struct *tty, struct file *file)
551 (ctrl & UART_MCR_OUT2 ? TIOCM_OUT2 : 0); 551 (ctrl & UART_MCR_OUT2 ? TIOCM_OUT2 : 0);
552} 552}
553 553
554static int ark3116_tiocmset(struct tty_struct *tty, struct file *file,
555 unsigned set, unsigned clr)
556{
557 struct usb_serial_port *port = tty->driver_data;
558 struct ark3116_private *priv = usb_get_serial_port_data(port);
559
560 /* we need to take the mutex here, to make sure that the value
561 * in priv->mcr is actually the one that is in the hardware
562 */
563
564 mutex_lock(&priv->hw_lock);
565
566 if (set & TIOCM_RTS)
567 priv->mcr |= UART_MCR_RTS;
568 if (set & TIOCM_DTR)
569 priv->mcr |= UART_MCR_DTR;
570 if (set & TIOCM_OUT1)
571 priv->mcr |= UART_MCR_OUT1;
572 if (set & TIOCM_OUT2)
573 priv->mcr |= UART_MCR_OUT2;
574 if (clr & TIOCM_RTS)
575 priv->mcr &= ~UART_MCR_RTS;
576 if (clr & TIOCM_DTR)
577 priv->mcr &= ~UART_MCR_DTR;
578 if (clr & TIOCM_OUT1)
579 priv->mcr &= ~UART_MCR_OUT1;
580 if (clr & TIOCM_OUT2)
581 priv->mcr &= ~UART_MCR_OUT2;
582
583 ark3116_write_reg(port->serial, UART_MCR, priv->mcr);
584
585 mutex_unlock(&priv->hw_lock);
586
587 return 0;
588}
589
590static void ark3116_break_ctl(struct tty_struct *tty, int break_state)
591{
592 struct usb_serial_port *port = tty->driver_data;
593 struct ark3116_private *priv = usb_get_serial_port_data(port);
594
595 /* LCR is also used for other things: protect access */
596 mutex_lock(&priv->hw_lock);
597
598 if (break_state)
599 priv->lcr |= UART_LCR_SBC;
600 else
601 priv->lcr &= ~UART_LCR_SBC;
602
603 ark3116_write_reg(port->serial, UART_LCR, priv->lcr);
604
605 mutex_unlock(&priv->hw_lock);
606}
607
554static struct usb_driver ark3116_driver = { 608static struct usb_driver ark3116_driver = {
555 .name = "ark3116", 609 .name = "ark3116",
556 .probe = usb_serial_probe, 610 .probe = usb_serial_probe,
@@ -573,8 +627,10 @@ static struct usb_serial_driver ark3116_device = {
573 .init_termios = ark3116_init_termios, 627 .init_termios = ark3116_init_termios,
574 .ioctl = ark3116_ioctl, 628 .ioctl = ark3116_ioctl,
575 .tiocmget = ark3116_tiocmget, 629 .tiocmget = ark3116_tiocmget,
630 .tiocmset = ark3116_tiocmset,
576 .open = ark3116_open, 631 .open = ark3116_open,
577 .close = ark3116_close, 632 .close = ark3116_close,
633 .break_ctl = ark3116_break_ctl,
578}; 634};
579 635
580static int __init ark3116_init(void) 636static int __init ark3116_init(void)