Linux GPIO subsystem development
 help / color / mirror / Atom feed
From: Jie Li <lj29312931@gmail.com>
To: Bartosz Golaszewski <brgl@kernel.org>, Linus Walleij <linusw@kernel.org>
Cc: 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: [PATCH v5 0/2] i2c: improve bus recovery for single-ended GPIOs
Date: Mon, 11 May 2026 13:37:24 +0200	[thread overview]
Message-ID: <20260511113726.49041-1-jie.i.li@nokia.com> (raw)
In-Reply-To: <CAMRc=MfMcEbQ3kkW3fMn-jzDoT2xdJWjp2xVBVsu7n683_5g9A@mail.gmail.com>

Hi Bartosz, Wolfram,

This is a respin of the series rebased on v7.1-rc1, as requested by
Linus Walleij. No code changes versus v4; only the base has moved.

The series addresses a limitation in the I2C bus recovery mechanism
where certain open-drain GPIOs are incorrectly identified as
input-only, preventing the recovery logic from functioning.

Following the earlier suggestion from Linus Walleij, the previously
proposed "force-set-sda" DT property has been dropped in favor of a
generic helper in the GPIO subsystem to identify single-ended
configurations. This allows the I2C core to reliably enable recovery
for open-drain lines regardless of the instantaneous hardware
direction reporting.

Merging strategy (suggested by Linus Walleij)
=============================================

Patch 2/2 depends on the new gpiolib helper gpiod_is_single_ended()
introduced in patch 1/2. To keep this bisectable and avoid build
breakage, the recommended flow is:

  1. Bartosz applies patch 1/2 to the GPIO tree and exposes it as an
     immutable branch.
  2. Wolfram pulls that immutable branch into the I2C tree and queues
     patch 2/2 on top.

Bartosz: per Linus's note, please could you pick up patch 1/2 and
offer an immutable branch to Wolfram? Patch 2/2 does not touch any
GPIO file, but it is the sole user of the new helper, so it cannot
land via the I2C tree until 1/2 is available there.

Changes in v5:
- Rebased onto v7.1-rc1 (no code changes vs v4).

Changes in v4:
- Patch 2:
  - Use GPIO_LINE_DIRECTION_OUT instead of the literal '0' when
    checking the return value of gpiod_get_direction(), and drop
    the now-obsolete FIXME comment (suggested by Wolfram Sang).
  - Added Acked-by: Wolfram Sang.

Changes in v3:
- Patch 1:
  - Changed return type of gpiod_is_single_ended() from int to bool.
  - Updated return values from 0/1 to false/true.
  - Added Reviewed-by: Linus Walleij.
- Patch 2:
  - Added Reviewed-by: Linus Walleij.

Changes in v2:
- Replaced DT-based "force-set-sda" with a gpiolib helper.
- Added gpiod_is_single_ended() to drivers/gpio/gpiolib.c.
- Updated i2c-core-base.c to use the new helper.

Jie Li (2):
  gpiolib: add gpiod_is_single_ended() helper
  i2c: core: support recovery for single-ended GPIOs

 drivers/gpio/gpiolib.c        | 22 ++++++++++++++++++++++
 drivers/i2c/i2c-core-base.c   |  4 ++--
 include/linux/gpio/consumer.h |  5 +++++
 3 files changed, 29 insertions(+), 2 deletions(-)


base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
-- 
2.43.0


  reply	other threads:[~2026-05-11 11:37 UTC|newest]

Thread overview: 26+ 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                                   ` Jie Li [this message]
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-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=20260511113726.49041-1-jie.i.li@nokia.com \
    --to=lj29312931@gmail.com \
    --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=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