Re: [PATCH v3 2/2] i2c: core: support recovery for single-ended GPIOs

From: Wolfram Sang

Date: Mon May 04 2026 - 08:14:54 EST


Hi all,

On Sun, Feb 01, 2026 at 12:18:12PM +0100, Jie Li wrote:
> Currently, i2c_init_recovery() only assigns the set_sda/set_scl
> hooks if gpiod_get_direction() returns 0 (output).
>
> This logic fails on certain SoC controllers where open-drain lines
> in a high-impedance state are physically reported as inputs. This
> leads to a "deadlock" where the I2C core refuses to assign the
> recovery hooks because it incorrectly assumes the pins are
> input-only, even though they are fully capable of driving the bus
> low for recovery.
>
> Update the recovery initialization to use the new
> gpiod_is_single_ended() helper. If a GPIO is configured as
> open-drain or open-source in the firmware, it is safe to assume
> it can be used for bus recovery, even if the current hardware
> direction is reported as input.
>
> Signed-off-by: Jie Li <jie.i.li@xxxxxxxxx>
> Reviewed-by: Linus Walleij <linusw@xxxxxxxxxx>

I think this should go via the GPIO tree? If so:

Acked-by: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>

This probably needs a respin, though, because I will push out a patch
today which will use the new GPIO_LINE_DIRECTION_OUT macro instead of 0.

Thanks and happy hacking,

Wolfram

Attachment: signature.asc
Description: PGP signature