mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Bartosz Golaszewski <brgl@kernel.org>
Cc: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>,
	Linus Walleij <linusw@kernel.org>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] gpio: shared: allow sharing a reset-gpios pin between reset-gpio and gpiolib
Date: Mon, 5 Jan 2026 19:16:00 +0100	[thread overview]
Message-ID: <eac0d2aa-fcc0-4aa4-a266-89957dcf7b70@samsung.com> (raw)
In-Reply-To: <3cb799ed-6760-481b-991d-5d90a23b9128@samsung.com>

On 05.01.2026 18:26, Marek Szyprowski wrote:
> On 05.01.2026 13:28, Bartosz Golaszewski wrote:
>> On Mon, Jan 5, 2026 at 12:50 PM Marek Szyprowski
>> <m.szyprowski@samsung.com> wrote:
>>> On 22.12.2025 11:01, Bartosz Golaszewski wrote:
>>>> We currently support sharing GPIOs between multiple devices whose 
>>>> drivers
>>>> use either the GPIOLIB API *OR* the reset control API but not both at
>>>> the same time.
>>>>
>>>> There's an unlikely corner-case where a reset-gpios pin can be 
>>>> shared by
>>>> one driver using the GPIOLIB API and a second using the reset API. 
>>>> This
>>>> will currently not work as the reset-gpio consumers are not 
>>>> described in
>>>> firmware at the time of scanning so the shared GPIO just chooses 
>>>> one of
>>>> the proxies created for the consumers when the reset-gpio driver 
>>>> performs
>>>> the lookup. This can of course conflict in the case described above.
>>>>
>>>> In order to fix it: if we deal with the "reset-gpios" pin that's 
>>>> shared
>>>> acconding to the firmware node setup, create a proxy for each 
>>>> described
>>>> consumer as well as another one for the potential reset-gpio 
>>>> device. To
>>>> that end: rework the matching to take this into account.
>>>>
>>>> Fixes: 7b78b26757e0 ("gpio: shared: handle the reset-gpios corner 
>>>> case")
>>>> Signed-off-by: Bartosz Golaszewski 
>>>> <bartosz.golaszewski@oss.qualcomm.com>
>>> This patch landed in linux-next as commit 49416483a953 ("gpio: shared:
>>> allow sharing a reset-gpios pin between reset-gpio and gpiolib"). In my
>>> tests I found that it breaks booting and triggers warnings on some 
>>> of my
>>> test boards. Reverting it on top of next-20260105 fixes those issues.
>>> Let me know if I can help debugging this issue.
>>>
>>>
>>> Here are relevant logs from my 3 test systems:
>>>
>> Thanks for the report.
>>
>> Nice combo, it looks like these are three separate bugs...
>>
>>> 1. Samsung TM2e - arch/arm64/boot/dts/exynos/exynos5433-tm2e.dts
>>>
>>> exynos-dsi 13900000.dsi: [drm:samsung_dsim_host_attach] Attached 
>>> s6e3hf2
>>> device (lanes:4 bpp:24 mode-flags:0x6e0)
>>> Unable to handle kernel NULL pointer dereference at virtual address
>> Could you use faddr2line to point me to the exact offending line? This
>> would speed up the debugging.
>
> I need some time to get that output, but this issue is caused by a 
> devm_gpiod_get_optional() call for a gpio that is not defined for that 
> board.
>
I think that everything is in the call stack:

Call trace:
  gpiod_direction_input_nonotify+0x20/0x39c (P)
  gpiod_configure_flags+0x23c/0x480
  gpiod_find_and_request+0x1a0/0x574
  gpiod_get_index+0x58/0x84
  devm_gpiod_get_index+0x20/0xb4
  devm_gpiod_get_optional+0x18/0x30
  samsung_dsim_host_attach+0x1c8/0x284
  mipi_dsi_attach+0x30/0x54
  s6e3ha2_probe+0x148/0x200 [panel_samsung_s6e3ha2]

...


The issue is in gpiod_direction_input_nonotify+0x20/0x39c:

$ grep gpiod_direction_input_nonotify System.map
ffff800080810360 T gpiod_direction_input_nonotify

$ aarch64-linux-gnu-addr2line -f -e vmlinux ffff800080810380
class_gpio_chip_guard_constructor
/home/m.szyprowski/dev/kernel/linux-next/drivers/gpio/gpiolib.h:231

IMHO it looks that gpiod_configure_flags() is called for NULL gpio_chip.

Best regards
-- 
Marek Szyprowski, PhD
Samsung R&D Institute Poland


  reply	other threads:[~2026-01-05 18:16 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-22 10:01 [PATCH 0/3] gpio: shared: close remaining gaps Bartosz Golaszewski
2025-12-22 10:01 ` [PATCH 1/3] gpiolib: allow multiple lookup tables per consumer Bartosz Golaszewski
2025-12-22 10:01 ` [PATCH 2/3] gpio: shared: verify con_id when adding proxy lookup Bartosz Golaszewski
2025-12-22 10:01 ` [PATCH 3/3] gpio: shared: allow sharing a reset-gpios pin between reset-gpio and gpiolib Bartosz Golaszewski
     [not found]   ` <CGME20260105115023eucas1p1af1f8e80041f94843beb664966894fb9@eucas1p1.samsung.com>
2026-01-05 11:50     ` Marek Szyprowski
2026-01-05 12:28       ` Bartosz Golaszewski
2026-01-05 17:26         ` Marek Szyprowski
2026-01-05 18:16           ` Marek Szyprowski [this message]
2026-01-06 10:55             ` Bartosz Golaszewski
2026-01-05 15:53       ` Bartosz Golaszewski
2026-01-06 12:21       ` Mark Brown
2026-01-06 12:25         ` Bartosz Golaszewski
2026-01-08 15:46   ` Mark Brown
2026-01-08 15:52     ` Bartosz Golaszewski
2026-01-08 16:29       ` Mark Brown
2026-01-08 18:04         ` Bartosz Golaszewski
2026-01-02  9:34 ` [PATCH 0/3] gpio: shared: close remaining gaps Bartosz Golaszewski

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=eac0d2aa-fcc0-4aa4-a266-89957dcf7b70@samsung.com \
    --to=m.szyprowski@samsung.com \
    --cc=bartosz.golaszewski@oss.qualcomm.com \
    --cc=brgl@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.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

all inboxes | Powered by JetHome®