From: bart.hartgers@gmail.com
To: Greg Kroah-Hartman <gregkh@suse.de>, Mike McCormack <mikem@ring3k.org>
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
Bart Hartgers <bart.hartgers@gmail.com>
Subject: [PATCH 4/6] ark3116: (v2) Add cmset and break
Date: Wed, 28 Oct 2009 10:43:28 +0100 [thread overview]
Message-ID: <20091028095108.305735076@gmail.com> (raw)
In-Reply-To: 20091028094324.010816897@gmail.com
[-- Attachment #1: 0025_ark3116_break_cmset.patch --]
[-- Type: text/plain, Size: 2306 bytes --]
Signed-off-by: Bart Hartgers <bart.hartgers@gmail.com>
---
Index: linux-2.6.32-rc4/drivers/usb/serial/ark3116.c
===================================================================
--- linux-2.6.32-rc4.orig/drivers/usb/serial/ark3116.c 2009-10-28 10:19:44.000000000 +0100
+++ linux-2.6.32-rc4/drivers/usb/serial/ark3116.c 2009-10-28 10:19:45.000000000 +0100
@@ -551,6 +551,60 @@ static int ark3116_tiocmget(struct tty_s
(ctrl & UART_MCR_OUT2 ? TIOCM_OUT2 : 0);
}
+static int ark3116_tiocmset(struct tty_struct *tty, struct file *file,
+ unsigned set, unsigned clr)
+{
+ struct usb_serial_port *port = tty->driver_data;
+ struct ark3116_private *priv = usb_get_serial_port_data(port);
+
+ /* we need to take the mutex here, to make sure that the value
+ * in priv->mcr is actually the one that is in the hardware
+ */
+
+ mutex_lock(&priv->hw_lock);
+
+ if (set & TIOCM_RTS)
+ priv->mcr |= UART_MCR_RTS;
+ if (set & TIOCM_DTR)
+ priv->mcr |= UART_MCR_DTR;
+ if (set & TIOCM_OUT1)
+ priv->mcr |= UART_MCR_OUT1;
+ if (set & TIOCM_OUT2)
+ priv->mcr |= UART_MCR_OUT2;
+ if (clr & TIOCM_RTS)
+ priv->mcr &= ~UART_MCR_RTS;
+ if (clr & TIOCM_DTR)
+ priv->mcr &= ~UART_MCR_DTR;
+ if (clr & TIOCM_OUT1)
+ priv->mcr &= ~UART_MCR_OUT1;
+ if (clr & TIOCM_OUT2)
+ priv->mcr &= ~UART_MCR_OUT2;
+
+ ark3116_write_reg(port->serial, UART_MCR, priv->mcr);
+
+ mutex_unlock(&priv->hw_lock);
+
+ return 0;
+}
+
+static void ark3116_break_ctl(struct tty_struct *tty, int break_state)
+{
+ struct usb_serial_port *port = tty->driver_data;
+ struct ark3116_private *priv = usb_get_serial_port_data(port);
+
+ /* LCR is also used for other things: protect access */
+ mutex_lock(&priv->hw_lock);
+
+ if (break_state)
+ priv->lcr |= UART_LCR_SBC;
+ else
+ priv->lcr &= ~UART_LCR_SBC;
+
+ ark3116_write_reg(port->serial, UART_LCR, priv->lcr);
+
+ mutex_unlock(&priv->hw_lock);
+}
+
static struct usb_driver ark3116_driver = {
.name = "ark3116",
.probe = usb_serial_probe,
@@ -573,8 +627,10 @@ static struct usb_serial_driver ark3116_
.init_termios = ark3116_init_termios,
.ioctl = ark3116_ioctl,
.tiocmget = ark3116_tiocmget,
+ .tiocmset = ark3116_tiocmset,
.open = ark3116_open,
.close = ark3116_close,
+ .break_ctl = ark3116_break_ctl,
};
static int __init ark3116_init(void)
--
next prev parent reply other threads:[~2009-10-28 9:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-28 9:43 [PATCH 0/6] ark3116: (v2) driver rework after review bart.hartgers
2009-10-28 9:43 ` [PATCH 1/6] ark3116: (v2) Setup some basic infrastructure for new ark3116 driver bart.hartgers
2009-10-28 9:43 ` [PATCH 2/6] ark3116: (v2) Make existing functions 16450-aware and add close and release functions bart.hartgers
2009-10-28 9:43 ` [PATCH 3/6] ark3116: (v2) Replace cmget bart.hartgers
2009-10-28 9:43 ` bart.hartgers [this message]
2009-10-28 9:43 ` [PATCH 5/6] ark3116: (v2) Callbacks for interrupt and bulk read bart.hartgers
2009-10-28 9:43 ` [PATCH 6/6] ark3116: (v2) Cleanup of now unneeded functions bart.hartgers
2009-10-28 11:41 ` [PATCH 0/6] ark3116: (v2) driver rework after review Mike McCormack
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091028095108.305735076@gmail.com \
--to=bart.hartgers@gmail.com \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=mikem@ring3k.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.