* [PATCH 00/21] gpiolib: fence off legacy interfaces
@ 2025-08-08 15:17 Arnd Bergmann
2025-08-08 15:17 ` [PATCH 01/21] ARM: select legacy gpiolib interfaces where used Arnd Bergmann
` (23 more replies)
0 siblings, 24 replies; 62+ messages in thread
From: Arnd Bergmann @ 2025-08-08 15:17 UTC (permalink / raw)
To: Bartosz Golaszewski, Linus Walleij, linux-gpio
Cc: Arnd Bergmann, Andrew Lunn, Sebastian Hesselbarth,
Gregory Clement, Russell King, Daniel Mack, Haojian Zhuang,
Robert Jarzmik, Krzysztof Kozlowski, Alim Akhtar,
Geert Uytterhoeven, Thomas Bogendoerfer, Yoshinori Sato,
Rich Felker, John Paul Adrian Glaubitz, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, Dave Hansen, x86, H. Peter Anvin,
Dmitry Torokhov, Lee Jones, Pavel Machek, Mauro Carvalho Chehab,
Matti Vaittinen, Florian Fainelli, Jeff Johnson, Hans de Goede,
Ilpo Järvinen, Greg Kroah-Hartman, Jaroslav Kysela,
Takashi Iwai, Liam Girdwood, Mark Brown, Andy Shevchenko,
Dr. David Alan Gilbert, linux-arm-kernel, linux-kernel,
linux-samsung-soc, linux-m68k, linux-mips, linux-sh, linux-input,
linux-leds, linux-media, patches, netdev, linux-wireless, ath10k,
platform-driver-x86, linux-usb, linux-sound
From: Arnd Bergmann <arnd@arndb.de>
Commit 678bae2eaa81 ("gpiolib: make legacy interfaces optional") was
merged for linux-6.17, so now it is possible to use the legacy interfaces
conditionally and eventually have the support left out of the kernel
whenever it is not needed.
I created six patches to force-enable CONFIG_GPIOLIB_LEGACY on the
few (mostly ancient) platforms that still require this, plus a set of
patches to either add the corresponding Kconfig dependencies that make
the device drivers conditional on that symbol, or change them to no
longer require it.
The final patch ends up turning the Kconfig symbol off by default,
which of course depends on everything else getting merged first to avoid
build errors.
I would suggest that patches 1-20 can just get merged through the
respective maintainer trees independently when they are deemed ready,
and the final patch can wait another merge window.
Arnd
Arnd Bergmann (21):
ARM: select legacy gpiolib interfaces where used
m68k: coldfire: select legacy gpiolib interface for mcfqspi
mips: select legacy gpiolib interfaces where used
sh: select legacy gpiolib interface
x86/platform: select legacy gpiolib interfaces where used
x86/olpc: select GPIOLIB_LEGACY
mfd: wm8994: remove dead legacy-gpio code
ASoC: add GPIOLIB_LEGACY dependency where needed
input: gpio-keys: make legacy gpiolib optional
leds: gpio: make legacy gpiolib interface optional
media: em28xx: add special case for legacy gpiolib interface
mfd: arizona: make legacy gpiolib interface optional
mfd: si476x: add GPIOLIB_LEGACY dependency
mfd: aat2870: add GPIOLIB_LEGACY dependency
dsa: b53: hide legacy gpiolib usage on non-mips
ath10k: remove gpio number assignment
nfc: marvell: convert to gpio descriptors
nfc: s3fwrn5: convert to gpio descriptors
usb: udc: pxa: remove unused platform_data
ASoC: pxa: add GPIOLIB_LEGACY dependency
gpiolib: turn off legacy interface by default
arch/arm/mach-mv78xx0/Kconfig | 1 +
arch/arm/mach-orion5x/Kconfig | 1 +
arch/arm/mach-pxa/Kconfig | 1 +
arch/arm/mach-pxa/devices.c | 7 --
arch/arm/mach-pxa/gumstix.c | 1 -
arch/arm/mach-pxa/udc.h | 8 --
arch/arm/mach-s3c/Kconfig.s3c64xx | 1 +
arch/arm/mach-sa1100/Kconfig | 1 +
arch/m68k/Kconfig.cpu | 1 +
arch/mips/Kconfig | 5 +
arch/mips/alchemy/Kconfig | 1 -
arch/mips/txx9/Kconfig | 1 +
arch/sh/Kconfig | 1 +
arch/sh/boards/Kconfig | 8 ++
arch/sh/boards/mach-highlander/Kconfig | 1 +
arch/sh/boards/mach-rsk/Kconfig | 3 +
arch/x86/Kconfig | 1 +
drivers/gpio/Kconfig | 11 ++-
drivers/input/keyboard/gpio_keys.c | 5 +-
drivers/input/keyboard/gpio_keys_polled.c | 2 +
drivers/input/misc/Kconfig | 3 +
drivers/leds/leds-gpio.c | 8 +-
drivers/media/usb/em28xx/Kconfig | 1 +
drivers/media/usb/em28xx/em28xx-dvb.c | 4 +-
drivers/mfd/Kconfig | 2 +
drivers/mfd/arizona-irq.c | 5 +-
drivers/mfd/rohm-bd71828.c | 2 +
drivers/mfd/rohm-bd718x7.c | 2 +
drivers/mfd/wm8994-irq.c | 94 +------------------
drivers/net/dsa/b53/b53_common.c | 17 +---
drivers/net/dsa/b53/b53_priv.h | 24 +++--
drivers/net/wireless/ath/ath10k/leds.c | 3 +-
drivers/nfc/nfcmrvl/main.c | 47 +++-------
drivers/nfc/nfcmrvl/nfcmrvl.h | 5 +-
drivers/nfc/nfcmrvl/uart.c | 5 -
drivers/nfc/nfcmrvl/usb.c | 1 -
drivers/nfc/s3fwrn5/i2c.c | 42 +++------
drivers/nfc/s3fwrn5/phy_common.c | 12 +--
drivers/nfc/s3fwrn5/phy_common.h | 4 +-
drivers/nfc/s3fwrn5/uart.c | 30 ++----
drivers/platform/x86/Kconfig | 3 +
.../platform/x86/x86-android-tablets/Kconfig | 1 +
drivers/usb/gadget/udc/pxa25x_udc.c | 41 +++-----
drivers/usb/gadget/udc/pxa25x_udc.h | 2 +-
drivers/usb/gadget/udc/pxa27x_udc.c | 35 +------
drivers/usb/gadget/udc/pxa27x_udc.h | 2 -
include/linux/gpio_keys.h | 2 +
include/linux/leds.h | 2 +
include/linux/mfd/arizona/pdata.h | 6 ++
include/linux/mfd/wm8994/pdata.h | 5 -
include/linux/platform_data/pxa2xx_udc.h | 15 ---
sound/pci/Kconfig | 1 +
sound/soc/codecs/Kconfig | 4 +
sound/soc/codecs/arizona-jack.c | 17 +++-
sound/soc/pxa/Kconfig | 4 +-
55 files changed, 192 insertions(+), 320 deletions(-)
delete mode 100644 arch/arm/mach-pxa/udc.h
--
2.39.5
Cc: Linus Walleij <linus.walleij@linaro.org> (maintainer:GPIO SUBSYSTEM,commit_signer:1/2=50%)
Cc: Bartosz Golaszewski <brgl@bgdev.pl> (maintainer:GPIO SUBSYSTEM,commit_signer:1/7=14%,commit_signer:1/2=50%)
Cc: linux-gpio@vger.kernel.org (open list:GPIO SUBSYSTEM)
Cc: Andrew Lunn <andrew@lunn.ch> (maintainer:ARM/Marvell Dove/MV78xx0/Orion SOC support)
Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> (maintainer:ARM/Marvell Dove/MV78xx0/Orion SOC support)
Cc: Gregory Clement <gregory.clement@bootlin.com> (maintainer:ARM/Marvell Dove/MV78xx0/Orion SOC support)
Cc: Russell King <linux@armlinux.org.uk> (maintainer:ARM PORT)
Cc: Daniel Mack <daniel@zonque.org> (maintainer:PXA2xx/PXA3xx SUPPORT)
Cc: Haojian Zhuang <haojian.zhuang@gmail.com> (maintainer:PXA2xx/PXA3xx SUPPORT)
Cc: Robert Jarzmik <robert.jarzmik@free.fr> (maintainer:PXA2xx/PXA3xx SUPPORT)
Cc: Krzysztof Kozlowski <krzk@kernel.org> (maintainer:ARM/SAMSUNG S3C, S5P AND EXYNOS ARM ARCHITECTURES,commit_signer:1/2=50%)
Cc: Alim Akhtar <alim.akhtar@samsung.com> (reviewer:ARM/SAMSUNG S3C, S5P AND EXYNOS ARM ARCHITECTURES)
Cc: Geert Uytterhoeven <geert@linux-m68k.org> (maintainer:M68K ARCHITECTURE,commit_signer:1/4=25%,authored:1/4=25%,added_lines:2/13=15%,removed_lines:2/6=33%)
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de> (maintainer:MIPS)
Cc: Yoshinori Sato <ysato@users.sourceforge.jp> (maintainer:SUPERH)
Cc: Rich Felker <dalias@libc.org> (maintainer:SUPERH)
Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> (maintainer:SUPERH,commit_signer:2/4=50%)
Cc: Thomas Gleixner <tglx@linutronix.de> (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT),added_lines:4/36=11%,removed_lines:6/49=12%)
Cc: Ingo Molnar <mingo@redhat.com> (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT))
Cc: Borislav Petkov <bp@alien8.de> (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT))
Cc: Dave Hansen <dave.hansen@linux.intel.com> (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT))
Cc: x86@kernel.org (maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT))
Cc: "H. Peter Anvin" <hpa@zytor.com> (reviewer:X86 ARCHITECTURE (32-BIT AND 64-BIT))
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> (maintainer:INPUT (KEYBOARD, MOUSE, JOYSTICK, TOUCHSCREEN)...,commit_signer:5/7=71%,authored:1/7=14%,added_lines:17/36=47%,removed_lines:27/49=55%,commit_signer:1/2=50%,commit_signer:3/5=60%)
Cc: Lee Jones <lee@kernel.org> (maintainer:LED SUBSYSTEM,commit_signer:2/5=40%)
Cc: Pavel Machek <pavel@kernel.org> (maintainer:LED SUBSYSTEM)
Cc: Mauro Carvalho Chehab <mchehab@kernel.org> (maintainer:EM28XX VIDEO4LINUX DRIVER)
Cc: Matti Vaittinen <mazziesaccount@gmail.com> (maintainer:ROHM POWER MANAGEMENT IC DEVICE DRIVERS)
Cc: Florian Fainelli <florian.fainelli@broadcom.com> (maintainer:BROADCOM B53/SF2 ETHERNET SWITCH DRIVER)
Cc: Jeff Johnson <jjohnson@kernel.org> (maintainer:QUALCOMM ATHEROS ATH10K WIRELESS DRIVER)
Cc: Hans de Goede <hansg@kernel.org> (maintainer:X86 PLATFORM DRIVERS,commit_signer:1/7=14%)
Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com> (maintainer:X86 PLATFORM DRIVERS)
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> (maintainer:USB SUBSYSTEM)
Cc: Jaroslav Kysela <perex@perex.cz> (maintainer:SOUND)
Cc: Takashi Iwai <tiwai@suse.com> (maintainer:SOUND,commit_signer:1/3=33%,authored:1/3=33%,removed_lines:2/2=100%)
Cc: Liam Girdwood <lgirdwood@gmail.com> (maintainer:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...)
Cc: Mark Brown <broonie@kernel.org> (maintainer:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM...,commit_signer:26/29=90%,commit_signer:1/3=33%)
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com> (authored:1/7=14%,added_lines:4/36=11%,removed_lines:6/49=12%,commit_signer:1/2=50%,authored:1/2=50%,added_lines:5/7=71%,removed_lines:7/7=100%,added_lines:7/7=100%,removed_lines:2/7=29%)
Cc: "Dr. David Alan Gilbert" <linux@treblig.org> (commit_signer:1/5=20%,authored:1/5=20%,removed_lines:7/10=70%)
Cc: linux-arm-kernel@lists.infradead.org (moderated list:ARM/Marvell Dove/MV78xx0/Orion SOC support)
Cc: linux-kernel@vger.kernel.org (open list)
Cc: linux-samsung-soc@vger.kernel.org (open list:ARM/SAMSUNG S3C, S5P AND EXYNOS ARM ARCHITECTURES)
Cc: linux-m68k@lists.linux-m68k.org (open list:M68K ARCHITECTURE)
Cc: linux-mips@vger.kernel.org (open list:MIPS)
Cc: linux-sh@vger.kernel.org (open list:SUPERH)
Cc: linux-input@vger.kernel.org (open list:INPUT (KEYBOARD, MOUSE, JOYSTICK, TOUCHSCREEN)...)
Cc: linux-leds@vger.kernel.org (open list:LED SUBSYSTEM)
Cc: linux-media@vger.kernel.org (open list:EM28XX VIDEO4LINUX DRIVER)
Cc: patches@opensource.cirrus.com (open list:WOLFSON MICROELECTRONICS DRIVERS)
Cc: netdev@vger.kernel.org (open list:BROADCOM B53/SF2 ETHERNET SWITCH DRIVER)
Cc: linux-wireless@vger.kernel.org (open list:QUALCOMM ATHEROS ATH10K WIRELESS DRIVER)
Cc: ath10k@lists.infradead.org (open list:QUALCOMM ATHEROS ATH10K WIRELESS DRIVER)
Cc: platform-driver-x86@vger.kernel.org (open list:X86 PLATFORM DRIVERS)
Cc: linux-usb@vger.kernel.org (open list:USB SUBSYSTEM)
Cc: linux-sound@vger.kernel.org (open list:SOUND)
^ permalink raw reply [flat|nested] 62+ messages in thread
* [PATCH 01/21] ARM: select legacy gpiolib interfaces where used
2025-08-08 15:17 [PATCH 00/21] gpiolib: fence off legacy interfaces Arnd Bergmann
@ 2025-08-08 15:17 ` Arnd Bergmann
2025-08-11 8:49 ` Krzysztof Kozlowski
2025-08-08 15:17 ` [PATCH 02/21] m68k: coldfire: select legacy gpiolib interface for mcfqspi Arnd Bergmann
` (22 subsequent siblings)
23 siblings, 1 reply; 62+ messages in thread
From: Arnd Bergmann @ 2025-08-08 15:17 UTC (permalink / raw)
To: Bartosz Golaszewski, Linus Walleij, linux-gpio, Andrew Lunn,
Sebastian Hesselbarth, Gregory Clement, Russell King, Daniel Mack,
Haojian Zhuang, Robert Jarzmik, Krzysztof Kozlowski
Cc: Arnd Bergmann, Alim Akhtar, linux-arm-kernel, linux-kernel,
linux-samsung-soc
From: Arnd Bergmann <arnd@arndb.de>
A few old machines have not been converted away from the old-style
gpiolib interfaces. Make these select the new CONFIG_GPIOLIB_LEGACY
symbol so the code still works where it is needed but can be left
out otherwise.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/arm/mach-mv78xx0/Kconfig | 1 +
arch/arm/mach-orion5x/Kconfig | 1 +
arch/arm/mach-pxa/Kconfig | 1 +
arch/arm/mach-s3c/Kconfig.s3c64xx | 1 +
arch/arm/mach-sa1100/Kconfig | 1 +
5 files changed, 5 insertions(+)
diff --git a/arch/arm/mach-mv78xx0/Kconfig b/arch/arm/mach-mv78xx0/Kconfig
index 9de3bbc09c3a..670e6587827e 100644
--- a/arch/arm/mach-mv78xx0/Kconfig
+++ b/arch/arm/mach-mv78xx0/Kconfig
@@ -6,6 +6,7 @@ menuconfig ARCH_MV78XX0
depends on ATAGS
select CPU_FEROCEON
select GPIOLIB
+ select GPIOLIB_LEGACY
select MVEBU_MBUS
select FORCE_PCI
select PLAT_ORION_LEGACY
diff --git a/arch/arm/mach-orion5x/Kconfig b/arch/arm/mach-orion5x/Kconfig
index ee449ca032d2..cef19bea6164 100644
--- a/arch/arm/mach-orion5x/Kconfig
+++ b/arch/arm/mach-orion5x/Kconfig
@@ -5,6 +5,7 @@ menuconfig ARCH_ORION5X
depends on CPU_LITTLE_ENDIAN
select CPU_FEROCEON
select GPIOLIB
+ select GPIOLIB_LEGACY
select MVEBU_MBUS
select FORCE_PCI
select PCI_QUIRKS
diff --git a/arch/arm/mach-pxa/Kconfig b/arch/arm/mach-pxa/Kconfig
index 10e472f4fa43..66e26990e2c8 100644
--- a/arch/arm/mach-pxa/Kconfig
+++ b/arch/arm/mach-pxa/Kconfig
@@ -10,6 +10,7 @@ menuconfig ARCH_PXA
select CPU_XSCALE if !CPU_XSC3
select GPIO_PXA
select GPIOLIB
+ select GPIOLIB_LEGACY
select PLAT_PXA
help
Support for Intel/Marvell's PXA2xx/PXA3xx processor line.
diff --git a/arch/arm/mach-s3c/Kconfig.s3c64xx b/arch/arm/mach-s3c/Kconfig.s3c64xx
index 8f40af063ad6..3f97fba8e4f5 100644
--- a/arch/arm/mach-s3c/Kconfig.s3c64xx
+++ b/arch/arm/mach-s3c/Kconfig.s3c64xx
@@ -101,6 +101,7 @@ config MACH_WLF_CRAGG_6410
depends on ATAGS
depends on I2C=y
select CPU_S3C6410
+ select GPIOLIB_LEGACY
select LEDS_GPIO_REGISTER
select S3C64XX_DEV_SPI0
select S3C64XX_SETUP_FB_24BPP
diff --git a/arch/arm/mach-sa1100/Kconfig b/arch/arm/mach-sa1100/Kconfig
index 0fb4c24cfad5..e23700e0d6c8 100644
--- a/arch/arm/mach-sa1100/Kconfig
+++ b/arch/arm/mach-sa1100/Kconfig
@@ -13,6 +13,7 @@ menuconfig ARCH_SA1100
select CPU_FREQ
select CPU_SA1100
select GPIOLIB
+ select GPIOLIB_LEGACY
select IRQ_DOMAIN
select ISA
select NEED_MACH_MEMORY_H
--
2.39.5
^ permalink raw reply related [flat|nested] 62+ messages in thread
* [PATCH 02/21] m68k: coldfire: select legacy gpiolib interface for mcfqspi
2025-08-08 15:17 [PATCH 00/21] gpiolib: fence off legacy interfaces Arnd Bergmann
2025-08-08 15:17 ` [PATCH 01/21] ARM: select legacy gpiolib interfaces where used Arnd Bergmann
@ 2025-08-08 15:17 ` Arnd Bergmann
2025-08-08 15:17 ` [PATCH 03/21] mips: select legacy gpiolib interfaces where used Arnd Bergmann
` (21 subsequent siblings)
23 siblings, 0 replies; 62+ messages in thread
From: Arnd Bergmann @ 2025-08-08 15:17 UTC (permalink / raw)
To: Bartosz Golaszewski, Linus Walleij, linux-gpio,
Geert Uytterhoeven
Cc: Arnd Bergmann, Greg Ungerer, linux-m68k, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
The common coldfire code uses the old GPIO number based interfaces for
at least the QSPI chipselect lines. Select the required Kconfig symbol
to keep it building when that becomes optional.
Apparently there are no devices attached to a QSPI controller in any of
the coldfire boards, so this is not actually used in upstream kernels.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/m68k/Kconfig.cpu | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/m68k/Kconfig.cpu b/arch/m68k/Kconfig.cpu
index c9a7e602d8a4..148f8a79d206 100644
--- a/arch/m68k/Kconfig.cpu
+++ b/arch/m68k/Kconfig.cpu
@@ -30,6 +30,7 @@ config COLDFIRE
select CPU_HAS_NO_MULDIV64
select GENERIC_CSUM
select GPIOLIB
+ select GPIOLIB_LEGACY if SPI_COLDFIRE_QSPI
select HAVE_LEGACY_CLK
select HAVE_PAGE_SIZE_8KB if !MMU
--
2.39.5
^ permalink raw reply related [flat|nested] 62+ messages in thread
* [PATCH 03/21] mips: select legacy gpiolib interfaces where used
2025-08-08 15:17 [PATCH 00/21] gpiolib: fence off legacy interfaces Arnd Bergmann
2025-08-08 15:17 ` [PATCH 01/21] ARM: select legacy gpiolib interfaces where used Arnd Bergmann
2025-08-08 15:17 ` [PATCH 02/21] m68k: coldfire: select legacy gpiolib interface for mcfqspi Arnd Bergmann
@ 2025-08-08 15:17 ` Arnd Bergmann
2025-08-08 15:17 ` [PATCH 04/21] sh: select legacy gpiolib interface Arnd Bergmann
` (20 subsequent siblings)
23 siblings, 0 replies; 62+ messages in thread
From: Arnd Bergmann @ 2025-08-08 15:17 UTC (permalink / raw)
To: Bartosz Golaszewski, Linus Walleij, linux-gpio,
Thomas Bogendoerfer
Cc: Arnd Bergmann, Andrew Morton, Mike Rapoport (Microsoft),
Masahiro Yamada, Dan Williams, Caleb James DeLisle, Eric Biggers,
Thomas Weißschuh, Dave Vasilevsky, Steven Rostedt,
linux-mips, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
A few old machines have not been converted away from the old-style
gpiolib interfaces. Make these select the new CONFIG_GPIOLIB_LEGACY
symbol so the code still works where it is needed but can be left
out otherwise.
This is the list of all gpio_request() calls in mips:
arch/mips/alchemy/board-mtx1.c: rc = gpio_request(mtx1_gpio_button[0].gpio,
arch/mips/alchemy/devboards/db1000.c: gpio_request(19, "sd0_cd");
arch/mips/alchemy/devboards/db1000.c: gpio_request(20, "sd1_cd");
arch/mips/alchemy/devboards/db1200.c: gpio_request(215, "otg-vbus");
arch/mips/bcm47xx/workarounds.c: err = gpio_request_one(usb_power, GPIOF_OUT_INIT_HIGH, "usb_power");
arch/mips/bcm63xx/boards/board_bcm963xx.c: gpio_request_one(board.ephy_reset_gpio,
arch/mips/txx9/rbtx4927/setup.c: gpio_request(15, "sio-dtr");
Most of these should be easy enough to change to modern gpio descriptors
or remove if they are no longer in use.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/mips/Kconfig | 5 +++++
arch/mips/alchemy/Kconfig | 1 -
arch/mips/txx9/Kconfig | 1 +
3 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index caf508f6e9ec..27f16c5b112a 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -205,6 +205,8 @@ config MIPS_ALCHEMY
select CSRC_R4K
select IRQ_MIPS_CPU
select DMA_NONCOHERENT # Au1000,1500,1100 aren't, rest is
+ select GPIOLIB
+ select GPIOLIB_LEGACY
select MIPS_FIXUP_BIGPHYS_ADDR if PCI
select SYS_HAS_CPU_MIPS32_R1
select SYS_SUPPORTS_32BIT_KERNEL
@@ -306,6 +308,7 @@ config BCM47XX
select SYS_HAS_EARLY_PRINTK
select USE_GENERIC_EARLY_PRINTK_8250
select GPIOLIB
+ select GPIOLIB_LEGACY
select LEDS_GPIO_REGISTER
select BCM47XX_NVRAM
select BCM47XX_SPROM
@@ -329,6 +332,7 @@ config BCM63XX
select SYS_HAS_CPU_BMIPS4380
select SWAP_IO_SPACE
select GPIOLIB
+ select GPIOLIB_LEGACY
select MIPS_L1_CACHE_SHIFT_4
select HAVE_LEGACY_CLK
help
@@ -981,6 +985,7 @@ config MIKROTIK_RB532
select SWAP_IO_SPACE
select BOOT_RAW
select GPIOLIB
+ select GPIOLIB_LEGACY
select MIPS_L1_CACHE_SHIFT_4
help
Support the Mikrotik(tm) RouterBoard 532 series,
diff --git a/arch/mips/alchemy/Kconfig b/arch/mips/alchemy/Kconfig
index 6ca81e1bd35c..cf5ad52c0a0f 100644
--- a/arch/mips/alchemy/Kconfig
+++ b/arch/mips/alchemy/Kconfig
@@ -12,7 +12,6 @@ config MIPS_MTX1
config MIPS_DB1XXX
bool "Alchemy DB1XXX / PB1XXX boards"
- select GPIOLIB
select HAVE_PCI
select HAVE_PATA_PLATFORM
select SYS_SUPPORTS_LITTLE_ENDIAN
diff --git a/arch/mips/txx9/Kconfig b/arch/mips/txx9/Kconfig
index 7335efa4d528..92b759a434c0 100644
--- a/arch/mips/txx9/Kconfig
+++ b/arch/mips/txx9/Kconfig
@@ -37,6 +37,7 @@ config SOC_TX4927
select IRQ_TXX9
select PCI_TX4927
select GPIO_TXX9
+ select GPIOLIB_LEGACY
config SOC_TX4938
bool
--
2.39.5
^ permalink raw reply related [flat|nested] 62+ messages in thread
* [PATCH 04/21] sh: select legacy gpiolib interface
2025-08-08 15:17 [PATCH 00/21] gpiolib: fence off legacy interfaces Arnd Bergmann
` (2 preceding siblings ...)
2025-08-08 15:17 ` [PATCH 03/21] mips: select legacy gpiolib interfaces where used Arnd Bergmann
@ 2025-08-08 15:17 ` Arnd Bergmann
2025-08-12 18:28 ` Rob Landley
2025-08-08 15:17 ` [PATCH 05/21] x86/platform: select legacy gpiolib interfaces where used Arnd Bergmann
` (19 subsequent siblings)
23 siblings, 1 reply; 62+ messages in thread
From: Arnd Bergmann @ 2025-08-08 15:17 UTC (permalink / raw)
To: Bartosz Golaszewski, Linus Walleij, linux-gpio, Yoshinori Sato,
Rich Felker, John Paul Adrian Glaubitz
Cc: Arnd Bergmann, Michael Ellerman, Steven Rostedt, Paul E. McKenney,
Masahiro Yamada, Dave Vasilevsky, Geert Uytterhoeven, linux-sh,
linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
Many board files on sh reference the legacy gpiolib interfaces that
are becoming optional. To ensure the boards can keep building, select
CONFIG_GPIOLIB_LEGACY on each of the boards that have one of the
hardcoded calls.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/sh/Kconfig | 1 +
arch/sh/boards/Kconfig | 8 ++++++++
arch/sh/boards/mach-highlander/Kconfig | 1 +
arch/sh/boards/mach-rsk/Kconfig | 3 +++
4 files changed, 13 insertions(+)
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index d5795067befa..d60f1d5a94c0 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -462,6 +462,7 @@ config CPU_SUBTYPE_SHX3
select CPU_SHX3
select GENERIC_CLOCKEVENTS_BROADCAST if SMP
select GPIOLIB
+ select GPIOLIB_LEGACY
select PINCTRL
# SH4AL-DSP Processor Support
diff --git a/arch/sh/boards/Kconfig b/arch/sh/boards/Kconfig
index 1af93be61b1f..d89b74177233 100644
--- a/arch/sh/boards/Kconfig
+++ b/arch/sh/boards/Kconfig
@@ -80,6 +80,7 @@ config SH_7724_SOLUTION_ENGINE
select SOLUTION_ENGINE
depends on CPU_SUBTYPE_SH7724
select GPIOLIB
+ select GPIOLIB_LEGACY
select REGULATOR_FIXED_VOLTAGE if REGULATOR
imply SND_SOC_AK4642 if SND_SIMPLE_CARD
help
@@ -199,6 +200,7 @@ config SH_SH7757LCR
bool "SH7757LCR"
depends on CPU_SUBTYPE_SH7757
select GPIOLIB
+ select GPIOLIB_LEGACY
select REGULATOR_FIXED_VOLTAGE if REGULATOR
config SH_SH7785LCR
@@ -226,6 +228,7 @@ config SH_URQUELL
bool "Urquell"
depends on CPU_SUBTYPE_SH7786
select GPIOLIB
+ select GPIOLIB_LEGACY
select HAVE_PCI
select NO_IOPORT_MAP if !PCI
@@ -233,6 +236,7 @@ config SH_MIGOR
bool "Migo-R"
depends on CPU_SUBTYPE_SH7722
select GPIOLIB
+ select GPIOLIB_LEGACY
select REGULATOR_FIXED_VOLTAGE if REGULATOR
help
Select Migo-R if configuring for the SH7722 Migo-R platform
@@ -242,6 +246,7 @@ config SH_AP325RXA
bool "AP-325RXA"
depends on CPU_SUBTYPE_SH7723
select GPIOLIB
+ select GPIOLIB_LEGACY
select REGULATOR_FIXED_VOLTAGE if REGULATOR
help
Renesas "AP-325RXA" support.
@@ -251,6 +256,7 @@ config SH_KFR2R09
bool "KFR2R09"
depends on CPU_SUBTYPE_SH7724
select GPIOLIB
+ select GPIOLIB_LEGACY
select REGULATOR_FIXED_VOLTAGE if REGULATOR
help
"Kit For R2R for 2009" support.
@@ -259,6 +265,7 @@ config SH_ECOVEC
bool "EcoVec"
depends on CPU_SUBTYPE_SH7724
select GPIOLIB
+ select GPIOLIB_LEGACY
select REGULATOR_FIXED_VOLTAGE if REGULATOR
imply SND_SOC_DA7210 if SND_SIMPLE_CARD
help
@@ -329,6 +336,7 @@ config SH_MAGIC_PANEL_R2
bool "Magic Panel R2"
depends on CPU_SUBTYPE_SH7720
select GPIOLIB
+ select GPIOLIB_LEGACY
select REGULATOR_FIXED_VOLTAGE if REGULATOR
help
Select Magic Panel R2 if configuring for Magic Panel R2.
diff --git a/arch/sh/boards/mach-highlander/Kconfig b/arch/sh/boards/mach-highlander/Kconfig
index b0abd03cac4e..cd3a553ce30c 100644
--- a/arch/sh/boards/mach-highlander/Kconfig
+++ b/arch/sh/boards/mach-highlander/Kconfig
@@ -20,6 +20,7 @@ config SH_R7785RP
bool "R7785RP board support"
depends on CPU_SUBTYPE_SH7785
select GPIOLIB
+ select GPIOLIB_LEGACY
endchoice
diff --git a/arch/sh/boards/mach-rsk/Kconfig b/arch/sh/boards/mach-rsk/Kconfig
index f0299bc4416f..3810937aa5d4 100644
--- a/arch/sh/boards/mach-rsk/Kconfig
+++ b/arch/sh/boards/mach-rsk/Kconfig
@@ -12,16 +12,19 @@ config SH_RSK7201
config SH_RSK7203
bool "RSK7203"
select GPIOLIB
+ select GPIOLIB_LEGACY
depends on CPU_SUBTYPE_SH7203
config SH_RSK7264
bool "RSK2+SH7264"
select GPIOLIB
+ select GPIOLIB_LEGACY
depends on CPU_SUBTYPE_SH7264
config SH_RSK7269
bool "RSK2+SH7269"
select GPIOLIB
+ select GPIOLIB_LEGACY
depends on CPU_SUBTYPE_SH7269
endchoice
--
2.39.5
^ permalink raw reply related [flat|nested] 62+ messages in thread
* [PATCH 05/21] x86/platform: select legacy gpiolib interfaces where used
2025-08-08 15:17 [PATCH 00/21] gpiolib: fence off legacy interfaces Arnd Bergmann
` (3 preceding siblings ...)
2025-08-08 15:17 ` [PATCH 04/21] sh: select legacy gpiolib interface Arnd Bergmann
@ 2025-08-08 15:17 ` Arnd Bergmann
2025-08-09 10:00 ` Andy Shevchenko
2025-08-08 15:17 ` [PATCH 06/21] x86/olpc: select GPIOLIB_LEGACY Arnd Bergmann
` (18 subsequent siblings)
23 siblings, 1 reply; 62+ messages in thread
From: Arnd Bergmann @ 2025-08-08 15:17 UTC (permalink / raw)
To: Bartosz Golaszewski, Linus Walleij, linux-gpio, Dmitry Torokhov,
Hans de Goede, Ilpo Järvinen
Cc: Arnd Bergmann, Lee Jones, Dzmitry Sankouski, Heiko Stuebner,
Dr. David Alan Gilbert, Thomas Weißschuh, Guenter Roeck,
Andy Shevchenko, linux-input, linux-kernel, platform-driver-x86
From: Arnd Bergmann <arnd@arndb.de>
A few old machines have not been converted away from the old-style
gpiolib interfaces. Make these select the new CONFIG_GPIOLIB_LEGACY
symbol so the code still works where it is needed but can be left
out otherwise.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/input/misc/Kconfig | 3 +++
drivers/platform/x86/Kconfig | 3 +++
drivers/platform/x86/x86-android-tablets/Kconfig | 1 +
3 files changed, 7 insertions(+)
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 0fb21c99a5e3..681d4123ef2b 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -860,6 +860,9 @@ config INPUT_IDEAPAD_SLIDEBAR
config INPUT_SOC_BUTTON_ARRAY
tristate "Windows-compatible SoC Button Array"
depends on KEYBOARD_GPIO && ACPI
+ depends on X86
+ depends on GPIOLIB
+ select GPIOLIB_LEGACY
help
Say Y here if you have a SoC-based tablet that originally runs
Windows 8 or a Microsoft Surface Book 2, Pro 5, Laptop 1 or later.
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index 6d238e120dce..979a2fce8fc1 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -309,6 +309,7 @@ config MERAKI_MX100
depends on GPIOLIB
depends on GPIO_ICH
depends on LEDS_CLASS
+ select GPIOLIB_LEGACY
select LEDS_GPIO
help
This driver provides support for the front button and LEDs on
@@ -564,6 +565,7 @@ config PCENGINES_APU2
depends on INPUT && INPUT_KEYBOARD && GPIOLIB
depends on LEDS_CLASS
select GPIO_AMD_FCH
+ select GPIOLIB_LEGACY
select KEYBOARD_GPIO_POLLED
select LEDS_GPIO
help
@@ -591,6 +593,7 @@ config PORTWELL_EC
config BARCO_P50_GPIO
tristate "Barco P50 GPIO driver for identify LED/button"
depends on GPIOLIB
+ select GPIOLIB_LEGACY
help
This driver provides access to the GPIOs for the identify button
and led present on Barco P50 board.
diff --git a/drivers/platform/x86/x86-android-tablets/Kconfig b/drivers/platform/x86/x86-android-tablets/Kconfig
index 193da15ee01c..54fa6112c9ea 100644
--- a/drivers/platform/x86/x86-android-tablets/Kconfig
+++ b/drivers/platform/x86/x86-android-tablets/Kconfig
@@ -8,6 +8,7 @@ config X86_ANDROID_TABLETS
depends on I2C && SPI && SERIAL_DEV_BUS
depends on GPIOLIB && PMIC_OPREGION
depends on ACPI && EFI && PCI
+ select GPIOLIB_LEGACY
select NEW_LEDS
select LEDS_CLASS
select POWER_SUPPLY
--
2.39.5
^ permalink raw reply related [flat|nested] 62+ messages in thread
* [PATCH 06/21] x86/olpc: select GPIOLIB_LEGACY
2025-08-08 15:17 [PATCH 00/21] gpiolib: fence off legacy interfaces Arnd Bergmann
` (4 preceding siblings ...)
2025-08-08 15:17 ` [PATCH 05/21] x86/platform: select legacy gpiolib interfaces where used Arnd Bergmann
@ 2025-08-08 15:17 ` Arnd Bergmann
2025-08-12 17:01 ` Borislav Petkov
2025-08-08 15:17 ` [PATCH 07/21] mfd: wm8994: remove dead legacy-gpio code Arnd Bergmann
` (17 subsequent siblings)
23 siblings, 1 reply; 62+ messages in thread
From: Arnd Bergmann @ 2025-08-08 15:17 UTC (permalink / raw)
To: Bartosz Golaszewski, Linus Walleij, linux-gpio, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, Dave Hansen, x86, Jaroslav Kysela,
Takashi Iwai
Cc: Arnd Bergmann, H. Peter Anvin, Andrew Morton,
Mateusz Jończyk, linux-kernel, linux-sound
From: Arnd Bergmann <arnd@arndb.de>
The OLPC GPIO controller sets up a fixed number space that is used
by at least two drivers:
arch/x86/platform/olpc/olpc-xo1-sci.c: In function 'setup_ec_sci':
arch/x86/platform/olpc/olpc-xo1-sci.c:358:13: error: implicit declaration of function 'gpio_request' [-Wimplicit-function-declaration]
358 | r = gpio_request(OLPC_GPIO_ECSCI, "OLPC-ECSCI");
| ^~~~~~~~~~~~
sound/pci/cs5535audio/cs5535audio_olpc.c: In function 'olpc_analog_input':
sound/pci/cs5535audio/cs5535audio_olpc.c:41:9: error: implicit declaration of function 'gpio_set_value'; did you mean 'gpiod_set_value'? [-Wimplicit-function-declaration]
41 | gpio_set_value(OLPC_GPIO_MIC_AC, on);
Select CONFIG_GPIOLIB_LEGACY for this platform and make sure the
sound driver portion cannot be compiled without this.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/x86/Kconfig | 1 +
sound/pci/Kconfig | 1 +
2 files changed, 2 insertions(+)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 58d890fe2100..3fd5e378a9f1 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -3006,6 +3006,7 @@ config OLPC
bool "One Laptop Per Child support"
depends on !X86_PAE
select GPIOLIB
+ select GPIOLIB_LEGACY
select OF
select OF_PROMTREE
select IRQ_DOMAIN
diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig
index e0996a9d90b0..6366f72b3667 100644
--- a/sound/pci/Kconfig
+++ b/sound/pci/Kconfig
@@ -300,6 +300,7 @@ config SND_CS5535AUDIO
tristate "CS5535/CS5536 Audio"
depends on X86_32 || MIPS || COMPILE_TEST
depends on HAS_IOPORT
+ depends on GPIOLIB_LEGACY || !OLPC
select SND_PCM
select SND_AC97_CODEC
help
--
2.39.5
^ permalink raw reply related [flat|nested] 62+ messages in thread
* [PATCH 07/21] mfd: wm8994: remove dead legacy-gpio code
2025-08-08 15:17 [PATCH 00/21] gpiolib: fence off legacy interfaces Arnd Bergmann
` (5 preceding siblings ...)
2025-08-08 15:17 ` [PATCH 06/21] x86/olpc: select GPIOLIB_LEGACY Arnd Bergmann
@ 2025-08-08 15:17 ` Arnd Bergmann
2025-08-11 13:14 ` Bartosz Golaszewski
2025-08-08 15:17 ` [PATCH 08/21] ASoC: add GPIOLIB_LEGACY dependency where needed Arnd Bergmann
` (16 subsequent siblings)
23 siblings, 1 reply; 62+ messages in thread
From: Arnd Bergmann @ 2025-08-08 15:17 UTC (permalink / raw)
To: Bartosz Golaszewski, Linus Walleij, linux-gpio, Lee Jones
Cc: Arnd Bergmann, Thomas Gleixner, Jiri Slaby (SUSE), patches,
linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
The old-style gpio handling in wm8994 came from a commit 7c8844481a1c
("mfd: wm8994: Emulate level triggered interrupts if required") in
linux-3.11, but nothing in the kernel ever set the 'irq_gpio' member
in the wm8994_pdata structure, so this was always dead code.
Remove it now to reduce the dependency on the legacy gpio interfaces.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/mfd/wm8994-irq.c | 94 ++------------------------------
include/linux/mfd/wm8994/pdata.h | 5 --
2 files changed, 4 insertions(+), 95 deletions(-)
diff --git a/drivers/mfd/wm8994-irq.c b/drivers/mfd/wm8994-irq.c
index 1475b1ac6983..a46cea948763 100644
--- a/drivers/mfd/wm8994-irq.c
+++ b/drivers/mfd/wm8994-irq.c
@@ -135,53 +135,9 @@ static const struct regmap_irq_chip wm8994_irq_chip = {
.runtime_pm = true,
};
-static void wm8994_edge_irq_enable(struct irq_data *data)
-{
-}
-
-static void wm8994_edge_irq_disable(struct irq_data *data)
-{
-}
-
-static struct irq_chip wm8994_edge_irq_chip = {
- .name = "wm8994_edge",
- .irq_disable = wm8994_edge_irq_disable,
- .irq_enable = wm8994_edge_irq_enable,
-};
-
-static irqreturn_t wm8994_edge_irq(int irq, void *data)
-{
- struct wm8994 *wm8994 = data;
-
- while (gpio_get_value_cansleep(wm8994->pdata.irq_gpio))
- handle_nested_irq(irq_find_mapping(wm8994->edge_irq, 0));
-
- return IRQ_HANDLED;
-}
-
-static int wm8994_edge_irq_map(struct irq_domain *h, unsigned int virq,
- irq_hw_number_t hw)
-{
- struct wm8994 *wm8994 = h->host_data;
-
- irq_set_chip_data(virq, wm8994);
- irq_set_chip_and_handler(virq, &wm8994_edge_irq_chip, handle_edge_irq);
- irq_set_nested_thread(virq, 1);
- irq_set_noprobe(virq);
-
- return 0;
-}
-
-static const struct irq_domain_ops wm8994_edge_irq_ops = {
- .map = wm8994_edge_irq_map,
- .xlate = irq_domain_xlate_twocell,
-};
-
int wm8994_irq_init(struct wm8994 *wm8994)
{
int ret;
- unsigned long irqflags;
- struct wm8994_pdata *pdata = &wm8994->pdata;
if (!wm8994->irq) {
dev_warn(wm8994->dev,
@@ -190,53 +146,11 @@ int wm8994_irq_init(struct wm8994 *wm8994)
return 0;
}
- /* select user or default irq flags */
- irqflags = IRQF_TRIGGER_HIGH | IRQF_ONESHOT;
- if (pdata->irq_flags)
- irqflags = pdata->irq_flags;
-
/* use a GPIO for edge triggered controllers */
- if (irqflags & (IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING)) {
- if (gpio_to_irq(pdata->irq_gpio) != wm8994->irq) {
- dev_warn(wm8994->dev, "IRQ %d is not GPIO %d (%d)\n",
- wm8994->irq, pdata->irq_gpio,
- gpio_to_irq(pdata->irq_gpio));
- wm8994->irq = gpio_to_irq(pdata->irq_gpio);
- }
-
- ret = devm_gpio_request_one(wm8994->dev, pdata->irq_gpio,
- GPIOF_IN, "WM8994 IRQ");
-
- if (ret != 0) {
- dev_err(wm8994->dev, "Failed to get IRQ GPIO: %d\n",
- ret);
- return ret;
- }
-
- wm8994->edge_irq = irq_domain_create_linear(NULL, 1, &wm8994_edge_irq_ops, wm8994);
-
- ret = regmap_add_irq_chip(wm8994->regmap,
- irq_create_mapping(wm8994->edge_irq,
- 0),
- IRQF_ONESHOT,
- wm8994->irq_base, &wm8994_irq_chip,
- &wm8994->irq_data);
- if (ret != 0) {
- dev_err(wm8994->dev, "Failed to get IRQ: %d\n",
- ret);
- return ret;
- }
-
- ret = request_threaded_irq(wm8994->irq,
- NULL, wm8994_edge_irq,
- irqflags,
- "WM8994 edge", wm8994);
- } else {
- ret = regmap_add_irq_chip(wm8994->regmap, wm8994->irq,
- irqflags,
- wm8994->irq_base, &wm8994_irq_chip,
- &wm8994->irq_data);
- }
+ ret = regmap_add_irq_chip(wm8994->regmap, wm8994->irq,
+ IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
+ wm8994->irq_base, &wm8994_irq_chip,
+ &wm8994->irq_data);
if (ret != 0) {
dev_err(wm8994->dev, "Failed to register IRQ chip: %d\n", ret);
diff --git a/include/linux/mfd/wm8994/pdata.h b/include/linux/mfd/wm8994/pdata.h
index 6e2962ef5b81..b95a56a338c3 100644
--- a/include/linux/mfd/wm8994/pdata.h
+++ b/include/linux/mfd/wm8994/pdata.h
@@ -226,11 +226,6 @@ struct wm8994_pdata {
* lines is mastered.
*/
int max_channels_clocked[WM8994_NUM_AIF];
-
- /**
- * GPIO for the IRQ pin if host only supports edge triggering
- */
- int irq_gpio;
};
#endif
--
2.39.5
^ permalink raw reply related [flat|nested] 62+ messages in thread
* [PATCH 08/21] ASoC: add GPIOLIB_LEGACY dependency where needed
2025-08-08 15:17 [PATCH 00/21] gpiolib: fence off legacy interfaces Arnd Bergmann
` (6 preceding siblings ...)
2025-08-08 15:17 ` [PATCH 07/21] mfd: wm8994: remove dead legacy-gpio code Arnd Bergmann
@ 2025-08-08 15:17 ` Arnd Bergmann
2025-08-08 15:17 ` [PATCH 09/21] input: gpio-keys: make legacy gpiolib optional Arnd Bergmann
` (15 subsequent siblings)
23 siblings, 0 replies; 62+ messages in thread
From: Arnd Bergmann @ 2025-08-08 15:17 UTC (permalink / raw)
To: Bartosz Golaszewski, Linus Walleij, linux-gpio, Liam Girdwood,
Mark Brown, Jaroslav Kysela, Takashi Iwai
Cc: Arnd Bergmann, ChiYuan Huang, Igor Prusov, Weidong Wang,
Richard Fitzgerald, Binbin Zhou, Jack Yu, Shenghao Ding, Nuno Sa,
André Apitzsch, linux-sound, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
In order to make the legacy gpiolib interfaces such as gpio_request()
optional, mark the three ASoC driver that rely on it today with a
dependency on the new Kconfig symbol.
The tlv320dac33 and ak4641 drivers have no in-tree users, while the
uda1380 driver is theoretically referened by two lpc3250 based boards,
but neither of them work because of the legacy gpiolib dependency.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
sound/soc/codecs/Kconfig | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index 6d7e4725d89c..759bcb8260cd 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -622,6 +622,7 @@ config SND_SOC_AK4619
config SND_SOC_AK4641
tristate
depends on I2C
+ depends on GPIOLIB_LEGACY
config SND_SOC_AK4642
tristate "AKM AK4642 CODEC"
@@ -2175,6 +2176,7 @@ config SND_SOC_TLV320AIC3X_SPI
config SND_SOC_TLV320DAC33
tristate
depends on I2C
+ depends on GPIOLIB_LEGACY
config SND_SOC_TLV320ADCX140
tristate "Texas Instruments TLV320ADCX140 CODEC family"
@@ -2229,6 +2231,7 @@ config SND_SOC_UDA1342
config SND_SOC_UDA1380
tristate
depends on I2C
+ depends on GPIOLIB_LEGACY
config SND_SOC_WCD_CLASSH
tristate
--
2.39.5
^ permalink raw reply related [flat|nested] 62+ messages in thread
* [PATCH 09/21] input: gpio-keys: make legacy gpiolib optional
2025-08-08 15:17 [PATCH 00/21] gpiolib: fence off legacy interfaces Arnd Bergmann
` (7 preceding siblings ...)
2025-08-08 15:17 ` [PATCH 08/21] ASoC: add GPIOLIB_LEGACY dependency where needed Arnd Bergmann
@ 2025-08-08 15:17 ` Arnd Bergmann
2025-08-11 10:34 ` Matti Vaittinen
2025-08-08 15:17 ` [PATCH 10/21] leds: gpio: make legacy gpiolib interface optional Arnd Bergmann
` (14 subsequent siblings)
23 siblings, 1 reply; 62+ messages in thread
From: Arnd Bergmann @ 2025-08-08 15:17 UTC (permalink / raw)
To: Bartosz Golaszewski, Linus Walleij, linux-gpio, Dmitry Torokhov,
Matti Vaittinen, Lee Jones
Cc: Arnd Bergmann, Gatien Chevallier, Fabrice Gasnier,
Andy Shevchenko, Bartosz Golaszewski, Thomas Gleixner,
Charles Keepax, Krzysztof Kozlowski, Christophe JAILLET,
linux-input, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
Most users of gpio-keys and gpio-keys-polled use modern gpiolib
interfaces, but there are still number of ancient sh, arm32 and x86
machines that have never been converted.
Add an #ifdef block for the parts of the driver that are only
used on those legacy machines.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/input/keyboard/gpio_keys.c | 5 +++--
drivers/input/keyboard/gpio_keys_polled.c | 2 ++
drivers/mfd/rohm-bd71828.c | 2 ++
drivers/mfd/rohm-bd718x7.c | 2 ++
include/linux/gpio_keys.h | 2 ++
5 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index f9db86da0818..984b20f773ed 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -528,6 +528,7 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
*/
bdata->gpiod = NULL;
}
+#ifdef CONFIG_GPIOLIB_LEGACY
} else if (gpio_is_valid(button->gpio)) {
/*
* Legacy GPIO number, so request the GPIO here and
@@ -546,6 +547,7 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
if (button->active_low ^ gpiod_is_active_low(bdata->gpiod))
gpiod_toggle_active_low(bdata->gpiod);
+#endif
}
if (bdata->gpiod) {
@@ -583,8 +585,7 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
if (irq < 0) {
error = irq;
dev_err_probe(dev, error,
- "Unable to get irq number for GPIO %d\n",
- button->gpio);
+ "Unable to get irq number for GPIO\n");
return error;
}
bdata->irq = irq;
diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c
index e6707d72210e..0ae0e53910ea 100644
--- a/drivers/input/keyboard/gpio_keys_polled.c
+++ b/drivers/input/keyboard/gpio_keys_polled.c
@@ -301,6 +301,7 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)
return dev_err_probe(dev, PTR_ERR(bdata->gpiod),
"failed to get gpio\n");
}
+#ifdef CONFIG_GPIOLIB_LEGACY
} else if (gpio_is_valid(button->gpio)) {
/*
* Legacy GPIO number so request the GPIO here and
@@ -323,6 +324,7 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)
if (button->active_low ^ gpiod_is_active_low(bdata->gpiod))
gpiod_toggle_active_low(bdata->gpiod);
+#endif
}
bdata->last_state = -1;
diff --git a/drivers/mfd/rohm-bd71828.c b/drivers/mfd/rohm-bd71828.c
index a14b7aa69c3c..fb68694fadca 100644
--- a/drivers/mfd/rohm-bd71828.c
+++ b/drivers/mfd/rohm-bd71828.c
@@ -21,7 +21,9 @@
static struct gpio_keys_button button = {
.code = KEY_POWER,
+#ifdef CONFIG_GPIOLIB_LEGACY
.gpio = -1,
+#endif
.type = EV_KEY,
};
diff --git a/drivers/mfd/rohm-bd718x7.c b/drivers/mfd/rohm-bd718x7.c
index 25e494a93d48..6c99ab62e31b 100644
--- a/drivers/mfd/rohm-bd718x7.c
+++ b/drivers/mfd/rohm-bd718x7.c
@@ -20,7 +20,9 @@
static struct gpio_keys_button button = {
.code = KEY_POWER,
+#ifdef CONFIG_GPIOLIB_LEGACY
.gpio = -1,
+#endif
.type = EV_KEY,
};
diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
index 80fa930b04c6..e8d6dc290efb 100644
--- a/include/linux/gpio_keys.h
+++ b/include/linux/gpio_keys.h
@@ -25,7 +25,9 @@ struct device;
*/
struct gpio_keys_button {
unsigned int code;
+#ifdef CONFIG_GPIOLIB_LEGACY
int gpio;
+#endif
int active_low;
const char *desc;
unsigned int type;
--
2.39.5
^ permalink raw reply related [flat|nested] 62+ messages in thread
* [PATCH 10/21] leds: gpio: make legacy gpiolib interface optional
2025-08-08 15:17 [PATCH 00/21] gpiolib: fence off legacy interfaces Arnd Bergmann
` (8 preceding siblings ...)
2025-08-08 15:17 ` [PATCH 09/21] input: gpio-keys: make legacy gpiolib optional Arnd Bergmann
@ 2025-08-08 15:17 ` Arnd Bergmann
2025-08-18 15:37 ` Linus Walleij
2025-08-19 12:19 ` Lee Jones
2025-08-08 15:17 ` [PATCH 11/21] media: em28xx: add special case for legacy gpiolib interface Arnd Bergmann
` (13 subsequent siblings)
23 siblings, 2 replies; 62+ messages in thread
From: Arnd Bergmann @ 2025-08-08 15:17 UTC (permalink / raw)
To: Bartosz Golaszewski, Linus Walleij, linux-gpio, Lee Jones,
Pavel Machek
Cc: Arnd Bergmann, Javier Carrasco, Gustavo A. R. Silva,
Andy Shevchenko, Kees Cook, Anish Kumar, Mukesh Ojha,
Thomas Zimmermann, Dmitry Rokosov, linux-leds, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
There are still a handful of ancient mips/armv5/sh boards that use the
gpio_led:gpio member to pass an old-style gpio number, but all modern
users have been converted to gpio descriptors.
Make the code that deals with this optional so the legacy interfaces
can be left out for all normal builds.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/leds/leds-gpio.c | 8 ++++++--
include/linux/leds.h | 2 ++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index a3428b22de3a..e43accfa78e9 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -212,7 +212,9 @@ static struct gpio_desc *gpio_led_get_gpiod(struct device *dev, int idx,
const struct gpio_led *template)
{
struct gpio_desc *gpiod;
+#ifdef CONFIG_GPIOLIB_LEGACY
int ret;
+#endif
/*
* This means the LED does not come from the device tree
@@ -228,6 +230,7 @@ static struct gpio_desc *gpio_led_get_gpiod(struct device *dev, int idx,
return gpiod;
}
+#ifdef CONFIG_GPIOLIB_LEGACY
/*
* This is the legacy code path for platform code that
* still uses GPIO numbers. Ultimately we would like to get
@@ -244,6 +247,7 @@ static struct gpio_desc *gpio_led_get_gpiod(struct device *dev, int idx,
return ERR_PTR(ret);
gpiod = gpio_to_desc(template->gpio);
+#endif
if (!gpiod)
return ERR_PTR(-EINVAL);
@@ -276,8 +280,8 @@ static int gpio_led_probe(struct platform_device *pdev)
led_dat->gpiod =
gpio_led_get_gpiod(dev, i, template);
if (IS_ERR(led_dat->gpiod)) {
- dev_info(dev, "Skipping unavailable LED gpio %d (%s)\n",
- template->gpio, template->name);
+ dev_info(dev, "Skipping unavailable LED gpio %s\n",
+ template->name);
continue;
}
diff --git a/include/linux/leds.h b/include/linux/leds.h
index b16b803cc1ac..034643f40152 100644
--- a/include/linux/leds.h
+++ b/include/linux/leds.h
@@ -676,7 +676,9 @@ typedef int (*gpio_blink_set_t)(struct gpio_desc *desc, int state,
struct gpio_led {
const char *name;
const char *default_trigger;
+#ifdef CONFIG_GPIOLIB_LEGACY
unsigned gpio;
+#endif
unsigned active_low : 1;
unsigned retain_state_suspended : 1;
unsigned panic_indicator : 1;
--
2.39.5
^ permalink raw reply related [flat|nested] 62+ messages in thread
* [PATCH 11/21] media: em28xx: add special case for legacy gpiolib interface
2025-08-08 15:17 [PATCH 00/21] gpiolib: fence off legacy interfaces Arnd Bergmann
` (9 preceding siblings ...)
2025-08-08 15:17 ` [PATCH 10/21] leds: gpio: make legacy gpiolib interface optional Arnd Bergmann
@ 2025-08-08 15:17 ` Arnd Bergmann
2025-08-08 15:17 ` [PATCH 12/21] mfd: arizona: make legacy gpiolib interface optional Arnd Bergmann
` (12 subsequent siblings)
23 siblings, 0 replies; 62+ messages in thread
From: Arnd Bergmann @ 2025-08-08 15:17 UTC (permalink / raw)
To: Bartosz Golaszewski, Linus Walleij, linux-gpio,
Mauro Carvalho Chehab
Cc: Arnd Bergmann, linux-media, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
The em28xx driver uses the old-style gpio_request_one() inteface to
switch the lna on the PCTV 290E card.
This interface is becoming optional and should no longer be called by
portable drivers. As I could not figure out an obvious replacement,
select the new GPIOLIB_LEGACY symbol as a workaround.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/media/usb/em28xx/Kconfig | 1 +
drivers/media/usb/em28xx/em28xx-dvb.c | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/media/usb/em28xx/Kconfig b/drivers/media/usb/em28xx/Kconfig
index cb61fd6cc6c6..3122d4bdfc59 100644
--- a/drivers/media/usb/em28xx/Kconfig
+++ b/drivers/media/usb/em28xx/Kconfig
@@ -68,6 +68,7 @@ config VIDEO_EM28XX_DVB
select MEDIA_TUNER_XC5000 if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_MT2060 if MEDIA_SUBDRV_AUTOSELECT
select DVB_MXL692 if MEDIA_SUBDRV_AUTOSELECT
+ select GPIOLIB_LEGACY if GPIOLIB && DVB_CXD2820R
help
This adds support for DVB cards based on the
Empiatech em28xx chips.
diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c
index 9fce59979e3b..b94f5c70ab75 100644
--- a/drivers/media/usb/em28xx/em28xx-dvb.c
+++ b/drivers/media/usb/em28xx/em28xx-dvb.c
@@ -727,7 +727,7 @@ static int em28xx_pctv_290e_set_lna(struct dvb_frontend *fe)
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
struct em28xx_i2c_bus *i2c_bus = fe->dvb->priv;
struct em28xx *dev = i2c_bus->dev;
-#ifdef CONFIG_GPIOLIB
+#ifdef CONFIG_GPIOLIB_LEGACY
struct em28xx_dvb *dvb = dev->dvb;
int ret;
unsigned long flags;
@@ -1705,7 +1705,7 @@ static int em28xx_dvb_init(struct em28xx *dev)
goto out_free;
}
-#ifdef CONFIG_GPIOLIB
+#ifdef CONFIG_GPIOLIB_LEGACY
/* enable LNA for DVB-T, DVB-T2 and DVB-C */
result = gpio_request_one(dvb->lna_gpio,
GPIOF_OUT_INIT_LOW, NULL);
--
2.39.5
^ permalink raw reply related [flat|nested] 62+ messages in thread
* [PATCH 12/21] mfd: arizona: make legacy gpiolib interface optional
2025-08-08 15:17 [PATCH 00/21] gpiolib: fence off legacy interfaces Arnd Bergmann
` (10 preceding siblings ...)
2025-08-08 15:17 ` [PATCH 11/21] media: em28xx: add special case for legacy gpiolib interface Arnd Bergmann
@ 2025-08-08 15:17 ` Arnd Bergmann
2025-09-02 12:44 ` Lee Jones
2025-08-08 15:17 ` [PATCH 13/21] mfd: si476x: add GPIOLIB_LEGACY dependency Arnd Bergmann
` (11 subsequent siblings)
23 siblings, 1 reply; 62+ messages in thread
From: Arnd Bergmann @ 2025-08-08 15:17 UTC (permalink / raw)
To: Bartosz Golaszewski, Linus Walleij, linux-gpio, Lee Jones,
Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai
Cc: Arnd Bergmann, Jiri Slaby (SUSE), Sakari Ailus, Charles Keepax,
patches, linux-kernel, linux-sound
From: Arnd Bergmann <arnd@arndb.de>
The only machine that still uses the old gpio number based interface
is the wlf_cragg_6410 board file. In order to remove the dependency
on the interfaces, add #ifdef blocks here.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/mfd/arizona-irq.c | 5 ++++-
include/linux/mfd/arizona/pdata.h | 6 ++++++
sound/soc/codecs/arizona-jack.c | 17 ++++++++++++++++-
3 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/drivers/mfd/arizona-irq.c b/drivers/mfd/arizona-irq.c
index 3f8622ee0e59..544016d420fe 100644
--- a/drivers/mfd/arizona-irq.c
+++ b/drivers/mfd/arizona-irq.c
@@ -136,7 +136,7 @@ static irqreturn_t arizona_irq_thread(int irq, void *data)
dev_err(arizona->dev,
"Failed to read main IRQ status: %d\n", ret);
}
-
+#ifdef CONFIG_GPIOLIB_LEGACY
/*
* Poll the IRQ pin status to see if we're really done
* if the interrupt controller can't do it for us.
@@ -150,6 +150,7 @@ static irqreturn_t arizona_irq_thread(int irq, void *data)
!gpio_get_value_cansleep(arizona->pdata.irq_gpio)) {
poll = true;
}
+#endif
} while (poll);
pm_runtime_put_autosuspend(arizona->dev);
@@ -349,6 +350,7 @@ int arizona_irq_init(struct arizona *arizona)
goto err_map_main_irq;
}
+#ifdef CONFIG_GPIOLIB_LEGACY
/* Used to emulate edge trigger and to work around broken pinmux */
if (arizona->pdata.irq_gpio) {
if (gpio_to_irq(arizona->pdata.irq_gpio) != arizona->irq) {
@@ -368,6 +370,7 @@ int arizona_irq_init(struct arizona *arizona)
arizona->pdata.irq_gpio = 0;
}
}
+#endif
ret = request_threaded_irq(arizona->irq, NULL, arizona_irq_thread,
flags, "arizona", arizona);
diff --git a/include/linux/mfd/arizona/pdata.h b/include/linux/mfd/arizona/pdata.h
index 2d13bbea4f3a..f72e6d4b14a7 100644
--- a/include/linux/mfd/arizona/pdata.h
+++ b/include/linux/mfd/arizona/pdata.h
@@ -117,8 +117,10 @@ struct arizona_pdata {
/** Check for line output with HPDET method */
bool hpdet_acc_id_line;
+#ifdef CONFIG_GPIOLIB_LEGACY
/** GPIO used for mic isolation with HPDET */
int hpdet_id_gpio;
+#endif
/** Channel to use for headphone detection */
unsigned int hpdet_channel;
@@ -129,8 +131,10 @@ struct arizona_pdata {
/** Extra debounce timeout used during initial mic detection (ms) */
unsigned int micd_detect_debounce;
+#ifdef CONFIG_GPIOLIB_LEGACY
/** GPIO for mic detection polarity */
int micd_pol_gpio;
+#endif
/** Mic detect ramp rate */
unsigned int micd_bias_start_time;
@@ -184,8 +188,10 @@ struct arizona_pdata {
/** Haptic actuator type */
unsigned int hap_act;
+#ifdef CONFIG_GPIOLIB_LEGACY
/** GPIO for primary IRQ (used for edge triggered emulation) */
int irq_gpio;
+#endif
/** General purpose switch control */
unsigned int gpsw;
diff --git a/sound/soc/codecs/arizona-jack.c b/sound/soc/codecs/arizona-jack.c
index 22f9c431a0e5..6b55610ad535 100644
--- a/sound/soc/codecs/arizona-jack.c
+++ b/sound/soc/codecs/arizona-jack.c
@@ -461,7 +461,11 @@ static int arizona_hpdet_do_id(struct arizona_priv *info, int *reading,
bool *mic)
{
struct arizona *arizona = info->arizona;
+#ifdef CONFIG_GPIOLIB_LEGACY
int id_gpio = arizona->pdata.hpdet_id_gpio;
+#else
+ int id_gpio = 0;
+#endif
if (!arizona->pdata.hpdet_acc_id)
return 0;
@@ -472,6 +476,7 @@ static int arizona_hpdet_do_id(struct arizona_priv *info, int *reading,
*/
info->hpdet_res[info->num_hpdet_res++] = *reading;
+#ifdef CONFIG_GPIOLIB_LEGACY
/* Only check the mic directly if we didn't already ID it */
if (id_gpio && info->num_hpdet_res == 1) {
dev_dbg(arizona->dev, "Measuring mic\n");
@@ -489,6 +494,7 @@ static int arizona_hpdet_do_id(struct arizona_priv *info, int *reading,
ARIZONA_HP_POLL, ARIZONA_HP_POLL);
return -EAGAIN;
}
+#endif
/* OK, got both. Now, compare... */
dev_dbg(arizona->dev, "HPDET measured %d %d\n",
@@ -529,7 +535,9 @@ static irqreturn_t arizona_hpdet_irq(int irq, void *data)
{
struct arizona_priv *info = data;
struct arizona *arizona = info->arizona;
+#ifdef CONFIG_GPIOLIB_LEGACY
int id_gpio = arizona->pdata.hpdet_id_gpio;
+#endif
int ret, reading, state, report;
bool mic = false;
@@ -585,8 +593,10 @@ static irqreturn_t arizona_hpdet_irq(int irq, void *data)
arizona_extcon_hp_clamp(info, false);
+#ifdef CONFIG_GPIOLIB_LEGACY
if (id_gpio)
gpio_set_value_cansleep(id_gpio, 0);
+#endif
/* If we have a mic then reenable MICDET */
if (state && (mic || info->mic))
@@ -1317,6 +1327,7 @@ int arizona_jack_codec_dev_probe(struct arizona_priv *info, struct device *dev)
regmap_update_bits(arizona->regmap, ARIZONA_GP_SWITCH_1,
ARIZONA_SW1_MODE_MASK, arizona->pdata.gpsw);
+#ifdef CONFIG_GPIOLIB_LEGACY
if (pdata->micd_pol_gpio > 0) {
if (info->micd_modes[0].gpio)
mode = GPIOF_OUT_INIT_HIGH;
@@ -1332,7 +1343,9 @@ int arizona_jack_codec_dev_probe(struct arizona_priv *info, struct device *dev)
}
info->micd_pol_gpio = gpio_to_desc(pdata->micd_pol_gpio);
- } else {
+ } else
+#endif
+ {
if (info->micd_modes[0].gpio)
mode = GPIOD_OUT_HIGH;
else
@@ -1353,6 +1366,7 @@ int arizona_jack_codec_dev_probe(struct arizona_priv *info, struct device *dev)
}
}
+#ifdef CONFIG_GPIOLIB_LEGACY
if (arizona->pdata.hpdet_id_gpio > 0) {
ret = devm_gpio_request_one(dev, arizona->pdata.hpdet_id_gpio,
GPIOF_OUT_INIT_LOW,
@@ -1364,6 +1378,7 @@ int arizona_jack_codec_dev_probe(struct arizona_priv *info, struct device *dev)
return ret;
}
}
+#endif
return 0;
}
--
2.39.5
^ permalink raw reply related [flat|nested] 62+ messages in thread
* [PATCH 13/21] mfd: si476x: add GPIOLIB_LEGACY dependency
2025-08-08 15:17 [PATCH 00/21] gpiolib: fence off legacy interfaces Arnd Bergmann
` (11 preceding siblings ...)
2025-08-08 15:17 ` [PATCH 12/21] mfd: arizona: make legacy gpiolib interface optional Arnd Bergmann
@ 2025-08-08 15:17 ` Arnd Bergmann
2025-08-08 15:17 ` [PATCH 14/21] mfd: aat2870: " Arnd Bergmann
` (10 subsequent siblings)
23 siblings, 0 replies; 62+ messages in thread
From: Arnd Bergmann @ 2025-08-08 15:17 UTC (permalink / raw)
To: Bartosz Golaszewski, Linus Walleij, linux-gpio, Lee Jones,
Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai
Cc: Arnd Bergmann, kernel test robot, Dr. David Alan Gilbert,
André Draszik, Krzysztof Kozlowski, Thomas Richard,
Charles Keepax, linux-kernel, linux-sound
From: Arnd Bergmann <arnd@arndb.de>
This driver uses the legacy gpiolib interfaces to get gpio
numbers from platform data:
drivers/mfd/si476x-i2c.c: In function 'si476x_core_start':
drivers/mfd/si476x-i2c.c:133:21: error: implicit declaration of function 'gpio_is_valid'; did you mean 'uuid_is_valid'? [-Werror=implicit-function-declaration]
133 | if (gpio_is_valid(core->gpio_reset))
There are no in-tree users of this driver, so nothing defines
the platform data.
Add a dependency on GPIOLIB_LEGACY for the moment to avoid the build
failure, and make sure the sound driver does not get built without the
mfd portion either pass that dependency along.
Alternatively, we could remove the mfd driver along with the radio and
sound portions.
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202507231653.UFlH2dMO-lkp@intel.com/
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/mfd/Kconfig | 1 +
sound/soc/codecs/Kconfig | 1 +
2 files changed, 2 insertions(+)
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 425c5fba6cb1..6d52a3d22430 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -1411,6 +1411,7 @@ config MFD_SEC_I2C
config MFD_SI476X_CORE
tristate "Silicon Laboratories 4761/64/68 AM/FM radio."
depends on I2C
+ depends on GPIOLIB_LEGACY
select MFD_CORE
select REGMAP_I2C
help
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index 759bcb8260cd..9d5b449fa747 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -1903,6 +1903,7 @@ config SND_SOC_SGTL5000
config SND_SOC_SI476X
tristate
+ depends on MFD_SI476X_CORE
config SND_SOC_SIGMADSP
tristate
--
2.39.5
^ permalink raw reply related [flat|nested] 62+ messages in thread
* [PATCH 14/21] mfd: aat2870: add GPIOLIB_LEGACY dependency
2025-08-08 15:17 [PATCH 00/21] gpiolib: fence off legacy interfaces Arnd Bergmann
` (12 preceding siblings ...)
2025-08-08 15:17 ` [PATCH 13/21] mfd: si476x: add GPIOLIB_LEGACY dependency Arnd Bergmann
@ 2025-08-08 15:17 ` Arnd Bergmann
2025-08-08 15:17 ` [PATCH 15/21] dsa: b53: hide legacy gpiolib usage on non-mips Arnd Bergmann
` (9 subsequent siblings)
23 siblings, 0 replies; 62+ messages in thread
From: Arnd Bergmann @ 2025-08-08 15:17 UTC (permalink / raw)
To: Bartosz Golaszewski, Linus Walleij, linux-gpio, Lee Jones
Cc: Arnd Bergmann, Dr. David Alan Gilbert, André Draszik,
Thomas Richard, Robert Marko, Charles Keepax, Sven Peter,
Heiko Stuebner, Lukas Bulwahn, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
This driver uses the legacy gpiolib interfaces to get gpio
numbers from platform data. There are no in-tree users of
this driver, so nothing defines the platform data.
Add a dependency on GPIOLIB_LEGACY for the moment to avoid the build
failure, and make sure the sound driver does not get built without the
mfd portion either pass that dependency along.
Alternatively, we could remove the mfd driver along with the backlight
and regulator portions.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/mfd/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 6d52a3d22430..d2bb88bd5917 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -129,6 +129,7 @@ config MFD_AAT2870_CORE
select MFD_CORE
depends on I2C=y
depends on GPIOLIB || COMPILE_TEST
+ depends on GPIOLIB_LEGACY
help
If you say yes here you get support for the AAT2870.
This driver provides common support for accessing the device,
--
2.39.5
^ permalink raw reply related [flat|nested] 62+ messages in thread
* [PATCH 15/21] dsa: b53: hide legacy gpiolib usage on non-mips
2025-08-08 15:17 [PATCH 00/21] gpiolib: fence off legacy interfaces Arnd Bergmann
` (13 preceding siblings ...)
2025-08-08 15:17 ` [PATCH 14/21] mfd: aat2870: " Arnd Bergmann
@ 2025-08-08 15:17 ` Arnd Bergmann
2025-08-09 10:01 ` Jonas Gorski
2025-08-08 15:18 ` [PATCH 16/21] ath10k: remove gpio number assignment Arnd Bergmann
` (8 subsequent siblings)
23 siblings, 1 reply; 62+ messages in thread
From: Arnd Bergmann @ 2025-08-08 15:17 UTC (permalink / raw)
To: Bartosz Golaszewski, Linus Walleij, linux-gpio, Florian Fainelli,
Andrew Lunn, Vladimir Oltean, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: Arnd Bergmann, Jonas Gorski, Álvaro Fernández Rojas,
Kyle Hendry, Russell King (Oracle), netdev, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
The MIPS bcm53xx platform still uses the legacy gpiolib interfaces based
on gpio numbers, but other platforms do not.
Hide these interfaces inside of the existing #ifdef block and use the
modern interfaces in the common parts of the driver to allow building
it when the gpio_set_value() is left out of the kernel.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/net/dsa/b53/b53_common.c | 17 +++++------------
drivers/net/dsa/b53/b53_priv.h | 24 ++++++++++++++++++------
2 files changed, 23 insertions(+), 18 deletions(-)
diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
index 9942fb6f7f4b..cb57bcc56c63 100644
--- a/drivers/net/dsa/b53/b53_common.c
+++ b/drivers/net/dsa/b53/b53_common.c
@@ -19,7 +19,7 @@
#include <linux/delay.h>
#include <linux/export.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
#include <linux/kernel.h>
#include <linux/math.h>
#include <linux/minmax.h>
@@ -948,17 +948,17 @@ EXPORT_SYMBOL(b53_configure_vlan);
static void b53_switch_reset_gpio(struct b53_device *dev)
{
- int gpio = dev->reset_gpio;
+ struct gpio_desc *gpio = dev->reset_gpio;
- if (gpio < 0)
+ if (IS_ERR(gpio))
return;
/* Reset sequence: RESET low(50ms)->high(20ms)
*/
- gpio_set_value(gpio, 0);
+ gpiod_set_value(gpio, 0);
mdelay(50);
- gpio_set_value(gpio, 1);
+ gpiod_set_value(gpio, 1);
mdelay(20);
dev->current_page = 0xff;
@@ -2925,7 +2925,6 @@ static int b53_switch_init(struct b53_device *dev)
{
u32 chip_id = dev->chip_id;
unsigned int i;
- int ret;
if (is63xx(dev))
chip_id = BCM63XX_DEVICE_ID;
@@ -3005,12 +3004,6 @@ static int b53_switch_init(struct b53_device *dev)
return -ENOMEM;
dev->reset_gpio = b53_switch_get_reset_gpio(dev);
- if (dev->reset_gpio >= 0) {
- ret = devm_gpio_request_one(dev->dev, dev->reset_gpio,
- GPIOF_OUT_INIT_HIGH, "robo_reset");
- if (ret)
- return ret;
- }
return 0;
}
diff --git a/drivers/net/dsa/b53/b53_priv.h b/drivers/net/dsa/b53/b53_priv.h
index 458775f95164..16e82653a7c6 100644
--- a/drivers/net/dsa/b53/b53_priv.h
+++ b/drivers/net/dsa/b53/b53_priv.h
@@ -136,7 +136,7 @@ struct b53_device {
u8 duplex_reg;
u8 jumbo_pm_reg;
u8 jumbo_size_reg;
- int reset_gpio;
+ struct gpio_desc *reset_gpio;
u8 num_arl_bins;
u16 num_arl_buckets;
enum dsa_tag_protocol tag_protocol;
@@ -375,22 +375,34 @@ static inline void b53_arl_from_entry_25(u64 *mac_vid,
#include <linux/bcm47xx_nvram.h>
#include <bcm47xx_board.h>
-static inline int b53_switch_get_reset_gpio(struct b53_device *dev)
+static inline gpio_desc *b53_switch_get_reset_gpio(struct b53_device *dev)
{
enum bcm47xx_board board = bcm47xx_board_get();
+ int gpio, ret;
switch (board) {
case BCM47XX_BOARD_LINKSYS_WRT300NV11:
case BCM47XX_BOARD_LINKSYS_WRT310NV1:
- return 8;
+ gpio = 8;
+ break;
default:
- return bcm47xx_nvram_gpio_pin("robo_reset");
+ gpio = bcm47xx_nvram_gpio_pin("robo_reset");
}
+
+ if (!gpio_is_valid(gpio))
+ return ERR_PTR(-EINVAL);
+
+ ret = devm_gpiod_request_one(dev->dev, gpio,
+ GPIOF_OUT_INIT_HIGH, "robo_reset");
+ if (ret)
+ return ERR_PTR(ret);
+
+ return gpio_to_desc(gpio);
}
#else
-static inline int b53_switch_get_reset_gpio(struct b53_device *dev)
+static inline struct gpio_desc *b53_switch_get_reset_gpio(struct b53_device *dev)
{
- return -ENOENT;
+ return ERR_PTR(-ENODEV);
}
#endif
--
2.39.5
^ permalink raw reply related [flat|nested] 62+ messages in thread
* [PATCH 16/21] ath10k: remove gpio number assignment
2025-08-08 15:17 [PATCH 00/21] gpiolib: fence off legacy interfaces Arnd Bergmann
` (14 preceding siblings ...)
2025-08-08 15:17 ` [PATCH 15/21] dsa: b53: hide legacy gpiolib usage on non-mips Arnd Bergmann
@ 2025-08-08 15:18 ` Arnd Bergmann
2025-08-08 15:18 ` [PATCH 17/21] nfc: marvell: convert to gpio descriptors Arnd Bergmann
` (7 subsequent siblings)
23 siblings, 0 replies; 62+ messages in thread
From: Arnd Bergmann @ 2025-08-08 15:18 UTC (permalink / raw)
To: Bartosz Golaszewski, Linus Walleij, linux-gpio, Jeff Johnson
Cc: Arnd Bergmann, linux-wireless, ath10k, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
The leds-gpio traditionally takes a global gpio number in its platform
data, but the number assigned here is not actually such a number but
only meant to be used internally to this driver.
As part of the kernel-wide cleanup of the old gpiolib interfaces, the
'gpio' number field is going away, so to keep ath10k building, move
the assignment into a private structure instead.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/net/wireless/ath/ath10k/leds.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/leds.c b/drivers/net/wireless/ath/ath10k/leds.c
index 9b1d04eb4265..3a6c8111e7c6 100644
--- a/drivers/net/wireless/ath/ath10k/leds.c
+++ b/drivers/net/wireless/ath/ath10k/leds.c
@@ -27,7 +27,7 @@ static int ath10k_leds_set_brightness_blocking(struct led_classdev *led_cdev,
goto out;
ar->leds.gpio_state_pin = (brightness != LED_OFF) ^ led->active_low;
- ath10k_wmi_gpio_output(ar, led->gpio, ar->leds.gpio_state_pin);
+ ath10k_wmi_gpio_output(ar, ar->hw_params.led_pin, ar->leds.gpio_state_pin);
out:
mutex_unlock(&ar->conf_mutex);
@@ -64,7 +64,6 @@ int ath10k_leds_register(struct ath10k *ar)
snprintf(ar->leds.label, sizeof(ar->leds.label), "ath10k-%s",
wiphy_name(ar->hw->wiphy));
ar->leds.wifi_led.active_low = 1;
- ar->leds.wifi_led.gpio = ar->hw_params.led_pin;
ar->leds.wifi_led.name = ar->leds.label;
ar->leds.wifi_led.default_state = LEDS_GPIO_DEFSTATE_KEEP;
--
2.39.5
^ permalink raw reply related [flat|nested] 62+ messages in thread
* [PATCH 17/21] nfc: marvell: convert to gpio descriptors
2025-08-08 15:17 [PATCH 00/21] gpiolib: fence off legacy interfaces Arnd Bergmann
` (15 preceding siblings ...)
2025-08-08 15:18 ` [PATCH 16/21] ath10k: remove gpio number assignment Arnd Bergmann
@ 2025-08-08 15:18 ` Arnd Bergmann
2025-08-09 10:09 ` Andy Shevchenko
` (2 more replies)
2025-08-08 15:18 ` [PATCH 18/21] nfc: s3fwrn5: " Arnd Bergmann
` (6 subsequent siblings)
23 siblings, 3 replies; 62+ messages in thread
From: Arnd Bergmann @ 2025-08-08 15:18 UTC (permalink / raw)
To: Bartosz Golaszewski, Linus Walleij, linux-gpio,
Krzysztof Kozlowski
Cc: Arnd Bergmann, Jakub Kicinski, Andy Shevchenko, netdev,
linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
The only reason this driver seems to still use the legacy gpio
numbers is for the module parameter that lets users pass a different
reset gpio.
Since the fixed numbers are on their way out, and none of the platforms
this driver is used on would have them any more, remove the module
parameter and instead just use the reset information from firmware.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/nfc/nfcmrvl/main.c | 47 +++++++++++------------------------
drivers/nfc/nfcmrvl/nfcmrvl.h | 5 ++--
drivers/nfc/nfcmrvl/uart.c | 5 ----
drivers/nfc/nfcmrvl/usb.c | 1 -
4 files changed, 18 insertions(+), 40 deletions(-)
diff --git a/drivers/nfc/nfcmrvl/main.c b/drivers/nfc/nfcmrvl/main.c
index 141bc4b66dcb..1b465a19a262 100644
--- a/drivers/nfc/nfcmrvl/main.c
+++ b/drivers/nfc/nfcmrvl/main.c
@@ -6,7 +6,7 @@
*/
#include <linux/module.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
#include <linux/delay.h>
#include <linux/of_gpio.h>
#include <linux/nfc.h>
@@ -112,14 +112,10 @@ struct nfcmrvl_private *nfcmrvl_nci_register_dev(enum nfcmrvl_phy phy,
memcpy(&priv->config, pdata, sizeof(*pdata));
- if (gpio_is_valid(priv->config.reset_n_io)) {
- rc = gpio_request_one(priv->config.reset_n_io,
- GPIOF_OUT_INIT_LOW,
- "nfcmrvl_reset_n");
- if (rc < 0) {
- priv->config.reset_n_io = -EINVAL;
- nfc_err(dev, "failed to request reset_n io\n");
- }
+ priv->reset_n_io = gpiod_get_optional(dev, "reset-n-io", GPIOD_OUT_LOW);
+ if (IS_ERR(priv->reset_n_io)) {
+ nfc_err(dev, "failed to get reset_n gpio\n");
+ return ERR_CAST(priv->reset_n_io);
}
if (phy == NFCMRVL_PHY_SPI) {
@@ -172,8 +168,7 @@ struct nfcmrvl_private *nfcmrvl_nci_register_dev(enum nfcmrvl_phy phy,
error_free_dev:
nci_free_device(priv->ndev);
error_free_gpio:
- if (gpio_is_valid(priv->config.reset_n_io))
- gpio_free(priv->config.reset_n_io);
+ gpiod_put(priv->reset_n_io);
kfree(priv);
return ERR_PTR(rc);
}
@@ -189,8 +184,7 @@ void nfcmrvl_nci_unregister_dev(struct nfcmrvl_private *priv)
nfcmrvl_fw_dnld_deinit(priv);
- if (gpio_is_valid(priv->config.reset_n_io))
- gpio_free(priv->config.reset_n_io);
+ gpiod_put(priv->reset_n_io);
nci_free_device(ndev);
kfree(priv);
@@ -232,35 +226,24 @@ void nfcmrvl_chip_reset(struct nfcmrvl_private *priv)
{
/* Reset possible fault of previous session */
clear_bit(NFCMRVL_PHY_ERROR, &priv->flags);
+ if (!priv->reset_n_io)
+ return;
- if (gpio_is_valid(priv->config.reset_n_io)) {
- nfc_info(priv->dev, "reset the chip\n");
- gpio_set_value(priv->config.reset_n_io, 0);
- usleep_range(5000, 10000);
- gpio_set_value(priv->config.reset_n_io, 1);
- } else
- nfc_info(priv->dev, "no reset available on this interface\n");
+ nfc_info(priv->dev, "reset the chip\n");
+ gpiod_set_value(priv->reset_n_io, 0);
+ usleep_range(5000, 10000);
+ gpiod_set_value(priv->reset_n_io, 1);
}
void nfcmrvl_chip_halt(struct nfcmrvl_private *priv)
{
- if (gpio_is_valid(priv->config.reset_n_io))
- gpio_set_value(priv->config.reset_n_io, 0);
+ if (priv->reset_n_io)
+ gpiod_set_value(priv->reset_n_io, 0);
}
int nfcmrvl_parse_dt(struct device_node *node,
struct nfcmrvl_platform_data *pdata)
{
- int reset_n_io;
-
- reset_n_io = of_get_named_gpio(node, "reset-n-io", 0);
- if (reset_n_io < 0) {
- pr_info("no reset-n-io config\n");
- } else if (!gpio_is_valid(reset_n_io)) {
- pr_err("invalid reset-n-io GPIO\n");
- return reset_n_io;
- }
- pdata->reset_n_io = reset_n_io;
pdata->hci_muxed = of_property_read_bool(node, "hci-muxed");
return 0;
diff --git a/drivers/nfc/nfcmrvl/nfcmrvl.h b/drivers/nfc/nfcmrvl/nfcmrvl.h
index f61a99e553db..156f46e1581f 100644
--- a/drivers/nfc/nfcmrvl/nfcmrvl.h
+++ b/drivers/nfc/nfcmrvl/nfcmrvl.h
@@ -53,8 +53,6 @@ struct nfcmrvl_platform_data {
* Generic
*/
- /* GPIO that is wired to RESET_N signal */
- int reset_n_io;
/* Tell if transport is muxed in HCI one */
bool hci_muxed;
@@ -83,6 +81,9 @@ struct nfcmrvl_private {
/* Platform configuration */
struct nfcmrvl_platform_data config;
+ /* RESET_N GPIO line */
+ struct gpio_desc *reset_n_io;
+
/* Parent dev */
struct nci_dev *ndev;
diff --git a/drivers/nfc/nfcmrvl/uart.c b/drivers/nfc/nfcmrvl/uart.c
index 2037cd6d4f4f..cb2da7a1d91f 100644
--- a/drivers/nfc/nfcmrvl/uart.c
+++ b/drivers/nfc/nfcmrvl/uart.c
@@ -20,7 +20,6 @@
static unsigned int hci_muxed;
static unsigned int flow_control;
static unsigned int break_control;
-static int reset_n_io = -EINVAL;
/*
* NFCMRVL NCI OPS
@@ -113,7 +112,6 @@ static int nfcmrvl_nci_uart_open(struct nci_uart *nu)
if (!pdata) {
pr_info("No platform data / DT -> fallback to module params\n");
config.hci_muxed = hci_muxed;
- config.reset_n_io = reset_n_io;
config.flow_control = flow_control;
config.break_control = break_control;
pdata = &config;
@@ -201,6 +199,3 @@ MODULE_PARM_DESC(break_control, "Tell if UART driver must drive break signal.");
module_param(hci_muxed, uint, 0);
MODULE_PARM_DESC(hci_muxed, "Tell if transport is muxed in HCI one.");
-
-module_param(reset_n_io, int, 0);
-MODULE_PARM_DESC(reset_n_io, "GPIO that is wired to RESET_N signal.");
diff --git a/drivers/nfc/nfcmrvl/usb.c b/drivers/nfc/nfcmrvl/usb.c
index ea7309453096..4cf19433fde1 100644
--- a/drivers/nfc/nfcmrvl/usb.c
+++ b/drivers/nfc/nfcmrvl/usb.c
@@ -294,7 +294,6 @@ static int nfcmrvl_probe(struct usb_interface *intf,
/* No configuration for USB */
memset(&config, 0, sizeof(config));
- config.reset_n_io = -EINVAL;
nfc_info(&udev->dev, "intf %p id %p\n", intf, id);
--
2.39.5
^ permalink raw reply related [flat|nested] 62+ messages in thread
* [PATCH 18/21] nfc: s3fwrn5: convert to gpio descriptors
2025-08-08 15:17 [PATCH 00/21] gpiolib: fence off legacy interfaces Arnd Bergmann
` (16 preceding siblings ...)
2025-08-08 15:18 ` [PATCH 17/21] nfc: marvell: convert to gpio descriptors Arnd Bergmann
@ 2025-08-08 15:18 ` Arnd Bergmann
2025-08-11 22:08 ` Dmitry Torokhov
2025-08-08 15:18 ` [PATCH 19/21] usb: udc: pxa: remove unused platform_data Arnd Bergmann
` (5 subsequent siblings)
23 siblings, 1 reply; 62+ messages in thread
From: Arnd Bergmann @ 2025-08-08 15:18 UTC (permalink / raw)
To: Bartosz Golaszewski, Linus Walleij, linux-gpio,
Krzysztof Kozlowski
Cc: Arnd Bergmann, Sumanth Gavini, Jakub Kicinski, netdev,
linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
There is no need for this driver to still use the legacy interfaces,
so convert all the legacy calls into their modern equivalents.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/nfc/s3fwrn5/i2c.c | 42 +++++++++-----------------------
drivers/nfc/s3fwrn5/phy_common.c | 12 ++++-----
drivers/nfc/s3fwrn5/phy_common.h | 4 +--
drivers/nfc/s3fwrn5/uart.c | 30 ++++++-----------------
4 files changed, 28 insertions(+), 60 deletions(-)
diff --git a/drivers/nfc/s3fwrn5/i2c.c b/drivers/nfc/s3fwrn5/i2c.c
index 110d086cfe5b..411be709b397 100644
--- a/drivers/nfc/s3fwrn5/i2c.c
+++ b/drivers/nfc/s3fwrn5/i2c.c
@@ -8,7 +8,7 @@
#include <linux/clk.h>
#include <linux/i2c.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
#include <linux/delay.h>
#include <linux/of_gpio.h>
#include <linux/of_irq.h>
@@ -149,29 +149,22 @@ static irqreturn_t s3fwrn5_i2c_irq_thread_fn(int irq, void *phy_id)
static int s3fwrn5_i2c_parse_dt(struct i2c_client *client)
{
struct s3fwrn5_i2c_phy *phy = i2c_get_clientdata(client);
- struct device_node *np = client->dev.of_node;
+ struct device *dev = &client->dev;
- if (!np)
- return -ENODEV;
-
- phy->common.gpio_en = of_get_named_gpio(np, "en-gpios", 0);
- if (!gpio_is_valid(phy->common.gpio_en)) {
+ phy->common.gpio_en = devm_gpiod_get(dev, "en", GPIOD_OUT_HIGH);
+ if (IS_ERR(phy->common.gpio_en)) {
/* Support also deprecated property */
- phy->common.gpio_en = of_get_named_gpio(np,
- "s3fwrn5,en-gpios",
- 0);
- if (!gpio_is_valid(phy->common.gpio_en))
- return -ENODEV;
+ phy->common.gpio_en = devm_gpiod_get(dev, "s3fwrn5,en", GPIOD_OUT_HIGH);
+ if (IS_ERR(phy->common.gpio_en))
+ return PTR_ERR(phy->common.gpio_en);
}
- phy->common.gpio_fw_wake = of_get_named_gpio(np, "wake-gpios", 0);
- if (!gpio_is_valid(phy->common.gpio_fw_wake)) {
+ phy->common.gpio_fw_wake = devm_gpiod_get(dev, "wake", GPIOD_OUT_LOW);
+ if (IS_ERR(phy->common.gpio_fw_wake)) {
/* Support also deprecated property */
- phy->common.gpio_fw_wake = of_get_named_gpio(np,
- "s3fwrn5,fw-gpios",
- 0);
- if (!gpio_is_valid(phy->common.gpio_fw_wake))
- return -ENODEV;
+ phy->common.gpio_fw_wake = devm_gpiod_get(dev, "s3fwrn5,fw", GPIOD_OUT_LOW);
+ if (IS_ERR(phy->common.gpio_fw_wake))
+ return PTR_ERR(phy->common.gpio_en);
}
return 0;
@@ -197,17 +190,6 @@ static int s3fwrn5_i2c_probe(struct i2c_client *client)
if (ret < 0)
return ret;
- ret = devm_gpio_request_one(&phy->i2c_dev->dev, phy->common.gpio_en,
- GPIOF_OUT_INIT_HIGH, "s3fwrn5_en");
- if (ret < 0)
- return ret;
-
- ret = devm_gpio_request_one(&phy->i2c_dev->dev,
- phy->common.gpio_fw_wake,
- GPIOF_OUT_INIT_LOW, "s3fwrn5_fw_wake");
- if (ret < 0)
- return ret;
-
/*
* S3FWRN5 depends on a clock input ("XI" pin) to function properly.
* Depending on the hardware configuration this could be an always-on
diff --git a/drivers/nfc/s3fwrn5/phy_common.c b/drivers/nfc/s3fwrn5/phy_common.c
index deb2c039f0fd..e802b4e609c8 100644
--- a/drivers/nfc/s3fwrn5/phy_common.c
+++ b/drivers/nfc/s3fwrn5/phy_common.c
@@ -8,7 +8,7 @@
* Bongsu Jeon <bongsu.jeon@samsung.com>
*/
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
#include <linux/delay.h>
#include <linux/module.h>
@@ -19,7 +19,7 @@ void s3fwrn5_phy_set_wake(void *phy_id, bool wake)
struct phy_common *phy = phy_id;
mutex_lock(&phy->mutex);
- gpio_set_value(phy->gpio_fw_wake, wake);
+ gpiod_set_value(phy->gpio_fw_wake, wake);
if (wake)
msleep(S3FWRN5_EN_WAIT_TIME);
mutex_unlock(&phy->mutex);
@@ -33,14 +33,14 @@ bool s3fwrn5_phy_power_ctrl(struct phy_common *phy, enum s3fwrn5_mode mode)
phy->mode = mode;
- gpio_set_value(phy->gpio_en, 1);
- gpio_set_value(phy->gpio_fw_wake, 0);
+ gpiod_set_value(phy->gpio_en, 1);
+ gpiod_set_value(phy->gpio_fw_wake, 0);
if (mode == S3FWRN5_MODE_FW)
- gpio_set_value(phy->gpio_fw_wake, 1);
+ gpiod_set_value(phy->gpio_fw_wake, 1);
if (mode != S3FWRN5_MODE_COLD) {
msleep(S3FWRN5_EN_WAIT_TIME);
- gpio_set_value(phy->gpio_en, 0);
+ gpiod_set_value(phy->gpio_en, 0);
msleep(S3FWRN5_EN_WAIT_TIME);
}
diff --git a/drivers/nfc/s3fwrn5/phy_common.h b/drivers/nfc/s3fwrn5/phy_common.h
index 9cef25436bf9..5451f46f7e27 100644
--- a/drivers/nfc/s3fwrn5/phy_common.h
+++ b/drivers/nfc/s3fwrn5/phy_common.h
@@ -21,8 +21,8 @@
struct phy_common {
struct nci_dev *ndev;
- int gpio_en;
- int gpio_fw_wake;
+ struct gpio_desc *gpio_en;
+ struct gpio_desc *gpio_fw_wake;
struct mutex mutex;
diff --git a/drivers/nfc/s3fwrn5/uart.c b/drivers/nfc/s3fwrn5/uart.c
index 9c09c10c2a46..39e3a64c4f4c 100644
--- a/drivers/nfc/s3fwrn5/uart.c
+++ b/drivers/nfc/s3fwrn5/uart.c
@@ -15,7 +15,7 @@
#include <linux/netdevice.h>
#include <linux/of.h>
#include <linux/serdev.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
#include <linux/of_gpio.h>
#include "phy_common.h"
@@ -91,18 +91,15 @@ MODULE_DEVICE_TABLE(of, s3fwrn82_uart_of_match);
static int s3fwrn82_uart_parse_dt(struct serdev_device *serdev)
{
struct s3fwrn82_uart_phy *phy = serdev_device_get_drvdata(serdev);
- struct device_node *np = serdev->dev.of_node;
+ struct device *dev = &serdev->dev;
- if (!np)
- return -ENODEV;
+ phy->common.gpio_en = devm_gpiod_get(dev, "en", GPIOD_OUT_HIGH);
+ if (IS_ERR(phy->common.gpio_en))
+ return PTR_ERR(phy->common.gpio_en);
- phy->common.gpio_en = of_get_named_gpio(np, "en-gpios", 0);
- if (!gpio_is_valid(phy->common.gpio_en))
- return -ENODEV;
-
- phy->common.gpio_fw_wake = of_get_named_gpio(np, "wake-gpios", 0);
- if (!gpio_is_valid(phy->common.gpio_fw_wake))
- return -ENODEV;
+ phy->common.gpio_fw_wake = devm_gpiod_get(dev, "wake", GPIOD_OUT_LOW);
+ if (IS_ERR(phy->common.gpio_fw_wake))
+ return PTR_ERR(phy->common.gpio_fw_wake);
return 0;
}
@@ -144,17 +141,6 @@ static int s3fwrn82_uart_probe(struct serdev_device *serdev)
if (ret < 0)
goto err_serdev;
- ret = devm_gpio_request_one(&phy->ser_dev->dev, phy->common.gpio_en,
- GPIOF_OUT_INIT_HIGH, "s3fwrn82_en");
- if (ret < 0)
- goto err_serdev;
-
- ret = devm_gpio_request_one(&phy->ser_dev->dev,
- phy->common.gpio_fw_wake,
- GPIOF_OUT_INIT_LOW, "s3fwrn82_fw_wake");
- if (ret < 0)
- goto err_serdev;
-
ret = s3fwrn5_probe(&phy->common.ndev, phy, &phy->ser_dev->dev,
&uart_phy_ops);
if (ret < 0)
--
2.39.5
^ permalink raw reply related [flat|nested] 62+ messages in thread
* [PATCH 19/21] usb: udc: pxa: remove unused platform_data
2025-08-08 15:17 [PATCH 00/21] gpiolib: fence off legacy interfaces Arnd Bergmann
` (17 preceding siblings ...)
2025-08-08 15:18 ` [PATCH 18/21] nfc: s3fwrn5: " Arnd Bergmann
@ 2025-08-08 15:18 ` Arnd Bergmann
2025-08-09 10:15 ` Andy Shevchenko
2025-08-11 22:12 ` Dmitry Torokhov
2025-08-08 15:18 ` [PATCH 20/21] ASoC: pxa: add GPIOLIB_LEGACY dependency Arnd Bergmann
` (4 subsequent siblings)
23 siblings, 2 replies; 62+ messages in thread
From: Arnd Bergmann @ 2025-08-08 15:18 UTC (permalink / raw)
To: Bartosz Golaszewski, Linus Walleij, linux-gpio, Daniel Mack,
Haojian Zhuang, Robert Jarzmik, Russell King, Greg Kroah-Hartman
Cc: Arnd Bergmann, Thomas Gleixner, Ingo Molnar, Andy Shevchenko,
linux-arm-kernel, linux-kernel, linux-usb
From: Arnd Bergmann <arnd@arndb.de>
None of the remaining boards put useful data into the platform_data
structures, so effectively this only works with DT based probing.
Remove all code that references this data, to stop using the legacy
gpiolib interfaces. The pxa27x version already supports gpio
descriptors, while the pxa25x version now does it the same way.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
arch/arm/mach-pxa/devices.c | 7 ----
arch/arm/mach-pxa/gumstix.c | 1 -
arch/arm/mach-pxa/udc.h | 8 -----
drivers/usb/gadget/udc/pxa25x_udc.c | 41 ++++++++----------------
drivers/usb/gadget/udc/pxa25x_udc.h | 2 +-
drivers/usb/gadget/udc/pxa27x_udc.c | 35 +++-----------------
drivers/usb/gadget/udc/pxa27x_udc.h | 2 --
include/linux/platform_data/pxa2xx_udc.h | 15 ---------
8 files changed, 19 insertions(+), 92 deletions(-)
delete mode 100644 arch/arm/mach-pxa/udc.h
diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c
index 7695cfce01a1..edad956a1483 100644
--- a/arch/arm/mach-pxa/devices.c
+++ b/arch/arm/mach-pxa/devices.c
@@ -11,7 +11,6 @@
#include <linux/platform_data/i2c-pxa.h>
#include <linux/soc/pxa/cpu.h>
-#include "udc.h"
#include <linux/platform_data/video-pxafb.h>
#include <linux/platform_data/mmc-pxamci.h>
#include "irqs.h"
@@ -83,10 +82,6 @@ void __init pxa_set_mci_info(const struct pxamci_platform_data *info,
pr_err("Unable to create mci device: %d\n", err);
}
-static struct pxa2xx_udc_mach_info pxa_udc_info = {
- .gpio_pullup = -1,
-};
-
static struct resource pxa2xx_udc_resources[] = {
[0] = {
.start = 0x40600000,
@@ -108,7 +103,6 @@ struct platform_device pxa25x_device_udc = {
.resource = pxa2xx_udc_resources,
.num_resources = ARRAY_SIZE(pxa2xx_udc_resources),
.dev = {
- .platform_data = &pxa_udc_info,
.dma_mask = &udc_dma_mask,
}
};
@@ -119,7 +113,6 @@ struct platform_device pxa27x_device_udc = {
.resource = pxa2xx_udc_resources,
.num_resources = ARRAY_SIZE(pxa2xx_udc_resources),
.dev = {
- .platform_data = &pxa_udc_info,
.dma_mask = &udc_dma_mask,
}
};
diff --git a/arch/arm/mach-pxa/gumstix.c b/arch/arm/mach-pxa/gumstix.c
index 1713bdf3b71e..6074815a4bca 100644
--- a/arch/arm/mach-pxa/gumstix.c
+++ b/arch/arm/mach-pxa/gumstix.c
@@ -39,7 +39,6 @@
#include "pxa25x.h"
#include <linux/platform_data/mmc-pxamci.h>
-#include "udc.h"
#include "gumstix.h"
#include "devices.h"
diff --git a/arch/arm/mach-pxa/udc.h b/arch/arm/mach-pxa/udc.h
deleted file mode 100644
index 9a827e32db98..000000000000
--- a/arch/arm/mach-pxa/udc.h
+++ /dev/null
@@ -1,8 +0,0 @@
-/*
- * arch/arm/mach-pxa/include/mach/udc.h
- *
- */
-#include <linux/platform_data/pxa2xx_udc.h>
-
-extern void pxa_set_udc_info(struct pxa2xx_udc_mach_info *info);
-
diff --git a/drivers/usb/gadget/udc/pxa25x_udc.c b/drivers/usb/gadget/udc/pxa25x_udc.c
index b97fb7b0cb2c..bad151aedec1 100644
--- a/drivers/usb/gadget/udc/pxa25x_udc.c
+++ b/drivers/usb/gadget/udc/pxa25x_udc.c
@@ -12,7 +12,7 @@
/* #define VERBOSE_DEBUG */
#include <linux/device.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/ioport.h>
@@ -261,24 +261,12 @@ static void nuke (struct pxa25x_ep *, int status);
/* one GPIO should control a D+ pullup, so host sees this device (or not) */
static void pullup_off(void)
{
- struct pxa2xx_udc_mach_info *mach = the_controller->mach;
- int off_level = mach->gpio_pullup_inverted;
-
- if (gpio_is_valid(mach->gpio_pullup))
- gpio_set_value(mach->gpio_pullup, off_level);
- else if (mach->udc_command)
- mach->udc_command(PXA2XX_UDC_CMD_DISCONNECT);
+ gpiod_set_value(the_controller->pullup_gpio, 0);
}
static void pullup_on(void)
{
- struct pxa2xx_udc_mach_info *mach = the_controller->mach;
- int on_level = !mach->gpio_pullup_inverted;
-
- if (gpio_is_valid(mach->gpio_pullup))
- gpio_set_value(mach->gpio_pullup, on_level);
- else if (mach->udc_command)
- mach->udc_command(PXA2XX_UDC_CMD_CONNECT);
+ gpiod_set_value(the_controller->pullup_gpio, 1);
}
#if defined(CONFIG_CPU_BIG_ENDIAN)
@@ -1190,8 +1178,7 @@ static int pxa25x_udc_pullup(struct usb_gadget *_gadget, int is_active)
udc = container_of(_gadget, struct pxa25x_udc, gadget);
- /* not all boards support pullup control */
- if (!gpio_is_valid(udc->mach->gpio_pullup) && !udc->mach->udc_command)
+ if (!udc->pullup_gpio)
return -EOPNOTSUPP;
udc->pullup = (is_active != 0);
@@ -2343,19 +2330,17 @@ static int pxa25x_udc_probe(struct platform_device *pdev)
/* other non-static parts of init */
dev->dev = &pdev->dev;
- dev->mach = dev_get_platdata(&pdev->dev);
dev->transceiver = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2);
- if (gpio_is_valid(dev->mach->gpio_pullup)) {
- retval = devm_gpio_request_one(&pdev->dev, dev->mach->gpio_pullup,
- GPIOF_OUT_INIT_LOW, "pca25x_udc GPIO PULLUP");
- if (retval) {
- dev_dbg(&pdev->dev,
- "can't get pullup gpio %d, err: %d\n",
- dev->mach->gpio_pullup, retval);
- goto err;
- }
+ dev->pullup_gpio = devm_gpiod_get_index_optional(&pdev->dev, "pullup", 0,
+ GPIOD_OUT_LOW);
+ if (IS_ERR(dev->pullup_gpio)) {
+ dev_dbg(&pdev->dev,
+ "can't get pullup gpio err: %ld\n",
+ PTR_ERR(dev->pullup_gpio));
+ retval = PTR_ERR(dev->pullup_gpio);
+ goto err;
}
timer_setup(&dev->timer, udc_watchdog, 0);
@@ -2439,7 +2424,7 @@ static int pxa25x_udc_suspend(struct platform_device *dev, pm_message_t state)
struct pxa25x_udc *udc = platform_get_drvdata(dev);
unsigned long flags;
- if (!gpio_is_valid(udc->mach->gpio_pullup) && !udc->mach->udc_command)
+ if (!udc->pullup_gpio)
WARNING("USB host won't detect disconnect!\n");
udc->suspended = 1;
diff --git a/drivers/usb/gadget/udc/pxa25x_udc.h b/drivers/usb/gadget/udc/pxa25x_udc.h
index 6ab6047edc83..3452cf54286c 100644
--- a/drivers/usb/gadget/udc/pxa25x_udc.h
+++ b/drivers/usb/gadget/udc/pxa25x_udc.h
@@ -112,7 +112,7 @@ struct pxa25x_udc {
struct device *dev;
struct clk *clk;
- struct pxa2xx_udc_mach_info *mach;
+ struct gpio_desc *pullup_gpio;
struct usb_phy *transceiver;
u64 dma_mask;
struct pxa25x_ep ep [PXA_UDC_NUM_ENDPOINTS];
diff --git a/drivers/usb/gadget/udc/pxa27x_udc.c b/drivers/usb/gadget/udc/pxa27x_udc.c
index 897f53601b5b..dbce931d7d3b 100644
--- a/drivers/usb/gadget/udc/pxa27x_udc.c
+++ b/drivers/usb/gadget/udc/pxa27x_udc.c
@@ -17,7 +17,6 @@
#include <linux/proc_fs.h>
#include <linux/clk.h>
#include <linux/irq.h>
-#include <linux/gpio.h>
#include <linux/gpio/consumer.h>
#include <linux/slab.h>
#include <linux/string_choices.h>
@@ -1423,14 +1422,7 @@ static const struct usb_ep_ops pxa_ep_ops = {
*/
static void dplus_pullup(struct pxa_udc *udc, int on)
{
- if (udc->gpiod) {
- gpiod_set_value(udc->gpiod, on);
- } else if (udc->udc_command) {
- if (on)
- udc->udc_command(PXA2XX_UDC_CMD_CONNECT);
- else
- udc->udc_command(PXA2XX_UDC_CMD_DISCONNECT);
- }
+ gpiod_set_value(udc->gpiod, on);
udc->pullup_on = on;
}
@@ -1520,7 +1512,7 @@ static int pxa_udc_pullup(struct usb_gadget *_gadget, int is_active)
{
struct pxa_udc *udc = to_gadget_udc(_gadget);
- if (!udc->gpiod && !udc->udc_command)
+ if (!udc->gpiod)
return -EOPNOTSUPP;
dplus_pullup(udc, is_active);
@@ -2354,26 +2346,9 @@ MODULE_DEVICE_TABLE(of, udc_pxa_dt_ids);
static int pxa_udc_probe(struct platform_device *pdev)
{
struct pxa_udc *udc = &memory;
- int retval = 0, gpio;
- struct pxa2xx_udc_mach_info *mach = dev_get_platdata(&pdev->dev);
-
- if (mach) {
- gpio = mach->gpio_pullup;
- if (gpio_is_valid(gpio)) {
- retval = devm_gpio_request_one(&pdev->dev, gpio,
- GPIOF_OUT_INIT_LOW,
- "USB D+ pullup");
- if (retval)
- return retval;
- udc->gpiod = gpio_to_desc(mach->gpio_pullup);
-
- if (mach->gpio_pullup_inverted ^ gpiod_is_active_low(udc->gpiod))
- gpiod_toggle_active_low(udc->gpiod);
- }
- udc->udc_command = mach->udc_command;
- } else {
- udc->gpiod = devm_gpiod_get(&pdev->dev, NULL, GPIOD_ASIS);
- }
+ int retval = 0;
+
+ udc->gpiod = devm_gpiod_get(&pdev->dev, NULL, GPIOD_ASIS);
udc->regs = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(udc->regs))
diff --git a/drivers/usb/gadget/udc/pxa27x_udc.h b/drivers/usb/gadget/udc/pxa27x_udc.h
index 31bf79ce931c..2c28b691010a 100644
--- a/drivers/usb/gadget/udc/pxa27x_udc.h
+++ b/drivers/usb/gadget/udc/pxa27x_udc.h
@@ -426,7 +426,6 @@ struct udc_stats {
* @usb_gadget: udc gadget structure
* @driver: bound gadget (zero, g_ether, g_mass_storage, ...)
* @dev: device
- * @udc_command: machine specific function to activate D+ pullup
* @gpiod: gpio descriptor of gpio for D+ pullup (or NULL if none)
* @transceiver: external transceiver to handle vbus sense and D+ pullup
* @ep0state: control endpoint state machine state
@@ -452,7 +451,6 @@ struct pxa_udc {
struct usb_gadget gadget;
struct usb_gadget_driver *driver;
struct device *dev;
- void (*udc_command)(int);
struct gpio_desc *gpiod;
struct usb_phy *transceiver;
diff --git a/include/linux/platform_data/pxa2xx_udc.h b/include/linux/platform_data/pxa2xx_udc.h
index bc99cc6a3c5f..c1e4d03bae2c 100644
--- a/include/linux/platform_data/pxa2xx_udc.h
+++ b/include/linux/platform_data/pxa2xx_udc.h
@@ -10,21 +10,6 @@
#ifndef PXA2XX_UDC_H
#define PXA2XX_UDC_H
-struct pxa2xx_udc_mach_info {
- int (*udc_is_connected)(void); /* do we see host? */
- void (*udc_command)(int cmd);
-#define PXA2XX_UDC_CMD_CONNECT 0 /* let host see us */
-#define PXA2XX_UDC_CMD_DISCONNECT 1 /* so host won't see us */
-
- /* Boards following the design guidelines in the developer's manual,
- * with on-chip GPIOs not Lubbock's weird hardware, can have a sane
- * VBUS IRQ and omit the methods above. Store the GPIO number
- * here. Note that sometimes the signals go through inverters...
- */
- bool gpio_pullup_inverted;
- int gpio_pullup; /* high == pullup activated */
-};
-
#ifdef CONFIG_PXA27x
extern void pxa27x_clear_otgph(void);
#else
--
2.39.5
^ permalink raw reply related [flat|nested] 62+ messages in thread
* [PATCH 20/21] ASoC: pxa: add GPIOLIB_LEGACY dependency
2025-08-08 15:17 [PATCH 00/21] gpiolib: fence off legacy interfaces Arnd Bergmann
` (18 preceding siblings ...)
2025-08-08 15:18 ` [PATCH 19/21] usb: udc: pxa: remove unused platform_data Arnd Bergmann
@ 2025-08-08 15:18 ` Arnd Bergmann
2025-08-08 15:18 ` [PATCH 21/21] gpiolib: turn off legacy interface by default Arnd Bergmann
` (3 subsequent siblings)
23 siblings, 0 replies; 62+ messages in thread
From: Arnd Bergmann @ 2025-08-08 15:18 UTC (permalink / raw)
To: Bartosz Golaszewski, Linus Walleij, linux-gpio, Daniel Mack,
Haojian Zhuang, Robert Jarzmik, Liam Girdwood, Mark Brown,
Jaroslav Kysela, Takashi Iwai
Cc: Arnd Bergmann, Kuninori Morimoto, linux-arm-kernel, linux-sound,
linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
The pxa27x platform uses the legacy gpiolib interfaces, including
in its sound drivers:
sound/arm/pxa2xx-ac97-lib.c: In function 'pxa2xx_ac97_hw_probe':
sound/arm/pxa2xx-ac97-lib.c:374:23: error: implicit declaration of function 'gpio_request_one' [-Wimplicit-function-declaration]
374 | ret = gpio_request_one(reset_gpio, GPIOF_OUT_INIT_HIGH,
Make sure we don't select those drivers for compile-testing unless
we are building for a pxa27x system, or CONFIG_GPIOLIB_LEGACY is
already enabled.
The SND_PXA_SOC_SSP driver accidentally used a dependency on PLAT_PXA,
which includes both ARCH_PXA and ARCH_MMP, but it is only used on
the former.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
sound/soc/pxa/Kconfig | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/pxa/Kconfig b/sound/soc/pxa/Kconfig
index e026f9912a6d..e54abcd39f79 100644
--- a/sound/soc/pxa/Kconfig
+++ b/sound/soc/pxa/Kconfig
@@ -3,7 +3,7 @@ menu "PXA"
config SND_PXA2XX_SOC
tristate "SoC Audio for the Intel PXA2xx chip"
- depends on ARCH_PXA || COMPILE_TEST
+ depends on ARCH_PXA || (COMPILE_TEST && GPIOLIB_LEGACY)
select SND_PXA2XX_LIB
help
Say Y or M if you want to add support for codecs attached to
@@ -26,7 +26,7 @@ config SND_PXA2XX_SOC_I2S
config SND_PXA_SOC_SSP
tristate "Soc Audio via PXA2xx/PXA3xx SSP ports"
- depends on PLAT_PXA
+ depends on ARCH_PXA
select PXA_SSP
select SND_PXA2XX_LIB
--
2.39.5
^ permalink raw reply related [flat|nested] 62+ messages in thread
* [PATCH 21/21] gpiolib: turn off legacy interface by default
2025-08-08 15:17 [PATCH 00/21] gpiolib: fence off legacy interfaces Arnd Bergmann
` (19 preceding siblings ...)
2025-08-08 15:18 ` [PATCH 20/21] ASoC: pxa: add GPIOLIB_LEGACY dependency Arnd Bergmann
@ 2025-08-08 15:18 ` Arnd Bergmann
2025-08-09 10:18 ` Andy Shevchenko
2025-08-11 13:10 ` [PATCH 00/21] gpiolib: fence off legacy interfaces Bartosz Golaszewski
` (2 subsequent siblings)
23 siblings, 1 reply; 62+ messages in thread
From: Arnd Bergmann @ 2025-08-08 15:18 UTC (permalink / raw)
To: Bartosz Golaszewski, Linus Walleij, linux-gpio
Cc: Arnd Bergmann, Peng Fan, Geert Uytterhoeven, Koichiro Den,
André Draszik, Andy Shevchenko, linux-kernel
From: Arnd Bergmann <arnd@arndb.de>
All users of the legacy interface now select CONFIG_GPIOLIB_LEGACY,
so it can be turned off by default.
Allow turning it on manually for compile testing, in order to keep
the build coverage of the legacy drivers.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/gpio/Kconfig | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index e43abb322fa6..2b57ba776c13 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -12,10 +12,17 @@ menuconfig GPIOLIB
If unsure, say N.
+if GPIOLIB
+
config GPIOLIB_LEGACY
- def_bool y
+ bool "Legacy GPIO interfaces" if COMPILE_TEST
+ help
+ There are a few legacy platforms that use the traditional GPIO
+ number based interfaces instead of GPIO descriptors.
+ Say Y here to enable build testing drivers that are specific
+ to those platforms.
-if GPIOLIB
+ If unsure, say N.
config GPIOLIB_FASTPATH_LIMIT
int "Maximum number of GPIOs for fast path"
--
2.39.5
^ permalink raw reply related [flat|nested] 62+ messages in thread
* Re: [PATCH 05/21] x86/platform: select legacy gpiolib interfaces where used
2025-08-08 15:17 ` [PATCH 05/21] x86/platform: select legacy gpiolib interfaces where used Arnd Bergmann
@ 2025-08-09 10:00 ` Andy Shevchenko
2025-08-09 19:44 ` Arnd Bergmann
0 siblings, 1 reply; 62+ messages in thread
From: Andy Shevchenko @ 2025-08-09 10:00 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Bartosz Golaszewski, Linus Walleij, linux-gpio, Dmitry Torokhov,
Hans de Goede, Ilpo Järvinen, Arnd Bergmann, Lee Jones,
Dzmitry Sankouski, Heiko Stuebner, Dr. David Alan Gilbert,
Thomas Weißschuh, Guenter Roeck, linux-input, linux-kernel,
platform-driver-x86
On Fri, Aug 08, 2025 at 05:17:49PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> A few old machines have not been converted away from the old-style
> gpiolib interfaces. Make these select the new CONFIG_GPIOLIB_LEGACY
> symbol so the code still works where it is needed but can be left
> out otherwise.
...
> --- a/drivers/platform/x86/x86-android-tablets/Kconfig
> +++ b/drivers/platform/x86/x86-android-tablets/Kconfig
> @@ -8,6 +8,7 @@ config X86_ANDROID_TABLETS
> depends on I2C && SPI && SERIAL_DEV_BUS
> depends on GPIOLIB && PMIC_OPREGION
> depends on ACPI && EFI && PCI
> + select GPIOLIB_LEGACY
> select NEW_LEDS
> select LEDS_CLASS
> select POWER_SUPPLY
Hmm... This is a surprising change. But I leave it to Hans.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH 15/21] dsa: b53: hide legacy gpiolib usage on non-mips
2025-08-08 15:17 ` [PATCH 15/21] dsa: b53: hide legacy gpiolib usage on non-mips Arnd Bergmann
@ 2025-08-09 10:01 ` Jonas Gorski
2025-08-09 20:55 ` Arnd Bergmann
0 siblings, 1 reply; 62+ messages in thread
From: Jonas Gorski @ 2025-08-09 10:01 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Bartosz Golaszewski, Linus Walleij, linux-gpio, Florian Fainelli,
Andrew Lunn, Vladimir Oltean, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Arnd Bergmann,
Álvaro Fernández Rojas, Kyle Hendry,
Russell King (Oracle), netdev, linux-kernel
Hi,
On Fri, Aug 8, 2025 at 5:23 PM Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> The MIPS bcm53xx platform still uses the legacy gpiolib interfaces based
> on gpio numbers, but other platforms do not.
>
> Hide these interfaces inside of the existing #ifdef block and use the
> modern interfaces in the common parts of the driver to allow building
> it when the gpio_set_value() is left out of the kernel.
Looks reasonable, but doesn't compile:
CC drivers/net/dsa/b53/b53_spi.o
In file included from drivers/net/dsa/b53/b53_spi.c:27:
drivers/net/dsa/b53/b53_priv.h:378:15: error: unknown type name 'gpio_desc'
378 | static inline gpio_desc *b53_switch_get_reset_gpio(struct
b53_device *dev)
| ^~~~~~~~~
drivers/net/dsa/b53/b53_priv.h: In function 'b53_switch_get_reset_gpio':
drivers/net/dsa/b53/b53_priv.h:392:14: error: implicit declaration of
function 'gpio_is_valid'; did you mean 'uuid_is_valid'?
[-Wimplicit-function-declaration]
392 | if (!gpio_is_valid(gpio))
| ^~~~~~~~~~~~~
| uuid_is_valid
drivers/net/dsa/b53/b53_priv.h:395:15: error: implicit declaration of
function 'devm_gpiod_request_one' [-Wimplicit-function-declaration]
395 | ret = devm_gpiod_request_one(dev->dev, gpio,
| ^~~~~~~~~~~~~~~~~~~~~~
drivers/net/dsa/b53/b53_priv.h:396:38: error: 'GPIOF_OUT_INIT_HIGH'
undeclared (first use in this function); did you mean
'GPIOD_OUT_HIGH'?
396 | GPIOF_OUT_INIT_HIGH, "robo_reset");
| ^~~~~~~~~~~~~~~~~~~
| GPIOD_OUT_HIGH
drivers/net/dsa/b53/b53_priv.h:396:38: note: each undeclared
identifier is reported only once for each function it appears in
drivers/net/dsa/b53/b53_priv.h:400:16: error: returning 'struct
gpio_desc *' from a function with incompatible return type 'int *'
[-Wincompatible-pointer-types]
400 | return gpio_to_desc(gpio);
| ^~~~~~~~~~~~~~~~~~
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/net/dsa/b53/b53_common.c | 17 +++++------------
> drivers/net/dsa/b53/b53_priv.h | 24 ++++++++++++++++++------
> 2 files changed, 23 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/net/dsa/b53/b53_common.c b/drivers/net/dsa/b53/b53_common.c
> index 9942fb6f7f4b..cb57bcc56c63 100644
> --- a/drivers/net/dsa/b53/b53_common.c
> +++ b/drivers/net/dsa/b53/b53_common.c
> @@ -19,7 +19,7 @@
>
> #include <linux/delay.h>
> #include <linux/export.h>
> -#include <linux/gpio.h>
this include is now needed for b53_priv.h.
> +#include <linux/gpio/consumer.h>
> #include <linux/kernel.h>
> #include <linux/math.h>
> #include <linux/minmax.h>
> @@ -948,17 +948,17 @@ EXPORT_SYMBOL(b53_configure_vlan);
>
> static void b53_switch_reset_gpio(struct b53_device *dev)
> {
> - int gpio = dev->reset_gpio;
> + struct gpio_desc *gpio = dev->reset_gpio;
>
> - if (gpio < 0)
> + if (IS_ERR(gpio))
> return;
>
> /* Reset sequence: RESET low(50ms)->high(20ms)
> */
> - gpio_set_value(gpio, 0);
> + gpiod_set_value(gpio, 0);
> mdelay(50);
>
> - gpio_set_value(gpio, 1);
> + gpiod_set_value(gpio, 1);
> mdelay(20);
>
> dev->current_page = 0xff;
> @@ -2925,7 +2925,6 @@ static int b53_switch_init(struct b53_device *dev)
> {
> u32 chip_id = dev->chip_id;
> unsigned int i;
> - int ret;
>
> if (is63xx(dev))
> chip_id = BCM63XX_DEVICE_ID;
> @@ -3005,12 +3004,6 @@ static int b53_switch_init(struct b53_device *dev)
> return -ENOMEM;
>
> dev->reset_gpio = b53_switch_get_reset_gpio(dev);
> - if (dev->reset_gpio >= 0) {
> - ret = devm_gpio_request_one(dev->dev, dev->reset_gpio,
> - GPIOF_OUT_INIT_HIGH, "robo_reset");
> - if (ret)
> - return ret;
> - }
>
> return 0;
> }
> diff --git a/drivers/net/dsa/b53/b53_priv.h b/drivers/net/dsa/b53/b53_priv.h
> index 458775f95164..16e82653a7c6 100644
> --- a/drivers/net/dsa/b53/b53_priv.h
> +++ b/drivers/net/dsa/b53/b53_priv.h
> @@ -136,7 +136,7 @@ struct b53_device {
> u8 duplex_reg;
> u8 jumbo_pm_reg;
> u8 jumbo_size_reg;
> - int reset_gpio;
> + struct gpio_desc *reset_gpio;
> u8 num_arl_bins;
> u16 num_arl_buckets;
> enum dsa_tag_protocol tag_protocol;
> @@ -375,22 +375,34 @@ static inline void b53_arl_from_entry_25(u64 *mac_vid,
>
> #include <linux/bcm47xx_nvram.h>
> #include <bcm47xx_board.h>
> -static inline int b53_switch_get_reset_gpio(struct b53_device *dev)
> +static inline gpio_desc *b53_switch_get_reset_gpio(struct b53_device *dev)
s/gpio_desc/struct gpio_desc/
> {
> enum bcm47xx_board board = bcm47xx_board_get();
> + int gpio, ret;
>
> switch (board) {
> case BCM47XX_BOARD_LINKSYS_WRT300NV11:
> case BCM47XX_BOARD_LINKSYS_WRT310NV1:
> - return 8;
> + gpio = 8;
> + break;
> default:
> - return bcm47xx_nvram_gpio_pin("robo_reset");
> + gpio = bcm47xx_nvram_gpio_pin("robo_reset");
> }
> +
> + if (!gpio_is_valid(gpio))
> + return ERR_PTR(-EINVAL);
> +
> + ret = devm_gpiod_request_one(dev->dev, gpio,
s/devm_gpiod_request_one/devm_gpio_request_one/
> + GPIOF_OUT_INIT_HIGH, "robo_reset");
> + if (ret)
> + return ERR_PTR(ret);
> +
> + return gpio_to_desc(gpio);
> }
> #else
> -static inline int b53_switch_get_reset_gpio(struct b53_device *dev)
> +static inline struct gpio_desc *b53_switch_get_reset_gpio(struct b53_device *dev)
> {
> - return -ENOENT;
> + return ERR_PTR(-ENODEV);
> }
> #endif
Can't really test this (no matching hardware), but with the code issues fixed
Reviewed-by: Jonas Gorski <jonas.gorski@gmail.com>
Best regards,
Jonas
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH 17/21] nfc: marvell: convert to gpio descriptors
2025-08-08 15:18 ` [PATCH 17/21] nfc: marvell: convert to gpio descriptors Arnd Bergmann
@ 2025-08-09 10:09 ` Andy Shevchenko
2025-08-11 21:43 ` Dmitry Torokhov
2025-08-11 7:49 ` Bartosz Golaszewski
2025-08-13 7:48 ` Krzysztof Kozlowski
2 siblings, 1 reply; 62+ messages in thread
From: Andy Shevchenko @ 2025-08-09 10:09 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Bartosz Golaszewski, Linus Walleij, linux-gpio,
Krzysztof Kozlowski, Arnd Bergmann, Jakub Kicinski, netdev,
linux-kernel
On Fri, Aug 08, 2025 at 05:18:01PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The only reason this driver seems to still use the legacy gpio
> numbers is for the module parameter that lets users pass a different
> reset gpio.
>
> Since the fixed numbers are on their way out, and none of the platforms
> this driver is used on would have them any more, remove the module
> parameter and instead just use the reset information from firmware.
This patch is my love in the series, thanks for doing it!
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
But note some comments below.
...
> - if (gpio_is_valid(priv->config.reset_n_io)) {
> - rc = gpio_request_one(priv->config.reset_n_io,
> - GPIOF_OUT_INIT_LOW,
> - "nfcmrvl_reset_n");
> - if (rc < 0) {
> - priv->config.reset_n_io = -EINVAL;
> - nfc_err(dev, "failed to request reset_n io\n");
> - }
> + priv->reset_n_io = gpiod_get_optional(dev, "reset-n-io", GPIOD_OUT_LOW);
> + if (IS_ERR(priv->reset_n_io)) {
> + nfc_err(dev, "failed to get reset_n gpio\n");
> + return ERR_CAST(priv->reset_n_io);
> }
This also needs a call to gpiod_set_consumer_name(), IIRC the API name.
...
> - if (gpio_is_valid(priv->config.reset_n_io)) {
> - nfc_info(priv->dev, "reset the chip\n");
> - gpio_set_value(priv->config.reset_n_io, 0);
> - usleep_range(5000, 10000);
> - gpio_set_value(priv->config.reset_n_io, 1);
> - } else
> - nfc_info(priv->dev, "no reset available on this interface\n");
> + nfc_info(priv->dev, "reset the chip\n");
> + gpiod_set_value(priv->reset_n_io, 0);
> + usleep_range(5000, 10000);
Side note, this would be nice to use fsleep(), but I see that's just a
copy'n'paste of the original piece.
> + gpiod_set_value(priv->reset_n_io, 1);
...
> void nfcmrvl_chip_halt(struct nfcmrvl_private *priv)
> {
> - if (gpio_is_valid(priv->config.reset_n_io))
> - gpio_set_value(priv->config.reset_n_io, 0);
> + if (priv->reset_n_io)
Not sure why we need this dup check.
> + gpiod_set_value(priv->reset_n_io, 0);
> }
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH 19/21] usb: udc: pxa: remove unused platform_data
2025-08-08 15:18 ` [PATCH 19/21] usb: udc: pxa: remove unused platform_data Arnd Bergmann
@ 2025-08-09 10:15 ` Andy Shevchenko
2025-08-11 22:12 ` Dmitry Torokhov
1 sibling, 0 replies; 62+ messages in thread
From: Andy Shevchenko @ 2025-08-09 10:15 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Bartosz Golaszewski, Linus Walleij, linux-gpio, Daniel Mack,
Haojian Zhuang, Robert Jarzmik, Russell King, Greg Kroah-Hartman,
Arnd Bergmann, Thomas Gleixner, Ingo Molnar, linux-arm-kernel,
linux-kernel, linux-usb
On Fri, Aug 08, 2025 at 05:18:04PM +0200, Arnd Bergmann wrote:
>
> None of the remaining boards put useful data into the platform_data
> structures, so effectively this only works with DT based probing.
>
> Remove all code that references this data, to stop using the legacy
> gpiolib interfaces. The pxa27x version already supports gpio
> descriptors, while the pxa25x version now does it the same way.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
See a comment below.
...
> static int pxa_udc_probe(struct platform_device *pdev)
> {
> struct pxa_udc *udc = &memory;
> - int retval = 0, gpio;
> - struct pxa2xx_udc_mach_info *mach = dev_get_platdata(&pdev->dev);
> -
> - if (mach) {
> - gpio = mach->gpio_pullup;
> - if (gpio_is_valid(gpio)) {
> - retval = devm_gpio_request_one(&pdev->dev, gpio,
> - GPIOF_OUT_INIT_LOW,
> - "USB D+ pullup");
> - if (retval)
> - return retval;
> - udc->gpiod = gpio_to_desc(mach->gpio_pullup);
> -
> - if (mach->gpio_pullup_inverted ^ gpiod_is_active_low(udc->gpiod))
> - gpiod_toggle_active_low(udc->gpiod);
> - }
> - udc->udc_command = mach->udc_command;
> - } else {
> - udc->gpiod = devm_gpiod_get(&pdev->dev, NULL, GPIOD_ASIS);
> - }
> + int retval = 0;
> +
> + udc->gpiod = devm_gpiod_get(&pdev->dev, NULL, GPIOD_ASIS);
Missed error check, in particular it will ignore deferred probe case.
> udc->regs = devm_platform_ioremap_resource(pdev, 0);
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH 21/21] gpiolib: turn off legacy interface by default
2025-08-08 15:18 ` [PATCH 21/21] gpiolib: turn off legacy interface by default Arnd Bergmann
@ 2025-08-09 10:18 ` Andy Shevchenko
2025-08-09 19:47 ` Arnd Bergmann
0 siblings, 1 reply; 62+ messages in thread
From: Andy Shevchenko @ 2025-08-09 10:18 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Bartosz Golaszewski, Linus Walleij, linux-gpio, Arnd Bergmann,
Peng Fan, Geert Uytterhoeven, Koichiro Den, André Draszik,
linux-kernel
On Fri, Aug 08, 2025 at 05:18:06PM +0200, Arnd Bergmann wrote:
> All users of the legacy interface now select CONFIG_GPIOLIB_LEGACY,
> so it can be turned off by default.
>
> Allow turning it on manually for compile testing, in order to keep
> the build coverage of the legacy drivers.
...
> config GPIOLIB_LEGACY
> - def_bool y
> + bool "Legacy GPIO interfaces" if COMPILE_TEST
Maybe I'm missing something, but how does it supposed to be compiled for old
platforms? (No, COMPILE_TEST is not a correct option for that)
Perhaps you meant EXPERT ?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH 05/21] x86/platform: select legacy gpiolib interfaces where used
2025-08-09 10:00 ` Andy Shevchenko
@ 2025-08-09 19:44 ` Arnd Bergmann
2025-08-10 15:12 ` Hans de Goede
0 siblings, 1 reply; 62+ messages in thread
From: Arnd Bergmann @ 2025-08-09 19:44 UTC (permalink / raw)
To: Andy Shevchenko, Arnd Bergmann
Cc: Bartosz Golaszewski, Linus Walleij, open list:GPIO SUBSYSTEM,
Dmitry Torokhov, Hans de Goede, Ilpo Järvinen, Lee Jones,
Dzmitry Sankouski, Heiko Stübner, linux,
Thomas Weißschuh, Guenter Roeck, linux-input, linux-kernel,
platform-driver-x86
On Sat, Aug 9, 2025, at 12:00, Andy Shevchenko wrote:
> On Fri, Aug 08, 2025 at 05:17:49PM +0200, Arnd Bergmann wrote:
>> From: Arnd Bergmann <arnd@arndb.de>
>>
>> A few old machines have not been converted away from the old-style
>> gpiolib interfaces. Make these select the new CONFIG_GPIOLIB_LEGACY
>> symbol so the code still works where it is needed but can be left
>> out otherwise.
>
>> --- a/drivers/platform/x86/x86-android-tablets/Kconfig
>> +++ b/drivers/platform/x86/x86-android-tablets/Kconfig
>> @@ -8,6 +8,7 @@ config X86_ANDROID_TABLETS
>> depends on I2C && SPI && SERIAL_DEV_BUS
>> depends on GPIOLIB && PMIC_OPREGION
>> depends on ACPI && EFI && PCI
>> + select GPIOLIB_LEGACY
>> select NEW_LEDS
>> select LEDS_CLASS
>> select POWER_SUPPLY
>
> Hmm... This is a surprising change. But I leave it to Hans.
I think the only function that still needs it is
x86_android_tablet_probe() doing
static struct gpio_keys_button *buttons;
for (i = 0; i < dev_info->gpio_button_count; i++) {
ret = x86_android_tablet_get_gpiod(dev_info->gpio_button[i].chip,
dev_info->gpio_button[i].pin,
dev_info->gpio_button[i].button.desc,
false, GPIOD_IN, &gpiod);
buttons[i] = dev_info->gpio_button[i].button;
buttons[i].gpio = desc_to_gpio(gpiod);
/* Release GPIO descriptor so that gpio-keys can request it */
devm_gpiod_put(&x86_android_tablet_device->dev, gpiod);
}
So the driver itself uses gpio descriptors, but it passes
some of them into another driver by number. There is probably
an easy workaround that I did not see.
Arnd
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH 21/21] gpiolib: turn off legacy interface by default
2025-08-09 10:18 ` Andy Shevchenko
@ 2025-08-09 19:47 ` Arnd Bergmann
2025-08-11 12:49 ` Andy Shevchenko
0 siblings, 1 reply; 62+ messages in thread
From: Arnd Bergmann @ 2025-08-09 19:47 UTC (permalink / raw)
To: Andy Shevchenko, Arnd Bergmann
Cc: Bartosz Golaszewski, Linus Walleij, open list:GPIO SUBSYSTEM,
Peng Fan, Geert Uytterhoeven, Koichiro Den, André Draszik,
linux-kernel
On Sat, Aug 9, 2025, at 12:18, Andy Shevchenko wrote:
> On Fri, Aug 08, 2025 at 05:18:06PM +0200, Arnd Bergmann wrote:
>
>> All users of the legacy interface now select CONFIG_GPIOLIB_LEGACY,
>> so it can be turned off by default.
>>
>> Allow turning it on manually for compile testing, in order to keep
>> the build coverage of the legacy drivers.
>
>> config GPIOLIB_LEGACY
>> - def_bool y
>> + bool "Legacy GPIO interfaces" if COMPILE_TEST
>
> Maybe I'm missing something, but how does it supposed to be compiled for old
> platforms? (No, COMPILE_TEST is not a correct option for that)
> Perhaps you meant EXPERT ?
The COMPILE_TEST is really just meant for enabling some drivers
that would otherwise be skipped in allmodconfig builds.
All the old platforms that use one of the GPIOLIB_LEGACY drivers
select that symbol once the first six patches are merged.
Arnd
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH 15/21] dsa: b53: hide legacy gpiolib usage on non-mips
2025-08-09 10:01 ` Jonas Gorski
@ 2025-08-09 20:55 ` Arnd Bergmann
0 siblings, 0 replies; 62+ messages in thread
From: Arnd Bergmann @ 2025-08-09 20:55 UTC (permalink / raw)
To: Jonas Gorski, Arnd Bergmann
Cc: Bartosz Golaszewski, Linus Walleij, open list:GPIO SUBSYSTEM,
Florian Fainelli, Andrew Lunn, Vladimir Oltean, David S . Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Álvaro Fernández Rojas, Kyle Hendry, Russell King,
Netdev, linux-kernel
On Sat, Aug 9, 2025, at 12:01, Jonas Gorski wrote:
> On Fri, Aug 8, 2025 at 5:23 PM Arnd Bergmann <arnd@kernel.org> wrote:
>
> Can't really test this (no matching hardware), but with the code issues fixed
>
> Reviewed-by: Jonas Gorski <jonas.gorski@gmail.com>
Thanks! I've added the fixes you suggested and made sure it
actually builds on mips. I had done lots of randconfig tested
on arm and x86, but since that code block is only built on
mips, I missed my mistakes.
Arnd
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH 05/21] x86/platform: select legacy gpiolib interfaces where used
2025-08-09 19:44 ` Arnd Bergmann
@ 2025-08-10 15:12 ` Hans de Goede
2025-08-11 2:27 ` Dmitry Torokhov
0 siblings, 1 reply; 62+ messages in thread
From: Hans de Goede @ 2025-08-10 15:12 UTC (permalink / raw)
To: Arnd Bergmann, Andy Shevchenko, Arnd Bergmann
Cc: Bartosz Golaszewski, Linus Walleij, open list:GPIO SUBSYSTEM,
Dmitry Torokhov, Ilpo Järvinen, Lee Jones, Dzmitry Sankouski,
Heiko Stübner, linux, Thomas Weißschuh, Guenter Roeck,
linux-input, linux-kernel, platform-driver-x86
[-- Attachment #1: Type: text/plain, Size: 3900 bytes --]
Hi Arnd, Andy,
On 9-Aug-25 9:44 PM, Arnd Bergmann wrote:
> On Sat, Aug 9, 2025, at 12:00, Andy Shevchenko wrote:
>> On Fri, Aug 08, 2025 at 05:17:49PM +0200, Arnd Bergmann wrote:
>>> From: Arnd Bergmann <arnd@arndb.de>
>>>
>>> A few old machines have not been converted away from the old-style
>>> gpiolib interfaces. Make these select the new CONFIG_GPIOLIB_LEGACY
>>> symbol so the code still works where it is needed but can be left
>>> out otherwise.
>>
>>> --- a/drivers/platform/x86/x86-android-tablets/Kconfig
>>> +++ b/drivers/platform/x86/x86-android-tablets/Kconfig
>>> @@ -8,6 +8,7 @@ config X86_ANDROID_TABLETS
>>> depends on I2C && SPI && SERIAL_DEV_BUS
>>> depends on GPIOLIB && PMIC_OPREGION
>>> depends on ACPI && EFI && PCI
>>> + select GPIOLIB_LEGACY
>>> select NEW_LEDS
>>> select LEDS_CLASS
>>> select POWER_SUPPLY
>>
>> Hmm... This is a surprising change. But I leave it to Hans.
Yes I was surprised by this myself since I explicitly removed
all legacy GPIO use from the x86-android-tablets code a while
ago (or so I thought).
> I think the only function that still needs it is
> x86_android_tablet_probe() doing
>
> static struct gpio_keys_button *buttons;
>
> for (i = 0; i < dev_info->gpio_button_count; i++) {
> ret = x86_android_tablet_get_gpiod(dev_info->gpio_button[i].chip,
> dev_info->gpio_button[i].pin,
> dev_info->gpio_button[i].button.desc,
> false, GPIOD_IN, &gpiod);
>
> buttons[i] = dev_info->gpio_button[i].button;
> buttons[i].gpio = desc_to_gpio(gpiod);
> /* Release GPIO descriptor so that gpio-keys can request it */
> devm_gpiod_put(&x86_android_tablet_device->dev, gpiod);
> }
>
> So the driver itself uses gpio descriptors, but it passes
> some of them into another driver by number. There is probably
> an easy workaround that I did not see.
Ah I see, so this is basically in the same boat as
drivers/input/misc/soc_button_array.c which also first
gets a gpio_desc and then calls desc_to_gpio() to store
the GPIO number in struct gpio_keys_button which is passed
as platform_data to drivers/input/keyboard/gpio_keys.c
The gpio_keys driver then converts things back
into a gpio_desc in gpio_keys_setup_key()
using devm_gpio_request_one() + gpio_to_desc()
So it looks like we need to add a gpiod member to
struct gpio_keys_button (include/linux/gpio_keys.h)
and modify gpio_keys.c to prefer that over using
button->gpio, something like the attached patch
basically.
I won't have time to work on this until September,
so if someone wants to take the attached patch and run
with it go for it.
Note the x86-android-tablets / soc_button_array code
will become responsible for requesting / releasing
the gpiod when using the new gpio_keys_button.gpiod
member.
For the x86-android-tablets code this is easy, just drop
these 2 lines:
/* Release GPIO descriptor so that gpio-keys can request it */
devm_gpiod_put(&x86_android_tablet_device->dev, gpiod);
And for soc_button_array.c it is _probably_ just a matter
of switching to devm_gpiod_get_index() and drop the
gpiod_put().
I have hardware to test both the x86-android-tablets
code as well as the soc_button_array code. I might be
able to do a quick test on August 22nd or 29th.
Regards,
Hans
p.s.
It looks like this will also help with:
drivers/platform/x86/meraki-mx100.c
drivers/platform/x86/pcengines-apuv2.c
drivers/platform/x86/barco-p50-gpio.c
I do not have hardware to test these, but if the changes
work for x86-android-tablets + soc_button_array then
hopefully they will be fine here too.
[-- Attachment #2: 0001-Input-gpio-keys-Allow-directly-passing-a-gpio_desc-i.patch --]
[-- Type: text/x-patch, Size: 2112 bytes --]
From 6fe4bd731db59bb01cc0ce3cbd2412434ea053c6 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hansg@kernel.org>
Date: Sun, 10 Aug 2025 16:58:01 +0200
Subject: [PATCH] Input: gpio-keys - Allow directly passing a gpio_desc instead
of a GPIO number
Using GPIO numbers is deprecated. Allow code passing GPIO-keys info through
platform-data (struct gpio_keys_button) to directly pass a gpio_desc
instead of a GPIO number.
Note requesting / releasing the gpio_desc will be the responsibility
of the code passing in the platform-data.
Signed-off-by: Hans de Goede <hansg@kernel.org>
---
drivers/input/keyboard/gpio_keys.c | 2 ++
include/linux/gpio_keys.h | 5 ++++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index f9db86da0818..323247f63a7e 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -528,6 +528,8 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
*/
bdata->gpiod = NULL;
}
+ } else if (button->gpiod) {
+ bdata->gpiod = button->gpiod;
} else if (gpio_is_valid(button->gpio)) {
/*
* Legacy GPIO number, so request the GPIO here and
diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
index 80fa930b04c6..7c32c3a0695f 100644
--- a/include/linux/gpio_keys.h
+++ b/include/linux/gpio_keys.h
@@ -5,11 +5,13 @@
#include <linux/types.h>
struct device;
+struct gpio_desc;
/**
* struct gpio_keys_button - configuration parameters
* @code: input event code (KEY_*, SW_*)
- * @gpio: %-1 if this key does not support gpio
+ * @gpio: %-1 if this key does not support gpio (deprecated use gpiod)
+ * @gpiod: gpio_desc for the GPIO, NULL if this key does not support gpio
* @active_low: %true indicates that button is considered
* depressed when gpio is low
* @desc: label that will be attached to button's gpio
@@ -26,6 +28,7 @@ struct device;
struct gpio_keys_button {
unsigned int code;
int gpio;
+ struct gpio_desc *gpiod;
int active_low;
const char *desc;
unsigned int type;
--
2.49.0
^ permalink raw reply related [flat|nested] 62+ messages in thread
* Re: [PATCH 05/21] x86/platform: select legacy gpiolib interfaces where used
2025-08-10 15:12 ` Hans de Goede
@ 2025-08-11 2:27 ` Dmitry Torokhov
0 siblings, 0 replies; 62+ messages in thread
From: Dmitry Torokhov @ 2025-08-11 2:27 UTC (permalink / raw)
To: Hans de Goede
Cc: Arnd Bergmann, Andy Shevchenko, Arnd Bergmann,
Bartosz Golaszewski, Linus Walleij, open list:GPIO SUBSYSTEM,
Ilpo Järvinen, Lee Jones, Dzmitry Sankouski,
Heiko Stübner, linux, Thomas Weißschuh, Guenter Roeck,
linux-input, linux-kernel, platform-driver-x86
Hi Hans,
On Sun, Aug 10, 2025 at 05:12:46PM +0200, Hans de Goede wrote:
> Hi Arnd, Andy,
>
> On 9-Aug-25 9:44 PM, Arnd Bergmann wrote:
> > On Sat, Aug 9, 2025, at 12:00, Andy Shevchenko wrote:
> >> On Fri, Aug 08, 2025 at 05:17:49PM +0200, Arnd Bergmann wrote:
> >>> From: Arnd Bergmann <arnd@arndb.de>
> >>>
> >>> A few old machines have not been converted away from the old-style
> >>> gpiolib interfaces. Make these select the new CONFIG_GPIOLIB_LEGACY
> >>> symbol so the code still works where it is needed but can be left
> >>> out otherwise.
> >>
> >>> --- a/drivers/platform/x86/x86-android-tablets/Kconfig
> >>> +++ b/drivers/platform/x86/x86-android-tablets/Kconfig
> >>> @@ -8,6 +8,7 @@ config X86_ANDROID_TABLETS
> >>> depends on I2C && SPI && SERIAL_DEV_BUS
> >>> depends on GPIOLIB && PMIC_OPREGION
> >>> depends on ACPI && EFI && PCI
> >>> + select GPIOLIB_LEGACY
> >>> select NEW_LEDS
> >>> select LEDS_CLASS
> >>> select POWER_SUPPLY
> >>
> >> Hmm... This is a surprising change. But I leave it to Hans.
>
> Yes I was surprised by this myself since I explicitly removed
> all legacy GPIO use from the x86-android-tablets code a while
> ago (or so I thought).
>
> > I think the only function that still needs it is
> > x86_android_tablet_probe() doing
> >
> > static struct gpio_keys_button *buttons;
> >
> > for (i = 0; i < dev_info->gpio_button_count; i++) {
> > ret = x86_android_tablet_get_gpiod(dev_info->gpio_button[i].chip,
> > dev_info->gpio_button[i].pin,
> > dev_info->gpio_button[i].button.desc,
> > false, GPIOD_IN, &gpiod);
> >
> > buttons[i] = dev_info->gpio_button[i].button;
> > buttons[i].gpio = desc_to_gpio(gpiod);
> > /* Release GPIO descriptor so that gpio-keys can request it */
> > devm_gpiod_put(&x86_android_tablet_device->dev, gpiod);
> > }
> >
> > So the driver itself uses gpio descriptors, but it passes
> > some of them into another driver by number. There is probably
> > an easy workaround that I did not see.
>
> Ah I see, so this is basically in the same boat as
> drivers/input/misc/soc_button_array.c which also first
> gets a gpio_desc and then calls desc_to_gpio() to store
> the GPIO number in struct gpio_keys_button which is passed
> as platform_data to drivers/input/keyboard/gpio_keys.c
>
> The gpio_keys driver then converts things back
> into a gpio_desc in gpio_keys_setup_key()
> using devm_gpio_request_one() + gpio_to_desc()
>
> So it looks like we need to add a gpiod member to
> struct gpio_keys_button (include/linux/gpio_keys.h)
> and modify gpio_keys.c to prefer that over using
> button->gpio, something like the attached patch
> basically.
>
> I won't have time to work on this until September,
> so if someone wants to take the attached patch and run
> with it go for it.
>
> Note the x86-android-tablets / soc_button_array code
> will become responsible for requesting / releasing
> the gpiod when using the new gpio_keys_button.gpiod
> member.
>
> For the x86-android-tablets code this is easy, just drop
> these 2 lines:
>
> /* Release GPIO descriptor so that gpio-keys can request it */
> devm_gpiod_put(&x86_android_tablet_device->dev, gpiod);
>
> And for soc_button_array.c it is _probably_ just a matter
> of switching to devm_gpiod_get_index() and drop the
> gpiod_put().
>
> I have hardware to test both the x86-android-tablets
> code as well as the soc_button_array code. I might be
> able to do a quick test on August 22nd or 29th.
I just sent out a v2 of my series from '23 converting
x86-android-tablets to use PROPERTY_ENTRY_GPIO(), including converting
buttons and switches:
https://lore.kernel.org/all/20250810-x86-andoroid-tablet-v2-0-9c7a1b3c32b2@gmail.com/
I do not have hardware so it probably is busted but if you could make it
work that would be great.
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH 17/21] nfc: marvell: convert to gpio descriptors
2025-08-08 15:18 ` [PATCH 17/21] nfc: marvell: convert to gpio descriptors Arnd Bergmann
2025-08-09 10:09 ` Andy Shevchenko
@ 2025-08-11 7:49 ` Bartosz Golaszewski
2025-08-13 7:48 ` Krzysztof Kozlowski
2 siblings, 0 replies; 62+ messages in thread
From: Bartosz Golaszewski @ 2025-08-11 7:49 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Linus Walleij, linux-gpio, Krzysztof Kozlowski, Arnd Bergmann,
Jakub Kicinski, Andy Shevchenko, netdev, linux-kernel
On Fri, Aug 8, 2025 at 5:24 PM Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> The only reason this driver seems to still use the legacy gpio
> numbers is for the module parameter that lets users pass a different
> reset gpio.
>
> Since the fixed numbers are on their way out, and none of the platforms
> this driver is used on would have them any more, remove the module
> parameter and instead just use the reset information from firmware.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
Yes, please!
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH 01/21] ARM: select legacy gpiolib interfaces where used
2025-08-08 15:17 ` [PATCH 01/21] ARM: select legacy gpiolib interfaces where used Arnd Bergmann
@ 2025-08-11 8:49 ` Krzysztof Kozlowski
0 siblings, 0 replies; 62+ messages in thread
From: Krzysztof Kozlowski @ 2025-08-11 8:49 UTC (permalink / raw)
To: Arnd Bergmann, Bartosz Golaszewski, Linus Walleij, linux-gpio,
Andrew Lunn, Sebastian Hesselbarth, Gregory Clement, Russell King,
Daniel Mack, Haojian Zhuang, Robert Jarzmik
Cc: Arnd Bergmann, Alim Akhtar, linux-arm-kernel, linux-kernel,
linux-samsung-soc
On 08/08/2025 17:17, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> A few old machines have not been converted away from the old-style
> gpiolib interfaces. Make these select the new CONFIG_GPIOLIB_LEGACY
> symbol so the code still works where it is needed but can be left
> out otherwise.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH 09/21] input: gpio-keys: make legacy gpiolib optional
2025-08-08 15:17 ` [PATCH 09/21] input: gpio-keys: make legacy gpiolib optional Arnd Bergmann
@ 2025-08-11 10:34 ` Matti Vaittinen
2025-08-11 12:52 ` Andy Shevchenko
0 siblings, 1 reply; 62+ messages in thread
From: Matti Vaittinen @ 2025-08-11 10:34 UTC (permalink / raw)
To: Arnd Bergmann, Bartosz Golaszewski, Linus Walleij, linux-gpio,
Dmitry Torokhov, Lee Jones
Cc: Arnd Bergmann, Gatien Chevallier, Fabrice Gasnier,
Andy Shevchenko, Bartosz Golaszewski, Thomas Gleixner,
Charles Keepax, Krzysztof Kozlowski, Christophe JAILLET,
linux-input, linux-kernel
Hi dee Ho peeps,
On 08/08/2025 18:17, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> Most users of gpio-keys and gpio-keys-polled use modern gpiolib
> interfaces, but there are still number of ancient sh, arm32 and x86
> machines that have never been converted.
>
> Add an #ifdef block for the parts of the driver that are only
> used on those legacy machines.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/input/keyboard/gpio_keys.c | 5 +++--
> drivers/input/keyboard/gpio_keys_polled.c | 2 ++
> drivers/mfd/rohm-bd71828.c | 2 ++
> drivers/mfd/rohm-bd718x7.c | 2 ++
> include/linux/gpio_keys.h | 2 ++
> 5 files changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
> index f9db86da0818..984b20f773ed 100644
> --- a/drivers/input/keyboard/gpio_keys.c
> +++ b/drivers/input/keyboard/gpio_keys.c
> @@ -528,6 +528,7 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
> */
> bdata->gpiod = NULL;
> }
> +#ifdef CONFIG_GPIOLIB_LEGACY
> } else if (gpio_is_valid(button->gpio)) {
> /*
> * Legacy GPIO number, so request the GPIO here and
> @@ -546,6 +547,7 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
>
> if (button->active_low ^ gpiod_is_active_low(bdata->gpiod))
> gpiod_toggle_active_low(bdata->gpiod);
> +#endif
> }
>
> if (bdata->gpiod) {
> @@ -583,8 +585,7 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
> if (irq < 0) {
> error = irq;
> dev_err_probe(dev, error,
> - "Unable to get irq number for GPIO %d\n",
> - button->gpio);
> + "Unable to get irq number for GPIO\n");
> return error;
> }
> bdata->irq = irq;
> diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c
> index e6707d72210e..0ae0e53910ea 100644
> --- a/drivers/input/keyboard/gpio_keys_polled.c
> +++ b/drivers/input/keyboard/gpio_keys_polled.c
> @@ -301,6 +301,7 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)
> return dev_err_probe(dev, PTR_ERR(bdata->gpiod),
> "failed to get gpio\n");
> }
> +#ifdef CONFIG_GPIOLIB_LEGACY
> } else if (gpio_is_valid(button->gpio)) {
> /*
> * Legacy GPIO number so request the GPIO here and
> @@ -323,6 +324,7 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)
>
> if (button->active_low ^ gpiod_is_active_low(bdata->gpiod))
> gpiod_toggle_active_low(bdata->gpiod);
> +#endif
> }
>
> bdata->last_state = -1;
> diff --git a/drivers/mfd/rohm-bd71828.c b/drivers/mfd/rohm-bd71828.c
> index a14b7aa69c3c..fb68694fadca 100644
> --- a/drivers/mfd/rohm-bd71828.c
> +++ b/drivers/mfd/rohm-bd71828.c
> @@ -21,7 +21,9 @@
>
> static struct gpio_keys_button button = {
> .code = KEY_POWER,
> +#ifdef CONFIG_GPIOLIB_LEGACY
> .gpio = -1,
> +#endif
> .type = EV_KEY,
> };
>
> diff --git a/drivers/mfd/rohm-bd718x7.c b/drivers/mfd/rohm-bd718x7.c
> index 25e494a93d48..6c99ab62e31b 100644
> --- a/drivers/mfd/rohm-bd718x7.c
> +++ b/drivers/mfd/rohm-bd718x7.c
> @@ -20,7 +20,9 @@
>
> static struct gpio_keys_button button = {
> .code = KEY_POWER,
> +#ifdef CONFIG_GPIOLIB_LEGACY
> .gpio = -1,
> +#endif
> .type = EV_KEY,
> };
>
> diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
> index 80fa930b04c6..e8d6dc290efb 100644
> --- a/include/linux/gpio_keys.h
> +++ b/include/linux/gpio_keys.h
> @@ -25,7 +25,9 @@ struct device;
> */
> struct gpio_keys_button {
> unsigned int code;
> +#ifdef CONFIG_GPIOLIB_LEGACY
> int gpio;
> +#endif
> int active_low;
> const char *desc;
> unsigned int type;
AFAIR, these ROHM PMICs (bd718[15, 27, 28, 37, 47, 50, 78, 85]) all
provide a 'button IRQ', from a power button. (Or, couple of IRQs but
let's skip the details) The gpio-keys is used to send the KEY_POWER
event when IRQ is detected.
The IRQ comes from the PMIC, and the regmap_irq chip provided by the MFD
provides it. This IRQ information is delivered to the gpio-keys from the
MFD driver via platform data. That's basically what these "button"
structs are here for. No GPIO line information (only the IRQ number) is
needed to be delivered to the gpio-keys. This problematic assignment:
> +#ifdef CONFIG_GPIOLIB_LEGACY
> .gpio = -1,
> +#endif
is only needed to invalidate the gpio information so that the gpio-keys
wont use it, only the IRQ.
As such, this patch seems Ok to me, you can treat this as an ack :)
This, however made me ponder following - is this the tight way to handle
the power-button IRQ? I don't see any other MFD devices doing this in
same way, although I am pretty sure there are other PMICs with similar
power-button IRQ...
I see for example the "drivers/mfd/rt5120.c" to invoke
"drivers/input/misc/rt5120-pwrkey.c" instead of using the gpio-keys.
This, however, feels like code duplication to me. I'd rather kept using
the gpio-keys, but seeing:
git grep KEY_POWER drivers/mfd/
drivers/mfd/rohm-bd71828.c: .code = KEY_POWER,
drivers/mfd/rohm-bd718x7.c: .code = KEY_POWER,
makes me wonder if there is more widely used (better) way?
Yours,
-- Matti
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH 21/21] gpiolib: turn off legacy interface by default
2025-08-09 19:47 ` Arnd Bergmann
@ 2025-08-11 12:49 ` Andy Shevchenko
0 siblings, 0 replies; 62+ messages in thread
From: Andy Shevchenko @ 2025-08-11 12:49 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Arnd Bergmann, Bartosz Golaszewski, Linus Walleij,
open list:GPIO SUBSYSTEM, Peng Fan, Geert Uytterhoeven,
Koichiro Den, André Draszik, linux-kernel
On Sat, Aug 09, 2025 at 09:47:31PM +0200, Arnd Bergmann wrote:
> On Sat, Aug 9, 2025, at 12:18, Andy Shevchenko wrote:
> > On Fri, Aug 08, 2025 at 05:18:06PM +0200, Arnd Bergmann wrote:
> >
> >> All users of the legacy interface now select CONFIG_GPIOLIB_LEGACY,
> >> so it can be turned off by default.
> >>
> >> Allow turning it on manually for compile testing, in order to keep
> >> the build coverage of the legacy drivers.
> >
> >> config GPIOLIB_LEGACY
> >> - def_bool y
> >> + bool "Legacy GPIO interfaces" if COMPILE_TEST
> >
> > Maybe I'm missing something, but how does it supposed to be compiled for old
> > platforms? (No, COMPILE_TEST is not a correct option for that)
> > Perhaps you meant EXPERT ?
>
> The COMPILE_TEST is really just meant for enabling some drivers
> that would otherwise be skipped in allmodconfig builds.
>
> All the old platforms that use one of the GPIOLIB_LEGACY drivers
> select that symbol once the first six patches are merged.
Ah, that makes sense. Perhaps a word to be added into commit message?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH 09/21] input: gpio-keys: make legacy gpiolib optional
2025-08-11 10:34 ` Matti Vaittinen
@ 2025-08-11 12:52 ` Andy Shevchenko
2025-08-11 19:21 ` Dmitry Torokhov
0 siblings, 1 reply; 62+ messages in thread
From: Andy Shevchenko @ 2025-08-11 12:52 UTC (permalink / raw)
To: Matti Vaittinen
Cc: Arnd Bergmann, Bartosz Golaszewski, Linus Walleij, linux-gpio,
Dmitry Torokhov, Lee Jones, Arnd Bergmann, Gatien Chevallier,
Fabrice Gasnier, Bartosz Golaszewski, Thomas Gleixner,
Charles Keepax, Krzysztof Kozlowski, Christophe JAILLET,
linux-input, linux-kernel
On Mon, Aug 11, 2025 at 01:34:43PM +0300, Matti Vaittinen wrote:
> On 08/08/2025 18:17, Arnd Bergmann wrote:
...
> As such, this patch seems Ok to me, you can treat this as an ack :) This,
> however made me ponder following - is this the tight way to handle the
> power-button IRQ? I don't see any other MFD devices doing this in same way,
> although I am pretty sure there are other PMICs with similar power-button
> IRQ...
>
> I see for example the "drivers/mfd/rt5120.c" to invoke
> "drivers/input/misc/rt5120-pwrkey.c" instead of using the gpio-keys. This,
> however, feels like code duplication to me. I'd rather kept using the
> gpio-keys, but seeing:
>
> git grep KEY_POWER drivers/mfd/
> drivers/mfd/rohm-bd71828.c: .code = KEY_POWER,
> drivers/mfd/rohm-bd718x7.c: .code = KEY_POWER,
>
> makes me wonder if there is more widely used (better) way?
FWIW, on Intel platforms that use power button by PMIC we add a special driver
for each of such cases.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH 00/21] gpiolib: fence off legacy interfaces
2025-08-08 15:17 [PATCH 00/21] gpiolib: fence off legacy interfaces Arnd Bergmann
` (20 preceding siblings ...)
2025-08-08 15:18 ` [PATCH 21/21] gpiolib: turn off legacy interface by default Arnd Bergmann
@ 2025-08-11 13:10 ` Bartosz Golaszewski
2025-08-12 16:23 ` (subset) " Mark Brown
2025-09-02 12:56 ` Lee Jones
23 siblings, 0 replies; 62+ messages in thread
From: Bartosz Golaszewski @ 2025-08-11 13:10 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Arnd Bergmann, Andrew Lunn, Sebastian Hesselbarth,
Gregory Clement, Russell King, Daniel Mack, Haojian Zhuang,
Robert Jarzmik, Krzysztof Kozlowski, Alim Akhtar,
Geert Uytterhoeven, Thomas Bogendoerfer, Yoshinori Sato,
Rich Felker, John Paul Adrian Glaubitz, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, Dave Hansen, x86, H. Peter Anvin,
Dmitry Torokhov, Lee Jones, Pavel Machek, Mauro Carvalho Chehab,
Matti Vaittinen, Florian Fainelli, Jeff Johnson, Hans de Goede,
Ilpo Järvinen, Greg Kroah-Hartman, Jaroslav Kysela,
Takashi Iwai, Liam Girdwood, Mark Brown, Andy Shevchenko,
Dr. David Alan Gilbert, linux-arm-kernel, linux-kernel,
linux-samsung-soc, linux-m68k, linux-mips, linux-sh, linux-input,
linux-leds, linux-media, patches, netdev, linux-wireless, ath10k,
platform-driver-x86, linux-usb, linux-sound, Bartosz Golaszewski,
Linus Walleij, linux-gpio
On Fri, 8 Aug 2025 17:17:44 +0200, Arnd Bergmann <arnd@kernel.org> said:
> From: Arnd Bergmann <arnd@arndb.de>
>
> Commit 678bae2eaa81 ("gpiolib: make legacy interfaces optional") was
> merged for linux-6.17, so now it is possible to use the legacy interfaces
> conditionally and eventually have the support left out of the kernel
> whenever it is not needed.
>
> I created six patches to force-enable CONFIG_GPIOLIB_LEGACY on the
> few (mostly ancient) platforms that still require this, plus a set of
> patches to either add the corresponding Kconfig dependencies that make
> the device drivers conditional on that symbol, or change them to no
> longer require it.
>
> The final patch ends up turning the Kconfig symbol off by default,
> which of course depends on everything else getting merged first to avoid
> build errors.
>
> I would suggest that patches 1-20 can just get merged through the
> respective maintainer trees independently when they are deemed ready,
> and the final patch can wait another merge window.
>
Oh, not at all, I'm fine sending a second PR late into the merge window to
get that done in a single cycle.
Thanks for doing this, awesome work!
Bartosz
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH 07/21] mfd: wm8994: remove dead legacy-gpio code
2025-08-08 15:17 ` [PATCH 07/21] mfd: wm8994: remove dead legacy-gpio code Arnd Bergmann
@ 2025-08-11 13:14 ` Bartosz Golaszewski
0 siblings, 0 replies; 62+ messages in thread
From: Bartosz Golaszewski @ 2025-08-11 13:14 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Arnd Bergmann, Thomas Gleixner, Jiri Slaby (SUSE), patches,
linux-kernel, Bartosz Golaszewski, Linus Walleij, linux-gpio,
Lee Jones
On Fri, 8 Aug 2025 17:17:51 +0200, Arnd Bergmann <arnd@kernel.org> said:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The old-style gpio handling in wm8994 came from a commit 7c8844481a1c
> ("mfd: wm8994: Emulate level triggered interrupts if required") in
> linux-3.11, but nothing in the kernel ever set the 'irq_gpio' member
> in the wm8994_pdata structure, so this was always dead code.
>
> Remove it now to reduce the dependency on the legacy gpio interfaces.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH 09/21] input: gpio-keys: make legacy gpiolib optional
2025-08-11 12:52 ` Andy Shevchenko
@ 2025-08-11 19:21 ` Dmitry Torokhov
2025-08-11 20:09 ` Andy Shevchenko
0 siblings, 1 reply; 62+ messages in thread
From: Dmitry Torokhov @ 2025-08-11 19:21 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Matti Vaittinen, Arnd Bergmann, Bartosz Golaszewski,
Linus Walleij, linux-gpio, Lee Jones, Arnd Bergmann,
Gatien Chevallier, Fabrice Gasnier, Bartosz Golaszewski,
Thomas Gleixner, Charles Keepax, Krzysztof Kozlowski,
Christophe JAILLET, linux-input, linux-kernel
On Mon, Aug 11, 2025 at 03:52:19PM +0300, Andy Shevchenko wrote:
> On Mon, Aug 11, 2025 at 01:34:43PM +0300, Matti Vaittinen wrote:
> > On 08/08/2025 18:17, Arnd Bergmann wrote:
>
> ...
>
> > As such, this patch seems Ok to me, you can treat this as an ack :) This,
> > however made me ponder following - is this the tight way to handle the
> > power-button IRQ? I don't see any other MFD devices doing this in same way,
> > although I am pretty sure there are other PMICs with similar power-button
> > IRQ...
> >
> > I see for example the "drivers/mfd/rt5120.c" to invoke
> > "drivers/input/misc/rt5120-pwrkey.c" instead of using the gpio-keys. This,
> > however, feels like code duplication to me. I'd rather kept using the
> > gpio-keys, but seeing:
> >
> > git grep KEY_POWER drivers/mfd/
> > drivers/mfd/rohm-bd71828.c: .code = KEY_POWER,
> > drivers/mfd/rohm-bd718x7.c: .code = KEY_POWER,
> >
> > makes me wonder if there is more widely used (better) way?
>
> FWIW, on Intel platforms that use power button by PMIC we add a special driver
> for each of such cases.
If we can make gpio-keys work for various power buttons that would be
great IMO. The MFD drivers in question already are using device tree,
but they do not define/expect nodes for the power buttons. If the nodes
were there then I think gpio-keys would work out of the box?
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH 09/21] input: gpio-keys: make legacy gpiolib optional
2025-08-11 19:21 ` Dmitry Torokhov
@ 2025-08-11 20:09 ` Andy Shevchenko
2025-08-12 5:11 ` Matti Vaittinen
0 siblings, 1 reply; 62+ messages in thread
From: Andy Shevchenko @ 2025-08-11 20:09 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Matti Vaittinen, Arnd Bergmann, Bartosz Golaszewski,
Linus Walleij, linux-gpio, Lee Jones, Arnd Bergmann,
Gatien Chevallier, Fabrice Gasnier, Bartosz Golaszewski,
Thomas Gleixner, Charles Keepax, Krzysztof Kozlowski,
Christophe JAILLET, linux-input, linux-kernel
On Mon, Aug 11, 2025 at 12:21:51PM -0700, Dmitry Torokhov wrote:
> On Mon, Aug 11, 2025 at 03:52:19PM +0300, Andy Shevchenko wrote:
> > On Mon, Aug 11, 2025 at 01:34:43PM +0300, Matti Vaittinen wrote:
> > > On 08/08/2025 18:17, Arnd Bergmann wrote:
...
> > > As such, this patch seems Ok to me, you can treat this as an ack :) This,
> > > however made me ponder following - is this the tight way to handle the
> > > power-button IRQ? I don't see any other MFD devices doing this in same way,
> > > although I am pretty sure there are other PMICs with similar power-button
> > > IRQ...
> > >
> > > I see for example the "drivers/mfd/rt5120.c" to invoke
> > > "drivers/input/misc/rt5120-pwrkey.c" instead of using the gpio-keys. This,
> > > however, feels like code duplication to me. I'd rather kept using the
> > > gpio-keys, but seeing:
> > >
> > > git grep KEY_POWER drivers/mfd/
> > > drivers/mfd/rohm-bd71828.c: .code = KEY_POWER,
> > > drivers/mfd/rohm-bd718x7.c: .code = KEY_POWER,
> > >
> > > makes me wonder if there is more widely used (better) way?
> >
> > FWIW, on Intel platforms that use power button by PMIC we add a special driver
> > for each of such cases.
>
> If we can make gpio-keys work for various power buttons that would be
> great IMO. The MFD drivers in question already are using device tree,
> but they do not define/expect nodes for the power buttons. If the nodes
> were there then I think gpio-keys would work out of the box?
Looking at the, e.g., https://elixir.bootlin.com/linux/v6.16/source/drivers/platform/x86/intel/mrfld_pwrbtn.c,
I am not sure it's as simply as it sounds. Basically it's an IRQ, which
requires IRQ handling and proper acking/masking/etc.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH 17/21] nfc: marvell: convert to gpio descriptors
2025-08-09 10:09 ` Andy Shevchenko
@ 2025-08-11 21:43 ` Dmitry Torokhov
2025-08-13 12:35 ` Andy Shevchenko
0 siblings, 1 reply; 62+ messages in thread
From: Dmitry Torokhov @ 2025-08-11 21:43 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Arnd Bergmann, Bartosz Golaszewski, Linus Walleij, linux-gpio,
Krzysztof Kozlowski, Arnd Bergmann, Jakub Kicinski, netdev,
linux-kernel
On Sat, Aug 09, 2025 at 01:09:47PM +0300, Andy Shevchenko wrote:
> On Fri, Aug 08, 2025 at 05:18:01PM +0200, Arnd Bergmann wrote:
> > From: Arnd Bergmann <arnd@arndb.de>
> >
> > The only reason this driver seems to still use the legacy gpio
> > numbers is for the module parameter that lets users pass a different
> > reset gpio.
> >
> > Since the fixed numbers are on their way out, and none of the platforms
> > this driver is used on would have them any more, remove the module
> > parameter and instead just use the reset information from firmware.
>
> This patch is my love in the series, thanks for doing it!
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>
> But note some comments below.
>
> ...
>
> > - if (gpio_is_valid(priv->config.reset_n_io)) {
> > - rc = gpio_request_one(priv->config.reset_n_io,
> > - GPIOF_OUT_INIT_LOW,
> > - "nfcmrvl_reset_n");
> > - if (rc < 0) {
> > - priv->config.reset_n_io = -EINVAL;
> > - nfc_err(dev, "failed to request reset_n io\n");
> > - }
> > + priv->reset_n_io = gpiod_get_optional(dev, "reset-n-io", GPIOD_OUT_LOW);
No, this should be "reset". gpiolib-of.c has a quirk to resolve to naked
"reset-n-io", otherwise this will resolve to "reset-n-io-gpios" in the
bowels of gpiolib.
> > + if (IS_ERR(priv->reset_n_io)) {
> > + nfc_err(dev, "failed to get reset_n gpio\n");
> > + return ERR_CAST(priv->reset_n_io);
> > }
>
> This also needs a call to gpiod_set_consumer_name(), IIRC the API name.
It does not have to... I am not sure who pays attention to names.
>
> ...
>
> > - if (gpio_is_valid(priv->config.reset_n_io)) {
> > - nfc_info(priv->dev, "reset the chip\n");
> > - gpio_set_value(priv->config.reset_n_io, 0);
> > - usleep_range(5000, 10000);
> > - gpio_set_value(priv->config.reset_n_io, 1);
> > - } else
> > - nfc_info(priv->dev, "no reset available on this interface\n");
> > + nfc_info(priv->dev, "reset the chip\n");
> > + gpiod_set_value(priv->reset_n_io, 0);
> > + usleep_range(5000, 10000);
>
> Side note, this would be nice to use fsleep(), but I see that's just a
> copy'n'paste of the original piece.
>
> > + gpiod_set_value(priv->reset_n_io, 1);
Nope, this is not going to work. See
Documentation/devicetree/bindings/net/nfc/marvell,nci.yaml, this GPIO is
active low. We do not have any "live" DTS examples so I am not sure what
polarity is used in the wild. So either use logical level (my
preference) or switch to "_raw()" variant.
>
> ...
>
> > void nfcmrvl_chip_halt(struct nfcmrvl_private *priv)
> > {
> > - if (gpio_is_valid(priv->config.reset_n_io))
> > - gpio_set_value(priv->config.reset_n_io, 0);
> > + if (priv->reset_n_io)
>
> Not sure why we need this dup check.
I personally feel very uneasy when dealing with optional GPIO and not
checking if it exists or not, even though gpiod_set_value() handles
this. I think check makes logic clearer.
>
> > + gpiod_set_value(priv->reset_n_io, 0);
> > }
>
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH 18/21] nfc: s3fwrn5: convert to gpio descriptors
2025-08-08 15:18 ` [PATCH 18/21] nfc: s3fwrn5: " Arnd Bergmann
@ 2025-08-11 22:08 ` Dmitry Torokhov
0 siblings, 0 replies; 62+ messages in thread
From: Dmitry Torokhov @ 2025-08-11 22:08 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Bartosz Golaszewski, Linus Walleij, linux-gpio,
Krzysztof Kozlowski, Arnd Bergmann, Sumanth Gavini,
Jakub Kicinski, netdev, linux-kernel
Hi Arnd,
On Fri, Aug 08, 2025 at 05:18:02PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> There is no need for this driver to still use the legacy interfaces,
> so convert all the legacy calls into their modern equivalents.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/nfc/s3fwrn5/i2c.c | 42 +++++++++-----------------------
> drivers/nfc/s3fwrn5/phy_common.c | 12 ++++-----
> drivers/nfc/s3fwrn5/phy_common.h | 4 +--
> drivers/nfc/s3fwrn5/uart.c | 30 ++++++-----------------
> 4 files changed, 28 insertions(+), 60 deletions(-)
>
> diff --git a/drivers/nfc/s3fwrn5/i2c.c b/drivers/nfc/s3fwrn5/i2c.c
> index 110d086cfe5b..411be709b397 100644
> --- a/drivers/nfc/s3fwrn5/i2c.c
> +++ b/drivers/nfc/s3fwrn5/i2c.c
> @@ -8,7 +8,7 @@
>
> #include <linux/clk.h>
> #include <linux/i2c.h>
> -#include <linux/gpio.h>
> +#include <linux/gpio/consumer.h>
> #include <linux/delay.h>
> #include <linux/of_gpio.h>
> #include <linux/of_irq.h>
> @@ -149,29 +149,22 @@ static irqreturn_t s3fwrn5_i2c_irq_thread_fn(int irq, void *phy_id)
> static int s3fwrn5_i2c_parse_dt(struct i2c_client *client)
> {
> struct s3fwrn5_i2c_phy *phy = i2c_get_clientdata(client);
> - struct device_node *np = client->dev.of_node;
> + struct device *dev = &client->dev;
>
> - if (!np)
> - return -ENODEV;
> -
> - phy->common.gpio_en = of_get_named_gpio(np, "en-gpios", 0);
> - if (!gpio_is_valid(phy->common.gpio_en)) {
> + phy->common.gpio_en = devm_gpiod_get(dev, "en", GPIOD_OUT_HIGH);
> + if (IS_ERR(phy->common.gpio_en)) {
> /* Support also deprecated property */
> - phy->common.gpio_en = of_get_named_gpio(np,
> - "s3fwrn5,en-gpios",
> - 0);
> - if (!gpio_is_valid(phy->common.gpio_en))
> - return -ENODEV;
> + phy->common.gpio_en = devm_gpiod_get(dev, "s3fwrn5,en", GPIOD_OUT_HIGH);
> + if (IS_ERR(phy->common.gpio_en))
> + return PTR_ERR(phy->common.gpio_en);
> }
Should be GPIOD_OUT_LOW or ASIS.
>
> - phy->common.gpio_fw_wake = of_get_named_gpio(np, "wake-gpios", 0);
> - if (!gpio_is_valid(phy->common.gpio_fw_wake)) {
> + phy->common.gpio_fw_wake = devm_gpiod_get(dev, "wake", GPIOD_OUT_LOW);
> + if (IS_ERR(phy->common.gpio_fw_wake)) {
> /* Support also deprecated property */
> - phy->common.gpio_fw_wake = of_get_named_gpio(np,
> - "s3fwrn5,fw-gpios",
> - 0);
> - if (!gpio_is_valid(phy->common.gpio_fw_wake))
> - return -ENODEV;
> + phy->common.gpio_fw_wake = devm_gpiod_get(dev, "s3fwrn5,fw", GPIOD_OUT_LOW);
> + if (IS_ERR(phy->common.gpio_fw_wake))
> + return PTR_ERR(phy->common.gpio_en);
> }
>
> return 0;
> @@ -197,17 +190,6 @@ static int s3fwrn5_i2c_probe(struct i2c_client *client)
> if (ret < 0)
> return ret;
>
> - ret = devm_gpio_request_one(&phy->i2c_dev->dev, phy->common.gpio_en,
> - GPIOF_OUT_INIT_HIGH, "s3fwrn5_en");
> - if (ret < 0)
> - return ret;
> -
> - ret = devm_gpio_request_one(&phy->i2c_dev->dev,
> - phy->common.gpio_fw_wake,
> - GPIOF_OUT_INIT_LOW, "s3fwrn5_fw_wake");
> - if (ret < 0)
> - return ret;
> -
> /*
> * S3FWRN5 depends on a clock input ("XI" pin) to function properly.
> * Depending on the hardware configuration this could be an always-on
> diff --git a/drivers/nfc/s3fwrn5/phy_common.c b/drivers/nfc/s3fwrn5/phy_common.c
> index deb2c039f0fd..e802b4e609c8 100644
> --- a/drivers/nfc/s3fwrn5/phy_common.c
> +++ b/drivers/nfc/s3fwrn5/phy_common.c
> @@ -8,7 +8,7 @@
> * Bongsu Jeon <bongsu.jeon@samsung.com>
> */
>
> -#include <linux/gpio.h>
> +#include <linux/gpio/consumer.h>
> #include <linux/delay.h>
> #include <linux/module.h>
>
> @@ -19,7 +19,7 @@ void s3fwrn5_phy_set_wake(void *phy_id, bool wake)
> struct phy_common *phy = phy_id;
>
> mutex_lock(&phy->mutex);
> - gpio_set_value(phy->gpio_fw_wake, wake);
> + gpiod_set_value(phy->gpio_fw_wake, wake);
> if (wake)
> msleep(S3FWRN5_EN_WAIT_TIME);
> mutex_unlock(&phy->mutex);
> @@ -33,14 +33,14 @@ bool s3fwrn5_phy_power_ctrl(struct phy_common *phy, enum s3fwrn5_mode mode)
>
> phy->mode = mode;
>
> - gpio_set_value(phy->gpio_en, 1);
> - gpio_set_value(phy->gpio_fw_wake, 0);
> + gpiod_set_value(phy->gpio_en, 1);
> + gpiod_set_value(phy->gpio_fw_wake, 0);
> if (mode == S3FWRN5_MODE_FW)
> - gpio_set_value(phy->gpio_fw_wake, 1);
> + gpiod_set_value(phy->gpio_fw_wake, 1);
>
> if (mode != S3FWRN5_MODE_COLD) {
> msleep(S3FWRN5_EN_WAIT_TIME);
> - gpio_set_value(phy->gpio_en, 0);
> + gpiod_set_value(phy->gpio_en, 0);
> msleep(S3FWRN5_EN_WAIT_TIME);
The GPIO is describe as "active low" in DTS:
arch/arm64/boot/dts/exynos/exynos5433-tm2-common.dtsi
So here you are leaving the chip disabled. You need to use logical
polarity.
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH 19/21] usb: udc: pxa: remove unused platform_data
2025-08-08 15:18 ` [PATCH 19/21] usb: udc: pxa: remove unused platform_data Arnd Bergmann
2025-08-09 10:15 ` Andy Shevchenko
@ 2025-08-11 22:12 ` Dmitry Torokhov
1 sibling, 0 replies; 62+ messages in thread
From: Dmitry Torokhov @ 2025-08-11 22:12 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Bartosz Golaszewski, Linus Walleij, linux-gpio, Daniel Mack,
Haojian Zhuang, Robert Jarzmik, Russell King, Greg Kroah-Hartman,
Arnd Bergmann, Thomas Gleixner, Ingo Molnar, Andy Shevchenko,
linux-arm-kernel, linux-kernel, linux-usb
On Fri, Aug 08, 2025 at 05:18:04PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> None of the remaining boards put useful data into the platform_data
> structures, so effectively this only works with DT based probing.
>
> Remove all code that references this data, to stop using the legacy
> gpiolib interfaces. The pxa27x version already supports gpio
> descriptors, while the pxa25x version now does it the same way.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> arch/arm/mach-pxa/devices.c | 7 ----
> arch/arm/mach-pxa/gumstix.c | 1 -
> arch/arm/mach-pxa/udc.h | 8 -----
> drivers/usb/gadget/udc/pxa25x_udc.c | 41 ++++++++----------------
> drivers/usb/gadget/udc/pxa25x_udc.h | 2 +-
> drivers/usb/gadget/udc/pxa27x_udc.c | 35 +++-----------------
> drivers/usb/gadget/udc/pxa27x_udc.h | 2 --
> include/linux/platform_data/pxa2xx_udc.h | 15 ---------
> 8 files changed, 19 insertions(+), 92 deletions(-)
> delete mode 100644 arch/arm/mach-pxa/udc.h
>
> diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c
> index 7695cfce01a1..edad956a1483 100644
> --- a/arch/arm/mach-pxa/devices.c
> +++ b/arch/arm/mach-pxa/devices.c
> @@ -11,7 +11,6 @@
> #include <linux/platform_data/i2c-pxa.h>
> #include <linux/soc/pxa/cpu.h>
>
> -#include "udc.h"
> #include <linux/platform_data/video-pxafb.h>
> #include <linux/platform_data/mmc-pxamci.h>
> #include "irqs.h"
> @@ -83,10 +82,6 @@ void __init pxa_set_mci_info(const struct pxamci_platform_data *info,
> pr_err("Unable to create mci device: %d\n", err);
> }
>
> -static struct pxa2xx_udc_mach_info pxa_udc_info = {
> - .gpio_pullup = -1,
> -};
> -
> static struct resource pxa2xx_udc_resources[] = {
> [0] = {
> .start = 0x40600000,
> @@ -108,7 +103,6 @@ struct platform_device pxa25x_device_udc = {
> .resource = pxa2xx_udc_resources,
> .num_resources = ARRAY_SIZE(pxa2xx_udc_resources),
> .dev = {
> - .platform_data = &pxa_udc_info,
> .dma_mask = &udc_dma_mask,
> }
> };
> @@ -119,7 +113,6 @@ struct platform_device pxa27x_device_udc = {
> .resource = pxa2xx_udc_resources,
> .num_resources = ARRAY_SIZE(pxa2xx_udc_resources),
> .dev = {
> - .platform_data = &pxa_udc_info,
> .dma_mask = &udc_dma_mask,
> }
> };
> diff --git a/arch/arm/mach-pxa/gumstix.c b/arch/arm/mach-pxa/gumstix.c
> index 1713bdf3b71e..6074815a4bca 100644
> --- a/arch/arm/mach-pxa/gumstix.c
> +++ b/arch/arm/mach-pxa/gumstix.c
> @@ -39,7 +39,6 @@
>
> #include "pxa25x.h"
> #include <linux/platform_data/mmc-pxamci.h>
> -#include "udc.h"
> #include "gumstix.h"
> #include "devices.h"
>
> diff --git a/arch/arm/mach-pxa/udc.h b/arch/arm/mach-pxa/udc.h
> deleted file mode 100644
> index 9a827e32db98..000000000000
> --- a/arch/arm/mach-pxa/udc.h
> +++ /dev/null
> @@ -1,8 +0,0 @@
> -/*
> - * arch/arm/mach-pxa/include/mach/udc.h
> - *
> - */
> -#include <linux/platform_data/pxa2xx_udc.h>
> -
> -extern void pxa_set_udc_info(struct pxa2xx_udc_mach_info *info);
> -
> diff --git a/drivers/usb/gadget/udc/pxa25x_udc.c b/drivers/usb/gadget/udc/pxa25x_udc.c
> index b97fb7b0cb2c..bad151aedec1 100644
> --- a/drivers/usb/gadget/udc/pxa25x_udc.c
> +++ b/drivers/usb/gadget/udc/pxa25x_udc.c
> @@ -12,7 +12,7 @@
> /* #define VERBOSE_DEBUG */
>
> #include <linux/device.h>
> -#include <linux/gpio.h>
> +#include <linux/gpio/consumer.h>
> #include <linux/module.h>
> #include <linux/kernel.h>
> #include <linux/ioport.h>
> @@ -261,24 +261,12 @@ static void nuke (struct pxa25x_ep *, int status);
> /* one GPIO should control a D+ pullup, so host sees this device (or not) */
> static void pullup_off(void)
> {
> - struct pxa2xx_udc_mach_info *mach = the_controller->mach;
> - int off_level = mach->gpio_pullup_inverted;
> -
> - if (gpio_is_valid(mach->gpio_pullup))
> - gpio_set_value(mach->gpio_pullup, off_level);
> - else if (mach->udc_command)
> - mach->udc_command(PXA2XX_UDC_CMD_DISCONNECT);
> + gpiod_set_value(the_controller->pullup_gpio, 0);
> }
>
> static void pullup_on(void)
> {
> - struct pxa2xx_udc_mach_info *mach = the_controller->mach;
> - int on_level = !mach->gpio_pullup_inverted;
> -
> - if (gpio_is_valid(mach->gpio_pullup))
> - gpio_set_value(mach->gpio_pullup, on_level);
> - else if (mach->udc_command)
> - mach->udc_command(PXA2XX_UDC_CMD_CONNECT);
> + gpiod_set_value(the_controller->pullup_gpio, 1);
> }
>
> #if defined(CONFIG_CPU_BIG_ENDIAN)
> @@ -1190,8 +1178,7 @@ static int pxa25x_udc_pullup(struct usb_gadget *_gadget, int is_active)
>
> udc = container_of(_gadget, struct pxa25x_udc, gadget);
>
> - /* not all boards support pullup control */
> - if (!gpio_is_valid(udc->mach->gpio_pullup) && !udc->mach->udc_command)
> + if (!udc->pullup_gpio)
> return -EOPNOTSUPP;
>
> udc->pullup = (is_active != 0);
> @@ -2343,19 +2330,17 @@ static int pxa25x_udc_probe(struct platform_device *pdev)
>
> /* other non-static parts of init */
> dev->dev = &pdev->dev;
> - dev->mach = dev_get_platdata(&pdev->dev);
>
> dev->transceiver = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2);
>
> - if (gpio_is_valid(dev->mach->gpio_pullup)) {
> - retval = devm_gpio_request_one(&pdev->dev, dev->mach->gpio_pullup,
> - GPIOF_OUT_INIT_LOW, "pca25x_udc GPIO PULLUP");
> - if (retval) {
> - dev_dbg(&pdev->dev,
> - "can't get pullup gpio %d, err: %d\n",
> - dev->mach->gpio_pullup, retval);
> - goto err;
> - }
> + dev->pullup_gpio = devm_gpiod_get_index_optional(&pdev->dev, "pullup", 0,
> + GPIOD_OUT_LOW);
I think this should be GPIOD_OUT_HIGH: you want this to be active and
GPIO is likely "active low".
Thanks.
--
Dmitry
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH 09/21] input: gpio-keys: make legacy gpiolib optional
2025-08-11 20:09 ` Andy Shevchenko
@ 2025-08-12 5:11 ` Matti Vaittinen
0 siblings, 0 replies; 62+ messages in thread
From: Matti Vaittinen @ 2025-08-12 5:11 UTC (permalink / raw)
To: Andy Shevchenko, Dmitry Torokhov
Cc: Arnd Bergmann, Bartosz Golaszewski, Linus Walleij, linux-gpio,
Lee Jones, Arnd Bergmann, Gatien Chevallier, Fabrice Gasnier,
Bartosz Golaszewski, Thomas Gleixner, Charles Keepax,
Krzysztof Kozlowski, Christophe JAILLET, linux-input,
linux-kernel
On 11/08/2025 23:09, Andy Shevchenko wrote:
> On Mon, Aug 11, 2025 at 12:21:51PM -0700, Dmitry Torokhov wrote:
>> On Mon, Aug 11, 2025 at 03:52:19PM +0300, Andy Shevchenko wrote:
>>> On Mon, Aug 11, 2025 at 01:34:43PM +0300, Matti Vaittinen wrote:
>>>> On 08/08/2025 18:17, Arnd Bergmann wrote:
>
> ...
>
>>>> As such, this patch seems Ok to me, you can treat this as an ack :) This,
>>>> however made me ponder following - is this the tight way to handle the
>>>> power-button IRQ? I don't see any other MFD devices doing this in same way,
>>>> although I am pretty sure there are other PMICs with similar power-button
>>>> IRQ...
>>>>
>>>> I see for example the "drivers/mfd/rt5120.c" to invoke
>>>> "drivers/input/misc/rt5120-pwrkey.c" instead of using the gpio-keys. This,
>>>> however, feels like code duplication to me. I'd rather kept using the
>>>> gpio-keys, but seeing:
>>>>
>>>> git grep KEY_POWER drivers/mfd/
>>>> drivers/mfd/rohm-bd71828.c: .code = KEY_POWER,
>>>> drivers/mfd/rohm-bd718x7.c: .code = KEY_POWER,
>>>>
>>>> makes me wonder if there is more widely used (better) way?
>>>
>>> FWIW, on Intel platforms that use power button by PMIC we add a special driver
>>> for each of such cases.
>>
>> If we can make gpio-keys work for various power buttons that would be
>> great IMO. The MFD drivers in question already are using device tree,
>> but they do not define/expect nodes for the power buttons. If the nodes
>> were there then I think gpio-keys would work out of the box?
>
> Looking at the, e.g., https://elixir.bootlin.com/linux/v6.16/source/drivers/platform/x86/intel/mrfld_pwrbtn.c,
> I am not sure it's as simply as it sounds. Basically it's an IRQ, which
> requires IRQ handling and proper acking/masking/etc.
In some (many?) cases the interrupts (acking/masking) are handled by an
irqchip code. When this is the case, the gpio-keys (or any other
power-button code) does not need to care about IRQ-specifics. (I don't
know about the Intel driver though.)
Problem with many of the bd718* (and probably some other MFD drivers)
is, that the interrupts are really relevant only for the drivers
specific to this one device (like PMIC in ROHM case). When this is the
case, the device is not really (from the HW perspective) an
interrupt-controller, which means it shouldn't probably be marked as one
in the device-tree either. It will then also mean that there can't be
meaningful interrupt specification for the button IRQ in the
device-tree, right?
Additionally, we have devices where most of the interrupts are internal
to the PMIC, but then the PMIC also has some pins usable as GPIO, which
can be used as interrupt sources. Eg, someone can connect another device
to these pins - which makes the PMIC an interrupt-controller. For these
PMICs the power-button IRQ can be provided via device-tree node (but the
IRQ spec may become a bit hairy, since most of the IRQs are meant to be
internal).
Hence, for me, providing the IRQ number in platform data seems still to
be the right thing to do :)
TLDR; I agree with Dmitry. It's nice to have an easily re-usable
power-button handler, which requires no IC-specific code. Gpio-keys
works for simple IRQ based power-buttons where IRQ controller takes care
of the acks/masks. I just wanted to know if it is for some reason
discouraged, or if I've used it in a wrong way (because the grep
resulted so few results).
Yours,
-- Matti
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: (subset) [PATCH 00/21] gpiolib: fence off legacy interfaces
2025-08-08 15:17 [PATCH 00/21] gpiolib: fence off legacy interfaces Arnd Bergmann
` (21 preceding siblings ...)
2025-08-11 13:10 ` [PATCH 00/21] gpiolib: fence off legacy interfaces Bartosz Golaszewski
@ 2025-08-12 16:23 ` Mark Brown
2025-09-02 12:56 ` Lee Jones
23 siblings, 0 replies; 62+ messages in thread
From: Mark Brown @ 2025-08-12 16:23 UTC (permalink / raw)
To: Bartosz Golaszewski, Linus Walleij, linux-gpio, Arnd Bergmann
Cc: Arnd Bergmann, Andrew Lunn, Sebastian Hesselbarth,
Gregory Clement, Russell King, Daniel Mack, Haojian Zhuang,
Robert Jarzmik, Krzysztof Kozlowski, Alim Akhtar,
Geert Uytterhoeven, Thomas Bogendoerfer, Yoshinori Sato,
Rich Felker, John Paul Adrian Glaubitz, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, Dave Hansen, x86, H. Peter Anvin,
Dmitry Torokhov, Lee Jones, Pavel Machek, Mauro Carvalho Chehab,
Matti Vaittinen, Florian Fainelli, Jeff Johnson, Hans de Goede,
Ilpo Järvinen, Greg Kroah-Hartman, Jaroslav Kysela,
Takashi Iwai, Liam Girdwood, Andy Shevchenko,
Dr. David Alan Gilbert, linux-arm-kernel, linux-kernel,
linux-samsung-soc, linux-m68k, linux-mips, linux-sh, linux-input,
linux-leds, linux-media, patches, netdev, linux-wireless, ath10k,
platform-driver-x86, linux-usb, linux-sound
On Fri, 08 Aug 2025 17:17:44 +0200, Arnd Bergmann wrote:
> Commit 678bae2eaa81 ("gpiolib: make legacy interfaces optional") was
> merged for linux-6.17, so now it is possible to use the legacy interfaces
> conditionally and eventually have the support left out of the kernel
> whenever it is not needed.
>
> I created six patches to force-enable CONFIG_GPIOLIB_LEGACY on the
> few (mostly ancient) platforms that still require this, plus a set of
> patches to either add the corresponding Kconfig dependencies that make
> the device drivers conditional on that symbol, or change them to no
> longer require it.
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[08/21] ASoC: add GPIOLIB_LEGACY dependency where needed
commit: 5383d67e2430822fa7bd20dcbbebbd8ae808e386
[20/21] ASoC: pxa: add GPIOLIB_LEGACY dependency
commit: 2d86d2585ab929a143d1e6f8963da1499e33bf13
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH 06/21] x86/olpc: select GPIOLIB_LEGACY
2025-08-08 15:17 ` [PATCH 06/21] x86/olpc: select GPIOLIB_LEGACY Arnd Bergmann
@ 2025-08-12 17:01 ` Borislav Petkov
0 siblings, 0 replies; 62+ messages in thread
From: Borislav Petkov @ 2025-08-12 17:01 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Bartosz Golaszewski, Linus Walleij, linux-gpio, Thomas Gleixner,
Ingo Molnar, Dave Hansen, x86, Jaroslav Kysela, Takashi Iwai,
Arnd Bergmann, H. Peter Anvin, Andrew Morton,
Mateusz Jończyk, linux-kernel, linux-sound
On Fri, Aug 08, 2025 at 05:17:50PM +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The OLPC GPIO controller sets up a fixed number space that is used
> by at least two drivers:
>
> arch/x86/platform/olpc/olpc-xo1-sci.c: In function 'setup_ec_sci':
> arch/x86/platform/olpc/olpc-xo1-sci.c:358:13: error: implicit declaration of function 'gpio_request' [-Wimplicit-function-declaration]
> 358 | r = gpio_request(OLPC_GPIO_ECSCI, "OLPC-ECSCI");
> | ^~~~~~~~~~~~
> sound/pci/cs5535audio/cs5535audio_olpc.c: In function 'olpc_analog_input':
> sound/pci/cs5535audio/cs5535audio_olpc.c:41:9: error: implicit declaration of function 'gpio_set_value'; did you mean 'gpiod_set_value'? [-Wimplicit-function-declaration]
> 41 | gpio_set_value(OLPC_GPIO_MIC_AC, on);
>
> Select CONFIG_GPIOLIB_LEGACY for this platform and make sure the
> sound driver portion cannot be compiled without this.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> arch/x86/Kconfig | 1 +
> sound/pci/Kconfig | 1 +
> 2 files changed, 2 insertions(+)
>
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 58d890fe2100..3fd5e378a9f1 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -3006,6 +3006,7 @@ config OLPC
> bool "One Laptop Per Child support"
> depends on !X86_PAE
> select GPIOLIB
> + select GPIOLIB_LEGACY
> select OF
> select OF_PROMTREE
> select IRQ_DOMAIN
> diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig
> index e0996a9d90b0..6366f72b3667 100644
> --- a/sound/pci/Kconfig
> +++ b/sound/pci/Kconfig
> @@ -300,6 +300,7 @@ config SND_CS5535AUDIO
> tristate "CS5535/CS5536 Audio"
> depends on X86_32 || MIPS || COMPILE_TEST
> depends on HAS_IOPORT
> + depends on GPIOLIB_LEGACY || !OLPC
> select SND_PCM
> select SND_AC97_CODEC
> help
> --
Acked-by: Borislav Petkov (AMD) <bp@alien8.de>
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH 04/21] sh: select legacy gpiolib interface
2025-08-08 15:17 ` [PATCH 04/21] sh: select legacy gpiolib interface Arnd Bergmann
@ 2025-08-12 18:28 ` Rob Landley
2025-08-12 21:28 ` Arnd Bergmann
0 siblings, 1 reply; 62+ messages in thread
From: Rob Landley @ 2025-08-12 18:28 UTC (permalink / raw)
To: Arnd Bergmann, Bartosz Golaszewski, Linus Walleij, linux-gpio,
Yoshinori Sato, Rich Felker, John Paul Adrian Glaubitz
Cc: Arnd Bergmann, Michael Ellerman, Steven Rostedt, Paul E. McKenney,
Masahiro Yamada, Dave Vasilevsky, Geert Uytterhoeven, linux-sh,
linux-kernel
On 8/8/25 10:17, Arnd Bergmann wrote:
> diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
> index d5795067befa..d60f1d5a94c0 100644
> --- a/arch/sh/Kconfig
> +++ b/arch/sh/Kconfig
> @@ -462,6 +462,7 @@ config CPU_SUBTYPE_SHX3
> select CPU_SHX3
> select GENERIC_CLOCKEVENTS_BROADCAST if SMP
> select GPIOLIB
> + select GPIOLIB_LEGACY
> select PINCTRL
Is there a reason to have both rather than having GPIOLIB_LEGACY select
GPIOLIB? (Does the legacy one ever NOT use the new one?)
Rob
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH 04/21] sh: select legacy gpiolib interface
2025-08-12 18:28 ` Rob Landley
@ 2025-08-12 21:28 ` Arnd Bergmann
0 siblings, 0 replies; 62+ messages in thread
From: Arnd Bergmann @ 2025-08-12 21:28 UTC (permalink / raw)
To: Rob Landley, Arnd Bergmann, Bartosz Golaszewski, Linus Walleij,
open list:GPIO SUBSYSTEM, Yoshinori Sato, Rich Felker,
John Paul Adrian Glaubitz
Cc: Michael Ellerman, Steven Rostedt, Paul E. McKenney,
Masahiro Yamada, Dave Vasilevsky, Geert Uytterhoeven, linux-sh,
linux-kernel
On Tue, Aug 12, 2025, at 20:28, Rob Landley wrote:
> On 8/8/25 10:17, Arnd Bergmann wrote:
>> diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
>> index d5795067befa..d60f1d5a94c0 100644
>> --- a/arch/sh/Kconfig
>> +++ b/arch/sh/Kconfig
>> @@ -462,6 +462,7 @@ config CPU_SUBTYPE_SHX3
>> select CPU_SHX3
>> select GENERIC_CLOCKEVENTS_BROADCAST if SMP
>> select GPIOLIB
>> + select GPIOLIB_LEGACY
>> select PINCTRL
>
> Is there a reason to have both rather than having GPIOLIB_LEGACY select
> GPIOLIB? (Does the legacy one ever NOT use the new one?)
The way I've staged the series was
1. add GPIOLIB_LEGACY as an always-enabled symbol in 6.17
2. add the 'select' and 'depends on' for that symbol in 6.18
3. turn it off for all configs that don't select it already
Having GPIOLIB_LEGACY select GPIOLIB does sound like a nice
idea in stage 3, but that doesn't work with the first step
that's already merged now.
Arnd
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH 17/21] nfc: marvell: convert to gpio descriptors
2025-08-08 15:18 ` [PATCH 17/21] nfc: marvell: convert to gpio descriptors Arnd Bergmann
2025-08-09 10:09 ` Andy Shevchenko
2025-08-11 7:49 ` Bartosz Golaszewski
@ 2025-08-13 7:48 ` Krzysztof Kozlowski
2 siblings, 0 replies; 62+ messages in thread
From: Krzysztof Kozlowski @ 2025-08-13 7:48 UTC (permalink / raw)
To: Arnd Bergmann, Bartosz Golaszewski, Linus Walleij, linux-gpio
Cc: Arnd Bergmann, Jakub Kicinski, Andy Shevchenko, netdev,
linux-kernel
On 08/08/2025 17:18, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The only reason this driver seems to still use the legacy gpio
> numbers is for the module parameter that lets users pass a different
> reset gpio.
>
> Since the fixed numbers are on their way out, and none of the platforms
> this driver is used on would have them any more, remove the module
> parameter and instead just use the reset information from firmware.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/nfc/nfcmrvl/main.c | 47 +++++++++++------------------------
> drivers/nfc/nfcmrvl/nfcmrvl.h | 5 ++--
> drivers/nfc/nfcmrvl/uart.c | 5 ----
> drivers/nfc/nfcmrvl/usb.c | 1 -
> 4 files changed, 18 insertions(+), 40 deletions(-)
>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH 17/21] nfc: marvell: convert to gpio descriptors
2025-08-11 21:43 ` Dmitry Torokhov
@ 2025-08-13 12:35 ` Andy Shevchenko
0 siblings, 0 replies; 62+ messages in thread
From: Andy Shevchenko @ 2025-08-13 12:35 UTC (permalink / raw)
To: Dmitry Torokhov
Cc: Arnd Bergmann, Bartosz Golaszewski, Linus Walleij, linux-gpio,
Krzysztof Kozlowski, Arnd Bergmann, Jakub Kicinski, netdev,
linux-kernel
On Mon, Aug 11, 2025 at 02:43:51PM -0700, Dmitry Torokhov wrote:
> On Sat, Aug 09, 2025 at 01:09:47PM +0300, Andy Shevchenko wrote:
> > On Fri, Aug 08, 2025 at 05:18:01PM +0200, Arnd Bergmann wrote:
...
> > > - if (gpio_is_valid(priv->config.reset_n_io)) {
> > > - rc = gpio_request_one(priv->config.reset_n_io,
> > > - GPIOF_OUT_INIT_LOW,
> > > - "nfcmrvl_reset_n");
> > > - if (rc < 0) {
> > > - priv->config.reset_n_io = -EINVAL;
> > > - nfc_err(dev, "failed to request reset_n io\n");
> > > - }
> > > + priv->reset_n_io = gpiod_get_optional(dev, "reset-n-io", GPIOD_OUT_LOW);
>
> No, this should be "reset". gpiolib-of.c has a quirk to resolve to naked
> "reset-n-io", otherwise this will resolve to "reset-n-io-gpios" in the
> bowels of gpiolib.
Good point.
> > > + if (IS_ERR(priv->reset_n_io)) {
> > > + nfc_err(dev, "failed to get reset_n gpio\n");
> > > + return ERR_CAST(priv->reset_n_io);
> > > }
> >
> > This also needs a call to gpiod_set_consumer_name(), IIRC the API name.
>
> It does not have to... I am not sure who pays attention to names.
It goes to user space, isn't it?
In any case it will give 1:1 transition from the look&fell perspective.
...
> > > void nfcmrvl_chip_halt(struct nfcmrvl_private *priv)
> > > {
> > > - if (gpio_is_valid(priv->config.reset_n_io))
> > > - gpio_set_value(priv->config.reset_n_io, 0);
> > > + if (priv->reset_n_io)
> >
> > Not sure why we need this dup check.
>
> I personally feel very uneasy when dealing with optional GPIO and not
> checking if it exists or not, even though gpiod_set_value() handles
> this. I think check makes logic clearer.
I disagree with the duplicate. It doesn't make any additional clearness as I
read it. When one reads the code the "here we set GPIO to the X state" without
any conditional is fine as one may check later in DT schema if the GPIO is
optional or not.
> > > + gpiod_set_value(priv->reset_n_io, 0);
> > > }
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH 10/21] leds: gpio: make legacy gpiolib interface optional
2025-08-08 15:17 ` [PATCH 10/21] leds: gpio: make legacy gpiolib interface optional Arnd Bergmann
@ 2025-08-18 15:37 ` Linus Walleij
2025-08-19 12:19 ` Lee Jones
1 sibling, 0 replies; 62+ messages in thread
From: Linus Walleij @ 2025-08-18 15:37 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Bartosz Golaszewski, linux-gpio, Lee Jones, Pavel Machek,
Arnd Bergmann, Javier Carrasco, Gustavo A. R. Silva,
Andy Shevchenko, Kees Cook, Anish Kumar, Mukesh Ojha,
Thomas Zimmermann, Dmitry Rokosov, linux-leds, linux-kernel
On Fri, Aug 8, 2025 at 5:22 PM Arnd Bergmann <arnd@kernel.org> wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> There are still a handful of ancient mips/armv5/sh boards that use the
> gpio_led:gpio member to pass an old-style gpio number, but all modern
> users have been converted to gpio descriptors.
>
> Make the code that deals with this optional so the legacy interfaces
> can be left out for all normal builds.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
I like this, it cleans up things for current systems so they do not need
to carry around so much legacy.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH 10/21] leds: gpio: make legacy gpiolib interface optional
2025-08-08 15:17 ` [PATCH 10/21] leds: gpio: make legacy gpiolib interface optional Arnd Bergmann
2025-08-18 15:37 ` Linus Walleij
@ 2025-08-19 12:19 ` Lee Jones
2025-08-19 12:59 ` Arnd Bergmann
1 sibling, 1 reply; 62+ messages in thread
From: Lee Jones @ 2025-08-19 12:19 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Bartosz Golaszewski, Linus Walleij, linux-gpio, Pavel Machek,
Arnd Bergmann, Javier Carrasco, Gustavo A. R. Silva,
Andy Shevchenko, Kees Cook, Anish Kumar, Mukesh Ojha,
Thomas Zimmermann, Dmitry Rokosov, linux-leds, linux-kernel
On Fri, 08 Aug 2025, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> There are still a handful of ancient mips/armv5/sh boards that use the
> gpio_led:gpio member to pass an old-style gpio number, but all modern
> users have been converted to gpio descriptors.
>
> Make the code that deals with this optional so the legacy interfaces
> can be left out for all normal builds.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/leds/leds-gpio.c | 8 ++++++--
> include/linux/leds.h | 2 ++
> 2 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
> index a3428b22de3a..e43accfa78e9 100644
> --- a/drivers/leds/leds-gpio.c
> +++ b/drivers/leds/leds-gpio.c
> @@ -212,7 +212,9 @@ static struct gpio_desc *gpio_led_get_gpiod(struct device *dev, int idx,
> const struct gpio_led *template)
> {
> struct gpio_desc *gpiod;
> +#ifdef CONFIG_GPIOLIB_LEGACY
> int ret;
> +#endif
Isn't there another way to do his that doesn't entail sprinkling #ifery
around C-files?
> /*
> * This means the LED does not come from the device tree
> @@ -228,6 +230,7 @@ static struct gpio_desc *gpio_led_get_gpiod(struct device *dev, int idx,
> return gpiod;
> }
>
> +#ifdef CONFIG_GPIOLIB_LEGACY
> /*
> * This is the legacy code path for platform code that
> * still uses GPIO numbers. Ultimately we would like to get
> @@ -244,6 +247,7 @@ static struct gpio_desc *gpio_led_get_gpiod(struct device *dev, int idx,
> return ERR_PTR(ret);
>
> gpiod = gpio_to_desc(template->gpio);
> +#endif
> if (!gpiod)
> return ERR_PTR(-EINVAL);
>
> @@ -276,8 +280,8 @@ static int gpio_led_probe(struct platform_device *pdev)
> led_dat->gpiod =
> gpio_led_get_gpiod(dev, i, template);
> if (IS_ERR(led_dat->gpiod)) {
> - dev_info(dev, "Skipping unavailable LED gpio %d (%s)\n",
> - template->gpio, template->name);
> + dev_info(dev, "Skipping unavailable LED gpio %s\n",
> + template->name);
> continue;
> }
>
> diff --git a/include/linux/leds.h b/include/linux/leds.h
> index b16b803cc1ac..034643f40152 100644
> --- a/include/linux/leds.h
> +++ b/include/linux/leds.h
> @@ -676,7 +676,9 @@ typedef int (*gpio_blink_set_t)(struct gpio_desc *desc, int state,
> struct gpio_led {
> const char *name;
> const char *default_trigger;
> +#ifdef CONFIG_GPIOLIB_LEGACY
> unsigned gpio;
> +#endif
> unsigned active_low : 1;
> unsigned retain_state_suspended : 1;
> unsigned panic_indicator : 1;
> --
> 2.39.5
>
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH 10/21] leds: gpio: make legacy gpiolib interface optional
2025-08-19 12:19 ` Lee Jones
@ 2025-08-19 12:59 ` Arnd Bergmann
2025-08-20 7:16 ` Lee Jones
0 siblings, 1 reply; 62+ messages in thread
From: Arnd Bergmann @ 2025-08-19 12:59 UTC (permalink / raw)
To: Lee Jones, Arnd Bergmann
Cc: Bartosz Golaszewski, Linus Walleij, open list:GPIO SUBSYSTEM,
Pavel Machek, Javier Carrasco, Gustavo A. R. Silva,
Andy Shevchenko, Kees Cook, Anish Kumar, Mukesh Ojha,
Thomas Zimmermann, Dmitry Rokosov, linux-leds, linux-kernel
On Tue, Aug 19, 2025, at 14:19, Lee Jones wrote:
> On Fri, 08 Aug 2025, Arnd Bergmann wrote:
>> {
>> struct gpio_desc *gpiod;
>> +#ifdef CONFIG_GPIOLIB_LEGACY
>> int ret;
>> +#endif
>
> Isn't there another way to do his that doesn't entail sprinkling #ifery
> around C-files?
>
An alternativew would be to duplicate the driver and have
one modern variant and an additional legacy variant that
is only used on the few remaining platforms that select CONFIG_GPIOLIB_LEGACY and define platform data. See below
for the list of files that reference struct gpio_led.
There are already patches to convert some of those to
software nodes, and a lot of the others can probably be
removed, in particular the orion5x ones.
The leds-gpio driver with just the legacy interfaces left
would be a really small driver, and removing those bits from
the normal one would make that a bit simpler as well, but
there would be some amount of duplication.
Arnd
$ git grep -wl struct.gpio_led
arch/arm/mach-omap1/board-ams-delta.c
arch/arm/mach-omap1/board-osk.c
arch/arm/mach-orion5x/board-d2net.c
arch/arm/mach-orion5x/dns323-setup.c
arch/arm/mach-orion5x/mv2120-setup.c
arch/arm/mach-orion5x/net2big-setup.c
arch/arm/mach-orion5x/ts409-setup.c
arch/arm/mach-s3c/mach-crag6410.c
arch/arm/mach-sa1100/assabet.c
arch/mips/alchemy/board-gpr.c
arch/mips/alchemy/board-mtx1.c
arch/mips/bcm47xx/leds.c
arch/mips/include/asm/mach-bcm63xx/board_bcm963xx.h
arch/mips/loongson32/ls1b/board.c
arch/mips/txx9/generic/setup.c
arch/mips/txx9/rbtx4927/setup.c
arch/powerpc/platforms/44x/warp.c
arch/sh/boards/mach-rsk/devices-rsk7203.c
drivers/leds/leds-gpio.c
drivers/leds/simatic/simatic-ipc-leds-gpio-core.c
drivers/net/wireless/ath/ath10k/core.h
drivers/net/wireless/ath/ath10k/leds.c
drivers/platform/x86/barco-p50-gpio.c
drivers/platform/x86/intel/atomisp2/led.c
drivers/platform/x86/meraki-mx100.c
drivers/platform/x86/pcengines-apuv2.c
drivers/platform/x86/sel3350-platform.c
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH 10/21] leds: gpio: make legacy gpiolib interface optional
2025-08-19 12:59 ` Arnd Bergmann
@ 2025-08-20 7:16 ` Lee Jones
2025-08-20 12:00 ` Arnd Bergmann
0 siblings, 1 reply; 62+ messages in thread
From: Lee Jones @ 2025-08-20 7:16 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Arnd Bergmann, Bartosz Golaszewski, Linus Walleij,
open list:GPIO SUBSYSTEM, Pavel Machek, Javier Carrasco,
Gustavo A. R. Silva, Andy Shevchenko, Kees Cook, Anish Kumar,
Mukesh Ojha, Thomas Zimmermann, Dmitry Rokosov, linux-leds,
linux-kernel
On Tue, 19 Aug 2025, Arnd Bergmann wrote:
> On Tue, Aug 19, 2025, at 14:19, Lee Jones wrote:
> > On Fri, 08 Aug 2025, Arnd Bergmann wrote:
> >> {
> >> struct gpio_desc *gpiod;
> >> +#ifdef CONFIG_GPIOLIB_LEGACY
> >> int ret;
> >> +#endif
> >
> > Isn't there another way to do his that doesn't entail sprinkling #ifery
> > around C-files?
> >
>
> An alternativew would be to duplicate the driver and have
> one modern variant and an additional legacy variant that
> is only used on the few remaining platforms that select CONFIG_GPIOLIB_LEGACY and define platform data. See below
> for the list of files that reference struct gpio_led.
>
> There are already patches to convert some of those to
> software nodes, and a lot of the others can probably be
> removed, in particular the orion5x ones.
>
> The leds-gpio driver with just the legacy interfaces left
> would be a really small driver, and removing those bits from
> the normal one would make that a bit simpler as well, but
> there would be some amount of duplication.
Sounds like we're between a rock and a hard place with this.
Will the legacy parts be removed at some point or do you foresee us
supporting this forever?
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH 10/21] leds: gpio: make legacy gpiolib interface optional
2025-08-20 7:16 ` Lee Jones
@ 2025-08-20 12:00 ` Arnd Bergmann
2025-08-20 13:15 ` Andy Shevchenko
0 siblings, 1 reply; 62+ messages in thread
From: Arnd Bergmann @ 2025-08-20 12:00 UTC (permalink / raw)
To: Lee Jones
Cc: Arnd Bergmann, Bartosz Golaszewski, Linus Walleij,
open list:GPIO SUBSYSTEM, Pavel Machek, Javier Carrasco,
Gustavo A. R. Silva, Andy Shevchenko, Kees Cook, Anish Kumar,
Mukesh Ojha, Thomas Zimmermann, Dmitry Rokosov, linux-leds,
linux-kernel
On Wed, Aug 20, 2025, at 09:16, Lee Jones wrote:
> On Tue, 19 Aug 2025, Arnd Bergmann wrote:
>
> Sounds like we're between a rock and a hard place with this.
I don't think either variant is that bad to be honest, as it
gets us a long way towards removing the legacy interface from
default builds without having to update or remove the holdouts
immediately. It's mainly led-gpio and gpio-keys that need
a change like this.
Splitting out the entire gpio_led_platform_data handling
into a single #ifdef function block would be a little cleaner,
but that would in turn require changing over a couple of
files that got converted from legacy gpio numbers to passing
gpio descriptors or lookup tables (ppc44x/warp, x86/sel3350,
arm/omap1), making them use device properties instead.
> Will the legacy parts be removed at some point or do you foresee us
> supporting this forever?
It's hard to predict an timeline here, there is certainly a lot of
interest in minimizing the legacy users as much as possible and
patches are getting written for x86 and arm, but I don't see much
movement on the mips and sh platforms. These are also the ones
that have been holdouts for CONFIG_LEGACY_CLK for years, and I
hope we can eventually drop support for those boards.
That said, I first need to get my own act together and refresh
my patches to drop the old arm board files so we can merge that.
Arnd
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH 10/21] leds: gpio: make legacy gpiolib interface optional
2025-08-20 12:00 ` Arnd Bergmann
@ 2025-08-20 13:15 ` Andy Shevchenko
2025-08-20 13:15 ` Andy Shevchenko
0 siblings, 1 reply; 62+ messages in thread
From: Andy Shevchenko @ 2025-08-20 13:15 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Lee Jones, Arnd Bergmann, Bartosz Golaszewski, Linus Walleij,
open list:GPIO SUBSYSTEM, Pavel Machek, Javier Carrasco,
Gustavo A. R. Silva, Kees Cook, Anish Kumar, Mukesh Ojha,
Thomas Zimmermann, Dmitry Rokosov, linux-leds, linux-kernel
On Wed, Aug 20, 2025 at 02:00:56PM +0200, Arnd Bergmann wrote:
> On Wed, Aug 20, 2025, at 09:16, Lee Jones wrote:
> > On Tue, 19 Aug 2025, Arnd Bergmann wrote:
> >
> > Sounds like we're between a rock and a hard place with this.
>
> I don't think either variant is that bad to be honest, as it
> gets us a long way towards removing the legacy interface from
> default builds without having to update or remove the holdouts
> immediately. It's mainly led-gpio and gpio-keys that need
> a change like this.
And I believe Dmitry is working on gpio-keys this cycle to get rid of legacy
GPIO APIs.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH 10/21] leds: gpio: make legacy gpiolib interface optional
2025-08-20 13:15 ` Andy Shevchenko
@ 2025-08-20 13:15 ` Andy Shevchenko
0 siblings, 0 replies; 62+ messages in thread
From: Andy Shevchenko @ 2025-08-20 13:15 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Lee Jones, Arnd Bergmann, Bartosz Golaszewski, Linus Walleij,
open list:GPIO SUBSYSTEM, Pavel Machek, Javier Carrasco,
Gustavo A. R. Silva, Kees Cook, Anish Kumar, Mukesh Ojha,
Thomas Zimmermann, Dmitry Rokosov, linux-leds, linux-kernel
On Wed, Aug 20, 2025 at 04:15:05PM +0300, Andy Shevchenko wrote:
> On Wed, Aug 20, 2025 at 02:00:56PM +0200, Arnd Bergmann wrote:
> > On Wed, Aug 20, 2025, at 09:16, Lee Jones wrote:
> > > On Tue, 19 Aug 2025, Arnd Bergmann wrote:
> > >
> > > Sounds like we're between a rock and a hard place with this.
> >
> > I don't think either variant is that bad to be honest, as it
> > gets us a long way towards removing the legacy interface from
> > default builds without having to update or remove the holdouts
> > immediately. It's mainly led-gpio and gpio-keys that need
> > a change like this.
>
> And I believe Dmitry is working on gpio-keys this cycle to get rid of legacy
> GPIO APIs.
I just realize that this might be odd, I meant Dmitry Torokhov in this context.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH 12/21] mfd: arizona: make legacy gpiolib interface optional
2025-08-08 15:17 ` [PATCH 12/21] mfd: arizona: make legacy gpiolib interface optional Arnd Bergmann
@ 2025-09-02 12:44 ` Lee Jones
2025-09-02 13:47 ` Arnd Bergmann
0 siblings, 1 reply; 62+ messages in thread
From: Lee Jones @ 2025-09-02 12:44 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Bartosz Golaszewski, Linus Walleij, linux-gpio, Liam Girdwood,
Mark Brown, Jaroslav Kysela, Takashi Iwai, Arnd Bergmann,
Jiri Slaby (SUSE), Sakari Ailus, Charles Keepax, patches,
linux-kernel, linux-sound
On Fri, 08 Aug 2025, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> The only machine that still uses the old gpio number based interface
> is the wlf_cragg_6410 board file. In order to remove the dependency
> on the interfaces, add #ifdef blocks here.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/mfd/arizona-irq.c | 5 ++++-
> include/linux/mfd/arizona/pdata.h | 6 ++++++
> sound/soc/codecs/arizona-jack.c | 17 ++++++++++++++++-
> 3 files changed, 26 insertions(+), 2 deletions(-)
Just FTR, I hate this! =:-D
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: (subset) [PATCH 00/21] gpiolib: fence off legacy interfaces
2025-08-08 15:17 [PATCH 00/21] gpiolib: fence off legacy interfaces Arnd Bergmann
` (22 preceding siblings ...)
2025-08-12 16:23 ` (subset) " Mark Brown
@ 2025-09-02 12:56 ` Lee Jones
23 siblings, 0 replies; 62+ messages in thread
From: Lee Jones @ 2025-09-02 12:56 UTC (permalink / raw)
To: Bartosz Golaszewski, Linus Walleij, linux-gpio, Arnd Bergmann
Cc: Arnd Bergmann, Andrew Lunn, Sebastian Hesselbarth,
Gregory Clement, Russell King, Daniel Mack, Haojian Zhuang,
Robert Jarzmik, Krzysztof Kozlowski, Alim Akhtar,
Geert Uytterhoeven, Thomas Bogendoerfer, Yoshinori Sato,
Rich Felker, John Paul Adrian Glaubitz, Thomas Gleixner,
Ingo Molnar, Borislav Petkov, Dave Hansen, x86, H. Peter Anvin,
Dmitry Torokhov, Lee Jones, Pavel Machek, Mauro Carvalho Chehab,
Matti Vaittinen, Florian Fainelli, Jeff Johnson, Hans de Goede,
Ilpo Järvinen, Greg Kroah-Hartman, Jaroslav Kysela,
Takashi Iwai, Liam Girdwood, Mark Brown, Andy Shevchenko,
Dr. David Alan Gilbert, linux-arm-kernel, linux-kernel,
linux-samsung-soc, linux-m68k, linux-mips, linux-sh, linux-input,
linux-leds, linux-media, patches, netdev, linux-wireless, ath10k,
platform-driver-x86, linux-usb, linux-sound
On Fri, 08 Aug 2025 17:17:44 +0200, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> Commit 678bae2eaa81 ("gpiolib: make legacy interfaces optional") was
> merged for linux-6.17, so now it is possible to use the legacy interfaces
> conditionally and eventually have the support left out of the kernel
> whenever it is not needed.
>
> [...]
Applied, thanks!
[12/21] mfd: arizona: make legacy gpiolib interface optional
commit: 12f6c0afc8987d72017a3ecf7c1183cb951b0d24
[13/21] mfd: si476x: add GPIOLIB_LEGACY dependency
commit: 1ae250257e43b3fba225e4f8ea7d87125dc861ae
[14/21] mfd: aat2870: add GPIOLIB_LEGACY dependency
commit: 3144986f37911f131f373743f294b2941a8ef37c
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH 12/21] mfd: arizona: make legacy gpiolib interface optional
2025-09-02 12:44 ` Lee Jones
@ 2025-09-02 13:47 ` Arnd Bergmann
2025-09-03 8:05 ` Lee Jones
0 siblings, 1 reply; 62+ messages in thread
From: Arnd Bergmann @ 2025-09-02 13:47 UTC (permalink / raw)
To: Lee Jones, Arnd Bergmann
Cc: Bartosz Golaszewski, Linus Walleij, open list:GPIO SUBSYSTEM,
Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
Jiri Slaby, Sakari Ailus, Charles Keepax, patches, linux-kernel,
linux-sound
On Tue, Sep 2, 2025, at 14:44, Lee Jones wrote:
> On Fri, 08 Aug 2025, Arnd Bergmann wrote:
>
>> From: Arnd Bergmann <arnd@arndb.de>
>>
>> The only machine that still uses the old gpio number based interface
>> is the wlf_cragg_6410 board file. In order to remove the dependency
>> on the interfaces, add #ifdef blocks here.
>>
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>> ---
>> drivers/mfd/arizona-irq.c | 5 ++++-
>> include/linux/mfd/arizona/pdata.h | 6 ++++++
>> sound/soc/codecs/arizona-jack.c | 17 ++++++++++++++++-
>> 3 files changed, 26 insertions(+), 2 deletions(-)
>
> Just FTR, I hate this! =:-D
Any alternative suggestions?
Would you be happier with a hard "depends on GPIOLIB_LEGACY"?
I see only two in-tree users other than the old 6410 board
that use the modern path: exynos5433-tm2-common.dtsi
and drivers/platform/x86/x86-android-tablets/lenovo.c.
Making those platforms 'select GPIOLIB_LEGACY' is technically
incorrect since they don't need the legayc interfaces, but it
would be a temporary workaround until wlf_cragg_6410 is
gone.
Arnd
^ permalink raw reply [flat|nested] 62+ messages in thread
* Re: [PATCH 12/21] mfd: arizona: make legacy gpiolib interface optional
2025-09-02 13:47 ` Arnd Bergmann
@ 2025-09-03 8:05 ` Lee Jones
0 siblings, 0 replies; 62+ messages in thread
From: Lee Jones @ 2025-09-03 8:05 UTC (permalink / raw)
To: Arnd Bergmann
Cc: Arnd Bergmann, Bartosz Golaszewski, Linus Walleij,
open list:GPIO SUBSYSTEM, Liam Girdwood, Mark Brown,
Jaroslav Kysela, Takashi Iwai, Jiri Slaby, Sakari Ailus,
Charles Keepax, patches, linux-kernel, linux-sound
On Tue, 02 Sep 2025, Arnd Bergmann wrote:
> On Tue, Sep 2, 2025, at 14:44, Lee Jones wrote:
> > On Fri, 08 Aug 2025, Arnd Bergmann wrote:
> >
> >> From: Arnd Bergmann <arnd@arndb.de>
> >>
> >> The only machine that still uses the old gpio number based interface
> >> is the wlf_cragg_6410 board file. In order to remove the dependency
> >> on the interfaces, add #ifdef blocks here.
> >>
> >> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> >> ---
> >> drivers/mfd/arizona-irq.c | 5 ++++-
> >> include/linux/mfd/arizona/pdata.h | 6 ++++++
> >> sound/soc/codecs/arizona-jack.c | 17 ++++++++++++++++-
> >> 3 files changed, 26 insertions(+), 2 deletions(-)
> >
> > Just FTR, I hate this! =:-D
>
> Any alternative suggestions?
>
> Would you be happier with a hard "depends on GPIOLIB_LEGACY"?
>
> I see only two in-tree users other than the old 6410 board
> that use the modern path: exynos5433-tm2-common.dtsi
> and drivers/platform/x86/x86-android-tablets/lenovo.c.
>
> Making those platforms 'select GPIOLIB_LEGACY' is technically
> incorrect since they don't need the legayc interfaces, but it
> would be a temporary workaround until wlf_cragg_6410 is
> gone.
I've applied the patches for now in the hope that these can get cleaned
away at one point.
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 62+ messages in thread
end of thread, other threads:[~2025-09-03 8:06 UTC | newest]
Thread overview: 62+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-08 15:17 [PATCH 00/21] gpiolib: fence off legacy interfaces Arnd Bergmann
2025-08-08 15:17 ` [PATCH 01/21] ARM: select legacy gpiolib interfaces where used Arnd Bergmann
2025-08-11 8:49 ` Krzysztof Kozlowski
2025-08-08 15:17 ` [PATCH 02/21] m68k: coldfire: select legacy gpiolib interface for mcfqspi Arnd Bergmann
2025-08-08 15:17 ` [PATCH 03/21] mips: select legacy gpiolib interfaces where used Arnd Bergmann
2025-08-08 15:17 ` [PATCH 04/21] sh: select legacy gpiolib interface Arnd Bergmann
2025-08-12 18:28 ` Rob Landley
2025-08-12 21:28 ` Arnd Bergmann
2025-08-08 15:17 ` [PATCH 05/21] x86/platform: select legacy gpiolib interfaces where used Arnd Bergmann
2025-08-09 10:00 ` Andy Shevchenko
2025-08-09 19:44 ` Arnd Bergmann
2025-08-10 15:12 ` Hans de Goede
2025-08-11 2:27 ` Dmitry Torokhov
2025-08-08 15:17 ` [PATCH 06/21] x86/olpc: select GPIOLIB_LEGACY Arnd Bergmann
2025-08-12 17:01 ` Borislav Petkov
2025-08-08 15:17 ` [PATCH 07/21] mfd: wm8994: remove dead legacy-gpio code Arnd Bergmann
2025-08-11 13:14 ` Bartosz Golaszewski
2025-08-08 15:17 ` [PATCH 08/21] ASoC: add GPIOLIB_LEGACY dependency where needed Arnd Bergmann
2025-08-08 15:17 ` [PATCH 09/21] input: gpio-keys: make legacy gpiolib optional Arnd Bergmann
2025-08-11 10:34 ` Matti Vaittinen
2025-08-11 12:52 ` Andy Shevchenko
2025-08-11 19:21 ` Dmitry Torokhov
2025-08-11 20:09 ` Andy Shevchenko
2025-08-12 5:11 ` Matti Vaittinen
2025-08-08 15:17 ` [PATCH 10/21] leds: gpio: make legacy gpiolib interface optional Arnd Bergmann
2025-08-18 15:37 ` Linus Walleij
2025-08-19 12:19 ` Lee Jones
2025-08-19 12:59 ` Arnd Bergmann
2025-08-20 7:16 ` Lee Jones
2025-08-20 12:00 ` Arnd Bergmann
2025-08-20 13:15 ` Andy Shevchenko
2025-08-20 13:15 ` Andy Shevchenko
2025-08-08 15:17 ` [PATCH 11/21] media: em28xx: add special case for legacy gpiolib interface Arnd Bergmann
2025-08-08 15:17 ` [PATCH 12/21] mfd: arizona: make legacy gpiolib interface optional Arnd Bergmann
2025-09-02 12:44 ` Lee Jones
2025-09-02 13:47 ` Arnd Bergmann
2025-09-03 8:05 ` Lee Jones
2025-08-08 15:17 ` [PATCH 13/21] mfd: si476x: add GPIOLIB_LEGACY dependency Arnd Bergmann
2025-08-08 15:17 ` [PATCH 14/21] mfd: aat2870: " Arnd Bergmann
2025-08-08 15:17 ` [PATCH 15/21] dsa: b53: hide legacy gpiolib usage on non-mips Arnd Bergmann
2025-08-09 10:01 ` Jonas Gorski
2025-08-09 20:55 ` Arnd Bergmann
2025-08-08 15:18 ` [PATCH 16/21] ath10k: remove gpio number assignment Arnd Bergmann
2025-08-08 15:18 ` [PATCH 17/21] nfc: marvell: convert to gpio descriptors Arnd Bergmann
2025-08-09 10:09 ` Andy Shevchenko
2025-08-11 21:43 ` Dmitry Torokhov
2025-08-13 12:35 ` Andy Shevchenko
2025-08-11 7:49 ` Bartosz Golaszewski
2025-08-13 7:48 ` Krzysztof Kozlowski
2025-08-08 15:18 ` [PATCH 18/21] nfc: s3fwrn5: " Arnd Bergmann
2025-08-11 22:08 ` Dmitry Torokhov
2025-08-08 15:18 ` [PATCH 19/21] usb: udc: pxa: remove unused platform_data Arnd Bergmann
2025-08-09 10:15 ` Andy Shevchenko
2025-08-11 22:12 ` Dmitry Torokhov
2025-08-08 15:18 ` [PATCH 20/21] ASoC: pxa: add GPIOLIB_LEGACY dependency Arnd Bergmann
2025-08-08 15:18 ` [PATCH 21/21] gpiolib: turn off legacy interface by default Arnd Bergmann
2025-08-09 10:18 ` Andy Shevchenko
2025-08-09 19:47 ` Arnd Bergmann
2025-08-11 12:49 ` Andy Shevchenko
2025-08-11 13:10 ` [PATCH 00/21] gpiolib: fence off legacy interfaces Bartosz Golaszewski
2025-08-12 16:23 ` (subset) " Mark Brown
2025-09-02 12:56 ` Lee Jones
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).