Linux GPIO subsystem development
 help / color / mirror / Atom feed
* [PATCH v2 0/5] gpiolib / reset: resolve GPIO specifiers via gpiolib
@ 2026-12-05  6:43 Pufan Jin
  2026-12-05  6:43 ` [PATCH v2 1/5] gpiolib: add gpio_device_find_by_fwnode_args() Pufan Jin
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Pufan Jin @ 2026-12-05  6:43 UTC (permalink / raw)
  To: Bartosz Golaszewski, Bartosz Golaszewski, Linus Walleij,
	Philipp Zabel
  Cc: Krzysztof Kozlowski, linux-gpio, linux-kernel

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


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-12-05  7:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-05  6:43 [PATCH v2 0/5] gpiolib / reset: resolve GPIO specifiers via gpiolib Pufan Jin
2026-12-05  6:43 ` [PATCH v2 1/5] gpiolib: add gpio_device_find_by_fwnode_args() Pufan Jin
2026-12-05  7:07   ` sashiko-bot
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  7:18   ` sashiko-bot
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
2026-12-05  7:33   ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox