Peng Fan [Thu, 22 May 2025 07:11:51 +0000 (15:11 +0800)]
gpio: grgpio: select GPIOLIB_IRQCHIP
This driver uses gpiochip_irq_reqres() and gpiochip_irq_relres() which
are only built with GPIOLIB_IRQCHIP=y. Add the missing Kconfig select.
Fixes:
a30be40bf1d4 ("gpio: grgpio: Make irq_chip immutable")
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/20250522-gpio-fix-v1-2-98ceae7c4c3c@nxp.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Peng Fan [Thu, 22 May 2025 07:11:50 +0000 (15:11 +0800)]
gpio: bcm-kona: select GPIOLIB_IRQCHIP
This driver uses gpiochip_irq_reqres() and gpiochip_irq_relres() which
are only built with GPIOLIB_IRQCHIP=y. Add the missing Kconfig select.
Fixes:
7b04f98027af ("gpio: bcm-kona: make irq_chip immutable")
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/20250522-gpio-fix-v1-1-98ceae7c4c3c@nxp.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Haibo Chen [Tue, 20 May 2025 03:46:12 +0000 (11:46 +0800)]
dt-bindings: gpio: vf610: add ngpios and gpio-reserved-ranges
Add optional ngpios and gpio-reserved-ranges property.
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250520-gpio-dts-v3-1-04771c6cf325@nxp.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Peng Fan [Wed, 21 May 2025 07:20:48 +0000 (15:20 +0800)]
gpio: davinci: select GPIOLIB_IRQCHIP
This driver uses gpiochip_irq_reqres() and gpiochip_irq_relres() which
are only built with GPIOLIB_IRQCHIP=y. Add the missing Kconfig select.
Fixes:
3f50bb3124d7 ("gpio: davinci: Make irq_chip immutable")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/
202505210606.PudPm5pC-lkp@intel.com/
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/20250521072048.1053190-1-peng.fan@oss.nxp.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Bartosz Golaszewski [Wed, 21 May 2025 10:04:30 +0000 (12:04 +0200)]
Merge tag 'intel-gpio-v6.16-1' of git://git./linux/kernel/git/andy/linux-gpio-intel into gpio/for-next
intel-gpio for v6.16-1
* Split GPIO ACPI quirks to its own file
* Refactored GPIO ACPI library to shrink the code
The following is an automated git shortlog grouped by driver:
gpiolib:
- acpi: Update file references in the Documentation and MAINTAINERS
- acpi: Move quirks to a separate file
- acpi: Add acpi_gpio_need_run_edge_events_on_boot() getter
- acpi: Handle deferred list via new API
- acpi: Make sure we fill struct acpi_gpio_info
- acpi: Switch to use enum in acpi_gpio_in_ignore_list()
- acpi: Use temporary variable for struct acpi_gpio_info
- acpi: Deduplicate some code in __acpi_find_gpio()
- acpi: Reuse struct acpi_gpio_params in struct acpi_gpio_lookup
- acpi: Rename par to params for better readability
- acpi: Reduce memory footprint for struct acpi_gpio_params
- acpi: Remove index parameter from acpi_gpio_property_lookup()
- acpi: Improve struct acpi_gpio_info memory footprint
Andy Shevchenko [Fri, 16 May 2025 09:52:34 +0000 (12:52 +0300)]
gpiolib-acpi: Update file references in the Documentation and MAINTAINERS
The recent changes in the gpiolib-acpi.c need also updates in the Documentation
and MAINTAINERS. Do the necessary changes here.
Fixes:
babb541af627 ("gpiolib: acpi: Move quirks to a separate file")
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Closes: https://lore.kernel.org/r/
20250516193436.
09bdf8cc@canb.auug.org.au
Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
Acked-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Andy Shevchenko [Thu, 15 May 2025 10:11:28 +0000 (13:11 +0300)]
Merge patch series "gpiolib: acpi: Split quirks to its own file"
Andy Shevchenko <andriy.shevchenko@linux.intel.com> says:
The GPIO ACPI helpers use a few quirks which consumes approximately 20%
of the file. Besides that the necessary bits are sparse and being directly
referred. Split them to a separate file. There is no functional change.
For the new file I used the Hans' authorship of Hans as he the author of
all those bits (expect very tiny changes made by this series).
Link: https://lore.kernel.org/r/20250513100514.2492545-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Andy Shevchenko [Tue, 13 May 2025 10:00:34 +0000 (13:00 +0300)]
gpiolib: acpi: Move quirks to a separate file
The gpiolib-acpi.c is huge enough even without DMI quirks.
Move them to a separate file for a better maintenance.
No functional change intended.
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Andy Shevchenko [Tue, 13 May 2025 10:00:33 +0000 (13:00 +0300)]
gpiolib: acpi: Add acpi_gpio_need_run_edge_events_on_boot() getter
Add acpi_gpio_need_run_edge_events_on_boot() getter which moves
towards isolating the GPIO ACPI and quirk APIs. It will helps
splitting them completely in the next changes.
No functional changes.
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Andy Shevchenko [Wed, 9 Apr 2025 14:54:43 +0000 (17:54 +0300)]
Merge patch series "gpiolib: acpi: Fix missing info filling"
Andy Shevchenko <andriy.shevchenko@linux.intel.com> says:
Kees reported that code, while being refactored, missed the point of
filling the info structure which supplies GPIO flags to the upper layer.
Indeed, without that part the GPIO expander get no IRQ on Intel Edison,
for example. Fix this in this series.
Link: https://lore.kernel.org/r/20250409132942.2550719-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Andy Shevchenko [Tue, 13 May 2025 10:00:32 +0000 (13:00 +0300)]
gpiolib: acpi: Handle deferred list via new API
Introduce a new API and handle deferred list via it which moves
towards isolating the GPIO ACPI and quirk APIs. It will helps
splitting them completely in the next changes.
No functional changes.
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Andy Shevchenko [Wed, 9 Apr 2025 13:27:54 +0000 (16:27 +0300)]
gpiolib: acpi: Make sure we fill struct acpi_gpio_info
The previous refactoring missed the filling of the struct acpi_gpio_info
and that's how the lot of the code got eliminated. Restore those pieces
by passing the pointer all down in the call stack.
With this, the code grows by ~6%, but in conjunction with the previous
refactoring it still gives -387 bytes
add/remove: 2/0 grow/shrink: 5/1 up/down: 852/-35 (817)
Function old new delta
acpi_dev_gpio_irq_wake_get_by 129 695 +566
acpi_find_gpio 216 354 +138
acpi_find_gpio.__UNIQUE_ID_ddebug504 - 56 +56
acpi_dev_gpio_irq_wake_get_by.__UNIQUE_ID_ddebug506 - 56 +56
acpi_populate_gpio_lookup 536 548 +12
acpi_gpio_property_lookup 414 426 +12
acpi_get_gpiod_by_index 307 319 +12
__acpi_find_gpio 638 603 -35
Total: Before=14154, After=14971, chg +5.77%
As a positive side effect, it improves memory footprint for
struct acpi_gpio_lookup. `pahole` difference before and after:
- /* size: 64, cachelines: 1, members: 4 */
- /* member types with holes: 1, total: 1 */
+ /* size: 32, cachelines: 1, members: 4 */
Reported-by: Kees Bakker <kees@ijzerbout.nl>
Closes: https://lore.kernel.org/r/
9715c8dd-38df-48fd-a9d1-
7a78163dc989@ijzerbout.nl
Fixes:
8b4f52ef7a41 ("gpiolib: acpi: Deduplicate some code in __acpi_find_gpio()")
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Andy Shevchenko [Tue, 13 May 2025 10:00:31 +0000 (13:00 +0300)]
gpiolib: acpi: Switch to use enum in acpi_gpio_in_ignore_list()
Switch to use enum instead of pointers in acpi_gpio_in_ignore_list()
which moves towards isolating the GPIO ACPI and quirk APIs. It will
helps splitting them completely in the next changes.
No functional changes.
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Andy Shevchenko [Wed, 9 Apr 2025 13:27:53 +0000 (16:27 +0300)]
gpiolib: acpi: Use temporary variable for struct acpi_gpio_info
Use temporary variable to access the struct acpi_gpio_info members.
This will help further changes to be cleaner. No functional change
intended.
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Bartosz Golaszewski [Mon, 19 May 2025 11:10:43 +0000 (13:10 +0200)]
gpiolib: remove unneeded #ifdef
We are already within another `#ifdef CONFIG_GPIOLIB_IRQCHIP` in
gpiochip_to_irq() so there's no need for another guard. Remove it.
Acked-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/20250519-gpio-irq-kconfig-fixes-v1-3-fe6ba1c6116d@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Bartosz Golaszewski [Mon, 19 May 2025 11:10:42 +0000 (13:10 +0200)]
gpio: mpc8xxx: select GPIOLIB_IRQCHIP
This driver uses gpiochip_irq_reqres() and gpiochip_irq_relres() which
are only built with GPIOLIB_IRQCHIP=y. Add the missing Kconfig select.
Fixes:
7688a54d5b53 ("gpio: mpc8xxx: Make irq_chip immutable")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/
202505180309.1nosQMkI-lkp@intel.com/
Acked-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/20250519-gpio-irq-kconfig-fixes-v1-2-fe6ba1c6116d@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Bartosz Golaszewski [Mon, 19 May 2025 11:10:41 +0000 (13:10 +0200)]
gpio: pxa: select GPIOLIB_IRQCHIP
This driver uses gpiochip_irq_reqres() and gpiochip_irq_relres() which
are only built with GPIOLIB_IRQCHIP=y. Add the missing Kconfig select.
Fixes:
20117cf426b6 ("gpio: pxa: Make irq_chip immutable")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/
202505181429.mzyIatOU-lkp@intel.com/
Acked-by: Peng Fan <peng.fan@nxp.com>
Link: https://lore.kernel.org/r/20250519-gpio-irq-kconfig-fixes-v1-1-fe6ba1c6116d@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Peng Fan [Fri, 9 May 2025 04:45:40 +0000 (12:45 +0800)]
gpio: pxa: Make irq_chip immutable
Kernel warns about mutable irq_chips:
"not an immutable chip, please consider fixing!"
Constify pxa_muxed_gpio_chip, flag the irq_chip as IRQCHIP_IMMUTABLE,
add the new helper functions, and call the appropriate gpiolib functions.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250509-gpio-v1-9-639377c98288@nxp.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Peng Fan [Fri, 9 May 2025 04:45:39 +0000 (12:45 +0800)]
gpio: timberdale: Make irq_chip immutable
Kernel warns about mutable irq_chips:
"not an immutable chip, please consider fixing!"
Constify timbgpio_irqchip, flag the irq_chip as IRQCHIP_IMMUTABLE,
add the new helper functions, and call the appropriate gpiolib functions.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250509-gpio-v1-8-639377c98288@nxp.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Peng Fan [Fri, 9 May 2025 04:45:38 +0000 (12:45 +0800)]
gpio: xgene-sb: Make irq_chip immutable
Kernel warns about mutable irq_chips:
"not an immutable chip, please consider fixing!"
Constify xgene_gpio_sb_irq_chip, flag the irq_chip as IRQCHIP_IMMUTABLE,
add the new helper functions, and call the appropriate gpiolib functions.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250509-gpio-v1-7-639377c98288@nxp.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Peng Fan [Fri, 9 May 2025 04:45:37 +0000 (12:45 +0800)]
gpio: davinci: Make irq_chip immutable
Kernel warns about mutable irq_chips:
"not an immutable chip, please consider fixing!"
Constify gpio_irqchip, flag the irq_chip as IRQCHIP_IMMUTABLE, add the
new helper functions, and call the appropriate gpiolib functions.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250509-gpio-v1-6-639377c98288@nxp.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Peng Fan [Fri, 9 May 2025 04:45:36 +0000 (12:45 +0800)]
gpio: davinci: Update irq chip data
Use "struct davinci_gpio_controller *chips" as irq chip data to prepare
for immutable irq chip, then it will be easy to get gpio_chip pointer in
irq mask/unmask.
No functional change.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250509-gpio-v1-5-639377c98288@nxp.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Peng Fan [Fri, 9 May 2025 04:45:35 +0000 (12:45 +0800)]
gpio: mpc8xxx: Make irq_chip immutable
Kernel warns about mutable irq_chips:
"not an immutable chip, please consider fixing!"
Flag the irq_chip as IRQCHIP_IMMUTABLE, add the new helper functions,
and call the appropriate gpiolib functions.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250509-gpio-v1-4-639377c98288@nxp.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Peng Fan [Fri, 9 May 2025 04:45:34 +0000 (12:45 +0800)]
gpio: lpc18xx: Make irq_chip immutable
Kernel warns about mutable irq_chips:
"not an immutable chip, please consider fixing!"
Constify lpc18xx_gpio_pin_ic, flag the irq_chip as IRQCHIP_IMMUTABLE,
add the new helper functions, and call the appropriate gpiolib functions.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250509-gpio-v1-3-639377c98288@nxp.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Peng Fan [Fri, 9 May 2025 04:45:33 +0000 (12:45 +0800)]
gpio: grgpio: Make irq_chip immutable
Kernel warns about mutable irq_chips:
"not an immutable chip, please consider fixing!"
Constify grgpio_irq_chip, flag the irq_chip as IRQCHIP_IMMUTABLE, add the
new helper functions, and call the appropriate gpiolib functions.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250509-gpio-v1-2-639377c98288@nxp.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Peng Fan [Fri, 9 May 2025 04:45:32 +0000 (12:45 +0800)]
gpio: bcm-kona: make irq_chip immutable
The gpiolib is moving to make irq_chip immutable, otherwise
there is warning: "not an immutable chip, please consider fixing it!"
The bcm_gpio_irq_chip already has irq hooks configured correctly,
bcm_kona_gpio_irq_mask/bcm_kona_gpio_irq_unmask calls gpiochip_disable_irq/
gpiochip_enable_irq, and bcm_kona_gpio_irq_reqres/irq_release_resources
calls gpiochip_reqres_irq/gpiochip_relres_irq.
So just need to flag it as IRQCHIP_IMMUTABLE.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250509-gpio-v1-1-639377c98288@nxp.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Ahmad Fatoum [Wed, 7 May 2025 17:28:01 +0000 (19:28 +0200)]
gpio: TODO: add item about GPIO drivers reading struct gpio_chip::base
drivers/pinctrl/pinctrl-at91.c uses struct gpio_chip::base to find out
which bit to set in a register:
dev_dbg(npct->dev, "enable pin %u as GPIO\n", offset);
mask = 1 << (offset - chip->base);
This adds a non-obvious dependency on the global numberspace from the
GPIO driver itself, even if all consumers use the descriptor API.
More such instances may exist and will need to be fixed in the quest for
removal of the global numberspace, so add a reminder about it to the
TODO list.
Link: https://lore.kernel.org/all/1d00c056-3d61-4c22-bedd-3bae0bf1ddc4@pengutronix.de/
Suggested-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.kernel.org/r/20250507-gpio-chip-base-readback-v1-1-ade56e38480b@pengutronix.de
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Ahmad Fatoum [Wed, 7 May 2025 13:07:25 +0000 (15:07 +0200)]
gpio: mxc: configure dynamic GPIO base for CONFIG_GPIO_SYSFS=n
i.MX GPIO numbering has been deterministic since commit
7e6086d9e54a
("gpio/mxc: specify gpio base for device tree probe"), a year after
device tree support was first added back in 2011.
Reverting to dynamically allocated GPIO base now would break most
systems making use of the sysfs API. These systems will be eventually
broken by the removal of the sysfs API, but that would result in GPIO
scripts not working instead of essentially toggling at random according
to probe order, which would happen if we unconditionally set base to -1.
Yet, the warning is annoying and has resulted in many rejected attempts
to remove it over the years[1][2][3].
As the i.MX GPIO driver is device tree only, GPIO_SYSFS is the only
consumer of the deterministic GPIO numbering. Let's therefore restrict the
static base and the warning that comes with it to configurations
with CONFIG_GPIO_SYSFS enabled.
[1]: https://lore.kernel.org/all/
20230226205319.
1013332-1-dario.binacchi@amarulasolutions.com/
[2]: https://lore.kernel.org/all/
20230506085928.933737-2-haibo.chen@nxp.com/
[3]: https://lore.kernel.org/all/
20241121145515.
3087855-1-catalin.popescu@leica-geosystems.com/
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250507-b4-imx-gpio-base-warning-v2-1-d43d09e2c6bf@pengutronix.de
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Aaron Kling [Tue, 29 Apr 2025 21:33:31 +0000 (16:33 -0500)]
dt-bindings: gpio: tegra186: Add gpio-ranges
Add optional gpio-ranges property.
Signed-off-by: Aaron Kling <webgeek1234@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://lore.kernel.org/r/20250429-tegra186-pinctrl-v1-2-722c7c42394e@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Bartosz Golaszewski [Tue, 6 May 2025 09:01:55 +0000 (11:01 +0200)]
gpio: ml-ioh: use new GPIO line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Link: https://lore.kernel.org/r/20250506-gpiochip-set-rv-gpio-part3-v1-12-0fbdea5a9667@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Bartosz Golaszewski [Tue, 6 May 2025 09:01:54 +0000 (11:01 +0200)]
gpio: mc33880: use new GPIO line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Link: https://lore.kernel.org/r/20250506-gpiochip-set-rv-gpio-part3-v1-11-0fbdea5a9667@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Bartosz Golaszewski [Tue, 6 May 2025 09:01:53 +0000 (11:01 +0200)]
gpio: mb86s7x: use new GPIO line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Link: https://lore.kernel.org/r/20250506-gpiochip-set-rv-gpio-part3-v1-10-0fbdea5a9667@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Bartosz Golaszewski [Tue, 6 May 2025 09:01:52 +0000 (11:01 +0200)]
gpio: max77620: use new GPIO line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Link: https://lore.kernel.org/r/20250506-gpiochip-set-rv-gpio-part3-v1-9-0fbdea5a9667@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Bartosz Golaszewski [Tue, 6 May 2025 09:01:51 +0000 (11:01 +0200)]
gpio: max732x: use new GPIO line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Link: https://lore.kernel.org/r/20250506-gpiochip-set-rv-gpio-part3-v1-8-0fbdea5a9667@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Bartosz Golaszewski [Tue, 6 May 2025 09:01:50 +0000 (11:01 +0200)]
gpio: max730x: use new GPIO line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Link: https://lore.kernel.org/r/20250506-gpiochip-set-rv-gpio-part3-v1-7-0fbdea5a9667@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Bartosz Golaszewski [Tue, 6 May 2025 09:01:49 +0000 (11:01 +0200)]
gpio: max3191x: remove unused callbacks
This driver is input-only and as such doesn't need to define empty set()
and direction_output() callbacks. Remove them.
Link: https://lore.kernel.org/r/20250506-gpiochip-set-rv-gpio-part3-v1-6-0fbdea5a9667@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Bartosz Golaszewski [Tue, 6 May 2025 09:01:48 +0000 (11:01 +0200)]
gpio: madera: use new GPIO line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20250506-gpiochip-set-rv-gpio-part3-v1-5-0fbdea5a9667@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Bartosz Golaszewski [Tue, 6 May 2025 09:01:47 +0000 (11:01 +0200)]
gpio: lpc32xx: use new GPIO line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Link: https://lore.kernel.org/r/20250506-gpiochip-set-rv-gpio-part3-v1-4-0fbdea5a9667@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Bartosz Golaszewski [Tue, 6 May 2025 09:01:46 +0000 (11:01 +0200)]
gpio: lpc18xx: use new GPIO line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Link: https://lore.kernel.org/r/20250506-gpiochip-set-rv-gpio-part3-v1-3-0fbdea5a9667@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Bartosz Golaszewski [Tue, 6 May 2025 09:01:45 +0000 (11:01 +0200)]
gpio: lp87565: use new GPIO line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Link: https://lore.kernel.org/r/20250506-gpiochip-set-rv-gpio-part3-v1-2-0fbdea5a9667@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Bartosz Golaszewski [Tue, 6 May 2025 09:01:44 +0000 (11:01 +0200)]
gpio: lp873x: use new GPIO line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Link: https://lore.kernel.org/r/20250506-gpiochip-set-rv-gpio-part3-v1-1-0fbdea5a9667@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Bartosz Golaszewski [Tue, 13 May 2025 13:11:12 +0000 (15:11 +0200)]
Merge tag 'ib-mfd-gpio-nvmem-v6.16' of git://git./linux/kernel/git/lee/mfd into gpio/for-next
Immutable branch between MFD, GPIO and NVMEM due for the v6.16 merge window
André Draszik [Fri, 9 May 2025 13:22:41 +0000 (14:22 +0100)]
nvmem: max77759: Add Maxim MAX77759 NVMEM driver
The Maxim MAX77759 is a companion PMIC for USB Type-C applications and
includes Battery Charger, Fuel Gauge, temperature sensors, USB Type-C
Port Controller (TCPC), NVMEM, and a GPIO expander.
This driver exposes the non volatile memory using the platform device
registered by the core MFD driver.
Signed-off-by: André Draszik <andre.draszik@linaro.org>
Acked-by: Srinivas Kandagatla <srini@kernel.org>
Acked-by: Peter Griffin <peter.griffin@linaro.org>
Link: https://lore.kernel.org/r/20250509-max77759-mfd-v10-3-962ac15ee3ef@linaro.org
Signed-off-by: Lee Jones <lee@kernel.org>
André Draszik [Fri, 9 May 2025 13:22:40 +0000 (14:22 +0100)]
gpio: max77759: Add Maxim MAX77759 gpio driver
The Maxim MAX77759 is a companion PMIC for USB Type-C applications and
includes Battery Charger, Fuel Gauge, temperature sensors, USB Type-C
Port Controller (TCPC), NVMEM, and a GPIO expander.
This driver supports the GPIO functions using the platform device
registered by the core MFD driver.
Signed-off-by: André Draszik <andre.draszik@linaro.org>
Acked-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Acked-by: Peter Griffin <peter.griffin@linaro.org>
Link: https://lore.kernel.org/r/20250509-max77759-mfd-v10-2-962ac15ee3ef@linaro.org
Signed-off-by: Lee Jones <lee@kernel.org>
André Draszik [Fri, 9 May 2025 13:22:39 +0000 (14:22 +0100)]
mfd: max77759: Add Maxim MAX77759 core driver
The Maxim MAX77759 is a companion PMIC for USB Type-C applications and
includes Battery Charger, Fuel Gauge, temperature sensors, USB Type-C
Port Controller (TCPC), NVMEM, and a GPIO expander.
Fuel Gauge and TCPC have separate and independent I2C addresses,
register maps, and interrupt lines and are therefore excluded from the
MFD core device driver here.
The GPIO and NVMEM interfaces are accessed via specific commands to the
built-in microprocessor. This driver implements an API that client
drivers can use for accessing those.
Signed-off-by: André Draszik <andre.draszik@linaro.org>
Acked-by: Peter Griffin <peter.griffin@linaro.org>
Link: https://lore.kernel.org/r/20250509-max77759-mfd-v10-1-962ac15ee3ef@linaro.org
Signed-off-by: Lee Jones <lee@kernel.org>
André Draszik [Tue, 25 Mar 2025 08:27:04 +0000 (08:27 +0000)]
dt-bindings: mfd: Add max77759 binding
The Maxim MAX77759 is a companion PMIC for USB Type-C applications and
includes Battery Charger, Fuel Gauge, temperature sensors, USB Type-C
Port Controller (TCPC), NVMEM, and a GPIO expander.
This describes the top-level device.
Signed-off-by: André Draszik <andre.draszik@linaro.org>
Reviewed-by: "Rob Herring (Arm)" <robh@kernel.org>
Link: https://lore.kernel.org/r/20250325-max77759-mfd-v6-3-c0870ca662ba@linaro.org
Signed-off-by: Lee Jones <lee@kernel.org>
André Draszik [Tue, 25 Mar 2025 08:27:03 +0000 (08:27 +0000)]
dt-bindings: nvmem: Add max77759 binding
The Maxim MAX77759 is a companion PMIC for USB Type-C applications and
includes Battery Charger, Fuel Gauge, temperature sensors, USB Type-C
Port Controller (TCPC), NVMEM, and a GPIO expander.
This describes its storage module (NVMEM).
Signed-off-by: André Draszik <andre.draszik@linaro.org>
Reviewed-by: "Rob Herring (Arm)" <robh@kernel.org>
Link: https://lore.kernel.org/r/20250325-max77759-mfd-v6-2-c0870ca662ba@linaro.org
Signed-off-by: Lee Jones <lee@kernel.org>
André Draszik [Tue, 25 Mar 2025 08:27:02 +0000 (08:27 +0000)]
dt-bindings: gpio: Add max77759 binding
The Maxim MAX77759 is a companion PMIC for USB Type-C applications and
includes Battery Charger, Fuel Gauge, temperature sensors, USB Type-C
Port Controller (TCPC), NVMEM, and a GPIO expander.
This describes its GPIO module.
Signed-off-by: André Draszik <andre.draszik@linaro.org>
Reviewed-by: "Rob Herring (Arm)" <robh@kernel.org>
Acked-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Link: https://lore.kernel.org/r/20250325-max77759-mfd-v6-1-c0870ca662ba@linaro.org
Signed-off-by: Lee Jones <lee@kernel.org>
Arnd Bergmann [Fri, 2 May 2025 20:37:07 +0000 (22:37 +0200)]
gpio: blzp1600: remove incorrect pf_match_ptr()
The blzp1600_gpio_of_match is defined unconditionally and can always be referenced
by the driver, so don't use of_match_ptr() and avoid this warning:
drivers/gpio/gpio-blzp1600.c:263:34: error: 'blzp1600_gpio_of_match' defined but not used [-Werror=unused-const-variable=]
263 | static const struct of_device_id blzp1600_gpio_of_match[] = {
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20250502203721.2117186-1-arnd@kernel.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Bartosz Golaszewski [Wed, 23 Apr 2025 07:15:14 +0000 (09:15 +0200)]
gpio: lp3943: use new line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250423-gpiochip-set-rv-gpio-part2-v1-12-b22245cde81a@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Bartosz Golaszewski [Wed, 23 Apr 2025 07:15:13 +0000 (09:15 +0200)]
gpio: loongson: use new line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250423-gpiochip-set-rv-gpio-part2-v1-11-b22245cde81a@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Bartosz Golaszewski [Wed, 23 Apr 2025 07:15:12 +0000 (09:15 +0200)]
gpio: loongson-64bit: use new line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250423-gpiochip-set-rv-gpio-part2-v1-10-b22245cde81a@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Bartosz Golaszewski [Wed, 23 Apr 2025 07:15:11 +0000 (09:15 +0200)]
gpio: logicvc: use new line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250423-gpiochip-set-rv-gpio-part2-v1-9-b22245cde81a@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Bartosz Golaszewski [Wed, 23 Apr 2025 07:15:10 +0000 (09:15 +0200)]
gpio: ljca: use new line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250423-gpiochip-set-rv-gpio-part2-v1-8-b22245cde81a@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Bartosz Golaszewski [Wed, 23 Apr 2025 07:15:09 +0000 (09:15 +0200)]
gpio: kempld: use new line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250423-gpiochip-set-rv-gpio-part2-v1-7-b22245cde81a@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Bartosz Golaszewski [Wed, 23 Apr 2025 07:15:08 +0000 (09:15 +0200)]
gpio: janz-ttl: use new line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250423-gpiochip-set-rv-gpio-part2-v1-6-b22245cde81a@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Bartosz Golaszewski [Wed, 23 Apr 2025 07:15:07 +0000 (09:15 +0200)]
gpio: it87: use new line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250423-gpiochip-set-rv-gpio-part2-v1-5-b22245cde81a@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Bartosz Golaszewski [Wed, 23 Apr 2025 07:15:06 +0000 (09:15 +0200)]
gpio: imx-scu: use new line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250423-gpiochip-set-rv-gpio-part2-v1-4-b22245cde81a@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Bartosz Golaszewski [Wed, 23 Apr 2025 07:15:05 +0000 (09:15 +0200)]
gpio: imx-scu: destroy the mutex in detach path
Use devm_mutex_init() in order to clean up after the mutex debug data in
detach and error path.
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250423-gpiochip-set-rv-gpio-part2-v1-3-b22245cde81a@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Bartosz Golaszewski [Wed, 23 Apr 2025 07:15:04 +0000 (09:15 +0200)]
gpio: imx-scu: use lock guards
Simplify the code by using lock guards from cleanup.h with the driver's
mutex.
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250423-gpiochip-set-rv-gpio-part2-v1-2-b22245cde81a@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Bartosz Golaszewski [Wed, 23 Apr 2025 07:15:03 +0000 (09:15 +0200)]
gpio: imx-scu: don't check the GPIO range
Core GPIO code already does this for drivers, no need to duplicate the
check.
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250423-gpiochip-set-rv-gpio-part2-v1-1-b22245cde81a@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Andy Shevchenko [Thu, 20 Feb 2025 16:20:28 +0000 (18:20 +0200)]
gpiolib: devres: Finish the conversion to use devm_add_action()
With a recently added helper we can complete the conversion of
the GPIOLIB code to use devm_add_action() in all suitable cases.
So do this.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20250220162238.2738038-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Bartosz Golaszewski [Mon, 28 Apr 2025 07:40:53 +0000 (09:40 +0200)]
Merge tag 'gpiod-devm-is-action-added-for-v6.16-rc1' into gpio/for-next
Immutable tag for the driver core tree to pull from
devres: Move devm_*_action*() APIs to devres.h
devres: Add devm_is_action_added() helper
Andy Shevchenko [Thu, 20 Feb 2025 16:20:27 +0000 (18:20 +0200)]
devres: Add devm_is_action_added() helper
In some code we would like to know if the action in device managed resources
was added by devm_add_action() family of calls. Introduce a helper for that.
Reviewed-by: Raag Jadav <raag.jadav@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Zijun Hu <quic_zijuhu@quicinc.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20250220162238.2738038-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Andy Shevchenko [Thu, 20 Feb 2025 16:20:26 +0000 (18:20 +0200)]
devres: Move devm_*_action*() APIs to devres.h
We have a newly created header linux/device/devres.h that gathers
device managed APIs, so users won't need to include entire device.h
for only these ones. Move devm_*_action*() APIs to devres.h as well.
Reviewed-by: Raag Jadav <raag.jadav@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Zijun Hu <quic_zijuhu@quicinc.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20250220162238.2738038-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Potin Lai [Wed, 9 Apr 2025 15:37:30 +0000 (23:37 +0800)]
gpio: pca953x: Add support for level-triggered interrupts
Adds support for level-triggered interrupts in the PCA953x GPIO
expander driver. Previously, the driver only supported edge-triggered
interrupts, which could lead to missed events in scenarios where an
interrupt condition persists until it is explicitly cleared.
By enabling level-triggered interrupts, the driver can now detect and
respond to sustained interrupt conditions more reliably.
Signed-off-by: Potin Lai <potin.lai.pt@gmail.com>
Link: https://lore.kernel.org/r/20250409-gpio-pca953x-level-triggered-irq-v3-1-7f184d814934@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Jindong Yue [Wed, 16 Apr 2025 06:26:05 +0000 (15:26 +0900)]
gpio: vf610: Allow building as a module
Support for building it as a module for use on the Android platform,
because the Android kernel(GKI) doesn't contain board-specific drivers,
it requires that these drivers be built as a module and loaded into the
system.
Signed-off-by: Jindong Yue <jindong.yue@nxp.com>
Link: https://lore.kernel.org/r/20250416062605.1948856-1-jindong.yue@nxp.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Nathan Chancellor [Fri, 18 Apr 2025 20:17:20 +0000 (16:17 -0400)]
gpio: Restrict GPIO_ICH to compile testing with HAS_IOPORT
When building gpio-ich.c for a platform that does not have IO port
access like s390, there are several errors due to the use of inl() and
outl() throughout the driver:
drivers/gpio/gpio-ich.c: In function 'ichx_read_bit':
include/asm-generic/io.h:578:14: error: call to '_inl' declared with attribute error: inl() requires CONFIG_HAS_IOPORT
Only allow compile testing when the targeted platform selects HAS_IOPORT
so that there are no compile time errors.
Fixes:
f3592d252f77 ("gpio: ich: enable building with COMPILE_TEST=y")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/
202504171941.g1yXja0j-lkp@intel.com/
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Link: https://lore.kernel.org/r/20250418-gpio-ich-fix-build-without-ioport-v1-1-83fc753438ec@kernel.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Andy Shevchenko [Wed, 16 Apr 2025 09:55:16 +0000 (12:55 +0300)]
gpiolib: Remove redundant assignment of return variable
In some functions the returned variable is assigned to 0 and then
reassigned to the actual value. Remove redundant assignments.
In one case make it more clear that the assignment is not needed.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20250416095645.2027695-9-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Andy Shevchenko [Wed, 16 Apr 2025 09:55:15 +0000 (12:55 +0300)]
gpiolib: Reuse return variable in gpiod_to_irq()
There are two variables for the same used in the gpiod_to_irq().
Replace the second by reusing the function top-level one.
While at it, refactor the branch to have less lines of code.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20250416095645.2027695-8-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Andy Shevchenko [Wed, 16 Apr 2025 09:55:14 +0000 (12:55 +0300)]
gpiolib: Call validate_desc() when VALIDATE_DESC() can't be used
Call validate_desc() directly when VALIDATE_DESC() can't be used.
It will print additional information useful for debugging.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20250416095645.2027695-7-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Andy Shevchenko [Wed, 16 Apr 2025 09:55:13 +0000 (12:55 +0300)]
gpiolib: Move validate_desc() and Co upper in the code
Move validate_desc() and Co upper in the code to be able to use
in the further changes.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20250416095645.2027695-6-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Andy Shevchenko [Wed, 16 Apr 2025 09:55:12 +0000 (12:55 +0300)]
gpiolib: Revert "Don't WARN on gpiod_put() for optional GPIO"
No need to double check the pointer for NULL since gpiod_free()
is using VALIDATE_DESC_VOID() which simply returns in that case.
This reverts commit
1d7765ba15aca68f3bc52f59434c1c34855bbb54.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20250416095645.2027695-5-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Andy Shevchenko [Wed, 16 Apr 2025 09:55:11 +0000 (12:55 +0300)]
gpiolib: Print actual error when descriptor contains an error pointer
Print the actual error when descriptor contains an error pointer.
This might help debugging those rare cases.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20250416095645.2027695-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Andy Shevchenko [Wed, 16 Apr 2025 09:55:10 +0000 (12:55 +0300)]
gpiolib: Convert to use guard()() for gpio_machine_hogs_mutex
The driver uses guard()()/scoped_guard() for the rest of the synchronisation
calls. Convert to use the same for gpio_machine_hogs_mutex.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20250416095645.2027695-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Andy Shevchenko [Wed, 16 Apr 2025 09:55:09 +0000 (12:55 +0300)]
gpiolib: Make taking gpio_lookup_lock consistent
There are two ways to take a lock: plain call to the mutex_lock()
or using guard()() / scoped_guard(). The driver inconsistently uses
both. Make taking gpio_lookup_lock consistent.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20250416095645.2027695-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Yixun Lan [Fri, 11 Apr 2025 23:31:29 +0000 (07:31 +0800)]
gpio: spacemit: add support for K1 SoC
Implement GPIO functionality which capable of setting pin as
input, output. Also, each pin can be used as interrupt which
support rising, falling, or both edge type trigger.
Reviewed-by: Alex Elder <elder@riscstar.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Yixun Lan <dlan@gentoo.org>
Link: https://lore.kernel.org/r/20250412-03-k1-gpio-v8-2-1c6862d272ec@gentoo.org
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Yixun Lan [Fri, 11 Apr 2025 23:31:28 +0000 (07:31 +0800)]
dt-bindings: gpio: spacemit: add support for K1 SoC
The GPIO controller of K1 support basic functions as input/output,
all pins can be used as interrupt which route to one IRQ line,
trigger type can be select between rising edge, falling edge, or both.
There are four GPIO banks, each consisting of 32 pins.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Yixun Lan <dlan@gentoo.org>
Link: https://lore.kernel.org/r/20250412-03-k1-gpio-v8-1-1c6862d272ec@gentoo.org
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Bartosz Golaszewski [Tue, 8 Apr 2025 12:59:06 +0000 (14:59 +0200)]
gpio: tn48m: enable building the module with COMPILE_TEST=y
Extend the build coverage by allowing to build the module with
COMPILE_TEST enabled.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250408-gpio-compile-test-v1-6-140e108e9392@linaro.org
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Bartosz Golaszewski [Tue, 8 Apr 2025 12:59:04 +0000 (14:59 +0200)]
gpio: rtd: enable building the module with COMPILE_TEST=y
Extend the build coverage by allowing to build the module with
COMPILE_TEST enabled.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250408-gpio-compile-test-v1-4-140e108e9392@linaro.org
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Bartosz Golaszewski [Tue, 8 Apr 2025 12:59:03 +0000 (14:59 +0200)]
gpio: pl061: enable building the module with COMPILE_TEST=y
Extend the build coverage by allowing to build the module with
COMPILE_TEST enabled.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250408-gpio-compile-test-v1-3-140e108e9392@linaro.org
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Bartosz Golaszewski [Tue, 8 Apr 2025 12:59:02 +0000 (14:59 +0200)]
gpio: msc313: enable building the module with COMPILE_TEST=y
Extend the build coverage by allowing to build the module with
COMPILE_TEST enabled.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250408-gpio-compile-test-v1-2-140e108e9392@linaro.org
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Bartosz Golaszewski [Tue, 8 Apr 2025 12:59:01 +0000 (14:59 +0200)]
gpio: zynq: enable building the modules with COMPILE_TEST=y
Extend the build coverage by allowing to build the modules with
COMPILE_TEST enabled.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250408-gpio-compile-test-v1-1-140e108e9392@linaro.org
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Bartosz Golaszewski [Tue, 8 Apr 2025 14:36:29 +0000 (16:36 +0200)]
gpio: blzp1600: drop dependency on OF headers
Use the generic boolean device property getter instead of the
OF-specific variant. This allows us to stop pulling in linux/of.h. While
at it: drop the of_irq.h inclusion as none of its symbols are used in
this driver.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Nikolaos Pasaloukos <nikolaos.pasaloukos@blaize.com>
Link: https://lore.kernel.org/r/20250408143629.125576-1-brgl@bgdev.pl
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Bartosz Golaszewski [Tue, 8 Apr 2025 08:40:57 +0000 (10:40 +0200)]
gpio: ds4520: don't check the 'ngpios' property in the driver
This is already done by the gpio-regmap abstraction by calling
gpiochip_get_ngpios(). We don't need to do this at the driver level.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Link: https://lore.kernel.org/r/20250408-gpio-regmap-ngpios-v2-1-26f254014f57@linaro.org
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Bartosz Golaszewski [Mon, 7 Apr 2025 07:13:21 +0000 (09:13 +0200)]
gpio: ich: use new line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Link: https://lore.kernel.org/r/20250407-gpiochip-set-rv-gpio-part1-v1-12-78399683ca38@linaro.org
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Bartosz Golaszewski [Mon, 7 Apr 2025 07:13:20 +0000 (09:13 +0200)]
gpio: ich: enable building with COMPILE_TEST=y
Extend the build coverage by allowing to build the module with
COMPILE_TEST enabled.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250407-gpiochip-set-rv-gpio-part1-v1-11-78399683ca38@linaro.org
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Bartosz Golaszewski [Mon, 7 Apr 2025 07:13:19 +0000 (09:13 +0200)]
gpio: htc-egpio: use new line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Link: https://lore.kernel.org/r/20250407-gpiochip-set-rv-gpio-part1-v1-10-78399683ca38@linaro.org
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Bartosz Golaszewski [Mon, 7 Apr 2025 07:13:18 +0000 (09:13 +0200)]
gpio: htc-egpio: enable building with COMPILE_TEST=y
Extend the build coverage by allowing to build the module with
COMPILE_TEST enabled.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250407-gpiochip-set-rv-gpio-part1-v1-9-78399683ca38@linaro.org
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Bartosz Golaszewski [Mon, 7 Apr 2025 07:13:17 +0000 (09:13 +0200)]
gpio: gw-pld: use new line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Link: https://lore.kernel.org/r/20250407-gpiochip-set-rv-gpio-part1-v1-8-78399683ca38@linaro.org
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Bartosz Golaszewski [Mon, 7 Apr 2025 07:13:16 +0000 (09:13 +0200)]
gpio: graniterapids: use new line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Link: https://lore.kernel.org/r/20250407-gpiochip-set-rv-gpio-part1-v1-7-78399683ca38@linaro.org
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Bartosz Golaszewski [Mon, 7 Apr 2025 07:13:15 +0000 (09:13 +0200)]
gpio: f7188: use new line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Link: https://lore.kernel.org/r/20250407-gpiochip-set-rv-gpio-part1-v1-6-78399683ca38@linaro.org
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Bartosz Golaszewski [Mon, 7 Apr 2025 07:13:13 +0000 (09:13 +0200)]
gpio: exar: use new line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Link: https://lore.kernel.org/r/20250407-gpiochip-set-rv-gpio-part1-v1-4-78399683ca38@linaro.org
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Bartosz Golaszewski [Mon, 7 Apr 2025 07:13:12 +0000 (09:13 +0200)]
gpio: em: use new line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Link: https://lore.kernel.org/r/20250407-gpiochip-set-rv-gpio-part1-v1-3-78399683ca38@linaro.org
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Bartosz Golaszewski [Mon, 7 Apr 2025 07:13:11 +0000 (09:13 +0200)]
gpio: eic-sprd: use new line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Link: https://lore.kernel.org/r/20250407-gpiochip-set-rv-gpio-part1-v1-2-78399683ca38@linaro.org
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Bartosz Golaszewski [Mon, 7 Apr 2025 07:13:10 +0000 (09:13 +0200)]
gpio: dln2: use new line value setter callbacks
struct gpio_chip now has callbacks for setting line values that return
an integer, allowing to indicate failures. Convert the driver to using
them.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Link: https://lore.kernel.org/r/20250407-gpiochip-set-rv-gpio-part1-v1-1-78399683ca38@linaro.org
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Geert Uytterhoeven [Wed, 9 Apr 2025 09:22:35 +0000 (11:22 +0200)]
gpio: GPIO_BLZP1600 should depend on ARCH_BLAIZE
The Blaize BLZP1600 GPIO controller is only present on BLaize BLZP1600
SoCs. Hence add a dependency on ARCH_BLAIZE, to prevent asking the user
about this driver when configuring a kernel without Blaize platform
support.
Fixes:
602ae04f56542d8e ("gpio: Enable Blaize BLZP1600 GPIO support")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Nikolaos Pasaloukos <nikolaos.pasaloukos@blaize.com>
Link: https://lore.kernel.org/r/a75af4b623579a193b4a59350c063969aabb5b71.1744190524.git.geert+renesas@glider.be
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Koichiro Den [Sat, 12 Apr 2025 15:01:19 +0000 (00:01 +0900)]
selftests: gpio: gpio-aggregator: add a test case for _sysfs prefix reservation
The kernel doc for gpio-aggregator configfs interface, which was recently
added, states that users should not be able to create an aggregator with a
name prefixed by "_sysfs" via configfs. However, it was found that this
guard does not function as expected (thanks to Dan Carpenter for
identifying and fixing the issue).
Add a test case to verify the guard.
Signed-off-by: Koichiro Den <koichiro.den@canonical.com>
Link: https://lore.kernel.org/r/20250412150119.1461023-1-koichiro.den@canonical.com
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Dan Carpenter [Sat, 12 Apr 2025 10:15:31 +0000 (13:15 +0300)]
gpio: aggregator: Fix leak in gpio_aggregator_parse()
Call gpio_aggregator_free_lines() before returning on this error path.
Fixes:
83c8e3df642f ("gpio: aggregator: expose aggregator created via legacy sysfs to configfs")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Acked-by: Koichiro Den <koichiro.den@canonical.com>
Link: https://lore.kernel.org/r/e023bfe52509ce1bef6209ec7c47e99279c551dd.1744452787.git.dan.carpenter@linaro.org
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Dan Carpenter [Sat, 12 Apr 2025 10:15:25 +0000 (13:15 +0300)]
gpio: aggregator: Fix error code in gpio_aggregator_activate()
Propagate the error code if gpio_aggregator_make_device_sw_node() fails.
Don't return success.
Fixes:
86f162e73d2d ("gpio: aggregator: introduce basic configfs interface")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Acked-by: Koichiro Den <koichiro.den@canonical.com>
Link: https://lore.kernel.org/r/79b804a0769a434698616bebedacc0e5d5605fdc.1744452787.git.dan.carpenter@linaro.org
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>