Bartosz Golaszewski
0c5fa4ee5a
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 >
2025-04-30 10:27:58 +02:00
Bartosz Golaszewski
3444049044
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 >
2025-04-30 10:27:58 +02:00
Bartosz Golaszewski
ef877a1590
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 >
2025-04-30 10:27:58 +02:00
Bartosz Golaszewski
40150dda92
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 >
2025-04-30 10:27:58 +02:00
Bartosz Golaszewski
68ef71400d
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 >
2025-04-30 10:27:58 +02:00
Bartosz Golaszewski
dd6d13abb4
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 >
2025-04-30 10:27:58 +02:00
Bartosz Golaszewski
57bbc60be4
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 >
2025-04-30 10:27:58 +02:00
Andy Shevchenko
d1d52c6622
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 >
2025-04-28 09:41:04 +02:00
Bartosz Golaszewski
063a2b45d6
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
2025-04-28 09:40:53 +02:00
Andy Shevchenko
e383bb8f95
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 >
2025-04-28 09:30:41 +02:00
Andy Shevchenko
f5e5631df5
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 >
2025-04-28 09:30:40 +02:00
Potin Lai
417b0f8d08
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 >
2025-04-23 13:24:27 +02:00
Jindong Yue
73dc041f8a
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 >
2025-04-23 13:23:18 +02:00
Nathan Chancellor
29f4c4da74
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: f3592d252f ("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 >
2025-04-22 15:32:54 +02:00
Andy Shevchenko
550300b9a2
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 >
2025-04-17 15:22:06 +02:00
Andy Shevchenko
7cc868831b
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 >
2025-04-17 15:22:06 +02:00
Andy Shevchenko
8c13e6a3d5
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 >
2025-04-17 15:22:06 +02:00
Andy Shevchenko
35d9bb5f79
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 >
2025-04-17 15:22:06 +02:00
Andy Shevchenko
df6dccb4ae
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 1d7765ba15 .
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 >
2025-04-17 15:22:05 +02:00
Andy Shevchenko
b709d676c1
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 >
2025-04-17 15:22:05 +02:00
Andy Shevchenko
d4fe58c8ea
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 >
2025-04-17 15:22:05 +02:00
Andy Shevchenko
f1d6cd0774
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 >
2025-04-17 15:22:05 +02:00
Yixun Lan
d00553240e
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 >
2025-04-17 15:22:05 +02:00
Yixun Lan
26bb7614fa
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 >
2025-04-17 15:22:05 +02:00
Bartosz Golaszewski
4e8a72f9b7
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 >
2025-04-17 15:22:05 +02:00
Bartosz Golaszewski
3d1c5b6221
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 >
2025-04-17 13:58:55 +02:00
Bartosz Golaszewski
bcb4be0907
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 >
2025-04-17 13:58:55 +02:00
Bartosz Golaszewski
4675b78c88
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 >
2025-04-17 13:58:55 +02:00
Bartosz Golaszewski
6273ef3560
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 >
2025-04-17 13:58:55 +02:00
Bartosz Golaszewski
d024e48263
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 >
2025-04-17 13:58:55 +02:00
Bartosz Golaszewski
df1540f8f3
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 >
2025-04-17 13:58:55 +02:00
Bartosz Golaszewski
f74195d4b2
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 >
2025-04-17 13:58:55 +02:00
Bartosz Golaszewski
f3592d252f
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 >
2025-04-17 13:58:55 +02:00
Bartosz Golaszewski
8416e1c971
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 >
2025-04-17 13:58:54 +02:00
Bartosz Golaszewski
1791226b71
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 >
2025-04-17 13:58:54 +02:00
Bartosz Golaszewski
d170eef8d4
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 >
2025-04-17 13:58:54 +02:00
Bartosz Golaszewski
96af713382
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 >
2025-04-17 13:58:54 +02:00
Bartosz Golaszewski
8bf15cf9f9
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 >
2025-04-17 13:58:54 +02:00
Bartosz Golaszewski
bcdd5b3764
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 >
2025-04-16 17:52:43 +02:00
Bartosz Golaszewski
097cf61ba5
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 >
2025-04-16 17:52:43 +02:00
Bartosz Golaszewski
21d3c6531b
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 >
2025-04-16 17:52:42 +02:00
Bartosz Golaszewski
afb4aed832
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 >
2025-04-16 17:52:42 +02:00
Geert Uytterhoeven
df9b3454a0
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: 602ae04f56 ("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 >
2025-04-14 22:31:15 +02:00
Koichiro Den
290ffcfe30
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 >
2025-04-14 22:30:01 +02:00
Dan Carpenter
d945ff5264
gpio: aggregator: Fix leak in gpio_aggregator_parse()
...
Call gpio_aggregator_free_lines() before returning on this error path.
Fixes: 83c8e3df64 ("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 >
2025-04-14 22:25:20 +02:00
Dan Carpenter
05b43de95a
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: 86f162e73d ("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 >
2025-04-14 22:25:20 +02:00
Dan Carpenter
db1baf69e5
gpio: aggregator: Return an error if there are no GPIOs in gpio_aggregator_parse()
...
The error handling in gpio_aggregator_parse() was re-written. It now
returns success if there are no GPIOs. Restore the previous behavior
and return -EINVAL instead.
Fixes: 83c8e3df64 ("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/9dcd5fda7a3819e896d9eee4156e7c46c9a64595.1744452787.git.dan.carpenter@linaro.org
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl >
2025-04-14 22:25:20 +02:00
Dan Carpenter
2e8636ca34
gpio: aggregator: Fix gpio_aggregator_line_alloc() checking
...
The gpio_aggregator_line_alloc() function returns error pointers, but
the callers check for NULL. Update the error checking in the callers.
Fixes: 83c8e3df64 ("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/cc71d8cf6e9bb4bb8cd9ae5050100081891d9345.1744452787.git.dan.carpenter@linaro.org
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl >
2025-04-14 22:25:20 +02:00
Dan Carpenter
eebfcb98cd
gpio: aggregator: fix "_sysfs" prefix check in gpio_aggregator_make_group()
...
This code is intended to reject strings that start with "_sysfs" but the
strcmp() limit is wrong so checks the whole string instead of the prefix.
Fixes: 83c8e3df64 ("gpio: aggregator: expose aggregator created via legacy sysfs to configfs")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org >
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be >
Acked-by: Koichiro Den <koichiro.den@canonical.com >
Link: https://lore.kernel.org/r/30210ed77b40b4b6629de659cb56b9ec7832c447.1744452787.git.dan.carpenter@linaro.org
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl >
2025-04-14 22:25:20 +02:00
Koichiro Den
6d7f0c1103
selftests: gpio: add test cases for gpio-aggregator
...
Add a set of tests for gpio-aggregator module. This test covers both
pre-existing new_device/delete_device interface and new configfs-based
interface.
Signed-off-by: Koichiro Den <koichiro.den@canonical.com >
Link: https://lore.kernel.org/r/20250407043019.4105613-10-koichiro.den@canonical.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org >
2025-04-09 16:57:30 +02:00