From: Linus Walleij <linus.walleij@linaro.org>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Bartosz Golaszewski <brgl@bgdev.pl>, Kees Cook <kees@kernel.org>,
Mika Westerberg <westeri@kernel.org>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
Manivannan Sadhasivam <mani@kernel.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Saravana Kannan <saravanak@google.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Andy Shevchenko <andy@kernel.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
Srinivas Kandagatla <srini@kernel.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
Alexey Klimov <alexey.klimov@linaro.org>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>,
linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-gpio@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>,
Linux-Renesas <linux-renesas-soc@vger.kernel.org>
Subject: Re: [PATCH v4 00/10] gpio: improve support for shared GPIOs
Date: Wed, 19 Nov 2025 00:23:53 +0100 [thread overview]
Message-ID: <CACRpkdZioOu9AEBdaNWX1njsVvFYR8SP8yJrY8MFMbJtL6YLJA@mail.gmail.com> (raw)
In-Reply-To: <CAMuHMdVR9Z70+M-SqHYrHiC6H_yw=VRuDOOg=YnXSNKjPnx3WQ@mail.gmail.com>
On Tue, Nov 18, 2025 at 12:15 PM Geert Uytterhoeven
<geert@linux-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.
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>;
};
};
Yours,
Linus Walleij
next prev parent reply other threads:[~2025-11-18 23:24 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-12 13:55 [PATCH v4 00/10] gpio: improve support for shared GPIOs Bartosz Golaszewski
2025-11-12 13:55 ` [PATCH v4 01/10] string: provide strends() Bartosz Golaszewski
2025-11-17 20:33 ` Kees Cook
2025-11-18 9:47 ` Bartosz Golaszewski
2025-11-18 10:13 ` Andy Shevchenko
2025-11-12 13:55 ` [PATCH v4 02/10] gpiolib: define GPIOD_FLAG_SHARED Bartosz Golaszewski
2025-11-12 13:55 ` [PATCH v4 03/10] gpiolib: implement low-level, shared GPIO support Bartosz Golaszewski
2025-11-12 13:55 ` [PATCH v4 04/10] gpio: shared-proxy: implement the shared GPIO proxy driver Bartosz Golaszewski
2025-11-12 13:55 ` [PATCH v4 05/10] gpiolib: support shared GPIOs in core subsystem code Bartosz Golaszewski
2025-11-12 13:55 ` [PATCH v4 06/10] gpio: provide gpiod_is_shared() Bartosz Golaszewski
2025-11-12 13:55 ` [PATCH v4 07/10] arm64: select HAVE_SHARED_GPIOS for ARCH_QCOM Bartosz Golaszewski
2025-11-13 8:51 ` Arnd Bergmann
2025-11-14 19:40 ` Bjorn Andersson
2025-11-18 14:06 ` Mark Brown
2025-11-18 14:13 ` Bartosz Golaszewski
2025-11-18 14:20 ` Mark Brown
2025-11-18 14:27 ` Bartosz Golaszewski
2025-11-18 19:46 ` Mark Brown
2025-11-12 13:55 ` [PATCH v4 08/10] ASoC: wsa881x: drop GPIOD_FLAGS_BIT_NONEXCLUSIVE flag from GPIO lookup Bartosz Golaszewski
2025-11-12 13:55 ` [PATCH v4 09/10] ASoC: wsa883x: " Bartosz Golaszewski
2025-11-12 13:55 ` [PATCH v4 10/10] regulator: make the subsystem aware of shared GPIOs Bartosz Golaszewski
2025-11-17 9:20 ` (subset) [PATCH v4 00/10] gpio: improve support for " Bartosz Golaszewski
2025-11-18 11:15 ` Geert Uytterhoeven
2025-11-18 11:55 ` Bartosz Golaszewski
2025-11-18 12:55 ` Geert Uytterhoeven
2025-11-18 13:21 ` Bartosz Golaszewski
2025-11-18 23:23 ` Linus Walleij [this message]
2025-11-19 8:01 ` Andy Shevchenko
2025-11-19 8:33 ` Geert Uytterhoeven
2025-11-19 14:29 ` Linus Walleij
2025-11-20 10:39 ` (subset) " Mark Brown
2025-11-20 13:36 ` Mark Brown
2025-11-21 0:27 ` Val Packett
2025-11-21 9:03 ` Bartosz Golaszewski
2025-11-21 10:20 ` Krzysztof Kozlowski
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=CACRpkdZioOu9AEBdaNWX1njsVvFYR8SP8yJrY8MFMbJtL6YLJA@mail.gmail.com \
--to=linus.walleij@linaro.org \
--cc=akpm@linux-foundation.org \
--cc=alexey.klimov@linaro.org \
--cc=andersson@kernel.org \
--cc=andy@kernel.org \
--cc=bartosz.golaszewski@linaro.org \
--cc=brgl@bgdev.pl \
--cc=broonie@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=conor+dt@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=geert@linux-m68k.org \
--cc=gregkh@linuxfoundation.org \
--cc=kees@kernel.org \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=mani@kernel.org \
--cc=perex@perex.cz \
--cc=robh@kernel.org \
--cc=saravanak@google.com \
--cc=srini@kernel.org \
--cc=tiwai@suse.com \
--cc=westeri@kernel.org \
--cc=will@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;
as well as URLs for NNTP newsgroup(s).