lkml.org 
[lkml]   [2020]   [Mar]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH DON'T APPLY v2 3/7] serial: 8250: Support rs485 bus termination GPIO
On Thu, Mar 26, 2020 at 12:14:18AM +0100, Heiko Stuebner wrote:
> From: Lukas Wunner <lukas@wunner.de>
>
> Amend the serial core to retrieve the rs485 bus termination GPIO from
> the device tree (or ACPI table) and amend the default ->rs485_config()
> callback for 8250 drivers to change the GPIO on request from user space.

> + port->rs485_term_gpio = devm_gpiod_get(dev, "rs485-term",
> + GPIOD_FLAGS_BIT_DIR_OUT);
> + if (IS_ERR(port->rs485_term_gpio)) {
> + ret = PTR_ERR(port->rs485_term_gpio);
> + port->rs485_term_gpio = NULL;
> + if (ret != -ENOENT) {
> + if (ret != -EPROBE_DEFER)
> + dev_err(dev, "Cannot get rs485-term-gpios\n");
> + return ret;
> + }

NIH of gpiod_get_optional().

> + } else {
> + ret = gpiod_get_value(port->rs485_term_gpio);
> + if (ret < 0) {
> + dev_err(dev, "Cannot get rs485-term-gpios value\n");
> + return ret;
> + }
> + if (ret)
> + rs485conf->flags |= SER_RS485_TERMINATE_BUS;
> + }

--
With Best Regards,
Andy Shevchenko


\
 
 \ /
  Last update: 2020-03-30 16:51    [W:0.093 / U:0.824 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site