diff options
author | Axel Haslam <ahaslam@baylibre.com> | 2016-05-31 15:36:09 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2016-06-01 03:18:18 +0300 |
commit | 219ffcf3a51d0e0d8464d42db01e1e745a0d690f (patch) | |
tree | 02aaae512390c77dc3e193b17361493798fb91d6 /drivers/staging/greybus/uart.c | |
parent | e55c25206d5c99b12443eec37b4832d6817170ba (diff) | |
download | linux-219ffcf3a51d0e0d8464d42db01e1e745a0d690f.tar.xz |
greybus: uart: Implement dtr_rts callback.
Dtr_dts allows the tty layer to set the flow control lines
to the correct state during open and close.
Note that locking for newctrl is missing throughout the
driver and will be addressed on a separate patch.
Suggested-and-reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/uart.c')
-rw-r--r-- | drivers/staging/greybus/uart.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/drivers/staging/greybus/uart.c b/drivers/staging/greybus/uart.c index 44d8b9ad183a..c257fbf40b79 100644 --- a/drivers/staging/greybus/uart.c +++ b/drivers/staging/greybus/uart.c @@ -604,6 +604,22 @@ static int gb_tty_ioctl(struct tty_struct *tty, unsigned int cmd, return -ENOIOCTLCMD; } +static void gb_tty_dtr_rts(struct tty_port *port, int on) +{ + struct gb_tty *gb_tty; + u8 newctrl; + + gb_tty = container_of(port, struct gb_tty, port); + newctrl = gb_tty->ctrlout; + + if (on) + newctrl |= (GB_UART_CTRL_DTR | GB_UART_CTRL_RTS); + else + newctrl &= ~(GB_UART_CTRL_DTR | GB_UART_CTRL_RTS); + + gb_tty->ctrlout = newctrl; + send_control(gb_tty, newctrl); +} static const struct tty_operations gb_ops = { .install = gb_tty_install, @@ -623,7 +639,9 @@ static const struct tty_operations gb_ops = { .tiocmset = gb_tty_tiocmset, }; -static struct tty_port_operations null_ops = { }; +static struct tty_port_operations gb_port_ops = { + .dtr_rts = gb_tty_dtr_rts, +}; static int gb_uart_probe(struct gbphy_device *gbphy_dev, const struct gbphy_device_id *id) @@ -681,7 +699,7 @@ static int gb_uart_probe(struct gbphy_device *gbphy_dev, mutex_init(&gb_tty->mutex); tty_port_init(&gb_tty->port); - gb_tty->port.ops = &null_ops; + gb_tty->port.ops = &gb_port_ops; gb_tty->connection = connection; gb_tty->gbphy_dev = gbphy_dev; |