Commit Graph

1444072 Commits

Author SHA1 Message Date
Uwe Kleine-König (The Capable Hub)
2d43fb71f4 gpio: Use named initializers for platform_device_id arrays
Named initializers are better readable and more robust to changes of the
struct definition. This robustness is relevant for a planned change to
struct platform_device_id replacing .driver_data by an anonymous unit.

While touching these arrays unify spacing and usage of commas.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/b8f7581e9311d5579447304ac4f2d557b29e4f9d.1779893336.git.u.kleine-koenig@baylibre.com
[Bartosz: Rebased on top of current linux-next where one of the drivers
no longer exists.]
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-28 10:46:46 +02:00
Uwe Kleine-König (The Capable Hub)
516e4d8869 gpio: cros-ec: Drop unused assignment of platform_device_id driver data
The driver explicitly set the .driver_data member of struct
platform_device_id to zero without relying on that value. Drop this
unused assignments.

While touching this array unify spacing and use named initializers for
.name.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/06dfc8d1df46467269ee6113f161edac234e51cf.1779893336.git.u.kleine-koenig@baylibre.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-28 10:45:09 +02:00
Bartosz Golaszewski
61442e46fb ARM: omap1: enable real software node lookup of GPIOs on Nokia 770
Currently the board file for Nokia 770 creates dummy software nodes not
attached in any way to the actual GPIO controller devices and uses the
fact that GPIOLIB matching swnode's name to the GPIO chip's label during
software node lookup. This behavior is wrong and we want to remove it.
To that end, we need to first convert all existing users to creating
actual fwnode links.

Create real software nodes for GPIO controllers on OMAP16xx and
reference them from the software nodes in the nokia board file.

Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>
Acked-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Link: https://patch.msgid.link/20260430-nokia770-gpio-swnodes-v7-3-c88f74c90dd6@oss.qualcomm.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-27 10:00:51 +02:00
Bartosz Golaszewski
2bdf432e15 ARM: omap1: use platform_device_register_full() for GPIO devices on OMAP 16xx
Ahead of changes attaching GPIO controller's software nodes referenced
from the Nokia 770 board files to their target devices, switch the
method for registering the platform devices to the
platform_device_register_full() variant. This is done to leverage the
new swnode field of struct platform_device_info which automate the
software node's registration and assignment.

Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Link: https://patch.msgid.link/20260430-nokia770-gpio-swnodes-v7-2-c88f74c90dd6@oss.qualcomm.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-27 10:00:50 +02:00
Bartosz Golaszewski
3288e99f99 ARM: omap1: drop unused variable from omap16xx_gpio_init()
The pdata variable is set but not used. Remove it.

Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Link: https://patch.msgid.link/20260430-nokia770-gpio-swnodes-v7-1-c88f74c90dd6@oss.qualcomm.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-27 10:00:50 +02:00
Chen Jung Ku
20de1f993e gpio: gpiolib: use seq_puts() for plain strings
Replace seq_printf() with seq_puts() where the format string is a
plain string literal with no format specifiers.

No functional change intended.

Signed-off-by: Chen Jung Ku <ku.loong@gapp.nthu.edu.tw>
Link: https://patch.msgid.link/20260526121905.46345-1-ku.loong@gapp.nthu.edu.tw
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-27 09:59:29 +02:00
Arnd Bergmann
cacb104ed9 gpio: ts5500: remove obsolete driver
The ts5500 platform is no longer functional because it is
based on the removed AMD Élan i486 SoC. Remove the now
obsolete driver.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20260526103424.3246915-1-arnd@kernel.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-27 09:58:21 +02:00
Bartosz Golaszewski
a6d2a3b403 gpio: add kunit test cases for the GPIO subsystem
Add a module containing kunit test cases for GPIO core. The idea is to
use it to test functionalities that can't easily be tested from
user-space with kernel selftests or GPIO character device test suites
provided by the libgpiod package.

For now add test cases that verify software node based lookup and ensure
that a GPIO provider unbinding with active consumers does not cause a
crash.

Reviewed-by: David Gow <david@davidgow.net>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20260522-gpiolib-kunit-v3-3-b15fe6987430@oss.qualcomm.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-26 11:19:54 +02:00
Bartosz Golaszewski
136569e6bc kunit: provide kunit_platform_device_unregister()
Tests may want to unregister a platform device as part of the test case
logic. Using the regular platform_device_register() with kunit
assertions may result in a platform device leak or otherwise requires
cumbersome error handling. Provide a function that unregisters a
kunit-managed platform device and drops the release action from the
test's list.

Reviewed-by: David Gow <david@davidgow.net>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20260522-gpiolib-kunit-v3-2-b15fe6987430@oss.qualcomm.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-26 11:19:54 +02:00
Bartosz Golaszewski
4c237ab773 kunit: provide kunit_platform_device_register_full()
Provide a kunit-managed variant of platform_device_register_full().

Reviewed-by: David Gow <david@davidgow.net>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20260522-gpiolib-kunit-v3-1-b15fe6987430@oss.qualcomm.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-26 11:19:54 +02:00
Len Bao
b12e12ee41 gpiolib: Mark gpio_devt, gpiolib_initialized and gpio_stub_drv as __ro_after_init
The 'gpio_devt' and 'gpiolib_initialized' variables are initialized only
during the init phase in the 'gpiolib_dev_init' function and never
changed. So, mark these as __ro_after_init.

The 'gpio_stub_drv' variable is initialized only in the declaration and
never changed. So, this variable could be 'const', but using the
'driver_register' and 'driver_unregister' functions discards the 'const'
qualifier. Therefore, as an alternative, mark it as a __ro_after_init.

Signed-off-by: Len Bao <len.bao@gmx.us>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20260516105737.45174-1-len.bao@gmx.us
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-26 10:35:24 +02:00
Jun Yan
820017813b dt-bindings: gpio: meson-axg: Fix whitespace issue
Clean up whitespace misalignment in meson-axg-gpio.h

Signed-off-by: Jun Yan <jerrysteve1101@gmail.com>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://patch.msgid.link/20260524154954.385778-1-jerrysteve1101@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-26 10:02:53 +02:00
Thomas Lin
d01bf517cb gpio: dwapb: Add ACPI ID LECA0001 for LECARC SoCs
Add ACPI ID "LECA0001" for LECARC SoCs that use the DesignWare
GPIO controller with V1 register offsets.

Signed-off-by: Thomas Lin <thomas_lin@lecomputing.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20260521-lecarc-acpi-ids-v1-1-ae0ae90b2817@lecomputing.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-21 10:48:47 +02:00
Suneel Garapati
822878aa17 gpio: tegra186: Enable GTE for Tegra264
Set has_gte flag to enable GTE for Tegra264 AON pins.

Signed-off-by: Suneel Garapati <suneelg@nvidia.com>
Reviewed-by: Jon Hunter <jonathanh@nvidia.com>
Link: https://patch.msgid.link/20260521012031.2003914-1-suneelg@nvidia.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-21 10:47:39 +02:00
Uwe Kleine-König (The Capable Hub)
c010a78304 gpio: Initialize all i2c_device_id arrays using member names
The previously applied similar commit 553e26a45e ("gpio: Initialize
i2c_device_id arrays using member names") only handled i2c_device_id
arrays that also have an assignment for .driver_data.

For consistency also convert the entries without such an assignment.
Again this is a modification that has no influence on the generated
code, it's only more robust against changes to struct i2c_device_id and
easier to understand for a human.

While touching adnp_i2c_id[] drop the comma after the list terminator.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Link: https://patch.msgid.link/20260520074812.1632512-2-u.kleine-koenig@baylibre.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-20 15:24:49 +02:00
Rosen Penev
292e7cab58 gpio: en7523: allow COMPILE_TEST builds
The Airoha EN7523 GPIO driver uses generic platform, MMIO, and gpiolib
interfaces.  Allow it to build with COMPILE_TEST so it gets coverage on
non-Airoha platforms.

Tested with:
make LLVM=1 ARCH=loongarch drivers/gpio/gpio-en7523.o

Assisted-by: Codex:GPT-5.5
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://patch.msgid.link/20260519005912.628667-1-rosenp@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-20 15:24:34 +02:00
Rosen Penev
c7b929fe28 gpio: xgene: allow COMPILE_TEST builds
The APM X-Gene GPIO driver uses generic platform, ACPI, MMIO, and gpiolib
interfaces.  Allow it to build with COMPILE_TEST, matching the existing
coverage for the X-Gene standby GPIO driver.

Tested with:
make LLVM=1 ARCH=loongarch drivers/gpio/gpio-xgene.o

Assisted-by: Codex:GPT-5.5
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://patch.msgid.link/20260519005958.628783-1-rosenp@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-20 15:23:46 +02:00
Prathamesh Shete
8ac12d8b70 gpio: tegra186: Add support for Tegra238
Extend the existing Tegra186 GPIO controller driver with support for the
GPIO controller found on Tegra238.

Signed-off-by: Prathamesh Shete <pshete@nvidia.com>
Link: https://patch.msgid.link/20260514124835.108532-2-pshete@nvidia.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-18 11:12:02 +02:00
Prathamesh Shete
4002ccd266 dt-bindings: gpio: Add Tegra238 support
Extend the existing Tegra186 GPIO controller device tree bindings with
support for the GPIO controllers found on Tegra238. Tegra238 has two
GPIO controllers: the main controller and always-on (AON) controller.
The number of pins is slightly different, but the programming model
remains the same.

Add a new header, include/dt-bindings/gpio/nvidia,tegra238-gpio.h,
that defines port IDs as well as the TEGRA238_MAIN_GPIO() helper,
both of which are used in conjunction to create a unique specifier
for each pin.

Signed-off-by: Prathamesh Shete <pshete@nvidia.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://patch.msgid.link/20260514124835.108532-1-pshete@nvidia.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-18 11:12:01 +02:00
Uwe Kleine-König (The Capable Hub)
553e26a45e gpio: Initialize i2c_device_id arrays using member names
While being less compact, using named initializers allows to more easily
see which members of the structs are assigned which value without having
to lookup the declaration of the struct. And it's also more robust
against changes to the struct definition.

The mentioned robustness is relevant for a planned change to struct
i2c_device_id that replaces .driver_data by an anonymous union.

This patch doesn't modify the compiled arrays, only their representation
in source form benefits. The former was confirmed with x86 and arm64
builds.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Link: https://patch.msgid.link/20260512152125.924433-2-u.kleine-koenig@baylibre.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-18 09:47:18 +02:00
Bartosz Golaszewski
cccecb5cbe Immutable branch between MFD and GPIO due for the v7.2 merge window
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdrbJNaO+IJqU8IdIUa+KL4f8d2EFAmn8rw4ACgkQUa+KL4f8
 d2EcmA/8DSOHphmRTqUukRnrZSScH1kfqejqm7d8mPg9jwCPMGvHbqJ1p83VFA+B
 1UTf0a9MsEl+wU+Zs5m1NqZWVrAaEZ7v25kOuopB335mDgsyT4rlg0p5TlNr7Gji
 mqM0o57mskMeG0Npx4CqlyEdG/BG65NiMBCjSkoRkg0ZWJRN6VWohjCi4pP98c3g
 V2X6WcnIDQPc9syp45jxj1RmLk/7NHa14Qezjvf4PBs2KZG2uCfP1MWG1+E6qgMX
 0nJ6SLpVdkD92PZXlwvuEovelF6cFPWbvbCUus0nETbcm+pO3Jd6pGV5g3gWJQyg
 A7Zd2vQ0fTCOhYxkwxsRh6PhL7RayJONu5ctxjXTYNGuq/YLi4j7payODf9lUnhv
 fqg/AVrsriVyUkjfjW7UrGpwVx0eUi3siGzbl/Bolh/1NC/4M15Wt9c6zRGIcViN
 5KeSE5YQnfWDk+4r9w06CkwLX852uqhux6LAqrgdswZ8x+vvPBc2vV6gnU/vGG+/
 xkZTqvt+Z9clksQV3LcqkaztS7vygjBmTYWEoxBY+MxIdwvB6N6Zt67WxSL6DDEd
 X/9ApwX9zKg01tnOPRuJZVGOdmWJvtZsXEp7ETB56m5y+ADRZ2MZop53fuxoGaja
 Y2MT0aclX5MvoTk7kbM/p6Uq4vxAVjsWjbfo2GYYJB3EHtp8kw4=
 =tVLe
 -----END PGP SIGNATURE-----

Merge tag 'ib-mfd-gpio-v7.2' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd into gpio/for-next

Immutable branch between MFD and GPIO due for the v7.2 merge window
2026-05-13 15:44:51 +02:00
Shubhrajyoti Datta
eeb1d6dfd8 gpio: zynq: Add eio gpio support
Add support for the EIO GPIO controller found on
xa2ve3288 silicon.

The EIO GPIO block provides access to multiplexed I/O pins exposed
through the EIO interface. Only bank 0 and bank 1 are connected to
external MIO pins, with 26 GPIOs per bank (52 GPIOs total). This
change extends the Zynq GPIO driver to support the EIO GPIO
variant.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>
Link: https://patch.msgid.link/20260512060917.2096456-4-shubhrajyoti.datta@amd.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-13 09:28:43 +02:00
Shubhrajyoti Datta
18409d06b4 dt-bindings: gpio: Add EIO GPIO compatible to gpio-zynq
EIO (Extended IO) GPIO is a Xilinx IP block that exposes
multiplexed I/O pins through an EIO interface.

The EIO GPIO block has 2 banks with 26 GPIOs each (52 total).
The GPIO width cannot be determined from the hardware registers,
the driver relies on the compatible string to select the correct
bank/pin configuration. A new compatible is therefore required.

The block is currently present on xa2ve3288 silicon.
The compatible string uses version 1.0 matching the IP core version.

Acked-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>
Link: https://patch.msgid.link/20260512060917.2096456-3-shubhrajyoti.datta@amd.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-13 09:28:43 +02:00
Shubhrajyoti Datta
3eb639ef8d dt-bindings: gpio: zynq: Sort compatible strings alphabetically
Sort the compatible string alphabetically.

Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>
Link: https://patch.msgid.link/20260512060917.2096456-2-shubhrajyoti.datta@amd.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-13 09:28:42 +02:00
Linus Walleij
806e7acf7f gpio: regmap: Don't set a fixed direction line
If a GPIO line has a fixed direction, report an error if a consumer
anyway tries to set the direction to something other than what it is
hardcoded to.

This didn't happen much before because what we supported was all lines
input or output and then the implementer would probably not specify the
direction registers, but with sparse fixed direction we can have
a mixture so let's take this into account.

As a consequence, since gpio_regmap_set_direction() can now fail, alter
the semantics in gpio_regmap_direction_output() such that we first check
if we can set the direction to output before we set the value and the
direction.

Suggested-by: Sashiko <sashiko-bot@kernel.org>
Link: https://sashiko.dev/#/patchset/20260507-regmap-gpio-sparse-fixed-dir-v1-1-a2e5855e2701%40kernel.org
Signed-off-by: Linus Walleij <linusw@kernel.org>
Reviewed-by: Michael Walle <mwalle@kernel.org>
Reviewed-by: Alex Elder <elder@riscstar.com>
Tested-by: Alex Elder <elder@riscstar.com>
Link: https://patch.msgid.link/20260511-regmap-gpio-sparse-fixed-dir-v3-2-1429ec453be7@kernel.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-12 11:54:37 +02:00
Linus Walleij
68d801eabd gpio: regmap: Support sparsed fixed direction
On some regmapped GPIOs apparently only a sparser selection of the lines
(not all) are actually fixed direction.

Support this situation by adding an optional bitmap indicating which
GPIOs are actually fixed direction and which are not.

Link: https://lore.kernel.org/linux-gpio/20260501155421.3329862-10-elder@riscstar.com/
Tested-by: Alex Elder <elder@riscstar.com>
Signed-off-by: Linus Walleij <linusw@kernel.org>
Reviewed-by: Michael Walle <mwalle@kernel.org>
Reviewed-by: Alex Elder <elder@riscstar.com>
Link: https://patch.msgid.link/20260511-regmap-gpio-sparse-fixed-dir-v3-1-1429ec453be7@kernel.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-12 11:54:17 +02:00
Rosen Penev
63677aa485 gpio: spear-spics: Add COMPILE_TEST support
The SPEAr SPI chip-select GPIO driver only depends on generic platform,
OF, and MMIO interfaces, so it can be built outside SPEAr platform
configurations.

Enable compile-test coverage to catch build regressions on other
architectures.

Assisted-by: Codex:GPT-5.5
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://patch.msgid.link/20260510195531.10561-1-rosenp@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-11 15:23:59 +02:00
Bartosz Golaszewski
e5d546fe43 Immutable branch betweeb the GPIO and I2C trees for v7.2-rc1
- add the gpiod_is_single_ended() helper function
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEkeUTLeW1Rh17omX8BZ0uy/82hMMFAmoByxQACgkQBZ0uy/82
 hMNJlA/7BdwjUu7DNcpIujhMEcNjDcyzHxOCU/e7uP9qO1Y4JGZbCCqP/AOXwekF
 PtCqlnsmA5sx5ILQ+TbIp8aS9DIcJsmBjSrG4J24514Yj850WoIvh+ZqG3w4yE7d
 06G9kLmGiyTI2KrKyI3lDy3KzmIGODYvSpf2vxb/Dub8MdcQ8swt1bBJINc704Rl
 2RNpvfim7bo5AeE5LQl+IT+RQTzuFZs2TAb0a2ZQ3vB8zgc1jt1OeQH9r6+c6MzI
 Mrku79E6ZEp5nIjp3Lhsa0iGlZ1j2X+QisQGJImZgEFTJrcOHpSfUwEbvYoNa+PM
 FLomkvLbuq4nZGz6QDiIZh4YT3qdhXmQnG6fTcmO4ZkTQCkSem+YLilOUPeg9Vgb
 AFzybELEbRXQAe/EGuDlviuPhdnYsOHRwPo9L0aMO5cYdionGCNRt6jpRSRFKcIF
 6C8OcXPcVFfAfbSZ2ftj8GVb34c7f4zHHzNYVUtCJhlHrzmbHGpvh+zRU9O5u1PU
 ZTGqEXUxv9Mer+2/7bUEasrXcERMLfx38Q6sgQTVh9uA8/C7hdtEdwL4TujuJmMC
 gZL0ZudAQ8csoFV3LEOC3DIhNZIRZEKum3UwxW9FQ0Xc6MvXUaqf8XaHDy7AKtde
 xAq5VcuIesZ8pkTICOSxio5y6AHYTdhmG0jRs0avpQLiupdVyfU=
 =J9un
 -----END PGP SIGNATURE-----

Merge tag 'ib-gpio-add-gpiod-is-single-ended-for-v7.2' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux into gpio/for-next

Immutable branch betweeb the GPIO and I2C trees for v7.2-rc1

- add the gpiod_is_single_ended() helper function
2026-05-11 14:31:05 +02:00
Jie Li
b5fafa01bd gpiolib: add gpiod_is_single_ended() helper
The direction of a single-ended (open-drain or open-source) GPIO line
cannot always be reliably determined by reading hardware registers.
In true open-drain implementations, the "high" state is achieved by
entering a high-impedance mode, which many hardware controllers report
as "input" even if the software intends to use it as an output.

This creates issues for consumer drivers (like I2C) that rely on
gpiod_get_direction() to decide if a line can be driven.

Introduce gpiod_is_single_ended() to allow consumers to check the
software configuration (GPIO_FLAG_OPEN_DRAIN/GPIO_FLAG_OPEN_SOURCE) of
a descriptor. This provides a robust way to identify lines that are
capable of being driven, regardless of their instantaneous hardware state.

Signed-off-by: Jie Li <jie.i.li@nokia.com>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20260511113726.49041-2-jie.i.li@nokia.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-11 14:25:25 +02:00
Bartosz Golaszewski
ff010c4984 Immutable branch between the GPIO and PCI trees for v7.2
- add fwnode_gpiod_get() helper to GPIOLIB
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEkeUTLeW1Rh17omX8BZ0uy/82hMMFAmoBtmgACgkQBZ0uy/82
 hMORBBAAn7ABKOUzrzA8kPwAAS5QVE1dtllXkiRG/iqocJsVrPAaJvbhcO/HQZa9
 kiIAlxahdfBwAZOZ3S9/yJaWgjTIdV9bUk5L8rOh6cG/khrho8YegJZzgN9oR5go
 gY6QWm4+cIaRHcAbAFmQKkBO1h1vZ/nem0txGf82T1/cIJ76WDUrkinvZ1YtH3+p
 /SwVSg28UgW9StxBnS/DZWHUpaECXi7beemkYHGGeTjv4BPwvzkoT4HkRn+7BViQ
 lj6snYEvft1sAWIqnGIGMavfV3X1Wfg2faF7ZY5QQtCAFTEPhqo1uQQtTcK5Id4i
 VDYYsop6RDXPq97Ff8zdFH5DJcqriYVR+aJbOWOw3rW+d9cGjbOtFWWicb8F26eh
 e3XCSC3GMynZoJi6oXoGUiyLKmq5CrrJQk4WdJzSzGN3w3alY2JDhRr6oR+AMnut
 KBaa8gfQ6rA7vXAhP6dMSuOaiFDSr8TesRW6uARwiJD02HQLC4cmcg0J5FITgXvO
 BDKtdUdc81gSW8/eX6YTeEu3ztAd+B7Dd8C2oXkMdWZ27CWLvbjRY2qzK7KYltSX
 Jm/XXkEOItWEL/s0cPj94dh3S+2hqba+RCI++U1AQ0HWRjbawGUdDkknVztMtA7X
 X+Jf6QW/lTK9cQyCnii52No6oD/IkFqh5RFLo9eqKH83VfEvvWY=
 =JPyU
 -----END PGP SIGNATURE-----

Merge tag 'ib-gpio-add-fwnode-gpiod-get-for-v7.2' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux into gpio/for-next

Immutable branch between the GPIO and PCI trees for v7.2

- add fwnode_gpiod_get() helper to GPIOLIB
2026-05-11 13:02:54 +02:00
Krishna Chaitanya Chundru
8a46bd2638 gpio: Add fwnode_gpiod_get() helper
Add fwnode_gpiod_get() as a convenience wrapper around
fwnode_gpiod_get_index() for the common case where only the
first GPIO is required.

This mirrors existing gpiod_get() and devm_gpiod_get() helpers
and avoids open-coding index 0 at call sites.

Suggested-by: Manivannan Sadhasivam <mani@kernel.org>
Acked-by: Manivannan Sadhasivam <mani@kernel.org>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Acked-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Signed-off-by: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com>
Link: https://patch.msgid.link/20260511-wakeirq_support-v10-1-c10af9c9eb8c@oss.qualcomm.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-11 12:57:48 +02:00
Icenowy Zheng
f76c8be440 dt-bindings: gpio: dwapb: allow GPIO hogs
GPIO hogs are described in the gpio.txt binding as automatic default
GPIO configuration items.

Allow them for GPIO ports in DesignWare APB GPIO controller nodes.

Cc: Hoan Tran <hoan@os.amperecomputing.com>
Cc: Linus Walleij <linusw@kernel.org>
Cc: Bartosz Golaszewski <brgl@kernel.org>
Cc: Serge Semin <fancer.lancer@gmail.com>
Signed-off-by: Icenowy Zheng <zhengxingda@iscas.ac.cn>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://patch.msgid.link/20260507081710.4090814-8-zhengxingda@iscas.ac.cn
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-11 12:53:53 +02:00
Rosen Penev
5d6f7ce387 gpio: zevio: allow COMPILE_TEST builds
The ZEVIO GPIO driver uses generic platform, MMIO, and gpiolib interfaces.
Allow it to build with COMPILE_TEST so it gets coverage on non-ARM
platforms.

Drop the ARM-specific IOMEM() casts around the register pointer.  The
pointer is already __iomem, so readl() and writel() can use it directly.

Tested with:
make LLVM=1 ARCH=loongarch drivers/gpio/gpio-zevio.o

Assisted-by: Codex:GPT-5.5
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://patch.msgid.link/20260509003438.956051-1-rosenp@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-11 12:14:37 +02:00
Dmitry Baryshkov
79f44c8acf gpio: add GPIO controller found on Waveshare DSI TOUCH panels
The Waveshare DSI TOUCH family of panels has separate on-board GPIO
controller, which controls power supplies to the panel and the touch
screen and provides reset pins for both the panel and the touchscreen.
Also it provides a simple PWM controller for panel backlight. Add
support for this GPIO controller.

Tested-by: Riccardo Mereu <r.mereu@arduino.cc>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Link: https://patch.msgid.link/20260507-waveshare-dsi-touch-v5-2-d2ac7ccc22d4@oss.qualcomm.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-11 09:56:28 +02:00
Dmitry Baryshkov
8cd19f5560 dt-bindings: gpio: describe Waveshare GPIO controller
The Waveshare DSI TOUCH family of panels has separate on-board GPIO
controller, which controls power supplies to the panel and the touch
screen and provides reset pins for both the panel and the touchscreen.
Also it provides a simple PWM controller for panel backlight.

Add bindings for these GPIO controllers. As overall integration might be
not very obvious (and it differs significantly from the bindings used by
the original drivers), provide complete example with the on-board
regulators and the DSI panel.

Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Link: https://patch.msgid.link/20260507-waveshare-dsi-touch-v5-1-d2ac7ccc22d4@oss.qualcomm.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-11 09:56:28 +02:00
Bartosz Golaszewski
061bc966cf gpio: timberdale: Remove platform data header
With no more users, we can remove timb_gpio.h.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20260327-gpio-timberdale-swnode-v3-4-9a1bc1b2b124@oss.qualcomm.com
Signed-off-by: Lee Jones <lee@kernel.org>
2026-05-07 16:25:48 +01:00
Bartosz Golaszewski
a0aa7d4037 gpio: timberdale: Use device properties
The top-level MFD driver now passes the device properties to the GPIO
cell via the software node. Use generic device property accessors and
stop using platform data. We can ignore the "ngpios" property here now
as it will be retrieved internally by GPIO core.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20260327-gpio-timberdale-swnode-v3-3-9a1bc1b2b124@oss.qualcomm.com
Signed-off-by: Lee Jones <lee@kernel.org>
2026-05-07 16:25:24 +01:00
Bartosz Golaszewski
0e951de770 mfd: timberdale: Set up a software node for the GPIO cell
Using generic device properties instead of custom platform data
structures is preferred due to the resulting unification of the way
properties are accessed in consumer drivers. There's no DT node for the
GPIO cell in this driver but we can create a software node with device
properties and attach it to all the GPIO cells.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20260327-gpio-timberdale-swnode-v3-2-9a1bc1b2b124@oss.qualcomm.com
Signed-off-by: Lee Jones <lee@kernel.org>
2026-05-07 16:25:15 +01:00
Bartosz Golaszewski
73ae5f8c23 mfd: timberdale: Move GPIO_NR_PINS into the driver
This symbol is only used inside the Timberdale MFD driver. Move into
the .c file as there's no need for it to be exposed in a header.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20260327-gpio-timberdale-swnode-v3-1-9a1bc1b2b124@oss.qualcomm.com
Signed-off-by: Lee Jones <lee@kernel.org>
2026-05-07 16:25:06 +01:00
Uwe Kleine-König (The Capable Hub)
87e4643ab1 gpio: amd8111: Drop useless zeros in array initialisation
The compiler fills in zeros as needed, so there is no technical reason
to add explicit zeros at the end of a list initializer. Drop them.

Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
Link: https://patch.msgid.link/20260506144918.2445358-2-u.kleine-koenig@baylibre.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-07 10:07:05 +02:00
Chanhong Jung
cb77f89334 gpio: 74x164: support lines-initial-states for boot-time output state
74HC595 and 74LVC594 chains retain their output state from the first
serial write onwards. Today the driver always kicks that first write
from a zero-initialised buffer, so every output comes up low until user
space issues a write. Boards that rely on the chain to drive signals
whose power-on state matters (active-low indicators, reset lines, etc.)
have no way to express the desired initial pattern via DT.

Read the optional lines-initial-states bitmask, recently documented for
this binding, into chip->buffer before the first
__gen_74x164_write_config() so the chain comes up in a known state on
the very first SPI transaction. Bit N maps to GPIO line N (matching the
nxp,pcf8575 convention); on this output-only device, bit=0 drives the
line low and bit=1 drives it high. Property absence keeps the existing
zeroing behaviour intact.

Suggested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Chanhong Jung <happycpu@gmail.com>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20260429035134.1023330-3-happycpu@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-06 10:08:11 +02:00
Chanhong Jung
d6e1a94888 dt-bindings: gpio: fairchild,74hc595: add lines-initial-states property
The 74HC595 and 74LVC594 shift registers latch their outputs until the
first serial write, so boards that depend on a specific power-on pattern
(for example active-low indicators, reset lines, or other signals that
must come up non-zero) have no way to express that today: the Linux
driver always writes zeros from its zero-initialised buffer during
probe.

Document support for the existing lines-initial-states bitmask, already
defined for nxp,pcf8575, so the same convention covers this output-only
device. Bit N corresponds to GPIO line N. Because the 74HC595/74LVC594
family is push-pull output only (no input mode, no high-impedance state
under software control), bit=0 drives the line low and bit=1 drives it
high; this differs from nxp,pcf8575, where the 0/1 polarity reflects the
quasi-bidirectional nature of that part.

The bitmask covers up to 32 lines, which fits the typical 1-4 chip
cascades that appear in tree. Should longer chains require seeding in
the future, the property can be extended to a uint32-array without
breaking the bit-N-equals-line-N convention.

Suggested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Chanhong Jung <happycpu@gmail.com>
Reviewed-by: Rob Herring (Arm) <robh@kernel.org>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20260429035134.1023330-2-happycpu@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-06 10:08:11 +02:00
Bartosz Golaszewski
3a33394e8a gpio: sim: add a Kconfig dependency on SYSFS
gpio-sim is unusable without sysfs. Add a Kconfig dependency to its
entry.

Closes: https://sashiko.dev/#/patchset/20260428113439.9783-1-m32285159%40gmail.com
Reviewed-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20260429080312.15561-1-bartosz.golaszewski@oss.qualcomm.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-05 12:50:42 +02:00
Arnd Bergmann
bfdc854ba6 gpiolib: move legacy interface into linux/gpio/legacy.h
Split the old contents from gpio.h for clarity. Ideally any driver
that still includes linux/gpio.h can now be ported over to use
either linux/gpio/legacy.h or linux/gpio/consumer.h, with the
original file getting removed once that is complete.

No functional changes intended for now.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://patch.msgid.link/20260428154522.2861492-1-arnd@kernel.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-04 09:59:19 +02:00
Linus Walleij
6458c5db0d gpio: altera: Use generic MMIO GPIO
If we use the generic GPIO lib for MMIO in the Altera driver
we do not only cut down on the code, we also get get/set_multiple
for free.

Keep the local raw spinlock instead of reusing the bgpio spinlock
because it makes the gpiochip and irqchip nicely orthogonal.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patch.msgid.link/20260427-gpio-mmio-more-v3-3-fe1882351424@kernel.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-04 09:32:54 +02:00
Linus Walleij
9278928e0f gpio: altera: User gc helper variable
Make the code easier to read by adding a local gpio_chip *gc
variable.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patch.msgid.link/20260427-gpio-mmio-more-v3-2-fe1882351424@kernel.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-04 09:32:54 +02:00
Linus Walleij
575d985581 gpio: devres: Use devres parent if undefined
If the user did not pass a parent in the struct gpio_chip
then use the device used for devres as parent.

This is quite intuitive and can help avoiding having to
assign parent explicitly in every driver using devres
to add the gpiochip.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patch.msgid.link/20260427-gpio-mmio-more-v3-1-fe1882351424@kernel.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-04 09:32:54 +02:00
Maxwell Doose
be22c0f7f2 gpio: sim: Replace sprintf() with sysfs_emit()
Replace sprintf() function calls with sysfs_emit() in the configfs show
callbacks. This will help harden the driver and will bring the driver
up-to-date with more modern functions.

Suggested-by: Bartosz Golaszewski <brgl@kernel.org>
Signed-off-by: Maxwell Doose <m32285159@gmail.com>
Link: https://patch.msgid.link/20260428113439.9783-1-m32285159@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-04-29 09:50:04 +02:00
Mohamed Ayman
1005d6e025 gpio: ixp4xx: switch to dynamic GPIO base
Most IXP4xx platforms are Device Tree-based, and GPIO consumers
use phandle-based descriptors rather than legacy integer GPIO numbers.

Audit of the IXP4xx platform shows:
- No gpio_request(), gpio_get_value(), or gpio_set_value() users
  in arch/arm/mach-ixp4xx/
- No platform data using fixed GPIO numbers

This switches the gpiochip to dynamic base allocation, aligning
with modern gpiolib expectations where GPIO numbers are not globally
fixed and may be assigned dynamically.

Set gpiochip.base = -1 to allow gpiolib to assign the GPIO base
dynamically, avoiding global GPIO number space conflicts.

Signed-off-by: Mohamed Ayman <mohamedaymanworkspace@gmail.com>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Link: https://patch.msgid.link/20260427214311.331996-1-mohamedaymanworkspace@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-04-28 10:13:40 +02:00
Bartosz Golaszewski
050f2d9220 ASoC: wsa881x: Move custom workaround to gpiolib-of
Move a workaround for misdescribed GPIOs from the wsa881x to use a
 generic implementation in gpiolib-of.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmnwK+QACgkQJNaLcl1U
 h9DoIwgAhjSAeww7KYamhgxhqYeheu88W8vp5KGgQ6J9jdaQO7CL+4zNOwEeEFTm
 qUm/5oBYtneCVEiaFJNN8dEOWvqYmJ7rAThhnmJfNS425NTXUozCAJ/wSQ3RpnJJ
 ZuhXeJVLT8Mm2Nc0Z7roTM4tdoJbT1xjYsua2PVupQap4Gd/CbgUUkg3Of6WBsMg
 cCrfmSzS7SlCDZU9iTfkusi6ZaUIhYB7rXowBL96Fi4dACk8sNoPvo/BNvw14Al2
 7F4P/nsns2zkdlRMbbZbkuiUwOFNQQ97AYySWOGypQkldTM8Nwwz6YtVx3nRXocQ
 LxcgL+FJDZj6m6kZZ56lSB/yMvBkIQ==
 =VqQb
 -----END PGP SIGNATURE-----

Merge tag 'asoc-wsa881x-gpiolib-of' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into gpio/for-next

ASoC: wsa881x: Move custom workaround to gpiolib-of

Move a workaround for misdescribed GPIOs from the wsa881x to use a
generic implementation in gpiolib-of.
2026-04-28 10:10:00 +02:00