Commit graph

6108 commits

Author SHA1 Message Date
Linus Torvalds
9b08f8327f gpio updates for v6.12-rc1
Core GPIOLIB:
 - provide and add users for a macro allowing to iterate over accepted
   GPIO property names of consumer device nodes
 - remove legacy definitions that are no longer used
 - put legacy GPIO devres helpers together with the rest of the deprecated
   code
 - implement and use swnode_gpio_get_reference(): a wrapper simplifying
   the underlying calls to fwnode_property_get_reference_args()
 - use IS_ERR_OR_NULL() where it makes sense
 - replace of_find_property() with of_property_present()
 - simplify code with the scoped variant of OF-node children iterator
 
 Documentation:
 - update GPIO kerneldocs with Return sections
 - fix "Excess struct member description" warnings now being triggered
   with W=1
 
 New drivers:
 - add support for Analog Devices ADP5585
 
 Driver improvements:
 - add support for wake-on-GPIO to gpio-mpc8xxx
 - use GPIO_LOOKUP_IDX() in gpio-virtuser
 - use devm_clk_get_[optional_]enabled() where applicable in several
   drivers
 - replace OF-specific functions with provider-agnostic alternatives where
   possible
 - drop support for legacy platform data from gpio-ath79 and gpio-davinci
 - refactor gpio-stmpe
 - improve error reporting in gpio-pca953x
 - add support for reading the direction of pins for some models to
   gpio-vf610
 
 DT bindings:
 - convert the bindings for nxp,lpc3220 to YAML
 - add gpio-reserved-ranges to gpio-davinci
 - simplify the GPIO hog schema
 - fix a GPIO hog issue in bindings for fcs,fxl6408
 
 Other:
 - fix format specifiers in user-space tools
 - remove leftover files on make clean in tools/gpio/
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEFp3rbAvDxGAT0sefEacuoBRx13IFAmboIqcACgkQEacuoBRx
 13KvTw/9FaLbR/9p5lZ6xre0VNseD6NgshfO5B8DFgip8bT7l8InsLE5/DJKI/re
 q8Bva3X1d2YZwGnKLjWW9GDFsJDHP9KFvH2n1iCoJ8Ctb7jbFDUgwq5uAO0N0ZC1
 fgcfC4c2DkOEWdp8iWEQtN7PdKqEWtk4jjCpK9IsLGSGuc8UWya3FCXjuOokFPKZ
 lvl9FU4U+5/Jt9YRuKnLtvRtXIx39tvxZbt6l4ot4fjgwhzZVrIG7Kc2wh/nFxr2
 Lgjuaxbcbqzopash5JHKIz8Pj11zUQkuHJpxBZ42QGNk5B63+7BvIl21jeeOvDHV
 Z4ueJkqaIriFeIM9G+jFzCyxPoYvUF3XiFF9+SSWEqTL1RaZCkQrJu20b7EqLgyv
 Tdj23ylHMuY9JPbAvs9e3zUVcoiT87LeSmYJ91Dw/DeKNZDInzxIPHGkbPXdfkRt
 ZpvCUzGA9a+FnOFRgGjsDxNG5rQN2rhZNTKKqxweCcecFMCVdnxomi3+j1cDxBHW
 2TGEgyewfYslsdC7KxSyGUCaku1aEA4UjliIwt3b6de6VHBawG4Rr2ObYR5Av8l8
 gI+nHZ0pD7Efxzj/HiFYXY2/nYh/NRR9JUrM7M+Lr+SD4TLjLNEzExxhl1AVnQkC
 cS+kJKMViQuForJtyerpmI1y3U7EdM5CWt5SP/XyKG8EM9Kt+0g=
 =vVau
 -----END PGP SIGNATURE-----

Merge tag 'gpio-updates-for-v6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux

Pull gpio updates from Bartosz Golaszewski:
 "Core GPIOLIB:
   - provide and add users for a macro allowing to iterate over accepted
     GPIO property names of consumer device nodes
   - remove legacy definitions that are no longer used
   - put legacy GPIO devres helpers together with the rest of the
     deprecated code
   - implement and use swnode_gpio_get_reference(): a wrapper
     simplifying the underlying calls to
     fwnode_property_get_reference_args()
   - use IS_ERR_OR_NULL() where it makes sense
   - replace of_find_property() with of_property_present()
   - simplify code with the scoped variant of OF-node children iterator

  Documentation:
   - update GPIO kerneldocs with Return sections
   - fix "Excess struct member description" warnings now being triggered
     with W=1

  New drivers:
   - add support for Analog Devices ADP5585

  Driver improvements:
   - add support for wake-on-GPIO to gpio-mpc8xxx
   - use GPIO_LOOKUP_IDX() in gpio-virtuser
   - use devm_clk_get_[optional_]enabled() where applicable in several
     drivers
   - replace OF-specific functions with provider-agnostic alternatives
     where possible
   - drop support for legacy platform data from gpio-ath79 and
     gpio-davinci
   - refactor gpio-stmpe
   - improve error reporting in gpio-pca953x
   - add support for reading the direction of pins for some models to
     gpio-vf610

  DT bindings:
   - convert the bindings for nxp,lpc3220 to YAML
   - add gpio-reserved-ranges to gpio-davinci
   - simplify the GPIO hog schema
   - fix a GPIO hog issue in bindings for fcs,fxl6408

  Other:
   - fix format specifiers in user-space tools
   - remove leftover files on make clean in tools/gpio/"

* tag 'gpio-updates-for-v6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: (54 commits)
  gpio: mpc8xxx: switch to using DEFINE_RUNTIME_DEV_PM_OPS()
  gpio: xilinx: Use helper function devm_clk_get_optional_enabled()
  gpio: mb86s7x: Use helper function devm_clk_get_optional_enabled()
  gpio: lpc18xx: Use helper function devm_clk_get_enabled()
  gpio: cadence: Use helper function devm_clk_get_enabled()
  gpio: sama5d2-piobu: convert comma to semicolon
  gpio: mpc8xxx: order headers alphabetically
  gpio: davinci: use devm_clk_get_enabled()
  gpio: davinci: drop platform data support
  gpio: stmpe: Sort headers
  gpio: stmpe: Make use of device properties
  gpio: stmpe: Utilise temporary variable for struct device
  gpio: stmpe: Remove unused 'dev' member of struct stmpe_gpio
  gpio: stmpe: Fix IRQ related error messages
  gpio: pch: kerneldoc fixes for excess members
  gpio: zynq: Simplify using devm_clk_get_enabled()
  gpio: mpc8xxx: Add wake on GPIO support
  gpio: syscon: fix excess struct member build warning
  gpio: stp-xway: Simplify using devm_clk_get_enabled()
  gpiolib: legacy: Consolidate devm_gpio_*() with other legacy APIs
  ...
2024-09-18 10:43:07 +02:00
Linus Torvalds
cc52dc2fe3 pwm: Changes for v6.12-rc1
This pull request contains some cleanups to the core and some mostly
 minor updates to a bunch of drivers and device tree bindings. One thing
 worth pointing out is that it contains an immutable branch containing
 support for a new mfd chip (Analog Devices ADP5585) with several sub
 drivers. So expect to get the four affected commits also from my fellow
 MFD and GPIO maintainers.
 
 Thanks go to Andrew Kreimer, Clark Wang, Conor Dooley, David Lechner,
 Dmitry Rokosov, Frank Li, Geert Uytterhoeven, George Stark, Jiapeng
 Chong, Krzysztof Kozlowski, Laurent Pinchart, Liao Chen, Liu Ying, Rob
 Herring and Wolfram Sang for code contributions and reviews and to Lee
 Jones for preparing the above mentioned immutable branch.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEP4GsaTp6HlmJrf7Tj4D7WH0S/k4FAmboM3AACgkQj4D7WH0S
 /k6IzQgAj+3B4F4UKPPI8jcQqRQGOWfjA365nIQmr1oeFYSGDILv4btU1TNV1MfH
 WLXMRXLQb4dng21J8IwIJ/qyndL+GjRj3KWxLHJa3+/gxf8YuGwWJlNjlxtrGXM/
 3JQ/aWqfgCf4KTRG3MoCTKc5fxtbHHWZ71kGdi6cchk1HggyBUH/7g85h/VkhCuc
 JpOC7CvDVmzTkTIltCbiVJQ4xO3zmsV2WgnsWUzN+41PUjqJmMLmhKjI6UdAYWlI
 B3qgCMXik153oYgaIw/BMtxFWa9e2ZxZ6hV+gx4tVQWbOtBPUxEqHpX2dt1fp5+h
 7PQoKVWJycykdxmlOSGnjOl3RHVX5A==
 =VjPD
 -----END PGP SIGNATURE-----

Merge tag 'pwm/for-6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux

Pull pwm updates from Uwe Kleine-König:
 "This contains some cleanups to the core and some mostly minor updates
  to a bunch of drivers and device tree bindings. One thing worth
  pointing out is that it contains an immutable branch containing
  support for a new mfd chip (Analog Devices ADP5585) with several sub
  drivers.

  Thanks go to Andrew Kreimer, Clark Wang, Conor Dooley, David Lechner,
  Dmitry Rokosov, Frank Li, Geert Uytterhoeven, George Stark, Jiapeng
  Chong, Krzysztof Kozlowski, Laurent Pinchart, Liao Chen, Liu Ying, Rob
  Herring and Wolfram Sang for code contributions and reviews and to Lee
  Jones for preparing the above mentioned immutable branch"

* tag 'pwm/for-6.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux: (21 commits)
  pwm: stm32: Fix a typo
  dt-bindings: pwm: amlogic: Add new bindings for meson A1 PWM
  dt-bindings: pwm: amlogic: Add optional power-domains
  pwm: Switch back to struct platform_driver::remove()
  dt-bindings: pwm: allwinner,sun4i-a10-pwm: add top-level constraints
  pwm: axi-pwmgen: use shared macro for version reg
  pwm: atmel-hlcdc: Drop trailing comma
  pwm: atmel-hlcdc: Enable module autoloading
  pwm: omap-dmtimer: Use of_property_read_bool()
  pwm: adp5585: Set OSC_EN bit to 1 when PWM state is enabled
  pwm: lp3943: Fix an incorrect type in lp3943_pwm_parse_dt()
  pwm: Simplify pwm_capture()
  pwm: lp3943: Use of_property_count_u32_elems() to get property length
  pwm: Don't export pwm_capture()
  pwm: Make info in traces about affected pwm more useful
  dt-bindings: pwm: renesas,tpu: Add r8a779h0 support
  dt-bindings: pwm: renesas,pwm-rcar: Add r8a779h0 support
  pwm: adp5585: Add Analog Devices ADP5585 support
  gpio: adp5585: Add Analog Devices ADP5585 support
  mfd: adp5585: Add Analog Devices ADP5585 core support
  ...
2024-09-18 10:39:35 +02:00
Bartosz Golaszewski
6b5e97c020 gpio: mpc8xxx: switch to using DEFINE_RUNTIME_DEV_PM_OPS()
Use the preferred API for assigning system sleep pm callbacks in drivers.

Suggested-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240904140706.70359-1-brgl@bgdev.pl
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-06 08:50:48 +02:00
Zhang Zekun
4e26ddab82 gpio: xilinx: Use helper function devm_clk_get_optional_enabled()
devm_clk_get_optional() and clk_prepare_enable() can be replaced by helper
function devm_clk_get_optional_enabled(). Let's simplify code with use of
devm_clk_get_optional_enabled() and avoid calling clk_disable_unprepare().

Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com>
Link: https://lore.kernel.org/r/20240904092311.9544-5-zhangzekun11@huawei.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-05 15:04:44 +02:00
Zhang Zekun
162b169656 gpio: mb86s7x: Use helper function devm_clk_get_optional_enabled()
devm_clk_get_optional() and clk_prepare_enable() can be replaced by helper
function devm_clk_get_optional_enabled(). Let's simplify code with use of
devm_clk_get_optional_enabled() and avoid calling clk_disable_unprepare().

Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com>
Link: https://lore.kernel.org/r/20240904092311.9544-4-zhangzekun11@huawei.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-05 15:04:44 +02:00
Zhang Zekun
8abc67adc9 gpio: lpc18xx: Use helper function devm_clk_get_enabled()
devm_clk_get() and clk_prepare_enable() can be replaced by helper
function devm_clk_get_enabled(). Let's use devm_clk_get_enabled() to
simplify code and avoid calling clk_disable_unprepare().

Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com>
Link: https://lore.kernel.org/r/20240904092311.9544-3-zhangzekun11@huawei.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-05 15:04:44 +02:00
Zhang Zekun
da426eda1b gpio: cadence: Use helper function devm_clk_get_enabled()
devm_clk_get() and clk_prepare_enable() can be replaced by helper
function devm_clk_get_enabled(). Let's use devm_clk_get_enabled() to
simplify code and avoid calling clk_disable_unprepare().

Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com>
Link: https://lore.kernel.org/r/20240904092311.9544-2-zhangzekun11@huawei.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-05 15:04:44 +02:00
Chen Ni
f4d08a8fed gpio: sama5d2-piobu: convert comma to semicolon
Replace comma between expressions with semicolons.

Using a ',' in place of a ';' can have unintended side effects. Although
that is not the case here, it is seems best to use ';' unless ',' is
intended.

Found by inspection. No functional change intended. Compile tested only.

Signed-off-by: Chen Ni <nichen@iscas.ac.cn>
Link: https://lore.kernel.org/r/20240905024245.1642989-1-nichen@iscas.ac.cn
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-05 09:34:51 +02:00
Bartosz Golaszewski
ccaf84694c gpio: mpc8xxx: order headers alphabetically
Cleanup the includes by putting them in alphabetical order.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Martyn Welch <martyn.welch@collabora.com>
Link: https://lore.kernel.org/r/20240903154533.101258-1-brgl@bgdev.pl
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-04 09:22:49 +02:00
Bartosz Golaszewski
d14f6f405f gpio: davinci: use devm_clk_get_enabled()
Simplify the code in error paths by using the managed variant of the
clock getter that controls the clock state as well.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20240819151705.37258-2-brgl@bgdev.pl
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-04 09:13:01 +02:00
Bartosz Golaszewski
d29e741cad gpio: davinci: drop platform data support
There are no more any board files that use the platform data for
gpio-davinci. We can remove the header defining it and port the code to
no longer store any context in pdata.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20240819151705.37258-1-brgl@bgdev.pl
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-04 09:13:01 +02:00
Andy Shevchenko
9f0127b9ce gpio: stmpe: Sort headers
Sort the headers in alphabetic order in order to ease
the maintenance for this part.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240902133148.2569486-6-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-04 09:02:44 +02:00
Andy Shevchenko
e6815a05c0 gpio: stmpe: Make use of device properties
Convert the module to be property provider agnostic and allow
it to be used on non-OF platforms.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240902133148.2569486-5-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-04 09:02:43 +02:00
Andy Shevchenko
56f534dde6 gpio: stmpe: Utilise temporary variable for struct device
We have a temporary variable to keep a pointer to struct device.
Utilise it where it makes sense.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240902133148.2569486-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-04 09:02:43 +02:00
Andy Shevchenko
c028e1c5a4 gpio: stmpe: Remove unused 'dev' member of struct stmpe_gpio
There is no evidence that the 'dev' member of struct stmpe_gpio
is used, drop it.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240902133148.2569486-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-04 09:02:43 +02:00
Andy Shevchenko
a794331325 gpio: stmpe: Fix IRQ related error messages
First of all, remove duplicate message that platform_get_irq()
does already print. Second, correct the error message when unable
to register a handler, which is broken in two ways:
1) the misleading 'get' vs. 'register';
2) missing '\n' at the end.

(Yes, for the curious ones, the dev_*() cases do not require '\n'
and issue it automatically, but it's better to have them explicit)

Fix all this here.

Fixes: 1882e76936 ("gpio: stmpe: Simplify with dev_err_probe()")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240902133148.2569486-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-04 09:02:43 +02:00
Liao Chen
a513552642 gpio: modepin: Enable module autoloading
Add MODULE_DEVICE_TABLE(), so modules could be properly autoloaded based
on the alias from of_device_id table.

Fixes: 7687a5b0ee ("gpio: modepin: Add driver support for modepin GPIO controller")
Signed-off-by: Liao Chen <liaochen4@huawei.com>
Reviewed-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/20240902115848.904227-1-liaochen4@huawei.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-02 15:00:53 +02:00
Krzysztof Kozlowski
adad2e460e gpio: rockchip: fix OF node leak in probe()
Driver code is leaking OF node reference from of_get_parent() in
probe().

Fixes: 936ee2675e ("gpio/rockchip: add driver for rockchip gpio")
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Heiko Stuebner <heiko@sntech.de>
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
Link: https://lore.kernel.org/r/20240826150832.65657-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-02 14:37:25 +02:00
Krzysztof Kozlowski
e1df5d0229 gpio: pch: kerneldoc fixes for excess members
Drop kerneldoc description of 'lock' to fix W=1 warning:

  drivers/gpio/gpio-pch.c:101: warning: Excess struct member 'lock' description in 'pch_gpio'

Reviewed-by: Andy Shevchenko <andy@kernel.org>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20240902121258.64094-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-02 14:35:32 +02:00
Rong Qianfeng
8d2aaf4382 gpio: zynq: Simplify using devm_clk_get_enabled()
Use devm_clk_get_enabled() simplify zynq_gpio_probe() and zynq_gpio_remove().

Acked-by: Michal Simek <michal.simek@amd.com>
Signed-off-by: Rong Qianfeng <rongqianfeng@vivo.com>
Link: https://lore.kernel.org/r/20240820121651.29706-3-rongqianfeng@vivo.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-02 13:59:31 +02:00
Martyn Welch
e9482dc50a gpio: mpc8xxx: Add wake on GPIO support
The mpc8xxx GPIO can generate an interrupt on state change. This
interrupt can be used to wake up the device from its sleep state if
enabled to do so. Add required support to the driver so that the GPIO
can be used in this way.

In order for the GPIO to actually function in this way, it is necessary
to also set the GPIO bit in the RCPM. This can be done via the device
tree fsl,rcpm-wakeup property.

Signed-off-by: Martyn Welch <martyn.welch@collabora.com>
Link: https://lore.kernel.org/r/20240820143328.1987442-1-martyn.welch@collabora.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-02 12:36:01 +02:00
Dhruva Gole
c10c762f76 gpio: syscon: fix excess struct member build warning
Fix the build warning with W=1 flag,
"Excess struct member 'compatible' description in 'syscon_gpio_data' "
by removing the documentation for the non existent member.

Signed-off-by: Dhruva Gole <d-gole@ti.com>
Link: https://lore.kernel.org/r/20240902-b4-gpio-fix-v1-1-49a997994fa5@ti.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-02 12:35:59 +02:00
Rong Qianfeng
ece70e7986 gpio: stp-xway: Simplify using devm_clk_get_enabled()
Use devm_clk_get_enabled() simplify xway_stp_probe().

Signed-off-by: Rong Qianfeng <rongqianfeng@vivo.com>
Link: https://lore.kernel.org/r/20240820121651.29706-2-rongqianfeng@vivo.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-02 12:31:48 +02:00
Andy Shevchenko
d25f9ab17d gpiolib: legacy: Consolidate devm_gpio_*() with other legacy APIs
There is no reason to keep deprecated legacy API implementations
in the gpiolib-devres.c. Consolidate devm_gpio_*() with other legacy
APIs. While at it, clean up header inclusion block in gpiolib-devres.c.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240828151357.2677340-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-02 12:27:36 +02:00
Andy Shevchenko
94bd9ce160 gpiolib: Update the kernel documentation - add Return sections
$ scripts/kernel-doc -v -none -Wall drivers/gpio/gpiolib* 2>&1 | grep -w warning | wc -l
67

Fix these by adding Return sections. While at it, make sure all of
Return sections use the same style.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
Tested-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240828164449.2777666-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-02 12:27:36 +02:00
Andy Shevchenko
1e3d42f508 gpio: ixp4xx: Replace of_node_to_fwnode() with more suitable API
of_node_to_fwnode() is a IRQ domain specific implementation of
of_fwnode_handle(). Replace the former with more suitable API.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20240822223332.705560-1-andy.shevchenko@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-02 12:27:36 +02:00
Andy Shevchenko
35ea26245e gpio: visconti: Replace of_node_to_fwnode() with more suitable API
of_node_to_fwnode() is a IRQ domain specific implementation of
of_fwnode_handle(). Replace the former with more suitable API.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20240822225818.707550-1-andy.shevchenko@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-02 12:27:36 +02:00
Andy Shevchenko
6d6395cd50 gpio: thunderx: Replace of_node_to_fwnode() with more suitable API
of_node_to_fwnode() is a IRQ domain specific implementation of
of_fwnode_handle(). Replace the former with more suitable API.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20240822225300.707178-1-andy.shevchenko@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-02 12:27:36 +02:00
Andy Shevchenko
5482f1a5c2 gpio: tegra186: Replace of_node_to_fwnode() with more suitable API
of_node_to_fwnode() is a IRQ domain specific implementation of
of_fwnode_handle(). Replace the former with more suitable API.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20240822224737.706870-1-andy.shevchenko@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-02 12:27:36 +02:00
Andy Shevchenko
9f12737342 gpio: uniphier: Replace of_node_to_fwnode() with more suitable API
of_node_to_fwnode() is a IRQ domain specific implementation of
of_fwnode_handle(). Replace the former with more suitable API.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20240822225629.707365-1-andy.shevchenko@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-02 12:27:36 +02:00
Andy Shevchenko
f5c4a495b1 gpio: msc313: Replace of_node_to_fwnode() with more suitable API
of_node_to_fwnode() is a IRQ domain specific implementation of
of_fwnode_handle(). Replace the former with more suitable API.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20240822224130.706564-1-andy.shevchenko@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-02 12:27:36 +02:00
Andy Shevchenko
c1e4e5dc9b gpio: tegra: Replace of_node_to_fwnode() with more suitable API
of_node_to_fwnode() is a IRQ domain specific implementation of
of_fwnode_handle(). Replace the former with more suitable API.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://lore.kernel.org/r/20240822223845.706346-1-andy.shevchenko@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-02 12:27:36 +02:00
Hongbo Li
30a32e9311 gpio: Use IS_ERR_OR_NULL() helper function
Use the IS_ERR_OR_NULL() helper instead of open-coding a
NULL and an error pointer checks to simplify the code and
improve readability.

No functional changes are intended.

Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
Link: https://lore.kernel.org/r/20240828122039.3697037-1-lihongbo22@huawei.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-02 12:27:35 +02:00
Andy Shevchenko
8c045ca534 gpiolib: legacy: Kill GPIOF_DIR_* definitions
Besides the fact that (old) drivers use wrong definitions, e.g.,
GPIOF_DIR_IN instead of GPIOF_IN, shrink the legacy definitions
by killing those GPIOF_DIR_* completely.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Reviewed-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Link: https://lore.kernel.org/r/20240828142554.2424189-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-02 11:47:06 +02:00
Andy Shevchenko
4b2b0a2ce8 gpiolib: legacy: Kill GPIOF_INIT_* definitions
Besides the fact that (old) drivers use wrong definitions, e.g.,
GPIOF_INIT_HIGH instead of GPIOF_OUT_INIT_HIGH, shrink the legacy
definitions by killing those GPIOF_INIT_* completely.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Reviewed-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Link: https://lore.kernel.org/r/20240828142554.2424189-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-02 11:47:06 +02:00
Shen Lichuan
1882e76936 gpio: stmpe: Simplify with dev_err_probe()
Use dev_err_probe() to simplify the error path and unify a message
template.

Using this helper is totally fine even if err is known to never
be -EPROBE_DEFER.

The benefit compared to a normal dev_err() is the standardized format
of the error code, it being emitted symbolically and the fact that
the error code is returned which allows more compact error paths.

Signed-off-by: Shen Lichuan <shenlichuan@vivo.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20240829131051.43200-1-shenlichuan@vivo.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-02 11:45:05 +02:00
Bartosz Golaszewski
c4a315eaf8 gpio: ath79: remove support for platform data
There are no more board files defining platform data for this driver so
remove the header and support from the driver.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20240821121456.19553-4-brgl@bgdev.pl
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-02 09:45:18 +02:00
Bartosz Golaszewski
10a968b21b gpio: ath79: use generic device property getters
Don't use specialized OF accessors if we can avoid it: switch to using
the generic device property helpers.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20240821121456.19553-3-brgl@bgdev.pl
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-02 09:45:14 +02:00
Bartosz Golaszewski
4acde50b4d gpio: ath79: add missing header
Include mod_devicetable.h for struct of_device_id and its helpers.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20240821121456.19553-2-brgl@bgdev.pl
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-02 09:45:10 +02:00
Bartosz Golaszewski
7b4b93e260 gpio: ath79: order headers alphabetically
Put all headers in alphabetical order.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20240821121456.19553-1-brgl@bgdev.pl
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-02 09:44:23 +02:00
Fabio Estevam
b41a9bf2c6 gpio: pca953x: Print the error code on read/write failures
Print the error code in the pca953x_write_regs() and pca953x_read_regs()
functions to help debugging.

Suggested-by: Russell King (Oracle) <linux@armlinux.org.uk>
Signed-off-by: Fabio Estevam <festevam@denx.de>
Link: https://lore.kernel.org/r/20240821114202.2072220-1-festevam@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-08-21 14:28:55 +02:00
Andy Shevchenko
2a4727e6a8 gpio: virtuser: Use GPIO_LOOKUP_IDX() macro
Use GPIO_LOOKUP_IDX() macro which provides a compound literal
and can be used with dynamic data.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240820200858.3659995-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-08-21 12:18:21 +02:00
Andy Shevchenko
4b91188dce gpiolib: Replace gpio_suffix_count with NULL-terminated array
There is no need to have and export the count variable for the array
in question. Instead, make it NULL-terminated.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240819142945.327808-6-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-08-20 10:22:38 +02:00
Andy Shevchenko
a975a64692 gpiolib: swnode: Make use of for_each_gpio_property_name()
For the sake of unification and easier maintenance replace
swnode_format_propname() call with for_each_gpio_property_name()
for-loop.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240819142945.327808-5-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-08-20 10:22:38 +02:00
Andy Shevchenko
7fd6809888 gpiolib: swnode: Introduce swnode_gpio_get_reference() helper
Instead of the spreading simlar code over the file, introduce a helper.
It also enforces the nargs validation for all GPIO software node APIs.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240819142945.327808-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-08-20 10:22:38 +02:00
Andy Shevchenko
e42fce0ff9 gpiolib: swnode: Unify return code variable name
In one case 'ret' is used in the other 'error'. Make the latter
use the former, i.e. 'ret'.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240819142945.327808-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-08-20 10:22:38 +02:00
Andy Shevchenko
ef3d4b94d2 gpiolib: Introduce for_each_gpio_property_name() helper
Introduce a helper macro for_each_gpio_property_name().
With that in place, update users. This, in particular,
will help making the following simplifications easier.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20240819142945.327808-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-08-20 10:22:38 +02:00
Bartosz Golaszewski
88d8a3082a Immutable branch between MFD, GPIO and PWM due for the v6.12 merge window
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEdrbJNaO+IJqU8IdIUa+KL4f8d2EFAma/b6oACgkQUa+KL4f8
 d2GkpA/+Nm9UAkYWk42yv52J0MlWe16Dp0F3h5hr42QLY0N3AWRux8wvKJ4L70Ew
 Twt9i25wIcYxqOPKVAcNKTOYmeobhLh7GvTOJeidajmdVE2g+MXHH+WRz84koLma
 KSOLGG9JauDvK+n3y3hnvsbBqJXMYEKG4kY3tvvNJ0YC2MEqXjVbBwZJzHlPI+bg
 jhsCqIX0BiiWxkcslIvzYkJjcbL4fKiXE1x8C6wSEBorf7i38Je4WxBcwnlmED01
 sBEBxXAtXUyNbczHSz2NeLXuccPhjJc8Y1c4FnGxofv0NcCMKWNR78IPr/9nYlMY
 NYLnMSqvSKEcNJ2oCniGjH851xt+lvwFJujw+0rvREj7zVg2SiO/iemrLXJO0jPs
 43pjY9s/xTzRFIDMa0w0OpCG+CIjzy/Vd3DUkt6BwPH43iEQhx7grLpgv1dA5dfr
 hGOmrbjxvhr+e4+f+GSXgVt+8zPiOOG217EIJ9O0TPsLjuocZuO2ecE/RR+byB2H
 Y+p8L+hEUooVAc8/t2ylQB5QQVw3EI3d0z04RF5wB8gGujjAF3FNl0xGFarnUYM1
 tzLmAO6D07xNAU2KdhiBLgnuCZ1YHNvVlsFWfXDt6K91xz/T/EpYpR0vu8lLZANa
 f7FHfFoS3F6wYZFWmpn+SYgh18OGDFzfItLtv83VQWQiiala4cg=
 =nxTp
 -----END PGP SIGNATURE-----

Merge tag 'ib-mfd-gpio-pwm-v6.12' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git/lee/mfd into gpio/for-next

Immutable branch between MFD, GPIO and PWM due for the v6.12 merge window
2024-08-19 10:13:05 +02:00
Krzysztof Kozlowski
f2c38c96d5 gpio: of: simplify with scoped for each OF child loop
Use scoped for_each_xxx loop when iterating over device nodes to make
code a bit simpler.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20240816151356.154991-1-krzysztof.kozlowski@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-08-19 10:07:26 +02:00
Asmaa Mnebhi
aad4183232 gpio: mlxbf3: Support shutdown() function
During Linux graceful reboot, the GPIO interrupts are not disabled.
Since the drivers are not removed during graceful reboot,
the logic to call mlxbf3_gpio_irq_disable() is not triggered.
Interrupts that remain enabled can cause issues on subsequent boots.

For example, the mlxbf-gige driver contains PHY logic to bring up the link.
If the gpio-mlxbf3 driver loads first, the mlxbf-gige driver
will use a GPIO interrupt to bring up the link.
Otherwise, it will use polling.
The next time Linux boots and loads the drivers in this order, we encounter the issue:
- mlxbf-gige loads first and uses polling while the GPIO10
  interrupt is still enabled from the previous boot. So if
  the interrupt triggers, there is nothing to clear it.
- gpio-mlxbf3 loads.
- i2c-mlxbf loads. The interrupt doesn't trigger for I2C
  because it is shared with the GPIO interrupt line which
  was not cleared.

The solution is to add a shutdown function to the GPIO driver to clear and disable
all interrupts. Also clear the interrupt after disabling it in mlxbf3_gpio_irq_disable().

Fixes: 38a700efc5 ("gpio: mlxbf3: Add gpio driver support")
Signed-off-by: Asmaa Mnebhi <asmaa@nvidia.com>
Reviewed-by: David Thompson <davthompson@nvidia.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20240611171509.22151-1-asmaa@nvidia.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-08-10 21:35:16 +02:00