Thread (35 messages) 35 messages, 5 authors, 2017-03-18

Re: [PATCH 09/10] serdev: add serdev_device_set_rts

From: Sebastian Reichel <hidden>
Date: 2017-03-07 21:18:50
Also in: linux-bluetooth, linux-devicetree, lkml

Hi Rob,

On Tue, Mar 07, 2017 at 10:07:56AM -0600, Rob Herring wrote:
On Sat, Mar 4, 2017 at 5:58 AM, Sebastian Reichel [off-list ref] wrote:
quoted
Add function to enable/disable RTS line.

Signed-off-by: Sebastian Reichel <redacted>
---
quoted
+static void ttyport_set_rts(struct serdev_controller *ctrl, bool enable)
+{
+       struct serport *serport = serdev_controller_get_drvdata(ctrl);
+       struct tty_struct *tty = serport->tty;
+       int status = tty->driver->ops->tiocmget(tty);
+       unsigned int set = 0;
+       unsigned int clear = 0;
+
+       if (enable) {
+               set |= (TIOCM_OUT2 | TIOCM_RTS);
+               clear = ~set;
+               set &= TIOCM_DTR | TIOCM_RTS | TIOCM_OUT1 |
+                      TIOCM_OUT2 | TIOCM_LOOP;
+               clear &= TIOCM_DTR | TIOCM_RTS | TIOCM_OUT1 |
+                        TIOCM_OUT2 | TIOCM_LOOP;
+               status = tty->driver->ops->tiocmset(tty, set, clear);
+       } else {
+               set &= ~(TIOCM_OUT2 | TIOCM_RTS);
+               clear = ~set;
+               set &= TIOCM_DTR | TIOCM_RTS | TIOCM_OUT1 |
+                      TIOCM_OUT2 | TIOCM_LOOP;
+               clear &= TIOCM_DTR | TIOCM_RTS | TIOCM_OUT1 |
+                        TIOCM_OUT2 | TIOCM_LOOP;
+               status = tty->driver->ops->tiocmset(tty, set, clear);
The logic here can be greatly simplified. Here's a patch to the
original version that I came up with, but haven't tested:
ah I totally forgot to clean that mess. I took that over from the
bluetooth code, since that got the nokia bluetooth chips working.
I will do this in the next revision.

-- Sebastian

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help