[GIT PULL] gpio updates for v6.15-rc1
From: Bartosz Golaszewski
Date: Tue Mar 25 2025 - 07:13:56 EST
From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
Linus,
Here's the big pull request from the GPIO tree for this merge window.
There are no new drivers this time but several changes to the core GPIO
framework and various driver updates.
This release cycle, we're starting a relatively straightforward but tedious
rework of the GPIO consumer API: for historical reasons, the gpiod_set_value()
variants would return void. Not only that but the GPIO provider interface does
not even allow drivers to return a value to GPIO core. This is because initial
GPIO controllers would be MMIO based and could not fail. We've had I2C, SPI
and USB controllers for years too but no way of indicating failures to callers.
This PR changes the consumer interface, adds new provider callbacks and starts
converting the drivers under drivers/gpio/ to using them. Once this gets
upstream, we'll keep on converting GPIO drivers that live elsewhere and once
there are no more users of the old callbacks, we'll remove them and rename the
new ones to the previous name. I imagine the last step would happen in one
sweeping change like what you did for the remove_new() -> remove() renaming.
We've also addressed an issue where invalid return values from GPIO drivers
would get propagated to user-space by adding some GPIO-core-level sanitization.
Again: not a complex change but way overdue.
Other than that: lots of driver and core refactoring, DT-bindings changes and
some other minor changes like coding style fixes or header reordering.
All changes (except for the TODO updates which I picked up yesterday) have
spent at least a week in linux-next (most way more than that) with regressions
nicely ironed out for most part.
Please pull,
Bartosz
The following changes since commit 4701f33a10702d5fc577c32434eb62adde0a1ae1:
Linux 6.14-rc7 (2025-03-16 12:55:17 -1000)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git gpio-updates-for-v6.15-rc1
for you to fetch changes up to af54a2fbdf45b1fd32cdcab916f422e6d097f430:
gpio: TODO: add an item to track reworking the sysfs interface (2025-03-24 10:35:10 +0100)
----------------------------------------------------------------
gpio updates for v6.15-rc1
GPIO core:
- add sanitization of return values of GPIO provider callbacks so that invalid
ones don't get propagated to user-space
- add new variants of the line setter callbacks for GPIO providers that return
an integer and allow to indicate driver errors to the GPIO core
- change the interface of all gpiod_set_value() variants to return an integer
thus becoming able to indicate failures in the underlying layer to callers
- drop unneeded ERR_CAST in gpiolib-acpi
- use for_each_if() where applicable
- provide gpiod_multi_set_value_cansleep() as a new, simpler interface to
gpiod_set_array_value_cansleep() and use it across several drivers treewide
- reduce the number of atomic reads of the descriptor flags in gpiolib debugfs
code
- simplify for_each_hwgpio_in_range() and for_each_requested_gpio_in_range()
- add support for three-cell GPIO specifiers in GPIO OF code
- don't build HTE (hardware timestamp engine) GPIO code with the HTE subsystem
disabled in Kconfig
- unduplicate calls to gpiod_direction_input_nonotify()
- rework the handling of the valid_mask property of GPIO chips: don't allow
drivers to set it as it should only be handled by GPIO core and start
actually enforcing it in GPIO core for *all* drivers, not only the ones
implementing a custom request() callback
- get the `ngpios` property from the fwnode of the GPIO chip, not its device in
order to handle multi-bank GPIO chips
Driver improvements:
- convert a part of the GPIO drivers under drivers/gpio/ to using the new value
setter callbacks
- convert several drivers to using automatic lock guards from cleanup.h
- allow building gpio-bt8xx with COMPILE_TEST=y
- refactor gpio-74x164 (use devres, cleanup helpers, __counted_by() and bits.h
macros)
- refactor gpio-latch (use generic device properties, lock guards and some
local variables for better readability)
- refactor gpio-xilinx (improve the usage of the bitmap API)
- support multiple virtual GPIO controller instances in gpio-virtio
- allow gpio-regmap to use the standard `ngpios` property from GPIOLIB
- factor out the common code for synchronous probing of virtual GPIO devices
into its own library
- use str_enable_disable(), str_high_low() and other string helpers where
applicable
- extend the gpio-mmio abstraction layer to allow calling into the pinctrl
back-end when setting direction
- convert gpio-vf610 to using the gpio-mmio library
- use more devres in gpio-adnp
- add support for reset-gpios in gpio-pcf857x
- add support for more models to gpio-loongson-64bit
DT bindings:
- add new compatibles to gpio-vf610 and gpio-loongson
- add missing gpio-ranges property to gpio-mvebu
- add reset-gpios to nxp,pcf8575
- enable gpio-hog parsing in ast2400-gpio
Misc:
- coding style improvements
- kerneldoc fixes
- includes reordering
- updates to the TODO list
----------------------------------------------------------------
Andy Shevchenko (23):
gpio: 74x164: Remove unneeded dependency to OF_GPIO
gpio: 74x164: Simplify code with cleanup helpers
gpio: 74x164: Annotate buffer with __counted_by()
gpio: 74x164: Make use of the macros from bits.h
gpio: 74x164: Fully convert to use managed resources
gpio: 74x164: Switch to use dev_err_probe()
gpio: 74x164: Utilise temporary variable for struct device
gpiolib: Even more opportunities to use str_high_low() helper
gpiolib: Deduplicate gpiod_direction_input_nonotify() call
gpio: xilinx: Use better bitmap APIs where appropriate
gpio: xilinx: Replace custom variants of bitmap_read()/bitmap_write()
gpiolib: Deduplicate some code in for_each_requested_gpio_in_range()
gpiolib: Simplify implementation of for_each_hwgpio_in_range()
drm: Move for_each_if() to util_macros.h for wider use
gpiolib: Switch to use for_each_if() helper
gpio: loongson-64bit: Remove unneeded ngpio assignment
gpiolib: Extract gpiochip_choose_fwnode() for wider use
gpiolib: Use fwnode instead of device in gpiochip_get_ngpios()
gpio: regmap: Group optional assignments together for better understanding
gpio: regmap: Move optional assignments down in the code
gpio: regmap: Allow ngpio to be read from the property
gpiolib: Align FLAG_* definitions in the struct gpio_desc
gpiolib-acpi: Drop unneeded ERR_CAST() in __acpi_find_gpio()
Bartosz Golaszewski (76):
Merge tag 'gpio-set-array-helper-v6.15-rc1' into gpio/for-next
gpio: latch: use generic device properties
gpio: latch: store the address of pdev->dev in a helper variable
gpiolib: move all includes to the top of gpio/consumer.h
gpiolib: don't build HTE code with CONFIG_HTE disabled
Merge tag 'v6.14-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux into HEAD
gpiolib: sanitize the return value of gpio_chip::request()
gpiolib: sanitize the return value of gpio_chip::set_config()
gpiolib: sanitize the return value of gpio_chip::get()
gpiolib: sanitize the return value of gpio_chip::get_multiple()
gpiolib: sanitize the return value of gpio_chip::direction_output()
gpiolib: sanitize the return value of gpio_chip::direction_input()
gpiolib: sanitize the return value of gpio_chip::get_direction()
gpiolib: read descriptor flags once in gpiolib_dbg_show()
gpiolib: use the required minimum set of headers
leds: aw200xx: don't use return with gpiod_set_value() variants
gpiolib: make value setters have return values
gpiolib: wrap gpio_chip::set()
gpiolib: rework the wrapper around gpio_chip::set_multiple()
gpiolib: introduce gpio_chip setters that return values
gpio: sim: use value returning setters
gpio: regmap: use value returning setters
gpio: pca953x: use value returning setters
gpio: mockup: use value returning setters
gpio: aggregator: use value returning setters
gpio: max77650: use value returning setters
gpio: latch: use lock guards
gpio: latch: use value returning setters
gpio: davinci: use value returning setters
gpio: mvebu: use value returning setters
gpiolib: don't use gpiochip_get_direction() when registering a chip
gpiolib: use a more explicit retval logic in gpiochip_get_direction()
gpiolib: don't double-check the gc->get callback's existence
Merge tag 'v6.14-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux into gpio/for-next
gpiolib: remove unneeded WARN_ON() from gpiochip_set_multiple()
gpiolib: deprecate gpio_chip::set and gpio_chip::set_multiple
gpiolib: update kerneldocs for value setters
gpiolib: fix kerneldoc
gpio: 74x164: use new line value setter callbacks
gpio: adnp: use devm_mutex_init()
gpio: adp5520: use new line value setter callbacks
gpio: adp5585: use new line value setter callbacks
gpio: altera-a10sr: use new line value setter callbacks
gpio: altera: use new line value setter callbacks
gpio: amd8111: use new line value setter callbacks
gpio: amd-fch: use new line value setter callbacks
gpio: arizona: use new line value setter callbacks
gpio: aspeed: use lock guards
gpio: aspeed: use new line value setter callbacks
gpio: aspeed-sgpio: use lock guards
gpio: aspeed-sgpio: use new line value setter callbacks
gpio: adnp: use lock guards for the I2C lock
gpio: adnp: use new line value setter callbacks
Merge tag 'intel-gpio-v6.15-1' of git://git.kernel.org/pub/scm/linux/kernel/git/andy/linux-gpio-intel into gpio/for-next
Merge tag 'v6.14-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux into gpio/for-next
gpio: bcm-kona: use lock guards
gpio: bcm-kona: use new line value setter callbacks
gpio: bd71815: use new line value setter callbacks
gpio: bd71828: use new line value setter callbacks
gpio: bd9571mwv: use new line value setter callbacks
gpio: bt8xx: allow to build the module with COMPILE_TEST=y
gpio: bt8xx: use lock guards
gpio: bt8xx: use new line value setter callbacks
gpio: cgbc: use new line value setter callbacks
gpio: creg-snps: use new line value setter callbacks
gpio: cros-ec: use new line value setter callbacks
gpio: crystalcove: use new line value setter callbacks
gpio: cs5535: use new line value setter callbacks
gpio: da9052: use new line value setter callbacks
gpio: da9055: use new line value setter callbacks
gpio: TODO: remove the item about the new debugfs interface
gpio: TODO: remove task duplication
gpio: TODO: remove the pinctrl integration task
gpio: TODO: add delimiters between tasks for better readability
gpio: TODO: add an item to track the conversion to the new value setters
gpio: TODO: add an item to track reworking the sysfs interface
Binbin Zhou (2):
dt-bindings: gpio: loongson: Add new loongson gpio chip compatible
gpio: loongson-64bit: Add more gpio chip support
David Lechner (5):
gpiolib: add gpiod_multi_set_value_cansleep()
gpio: max3191x: use gpiod_multi_set_value_cansleep
mmc: pwrseq_simple: use gpiod_multi_set_value_cansleep
mux: gpio: use gpiod_multi_set_value_cansleep
phy: mapphone-mdm6600: use gpiod_multi_set_value_cansleep
Frank Li (1):
dt-bindings: gpio: vf610: Add i.MX94 support
Koichiro Den (3):
gpio: introduce utilities for synchronous fake device creation
gpio: sim: convert to use dev-sync-probe utilities
gpio: virtuser: convert to use dev-sync-probe utilities
Krzysztof Kozlowski (1):
gpio: Use str_enable_disable-like helpers
Linus Walleij (4):
gpio: mmio: Add flag for calling pinctrl back-end
gpio: vf610: Switch to gpio-mmio
gpiolib: of: Use local variables
gpiolib: of: Handle threecell GPIO chips
Matti Vaittinen (4):
gpio: Respect valid_mask when requesting GPIOs
gpio: Add a valid_mask getter
gpio: gpio-rcar: Drop direct use of valid_mask
gpio: Hide valid_mask from direct assignments
Ninad Palsule (1):
dt-bindings: gpio: ast2400-gpio: Add hogs parsing
Quentin Schulz (2):
dt-bindings: gpio: nxp,pcf8575: add reset GPIO
gpio: pcf857x: add support for reset-gpios on (most) PCA967x
Rob Herring (Arm) (1):
dt-bindings: gpio: mvebu: Add missing 'gpio-ranges' property and hog nodes
hlleng (1):
gpio: virtio: support multiple virtio-gpio controller instances
.../bindings/gpio/aspeed,ast2400-gpio.yaml | 6 +
.../devicetree/bindings/gpio/gpio-mvebu.yaml | 10 +
.../devicetree/bindings/gpio/gpio-vf610.yaml | 1 +
.../devicetree/bindings/gpio/loongson,ls-gpio.yaml | 3 +
.../devicetree/bindings/gpio/nxp,pcf8575.yaml | 37 +++
drivers/gpio/Kconfig | 9 +-
drivers/gpio/Makefile | 3 +
drivers/gpio/TODO | 89 ++---
drivers/gpio/dev-sync-probe.c | 97 ++++++
drivers/gpio/dev-sync-probe.h | 25 ++
drivers/gpio/gpio-74x164.c | 96 +++---
drivers/gpio/gpio-adnp.c | 140 ++++----
drivers/gpio/gpio-adp5520.c | 12 +-
drivers/gpio/gpio-adp5585.c | 10 +-
drivers/gpio/gpio-aggregator.c | 38 ++-
drivers/gpio/gpio-altera-a10sr.c | 14 +-
drivers/gpio/gpio-altera.c | 6 +-
drivers/gpio/gpio-amd-fch.c | 7 +-
drivers/gpio/gpio-amd8111.c | 6 +-
drivers/gpio/gpio-arizona.c | 9 +-
drivers/gpio/gpio-aspeed-sgpio.c | 82 ++---
drivers/gpio/gpio-aspeed.c | 108 +++---
drivers/gpio/gpio-bcm-kona.c | 69 ++--
drivers/gpio/gpio-bd71815.c | 15 +-
drivers/gpio/gpio-bd71828.c | 15 +-
drivers/gpio/gpio-bd9571mwv.c | 8 +-
drivers/gpio/gpio-brcmstb.c | 3 +-
drivers/gpio/gpio-bt8xx.c | 48 +--
drivers/gpio/gpio-cgbc.c | 24 +-
drivers/gpio/gpio-creg-snps.c | 10 +-
drivers/gpio/gpio-cros-ec.c | 13 +-
drivers/gpio/gpio-crystalcove.c | 15 +-
drivers/gpio/gpio-cs5535.c | 6 +-
drivers/gpio/gpio-da9052.c | 34 +-
drivers/gpio/gpio-da9055.c | 14 +-
drivers/gpio/gpio-davinci.c | 6 +-
drivers/gpio/gpio-grgpio.c | 3 +-
drivers/gpio/gpio-latch.c | 78 ++---
drivers/gpio/gpio-loongson-64bit.c | 55 ++-
drivers/gpio/gpio-max3191x.c | 18 +-
drivers/gpio/gpio-max77650.c | 14 +-
drivers/gpio/gpio-mmio.c | 37 ++-
drivers/gpio/gpio-mockup.c | 14 +-
drivers/gpio/gpio-mvebu.c | 15 +-
drivers/gpio/gpio-nomadik.c | 3 +-
drivers/gpio/gpio-pca953x.c | 17 +-
drivers/gpio/gpio-pcf857x.c | 29 +-
drivers/gpio/gpio-rcar.c | 13 +-
drivers/gpio/gpio-regmap.c | 73 ++--
drivers/gpio/gpio-sim.c | 98 ++----
drivers/gpio/gpio-stmpe.c | 6 +-
drivers/gpio/gpio-vf610.c | 105 +-----
drivers/gpio/gpio-virtio.c | 29 +-
drivers/gpio/gpio-virtuser.c | 73 +---
drivers/gpio/gpio-wcove.c | 3 +-
drivers/gpio/gpio-wm831x.c | 3 +-
drivers/gpio/gpio-xilinx.c | 102 +++---
drivers/gpio/gpio-xra1403.c | 3 +-
drivers/gpio/gpiolib-acpi.c | 2 +-
drivers/gpio/gpiolib-of.c | 132 ++++++--
drivers/gpio/gpiolib.c | 367 +++++++++++++++------
drivers/gpio/gpiolib.h | 39 ++-
drivers/leds/leds-aw200xx.c | 2 +-
drivers/mmc/core/pwrseq_simple.c | 3 +-
drivers/mux/gpio.c | 4 +-
drivers/phy/motorola/phy-mapphone-mdm6600.c | 4 +-
include/drm/drm_util.h | 16 +-
include/linux/gpio.h | 4 +-
include/linux/gpio/consumer.h | 80 +++--
include/linux/gpio/driver.h | 92 ++++--
include/linux/gpio/regmap.h | 4 +-
include/linux/util_macros.h | 15 +
72 files changed, 1465 insertions(+), 1178 deletions(-)
create mode 100644 drivers/gpio/dev-sync-probe.c
create mode 100644 drivers/gpio/dev-sync-probe.h