Commit 219ffcf3 authored by Axel Haslam's avatar Axel Haslam Committed by Greg Kroah-Hartman

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: default avatarJohan Hovold <johan@hovoldconsulting.com>
Signed-off-by: default avatarAxel Haslam <ahaslam@baylibre.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent e55c2520
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment