From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx> Linus, Here's is the first pull-request from the GPIO subsystem for this merge window. It's going to be one of three total, more on that later. I'm sending it ahead as I'll be off Mon-Thu. We don't have any new drivers. The loongson driver is getting extended with support for new models. There's a big refactor of gpio-pca953x and many small improvements to others. The GPIO code in the kernel has acquired a lot of cruft over the years as well as many abusers of the API across the kernel tree. This release cycle we have started a major cleanup and improvement effort that will most likely span several releases. We have started by converting external users of struct gpio_chip to accessing the wrapper around it - struct gpio_device. This is because the latter is reference counted while the former is removed when the provider is unbound. We also removed several instances of drivers accessing private GPIOLIB structures and including the private header from drivers/gpio/. To that end you'll see several commits aimed at different subsystems (acked by relevant maintainers) as well as two merges from the x86/platform tree. We'll then rework the locking in GPIOLIB which currently uses a big spinlock for many different things and could use becoming more fine-grained, especially as it doesn't even get the locking right. We'll also use SRCU for protecting the gpio_chip pointer against in-kernel hot-unplug crashes similar to what we saw triggered from user-space and fixed with semaphores in gpiolib-cdev. The core GPIOLIB is still vulnerable to these use-cases. I'm just mentioning the plans here, this is not part of this PR. You'll see some new instances of using __free(). We've added a gpio_device_put cleanup helper similar to the put_device one introduced by Peter Zijlstra and used it according to the preferred pattern except where it didn't make sense. All details are in the signed tag. There's a trivial conflict between this tag and current master that can be resolved as follows: diff --cc drivers/gpio/gpio-vf610.c index 656d6b1dddb5,a89ae84a1fa0..444501c56a3b --- a/drivers/gpio/gpio-vf610.c +++ b/drivers/gpio/gpio-vf610.c @@@ -126,9 -140,7 +140,9 @@@ static int vf610_gpio_direction_output( unsigned long mask = BIT(gpio); u32 val; + vf610_gpio_set(chip, gpio, value); + - if (port->sdata && port->sdata->have_paddr) { + if (port->sdata->have_paddr) { val = vf610_gpio_readl(port->gpio_base + GPIO_PDDR); val |= mask; vf610_gpio_writel(val, port->gpio_base + GPIO_PDDR); And another one between the GPIO and HTE trees for which the proposed resolution looks like this: diff --cc drivers/hte/Kconfig index 8e0fd818a73e,083e67492bf2..000000000000 --- a/drivers/hte/Kconfig +++ b/drivers/hte/Kconfig @@@ -16,8 -16,7 +16,8 @@@ if HT config HTE_TEGRA194 tristate "NVIDIA Tegra194 HTE Support" - depends on ARCH_TEGRA_194_SOC + depends on (ARCH_TEGRA_194_SOC || COMPILE_TEST) + depends on GPIOLIB help Enable this option for integrated hardware timestamping engine also known as generic timestamping engine (GTE) support on NVIDIA Tegra194 There'll be two more PRs later in the merge window. First will contain ~70 commits that refactor the glue code between GPIO and pinctrl. It introduced several conflicts between Linus' and my trees so we decided to wait for the bulk GPIO and pinctrl changes to be in the master branch before sending it separately. The final PR will remove gpiochip_find() from the tree. This removal depends on changes in the SPI tree and will be sent once they are merged as well. Please pull Bartosz Golaszewski The following changes since commit 0bb80ecc33a8fb5a682236443c1e740d5c917d1d: Linux 6.6-rc1 (2023-09-10 16:28:41 -0700) are available in the Git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git tags/gpio-updates-for-v6.7-rc1 for you to fetch changes up to 9bc633117d6a8411c6912cb0194b3e0f83ef9d56: hte: tegra194: add GPIOLIB dependency (2023-10-23 20:07:36 +0200) ---------------------------------------------------------------- gpio updates for v6.7-rc1 GPIOLIB core: - provide interfaces allowing users to retrieve, manage and query the reference counted GPIO device instead of accessing the private gpio_chip structure - replace gpiochip_find() with gpio_device_find() - remove unused acpi_get_and_request_gpiod() - improve the ignore_interrupt functionality in GPIO ACPI - correct notifier return codes in gpiolib-of - unexport gpiod_set_transitory() as it's unused outside of core GPIO code - while there are still external users accessing struct gpio_chip, let's make gpiochip_get_desc() public so that they at least use the preferred helper - improve locking for lookup tables - annotate struct linereq with __counted_by - improve GPIOLIB docs - add an OF quirk for LED trigger sources Driver improvements: - convert all GPIO drivers with .remove() callbacks to using the new variant returning void instead of int - stop accessing the GPIOLIB private structures in gpio-mockup, i2c-mux-gpio, hte-tegra194, gpio-sim - use the recommended pattern for autofree variables in gpio-sim - add support for more models to gpio-loongson - use a notifier chain to notify other blocks about interrupts in gpio-eic-sprd instead of looking up GPIO devices on every interrupt - convert gpio-pca953x and gpio-fx6408 to using the maple tree regmap cache - don't include GPIOLIB internal headers in drivers which don't need them - move the ingenic NAND quirk into gpiolib-of - add an ignore interrupt quirk for Peaq C1010 - drop static GPIO base from gpio-omap, gpio-f7188x - use the preferred device_get_match_data() function in drivers that still don't - refactor gpio-pca953x: switch to using DEFINE_SIMPLE_DEV_PM_OPS(), use cleanup helpers, use dev_err_probe() where it makes sense, fully convert to using devres and some other minor tweaks DT bindings: - add support for a new model to gpio-vf610 and update existing properties - add support for more loongson models - add missing support for imx models that are used but undocumented - convert bindings for Intel IXP4xx to schema Minor stuff: - deprecate gpio-mockup in favor of gpio-sim - include missing headers here and there - stop using gpiochip_find() in OMAP1 board files - minor tweaks in gpio-vf610, gpio-hisi - remove unneeded 'extern' specifiers from headers ---------------------------------------------------------------- Andy Shevchenko (11): gpio: pca953x: Drop unused fields in struct pca953x_platform_data gpio: pca953x: Fully convert to device managed resources gpio: pca953x: Utilise dev_err_probe() where it makes sense gpio: pca953x: Split pca953x_restore_context() and pca953x_save_context() gpio: pca953x: Simplify code with cleanup helpers gpio: pca953x: Utilise temporary variable for struct device gpio: pca953x: Utilise temporary variable for struct gpio_chip gpio: pca953x: Switch to DEFINE_SIMPLE_DEV_PM_OPS() gpio: pca953x: Get rid of useless goto label gpio: pca953x: Revisit header inclusions gpiolib: provide gpio_device_find_by_fwnode() Arnd Bergmann (1): hte: tegra194: add GPIOLIB dependency Bartosz Golaszewski (45): gpio: mockup: fix kerneldoc gpio: mockup: remove unused field gpio: mockup: deprecate the old testing module gpio: mockup: simplify code by using cleanup helpers gpio: mockup: don't access internal GPIOLIB structures gpiolib: unexport gpiod_set_transitory() gpio: of: correct notifier return codes gpiolib: remove stray newline in gpio/driver.h gpiolib: remove unnecessary extern specifiers from the driver header gpio: xgene-sb: don't include gpiolib.h gpio: dwapb: don't include gpiolib.h gpio: mb86s7x: don't include gpiolib.h gpio: eic-sprd: use atomic notifiers to notify all chips about irqs Merge tag 'platform-drivers-x86-ib-x86-android-tablets-v6.7' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86 into gpio/for-next gpio: sim: don't fiddle with GPIOLIB private members pinctrl: da9062: add missing include gpiolib: make gpiochip_get_desc() public pinctrl: da9062: don't include private GPIOLIB header gpio: eic-sprd: unregister from the irq notifier on remove() gpio: eic-sprd: use a helper variable for &pdev->dev gpio: sim: include a missing header gpio: sim: initialize a managed pointer when declaring it mtd: rawnand: ingenic: move the GPIO quirk to gpiolib-of.c gpio: sim: add missing include gpiolib: extend the critical sections of lookup tables gpiolib: make gpio_device_get() and gpio_device_put() public gpiolib: add support for scope-based management to gpio_device gpiolib: provide gpio_device_find() gpiolib: provide gpio_device_find_by_label() gpiolib: provide gpio_device_get_desc() gpiolib: reluctantly provide gpio_device_get_chip() gpiolib: replace find_chip_by_name() with gpio_device_find_by_label() gpio: of: replace gpiochip_find_* with gpio_device_find_* gpio: acpi: replace gpiochip_find() with gpio_device_find() gpio: swnode: replace gpiochip_find() with gpio_device_find_by_label() gpio: sysfs: drop the mention of gpiochip_find() from sysfs code arm: omap1: ams-delta: stop using gpiochip_find() platform/x86: int3472: Add new skl_int3472_gpiod_get_from_temp_lookup() helper Merge tag 'platform-drivers-x86-ib-int3472-v6.7' of https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86 into gpio/for-next gpio: acpi: remove acpi_get_and_request_gpiod() gpiolib: provide gpio_device_to_device() gpiolib: provide gpiod_to_gpio_device() i2c: mux: gpio: don't fiddle with GPIOLIB internals gpiolib: provide gpio_device_get_base() hte: tegra194: don't access struct gpio_chip Devyn Liu (1): gpio: hisi: Fix format specifier Fabio Estevam (1): dt-bindings: gpio: fsl-imx-gpio: Document imx25 and imx27 Hans de Goede (11): gpiolib: acpi: Check if a GPIO is listed in ignore_interrupt earlier gpiolib: acpi: Add a ignore interrupt quirk for Peaq C1010 platform/x86: x86-android-tablets: Remove invalid_aei_gpiochip from Peaq C1010 platform/x86: x86-android-tablets: Remove invalid_aei_gpiochip support platform/x86: x86-android-tablets: Create a platform_device from module_init() platform/x86: x86-android-tablets: Stop using gpiolib private APIs platform/x86: x86-android-tablets: Use platform-device as gpio-keys parent platform/x86: x86-android-tablets: Drop "linux,power-supply-name" from lenovo_yt3_bq25892_0_props[] platform/x86: int3472: Add new skl_int3472_fill_gpiod_lookup() helper platform/x86: int3472: Stop using gpiod_toggle_active_low() platform/x86: int3472: Switch to devm_get_gpiod() Kees Cook (1): gpiolib: cdev: annotate struct linereq with __counted_by Linus Walleij (4): gpio: Rewrite IXP4xx GPIO bindings in schema gpiolib: of: Allow "trigger-sources" to reference a GPIO OMAP/gpio: drop MPUIO static base gpio: Further document optional GPIOLIB Mark Brown (2): gpio: pca953x: Convert to use maple tree register cache gpio: fx6408: Convert to use maple tree register cache Peng Fan (6): dt-bindings: gpio: vf610: update gpio-ranges dt-bindings: gpio: vf610: correct i.MX8ULP and i.MX93 dt-bindings: gpio: vf610: add i.MX95 compatible gpio: vf610: add i.MX8ULP of_device_id entry gpio: vf610: simplify code by dropping data check gpio: vf610: update comment for i.MX8ULP and i.MX93 legacy compatibles Rob Herring (1): gpio: Use device_get_match_data() Uwe Kleine-König (23): gpio: altera: Convert to platform remove callback returning void gpio: amdpt: Convert to platform remove callback returning void gpio: brcmstb: Convert to platform remove callback returning void gpio: cadence: Convert to platform remove callback returning void gpio: dln2: Convert to platform remove callback returning void gpio: ftgpio010: Convert to platform remove callback returning void gpio: grgpio: Convert to platform remove callback returning void gpio: ljca: Convert to platform remove callback returning void gpio: lpc18xx: Convert to platform remove callback returning void gpio: mb86s7x: Convert to platform remove callback returning void gpio: mm-lantiq: Convert to platform remove callback returning void gpio: mpc5200: Convert to platform remove callback returning void gpio: mpc8xxx: Convert to platform remove callback returning void gpio: omap: Convert to platform remove callback returning void gpio: rcar: Convert to platform remove callback returning void gpio: rockchip: Convert to platform remove callback returning void gpio: ts5500: Convert to platform remove callback returning void gpio: uniphier: Convert to platform remove callback returning void gpio: xgene-sb: Convert to platform remove callback returning void gpio: xgs-iproc: Convert to platform remove callback returning void gpio: xilinx: Convert to platform remove callback returning void gpio: zynq: Convert to platform remove callback returning void gpio: tb10x: Convert to platform remove callback returning void Yinbo Zhu (2): gpio: dt-bindings: add more loongson gpio chip support gpio: loongson: add more gpio chip support xingtong.wu (1): gpio-f7188x: fix base values conflicts with other gpio pins .../devicetree/bindings/gpio/fsl-imx-gpio.yaml | 8 + .../devicetree/bindings/gpio/gpio-vf610.yaml | 40 ++- .../devicetree/bindings/gpio/intel,ixp4xx-gpio.txt | 38 --- .../bindings/gpio/intel,ixp4xx-gpio.yaml | 73 +++++ .../devicetree/bindings/gpio/loongson,ls-gpio.yaml | 21 +- Documentation/driver-api/gpio/consumer.rst | 4 + MAINTAINERS | 2 +- arch/arm/mach-omap1/board-ams-delta.c | 36 ++- arch/arm/mach-omap1/board-palmte.c | 5 - drivers/gpio/Kconfig | 4 +- drivers/gpio/gpio-altera.c | 6 +- drivers/gpio/gpio-amdpt.c | 6 +- drivers/gpio/gpio-brcmstb.c | 6 +- drivers/gpio/gpio-cadence.c | 6 +- drivers/gpio/gpio-davinci.c | 9 +- drivers/gpio/gpio-dln2.c | 6 +- drivers/gpio/gpio-dwapb.c | 1 - drivers/gpio/gpio-eic-sprd.c | 73 +++-- drivers/gpio/gpio-f7188x.c | 138 ++++----- drivers/gpio/gpio-ftgpio010.c | 6 +- drivers/gpio/gpio-fxl6408.c | 2 +- drivers/gpio/gpio-grgpio.c | 6 +- drivers/gpio/gpio-hisi.c | 2 +- drivers/gpio/gpio-ljca.c | 5 +- drivers/gpio/gpio-loongson-64bit.c | 119 +++++++- drivers/gpio/gpio-lpc18xx.c | 6 +- drivers/gpio/gpio-mb86s7x.c | 7 +- drivers/gpio/gpio-mm-lantiq.c | 6 +- drivers/gpio/gpio-mmio.c | 4 +- drivers/gpio/gpio-mockup.c | 88 +++--- drivers/gpio/gpio-mpc5200.c | 8 +- drivers/gpio/gpio-mpc8xxx.c | 6 +- drivers/gpio/gpio-mvebu.c | 10 +- drivers/gpio/gpio-omap.c | 9 +- drivers/gpio/gpio-pca953x.c | 307 +++++++++------------ drivers/gpio/gpio-rcar.c | 5 +- drivers/gpio/gpio-rockchip.c | 6 +- drivers/gpio/gpio-sim.c | 76 +++-- drivers/gpio/gpio-tb10x.c | 6 +- drivers/gpio/gpio-ts5500.c | 6 +- drivers/gpio/gpio-uniphier.c | 6 +- drivers/gpio/gpio-vf610.c | 56 +++- drivers/gpio/gpio-xgene-sb.c | 7 +- drivers/gpio/gpio-xgs-iproc.c | 6 +- drivers/gpio/gpio-xilinx.c | 6 +- drivers/gpio/gpio-zynq.c | 5 +- drivers/gpio/gpiolib-acpi.c | 70 +++-- drivers/gpio/gpiolib-cdev.c | 4 +- drivers/gpio/gpiolib-of.c | 86 ++++-- drivers/gpio/gpiolib-swnode.c | 33 ++- drivers/gpio/gpiolib-sysfs.c | 2 +- drivers/gpio/gpiolib.c | 304 ++++++++++++++++---- drivers/gpio/gpiolib.h | 14 +- drivers/hte/Kconfig | 1 + drivers/hte/hte-tegra194.c | 30 +- drivers/i2c/muxes/i2c-mux-gpio.c | 12 +- drivers/mtd/nand/raw/ingenic/ingenic_nand_drv.c | 12 - drivers/pinctrl/pinctrl-da9062.c | 7 +- .../platform/x86/intel/int3472/clk_and_regulator.c | 54 +--- drivers/platform/x86/intel/int3472/common.h | 7 +- drivers/platform/x86/intel/int3472/discrete.c | 101 +++++-- drivers/platform/x86/intel/int3472/led.c | 24 +- drivers/platform/x86/x86-android-tablets/asus.c | 1 + drivers/platform/x86/x86-android-tablets/core.c | 117 ++++---- drivers/platform/x86/x86-android-tablets/lenovo.c | 29 +- drivers/platform/x86/x86-android-tablets/other.c | 11 +- .../x86/x86-android-tablets/x86-android-tablets.h | 7 +- include/linux/gpio/consumer.h | 16 -- include/linux/gpio/driver.h | 47 +++- include/linux/platform_data/gpio-omap.h | 3 - include/linux/platform_data/pca953x.h | 13 - 71 files changed, 1336 insertions(+), 927 deletions(-) delete mode 100644 Documentation/devicetree/bindings/gpio/intel,ixp4xx-gpio.txt create mode 100644 Documentation/devicetree/bindings/gpio/intel,ixp4xx-gpio.yaml