Messages in this thread | | | Date | Mon, 30 Mar 2020 17:51:02 +0300 | From | Andy Shevchenko <> | Subject | Re: [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
| |