[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75Vd56XYo6PgoJWeUcH328uD2svUCBX7SWT_WUZEH2AvoDw@mail.gmail.com>
Date: Wed, 19 Nov 2025 10:01:06 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Linus Walleij <linus.walleij@...aro.org>
Cc: Geert Uytterhoeven <geert@...ux-m68k.org>, Bartosz Golaszewski <brgl@...ev.pl>, Kees Cook <kees@...nel.org>,
Mika Westerberg <westeri@...nel.org>, Dmitry Torokhov <dmitry.torokhov@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>, Manivannan Sadhasivam <mani@...nel.org>,
Rob Herring <robh@...nel.org>, Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>,
Saravana Kannan <saravanak@...gle.com>, Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Andy Shevchenko <andy@...nel.org>, Catalin Marinas <catalin.marinas@....com>, Will Deacon <will@...nel.org>,
Srinivas Kandagatla <srini@...nel.org>, Liam Girdwood <lgirdwood@...il.com>, Mark Brown <broonie@...nel.org>,
Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.com>,
Alexey Klimov <alexey.klimov@...aro.org>, Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konradybcio@...nel.org>, linux-hardening@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-gpio@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, linux-sound@...r.kernel.org,
linux-arm-msm@...r.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@...aro.org>,
Linux-Renesas <linux-renesas-soc@...r.kernel.org>
Subject: Re: [PATCH v4 00/10] gpio: improve support for shared GPIOs
On Wed, Nov 19, 2025 at 1:24 AM Linus Walleij <linus.walleij@...aro.org> wrote:
> On Tue, Nov 18, 2025 at 12:15 PM Geert Uytterhoeven
> <geert@...ux-m68k.org> wrote:
...
> > We have a long-standing use-case on various Renesas R-Car Gen3 boards
> > (e.g. Salvator-X(S) and ULCB[1]), where GPIOs are shared by LEDs and
> > key switches. Basically, the GPIO is connected to:
> > 1. A key switch connecting to GND when closed, with pull-up.
> > 2. The gate of an N-channel MOSFET, turning on an LED when driven
> > high.
> >
> > Hence:
> > - In output mode, the LED can be controlled freely,
> > - In input mode, the LED is on, unless the key is pressed,
> > - Hence the switch state can only be read when the LED is turned on.
>
> Fantastic solution to a lack of GPIO lines.
I feel a poster "SARCASM" behind this line :-)
That's what happened when old-school (in a bad term) HW engineers who
try to enforce their experience on the modern SoC-based platforms that
run GP OSes in multi-tasking, multi-user manner.
> This reminds me of the Amiga 500 power LED which was connected
> to a GPIO which was cleverly also reused to control the audio filter,
> with the effect that when you turned off the audio filter the power LED
> went out and music toggling the filter off/on for effects would also
> give you an incidental stroboscope.
>
> > If you have any idea how to handle this, feel free to reply ;-)
>
> Isn't it pretty clear from the system-level DTS how the line
> is used?
>
> If it is connected to a gpio key it gets assigned for that usecase
> and handled by that driver and if it is connected to a gpio LED
> it is handled by that driver.
>
> For the input usecase the status of the LED is a byproduct and
> should not reflect in software I think. It surely should not be
> controllable and possible to set into output mode because
> that sounds like a recipe for HW damage if you drive it
> actively high and press the key at the same time.
>
> gpio_keys {
> compatible = "gpio-keys";
>
> button-ok {
> gpios = <&gpio 0 GPIO_OPEN_DRAIN | GPIO_PULL_UP>;
> };
> };
This is my understanding as well.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists