From: Miao Wang <shankerwangmiao@gmail.com>
To: Bartosz Golaszewski <brgl@kernel.org>
Cc: Miao Wang via B4 Relay
<devnull+shankerwangmiao.gmail.com@kernel.org>,
Xi Ruoyao <xry111@xry111.site>, WANG Xuerui <kernel@xen0n.name>,
Yinbo Zhu <zhuyinbo@loongson.cn>,
Jiaxun Yang <jiaxun.yang@flygoat.com>,
mfd@lists.linux.dev, linux-kernel@vger.kernel.org,
linux-gpio@vger.kernel.org,
openipmi-developer@lists.sourceforge.net,
Binbin Zhou <zhoubinbin@loongson.cn>,
Chong Qiao <qiaochong@loongson.cn>, Lee Jones <lee@kernel.org>,
Huacai Chen <chenhuacai@kernel.org>,
Corey Minyard <corey@minyard.net>,
Linus Walleij <linusw@kernel.org>
Subject: Re: [PATCH RFC v2 7/7] mfd: ls2kbmc: Capture the reset event of BMC through GPIO
Date: Wed, 8 Jul 2026 20:15:55 +0800 [thread overview]
Message-ID: <C8B03257-3909-4323-B183-331F7CB1DA3E@gmail.com> (raw)
In-Reply-To: <CAMRc=MeDq6=u66hc+ChmJA9iKRhsYFhg7rKkCGh2BA=--VGkcw@mail.gmail.com>
Hi
> 2026年7月8日 19:36,Bartosz Golaszewski <brgl@kernel.org> 写道:
>
> On Tue, 7 Jul 2026 23:16:31 +0200, Miao Wang via B4 Relay
> <devnull+shankerwangmiao.gmail.com@kernel.org> said:
>> From: Miao Wang <shankerwangmiao@gmail.com>
>>
>> The reset event of BMC is captured through GPIO. However, this driver
>> bypasses the GPIO framework and directly accesses the GPIO controller
>> through the fixed address. When the same GPIO controller is also
>> exposed through ACPI and probed by the corresponding GPIO driver,
>> there would be a conflict between the two drivers.
>>
>> This patch will try to find the GPIO through declared GPIO pin in the
>> _CRS resources of the ACPI node. If no such delaration is found, the
>> driver will fall back to search for the correct GPIO controller and pin
>> according to the fixed address and pin number. A possible DSDT
>> declaration for the GPIO pin might be as follows:
>>
>> Device (BMC0) {
>> Name (_ADR, ...) // Match the PCI address of the BMC device
>> // \_SB.GPO1 is the ACPI path of the GPIO controller
>> Name (_CRS, ResourceTemplate () {
>> GpioInt (Edge, ActiveLow, Exclusive, PullNone, 0,
>> "\\_SB.GPO1", 0) {
>> 14 // 14 is the GPIO pin number
>> }
>> }
>>
>> Signed-off-by: Miao Wang <shankerwangmiao@gmail.com>
>> ---
>> drivers/mfd/ls2k-bmc-core.c | 162 +++++++++++++++++++++++++++++++-------------
>> 1 file changed, 115 insertions(+), 47 deletions(-)
>>
>> diff --git a/drivers/mfd/ls2k-bmc-core.c b/drivers/mfd/ls2k-bmc-core.c
>> index f87224105b3720cca97dcef089dad63fe57bc8c2..7187b2dfddc3acfb9fdf3cb3b4675299928dd03a 100644
>> --- a/drivers/mfd/ls2k-bmc-core.c
>> +++ b/drivers/mfd/ls2k-bmc-core.c
>> @@ -26,6 +26,9 @@
>> #include <linux/stop_machine.h>
>> #include <linux/vt_kern.h>
>> #include <linux/console.h>
>> +#include <linux/gpio/consumer.h>
>> +#include <linux/gpio/driver.h>
>> +#include <linux/gpio.h>
>
> I've stopped here because this is a legacy header that must not be included
> and none of the interfaces in it must be used, as per the - very loud - comment
> at the top of that file.
I fully understand using the legacy interface is deprecated. However, there
seems no other way to obtain a gpio line description after a gpio device
is found using gpio_device_find(). As the comment shows in the code below,
the only place I use the legacy interface is:
gdev = gpio_device_find(...);
desc = gpio_device_get_desc(gdev, LS2K_BMC_RESET_GPIO);
// XXX: might be better to use gpiod_request()
legacy_gpio = desc_to_gpio(desc);
devm_gpio_request_one(..., legacy_gpio, ...);
return gpio_to_desc(legacy_gpio);
I just borrowed the legacy gpio interface to request the irq description. I
think that gpiod_request() should be better to be used here, but it is not
an interface that is exposed. As a result, I post this patch as a PoC here
to discuss and find a better way to achieve this.
Cheers,
Miao Wang
next prev parent reply other threads:[~2026-07-08 12:16 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-07 21:16 [PATCH RFC v2 0/7] mfd: ls2kbmc: multiple fixes for this driver Miao Wang via B4 Relay
2026-07-07 21:16 ` [PATCH RFC v2 1/7] mfd: ls2kbmc: Make a copy when parsing mode string Miao Wang via B4 Relay
2026-07-07 21:16 ` [PATCH RFC v2 2/7] mfd: ls2kbmc: Sanity check for the connected pci port Miao Wang via B4 Relay
2026-07-07 21:16 ` [PATCH RFC v2 3/7] mfd: ls2kbmc: Redraw using exported functions Miao Wang via B4 Relay
2026-07-07 21:16 ` [PATCH RFC v2 4/7] mfd: ls2kbmc: Cancel the work queue on removal Miao Wang via B4 Relay
2026-07-07 21:16 ` [PATCH RFC v2 5/7] ipmi: ls2k: Relax the dependency to its mfd driver Miao Wang via B4 Relay
2026-07-07 21:16 ` [PATCH RFC v2 6/7] mfd: ls2kbmc: Able to be compiled as a module Miao Wang via B4 Relay
2026-07-07 21:16 ` [PATCH RFC v2 7/7] mfd: ls2kbmc: Capture the reset event of BMC through GPIO Miao Wang via B4 Relay
2026-07-08 11:36 ` Bartosz Golaszewski
2026-07-08 12:15 ` Miao Wang [this message]
2026-07-08 12:55 ` Bartosz Golaszewski
2026-07-08 13:14 ` Xi Ruoyao
2026-07-08 14:16 ` Miao Wang
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=C8B03257-3909-4323-B183-331F7CB1DA3E@gmail.com \
--to=shankerwangmiao@gmail.com \
--cc=brgl@kernel.org \
--cc=chenhuacai@kernel.org \
--cc=corey@minyard.net \
--cc=devnull+shankerwangmiao.gmail.com@kernel.org \
--cc=jiaxun.yang@flygoat.com \
--cc=kernel@xen0n.name \
--cc=lee@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mfd@lists.linux.dev \
--cc=openipmi-developer@lists.sourceforge.net \
--cc=qiaochong@loongson.cn \
--cc=xry111@xry111.site \
--cc=zhoubinbin@loongson.cn \
--cc=zhuyinbo@loongson.cn \
/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