From: Andi Shyti <andi.shyti@kernel.org>
To: Jie Li <lj29312931@gmail.com>
Cc: Bartosz Golaszewski <brgl@kernel.org>,
Linus Walleij <linusw@kernel.org>, Wolfram Sang <wsa@kernel.org>,
Wolfram Sang <wsa+renesas@sang-engineering.com>,
linux-gpio@vger.kernel.org, linux-i2c@vger.kernel.org,
linux-kernel@vger.kernel.org, Jie Li <jie.i.li@nokia.com>
Subject: Re: [PATCH v5 2/2] i2c: core: support recovery for single-ended GPIOs
Date: Wed, 29 Jul 2026 23:46:50 +0200 [thread overview]
Message-ID: <amp0b2jpiV9VO9Pe@zenone.zhora.eu> (raw)
In-Reply-To: <20260511113726.49041-3-jie.i.li@nokia.com>
Hi Jie,
On Mon, May 11, 2026 at 01:37:26PM +0200, Jie Li wrote:
> Currently, i2c_init_recovery() only assigns the set_sda/set_scl
> hooks if gpiod_get_direction() returns GPIO_LINE_DIRECTION_OUT.
>
> 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@nokia.com>
> Reviewed-by: Linus Walleij <linusw@kernel.org>
> Acked-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Please do not send subsequent versions as --in-reply-to, it's
difficult to track them.
> ---
> drivers/i2c/i2c-core-base.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
> index 9c46147e3506..a3c33e804d47 100644
> --- a/drivers/i2c/i2c-core-base.c
> +++ b/drivers/i2c/i2c-core-base.c
> @@ -445,8 +445,8 @@ static int i2c_init_recovery(struct i2c_adapter *adap)
> bri->set_scl = set_scl_gpio_value;
> if (bri->sda_gpiod) {
> bri->get_sda = get_sda_gpio_value;
> - /* FIXME: add proper flag instead of '0' once available */
> - if (gpiod_get_direction(bri->sda_gpiod) == 0)
> + if (gpiod_get_direction(bri->sda_gpiod) == GPIO_LINE_DIRECTION_OUT ||
> + gpiod_is_single_ended(bri->sda_gpiod))
there was a little conflict here which I fixes and merged to
i2c/i2c.
Thanks,
Andi
next prev parent reply other threads:[~2026-07-29 21:46 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260114141352.103425-1-jie.i.li@nokia.com>
2026-01-15 9:27 ` [PATCH v1 0/2] i2c: add support for forced SDA recovery Linus Walleij
2026-01-15 13:12 ` 李杰
2026-01-16 13:59 ` Linus Walleij
2026-01-25 19:51 ` [PATCH v2 0/2] i2c: improve bus recovery for single-ended GPIOs Jie Li
2026-01-25 19:51 ` [PATCH v2 1/2] gpiolib: add gpiod_is_single_ended() helper Jie Li
2026-01-27 9:46 ` Linus Walleij
2026-01-25 19:51 ` [PATCH v2 2/2] i2c: core: support recovery for single-ended GPIOs Jie Li
2026-01-27 9:47 ` Linus Walleij
2026-02-01 11:18 ` [PATCH v3 0/2] i2c: improve bus " Jie Li
2026-02-01 11:18 ` [PATCH v3 1/2] gpiolib: add gpiod_is_single_ended() helper Jie Li
2026-02-01 11:18 ` [PATCH v3 2/2] i2c: core: support recovery for single-ended GPIOs Jie Li
2026-05-04 12:14 ` Wolfram Sang
2026-05-09 9:12 ` [PATCH v4 0/2] i2c: improve bus " Jie Li
2026-05-09 9:12 ` [PATCH v4 1/2] gpiolib: add gpiod_is_single_ended() helper Jie Li
2026-05-09 9:12 ` [PATCH v4 2/2] i2c: core: support recovery for single-ended GPIOs Jie Li
2026-05-09 10:10 ` Wolfram Sang
2026-05-11 7:25 ` 李杰
2026-05-11 8:19 ` Linus Walleij
2026-05-11 10:28 ` Bartosz Golaszewski
2026-05-11 10:33 ` Wolfram Sang
2026-05-11 10:48 ` Bartosz Golaszewski
2026-05-11 11:37 ` [PATCH v5 0/2] i2c: improve bus " Jie Li
2026-05-11 11:37 ` [PATCH v5 1/2] gpiolib: add gpiod_is_single_ended() helper Jie Li
2026-05-11 11:37 ` [PATCH v5 2/2] i2c: core: support recovery for single-ended GPIOs Jie Li
2026-07-29 21:46 ` Andi Shyti [this message]
2026-07-30 7:11 ` Jie I. Li (Nokia)
2026-07-30 9:32 ` Andi Shyti
2026-05-11 12:27 ` (subset) [PATCH v5 0/2] i2c: improve bus " Bartosz Golaszewski
2026-04-22 18:47 ` [PATCH v3 " 李杰
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=amp0b2jpiV9VO9Pe@zenone.zhora.eu \
--to=andi.shyti@kernel.org \
--cc=brgl@kernel.org \
--cc=jie.i.li@nokia.com \
--cc=linusw@kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lj29312931@gmail.com \
--cc=wsa+renesas@sang-engineering.com \
--cc=wsa@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox