Re: [PATCH] gpio: shared: call gpio_chip::of_xlate() if set

From: Jon Hunter

Date: Tue Mar 17 2026 - 08:56:54 EST



On 17/03/2026 11:44, Bartosz Golaszewski wrote:
On Tue, Mar 17, 2026 at 11:12 AM Jon Hunter <jonathanh@xxxxxxxxxx> wrote:

Thanks for sending this. However, I am seeing a different issue now ...

------------[ cut here ]------------
WARNING: drivers/gpio/gpiolib-shared.c:499 at gpio_shared_add_proxy_lookup+0x118/0x1d8, CPU#8: swapper/0/1
Modules linked in:
CPU: 8 UID: 0 PID: 1 Comm: swapper/0 Not tainted 7.0.0-rc3-next-20260309-00005-g02826fefa46f #14 PREEMPT
Hardware name: NVIDIA NVIDIA Jetson AGX Orin Developer Kit/Jetson, BIOS buildbrain-gcid-42974706 11/20/2025
pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : gpio_shared_add_proxy_lookup+0x118/0x1d8
lr : gpio_shared_add_proxy_lookup+0xfc/0x1d8
sp : ffff8000832bba30
x29: ffff8000832bba30 x28: ffff000080d01010 x27: ffffffffffffefff
x26: 0000000000000001 x25: ffff800082df0538 x24: ffff800082df0528
x23: 0000000000000000 x22: ffff00008012c158 x21: ffff000081455010
usb 1-3: new full-speed USB device number 2 using tegra-xusb
x20: ffff000080d5d430 x19: ffff00008012c158 x18: 00000000ffffffff
x17: ffff8000830786a8 x16: ffff800083078718 x15: ffff8000832bb880
x14: ffffffffffffffff x13: 0000000000000008 x12: 0101010101010101
x11: 7f7f7f7f7f7f7f7f x10: ffff8000827f20d0 x9 : 0000000000000003
x8 : 0101010101010101 x7 : 0080808080808000 x6 : 15151a0a59460209
x5 : 000000000000003c x4 : ffff8000832bb990 x3 : ffff0000800fe800
x2 : ffff0000801c2f40 x1 : ffff0000801c2f40 x0 : ffff800082df0538
Call trace:
gpio_shared_add_proxy_lookup+0x118/0x1d8 (P)
gpiod_find_and_request+0x1bc/0x548
devm_fwnode_gpiod_get_index+0x1c/0x6c
gpio_keys_probe+0x494/0x9fc
platform_probe+0x5c/0x98
really_probe+0xbc/0x2a8
__driver_probe_device+0x78/0x12c
driver_probe_device+0x3c/0x15c
__driver_attach+0x90/0x19c
bus_for_each_dev+0x78/0xd4
driver_attach+0x24/0x30
bus_add_driver+0xe4/0x208
driver_register+0x5c/0x124
__platform_driver_register+0x24/0x30
gpio_keys_init+0x1c/0x28
do_one_initcall+0x7c/0x1c0
kernel_init_freeable+0x204/0x2ec
kernel_init+0x24/0x1e0
ret_from_fork+0x10/0x20
---[ end trace 0000000000000000 ]---

I see the comment says ...

/* We warn here because this can only happen if the programmer borked. */
WARN_ON(1);

I will take a closer look, but let me know if you have any thoughts?


I suppose this is not a reset-gpio-like use-case? Could you point me
to the DTS you're using? I've reproduced the bug with a dummy dts and
xlate function in gpio-sim and this patch fixes it but maybe I'm
missing something.

So the board I originally observed this on is a farm board with camera
hardware I don't have. So like you I started off reproducing locally
with a dummy dts by making the following change ...

diff --git a/arch/arm64/boot/dts/nvidia/tegra234-p3737-0000+p3701.dtsi b/arch/arm64/boot/dts/nvidia/tegra234-p3737-0000+p3701.dtsi
index f6cad29355e6..5e62ffb425f4 100644
--- a/arch/arm64/boot/dts/nvidia/tegra234-p3737-0000+p3701.dtsi
+++ b/arch/arm64/boot/dts/nvidia/tegra234-p3737-0000+p3701.dtsi
@@ -389,14 +389,14 @@ gpio-keys {
key-force-recovery {
label = "Force Recovery";
- gpios = <&gpio TEGRA234_MAIN_GPIO(G, 0) GPIO_ACTIVE_LOW>;
+ gpios = <&gpio TEGRA234_MAIN_GPIO(AF, 2) GPIO_ACTIVE_LOW>;
linux,input-type = <EV_KEY>;
linux,code = <BTN_1>;
};
key-power {
label = "Power";
- gpios = <&gpio_aon TEGRA234_AON_GPIO(EE, 4) GPIO_ACTIVE_LOW>;
+ gpios = <&gpio TEGRA234_MAIN_GPIO(AF, 2) GPIO_ACTIVE_LOW>;
linux,input-type = <EV_KEY>;
linux,code = <KEY_POWER>;
wakeup-event-action = <EV_ACT_ASSERTED>;


With this I see ...

gpiolib_shared: GPIO 154 owned by tegra234-gpio is shared by multiple consumers
gpiolib_shared: Setting up a shared GPIO entry for key-force-recovery (con_id: '(none)')
gpiolib_shared: Created an auxiliary GPIO proxy gpiolib_shared.proxy.3 for GPIO device tegra234-gpio
gpiolib_shared: Setting up a shared GPIO entry for key-power (con_id: '(none)')
gpiolib_shared: Created an auxiliary GPIO proxy gpiolib_shared.proxy.4 for GPIO device tegra234-gpio
...
gpio-keys gpio-keys: error -ENXIO: Unable to determine IRQ# for button #0

I am not sure if this is because these are child nodes of gpio-keys?
Obviously this is not a proper example, but something quick and dirty
for local testing :-)

Jon

--
nvpublic