Linux GPIO subsystem development
 help / color / mirror / Atom feed
From: Pufan Jin <cyan2254650260@gmail.com>
To: Bartosz Golaszewski <brgl@kernel.org>,
	Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>,
	Linus Walleij <linusw@kernel.org>,
	Philipp Zabel <p.zabel@pengutronix.de>
Cc: Krzysztof Kozlowski <krzk@kernel.org>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 0/5] gpiolib / reset: resolve GPIO specifiers via gpiolib
Date: Sat,  5 Dec 2026 14:43:50 +0800	[thread overview]
Message-ID: <20261205064355.137581-1-cyan2254650260@gmail.com> (raw)

As discussed on v1, drivers/reset/core.c should not call
gpio_device_get_chip() or chip->of_xlate() to parse reset-gpios
phandles.

This series moves fwnode GPIO specifier lookup and translation into
gpiolib:

- Patch 1 adds gpio_device_find_by_fwnode_args() for OF and software
  nodes, translating specifiers and flags in gpiolib.
- Patch 2 makes swnode_find_gpio() match a consumer's parent
  gpio_device when its fwnode matches, so multi-bank controllers sharing
  one fwnode resolve the bank selected by of_xlate().
- Patch 3 updates gpio_shared_dev_is_reset_gpio() to match the
  reset-gpio software node offset against entry->offset.
- Patch 4 makes reset-gpio read fwnode_reset_n_cells from platform_data.
- Patch 5 converts __reset_add_reset_gpio_device() to use
  gpio_device_find_by_fwnode_args(), removing the #gpio-cells == 2
  restriction for devicetree providers and the flag check in
  drivers/reset/core.c.

Changes since v1:
- Moved specifier translation from drivers/reset/core.c into gpiolib.
- Added support for non-2-cell devicetree GPIO bindings, multi-bank
  single-fwnode controllers, and OF flag conversion.
- Updated gpiolib-shared reset-gpio matching to use entry->offset.
- Derived fwnode_reset_n_cells from platform_data in reset-gpio.c.

Tested on NVIDIA Jetson TX2 with tegra186-gpio and BCM4354 Wi-Fi
reset-gpios, resolving to PN.00 / offset 85 with ACTIVE_LOW, and with
KUnit covering 2-cell of_xlate, multi-bank 3-cell reset-gpio,
invalid specifiers, and software node lookups.

Pufan Jin (5):
  gpiolib: add gpio_device_find_by_fwnode_args()
  gpiolib: swnode: prefer matching parent gpio_device
  gpiolib: shared: match reset-gpio against translated entry offset
  reset: gpio: derive fwnode_reset_n_cells from platform data
  reset: core: translate GPIO specifier via
    gpio_device_find_by_fwnode_args()

 drivers/gpio/gpiolib-of.c     | 93 +++++++++++++++++++++++++++++++++--
 drivers/gpio/gpiolib-of.h     | 10 ++++
 drivers/gpio/gpiolib-shared.c | 70 ++++++--------------------
 drivers/gpio/gpiolib-swnode.c | 39 +++++++++++++--
 drivers/gpio/gpiolib-swnode.h | 10 +++-
 drivers/gpio/gpiolib.c        | 80 +++++++++++++++++++++++++++---
 drivers/gpio/gpiolib.h        |  5 ++
 drivers/reset/core.c          | 37 ++------------
 drivers/reset/reset-gpio.c    |  6 ++-
 include/linux/gpio/driver.h   | 12 +++++
 10 files changed, 258 insertions(+), 104 deletions(-)

-- 
2.56.1


             reply	other threads:[~2026-12-05  6:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-05  6:43 Pufan Jin [this message]
2026-12-05  6:43 ` [PATCH v2 1/5] gpiolib: add gpio_device_find_by_fwnode_args() Pufan Jin
2026-12-05  6:43 ` [PATCH v2 2/5] gpiolib: swnode: prefer matching parent gpio_device Pufan Jin
2026-12-05  6:43 ` [PATCH v2 3/5] gpiolib: shared: match reset-gpio against translated entry offset Pufan Jin
2026-12-05  6:43 ` [PATCH v2 4/5] reset: gpio: derive fwnode_reset_n_cells from platform data Pufan Jin
2026-12-05  6:43 ` [PATCH v2 5/5] reset: core: translate GPIO specifier via gpio_device_find_by_fwnode_args() Pufan Jin

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=20261205064355.137581-1-cyan2254650260@gmail.com \
    --to=cyan2254650260@gmail.com \
    --cc=bartosz.golaszewski@oss.qualcomm.com \
    --cc=brgl@kernel.org \
    --cc=krzk@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=p.zabel@pengutronix.de \
    /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