lkml.org 
[lkml]   [2023]   [Aug]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3] Currently if the SoC needs pinctrl to switch the SCL and SDA from the I2C function to GPIO function, the recovery won't work.
On Tue, Aug 22, 2023 at 11:15:55AM +0200, Yann Sionneau wrote:
> scl-gpio = <>;
> sda-gpio = <>;
>
> Are not enough for some SoCs to have a working recovery.
> Some need:
>
> scl-gpio = <>;
> sda-gpio = <>;
> pinctrl-names = "default", "recovery";
> pinctrl-0 = <&i2c_pins_hw>;
> pinctrl-1 = <&i2c_pins_gpio>;
>
> The driver was not filling rinfo->pinctrl with the device node
> pinctrl data which is needed by generic recovery code.

...

> + rinfo->pinctrl = devm_pinctrl_get(dev->dev);
> + if (IS_ERR(rinfo->pinctrl)) {
> + if (PTR_ERR(rinfo->pinctrl) == -EPROBE_DEFER)
> + return PTR_ERR(rinfo->pinctrl);
> +
> + rinfo->pinctrl = NULL;
> + dev_err(dev->dev, "getting pinctrl info failed: bus recovery might not work\n");
> + } else if (!rinfo->pinctrl) {
> + dev_dbg(dev->dev, "pinctrl is disabled, bus recovery might not work\n");
> + }

A bit of bikeshedding, would the below be slightly better?

rinfo->pinctrl = devm_pinctrl_get(dev->dev);
if (IS_ERR(rinfo->pinctrl)) {
if (PTR_ERR(rinfo->pinctrl) == -EPROBE_DEFER)
return PTR_ERR(rinfo->pinctrl);

rinfo->pinctrl = NULL;
dev_err(dev->dev, "getting pinctrl info failed, disabling...\n");
}
if (!rinfo->pinctrl)
dev_dbg(dev->dev, "pinctrl is disabled, bus recovery might not work\n");

--
With Best Regards,
Andy Shevchenko


\
 
 \ /
  Last update: 2023-08-22 14:03    [W:0.070 / U:0.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site