Commit Graph

6121 Commits

Author SHA1 Message Date
Johan Hovold
604888f8c3 gpiolib: fix debugfs dangling chip separator
Add the missing newline after entries for recently removed gpio chips
so that the chip sections are separated by a newline as intended.

Fixes: e348544f79 ("gpio: protect the list of GPIO devices with SRCU")
Cc: stable@vger.kernel.org	# 6.9
Cc: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Link: https://lore.kernel.org/r/20241028125000.24051-3-johan+linaro@kernel.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-10-31 19:14:17 +01:00
Johan Hovold
3e8b7238b4 gpiolib: fix debugfs newline separators
The gpiolib debugfs interface exports a list of all gpio chips in a
system and the state of their pins.

The gpio chip sections are supposed to be separated by a newline
character, but a long-standing bug prevents the separator from
being included when output is generated in multiple sessions, making the
output inconsistent and hard to read.

Make sure to only suppress the newline separator at the beginning of the
file as intended.

Fixes: f9c4a31f61 ("gpiolib: Use seq_file's iterator interface")
Cc: stable@vger.kernel.org	# 3.7
Cc: Thierry Reding <treding@nvidia.com>
Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
Link: https://lore.kernel.org/r/20241028125000.24051-2-johan+linaro@kernel.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-10-31 19:14:17 +01:00
Andy Shevchenko
90bad74985 gpio: sloppy-logic-analyzer: Check for error code from devm_mutex_init() call
Even if it's not critical, the avoidance of checking the error code
from devm_mutex_init() call today diminishes the point of using devm
variant of it. Tomorrow it may even leak something. Add the missed
check.

Fixes: 7828b7bbbf ("gpio: add sloppy logic analyzer using polling")
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20241030174132.2113286-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-10-31 13:48:25 +01:00
Suraj Sonawane
a14968aea6 gpio: fix uninit-value in swnode_find_gpio
Fix an issue detected by the Smatch tool:

drivers/gpio/gpiolib-swnode.c:78 swnode_find_gpio() error:
uninitialized symbol 'ret'.

The issue occurs because the 'ret' variable may be used without
initialization if the for_each_gpio_property_name loop does not run.
This could lead to returning an undefined value, causing unpredictable
behavior.

Initialize 'ret' to 0 before the loop to ensure the function
returns an error code if no properties are parsed, maintaining proper
error handling.

Fixes: 9e4c6c1ad ("Merge tag 'io_uring-6.12-20241011' of git://git.kernel.dk/linux")
Signed-off-by: Suraj Sonawane <surajsonawane0215@gmail.com>
Link: https://lore.kernel.org/r/20241026090642.28633-1-surajsonawane0215@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-10-31 13:39:25 +01:00
Billy Tsai
a6191a3d18 gpio: aspeed: Use devm_clk api to manage clock source
Replace of_clk_get with devm_clk_get_enabled to manage the clock source.

Fixes: 5ae4cb94b3 ("gpio: aspeed: Add debounce support")
Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au>
Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
Link: https://lore.kernel.org/r/20241008081450.1490955-3-billy_tsai@aspeedtech.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-10-08 16:01:58 +02:00
Billy Tsai
1bb5a99e1f gpio: aspeed: Add the flush write to ensure the write complete.
Performing a dummy read ensures that the register write operation is fully
completed, mitigating any potential bus delays that could otherwise impact
the frequency of bitbang usage. E.g., if the JTAG application uses GPIO to
control the JTAG pins (TCK, TMS, TDI, TDO, and TRST), and the application
sets the TCK clock to 1 MHz, the GPIO's high/low transitions will rely on
a delay function to ensure the clock frequency does not exceed 1 MHz.
However, this can lead to rapid toggling of the GPIO because the write
operation is POSTed and does not wait for a bus acknowledgment.

Fixes: 361b79119a ("gpio: Add Aspeed driver")
Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au>
Signed-off-by: Billy Tsai <billy_tsai@aspeedtech.com>
Link: https://lore.kernel.org/r/20241008081450.1490955-2-billy_tsai@aspeedtech.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-10-08 16:01:58 +02:00
Lad Prabhakar
7b99b5ab88 gpiolib: Fix potential NULL pointer dereference in gpiod_get_label()
In `gpiod_get_label()`, it is possible that `srcu_dereference_check()` may
return a NULL pointer, leading to a scenario where `label->str` is accessed
without verifying if `label` itself is NULL.

This patch adds a proper NULL check for `label` before accessing
`label->str`. The check for `label->str != NULL` is removed because
`label->str` can never be NULL if `label` is not NULL.

This fixes the issue where the label name was being printed as `(efault)`
when dumping the sysfs GPIO file when `label == NULL`.

Fixes: 5a646e03e9 ("gpiolib: Return label, if set, for IRQ only line")
Fixes: a86d276930 ("gpiolib: fix the speed of descriptor label setting with SRCU")
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Link: https://lore.kernel.org/r/20241003131351.472015-1-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-10-03 20:51:47 +02:00
Vignesh Raghavendra
5a431e50e9 gpio: davinci: Fix condition for irqchip registration
Since commit d29e741cad ("gpio: davinci: drop platform data support"),
irqchip is no longer being registered on platforms what don't use
unbanked gpios. Fix this.

Reported-by: Sabeeh Khan <sabeeh-khan@ti.com>
Fixes: d29e741cad ("gpio: davinci: drop platform data support")
Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
Link: https://lore.kernel.org/r/20241002071901.2752757-1-vigneshr@ti.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-10-02 12:24:37 +02:00
Emanuele Ghidoli
3360d41f4a gpio: davinci: fix lazy disable
On a few platforms such as TI's AM69 device, disable_irq() fails to keep
track of the interrupts that happen between disable_irq() and
enable_irq() and those interrupts are missed. Use the ->irq_unmask() and
->irq_mask() methods instead of ->irq_enable() and ->irq_disable() to
correctly keep track of edges when disable_irq is called.

This solves the issue of disable_irq() not working as expected on such
platforms.

Fixes: 23265442b0 ("ARM: davinci: irq_data conversion.")
Signed-off-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>
Signed-off-by: Parth Pancholi <parth.pancholi@toradex.com>
Acked-by: Keerthy <j-keerthy@ti.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20240828133207.493961-1-parth105105@gmail.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
2024-09-30 13:52:50 +02:00
Al Viro
cb787f4ac0 [tree-wide] finally take no_llseek out
no_llseek had been defined to NULL two years ago, in commit 868941b144
("fs: remove no_llseek")

To quote that commit,

  At -rc1 we'll need do a mechanical removal of no_llseek -

  git grep -l -w no_llseek | grep -v porting.rst | while read i; do
	sed -i '/\<no_llseek\>/d' $i
  done

  would do it.

Unfortunately, that hadn't been done.  Linus, could you do that now, so
that we could finally put that thing to rest? All instances are of the
form
	.llseek = no_llseek,
so it's obviously safe.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-09-27 08:18:43 -07:00
Linus Torvalds
075dbe9f6e soc: convert ep93xx to devicetree
This concludes a long journey towards replacing the old
 board files with devictree description on the Cirrus Logic
 EP93xx platform.
 
 Nikita Shubin has been working on this for a long time,
 for details see the last post on
 https://lore.kernel.org/lkml/20240909-ep93xx-v12-0-e86ab2423d4b@maquefel.me/
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEiK/NIGsWEZVxh/FrYKtH/8kJUicFAmb1croACgkQYKtH/8kJ
 UicY0g//XXEXcBgE2CLfKzGimN3gREIElEqFCpd7v32XWGIQNFdS7StiGqNx1MeU
 UYdILm97ldgpx+NnHd3Cb9HbLQ1CTIIvAZ2ngFLDeeZO+wgzBVxWTrdUUp57ZIBn
 5Fq0hNaR1bfqSr+J+ZbgizH5N96EvLr3OPz/eJetY7egVBUID/0OpwssPJxW1Ns0
 f+W+yIc7BomVa71xGgI+RkHrG/5DSaoFtrB+ESt7q1nNUIeMn32JqBYqE0U2iCRN
 ADO8I+WfAjIcO1uN5n3KM3tigZI3GKSrBdllByr8wWNbp9l5rMYfFAPEaI109iyI
 7PFrB6qhAlY9LckXMNhwLyjlnWt6qrI0B+tyg+3tW6+4OwFnpPN0cIhszFPOmrhv
 njsDSvybp0q9V6Mn7f394H6v9sk9RHr68mpu12hO65UBP7Qe7mrdl3snnFcm0FHL
 jCLnvjdmCSqRlV6YFsKDHuDzZOG88sAwH0mySKd3c/CVvgaNDsaJduelPGpuXlXX
 P7op6D8kyKFKfmwK0kz3t+3+2ozgYq3nu4amI7rJ72MOvJKBocTwwqpAesIuegde
 bn3ZN30yZDTbfEFuveOAzx7rqDlZYX/tN0uspL4VBN0rdayxBng5hneV2PypTtW0
 wE9ptz5qIz8AssJ7NInwpgRTDjEut4SY3m3CS2/66V08B4EznAA=
 =Y3Cd
 -----END PGP SIGNATURE-----

Merge tag 'soc-ep93xx-dt-6.12' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc

Pull SoC update from Arnd Bergmann:
 "Convert ep93xx to devicetree

  This concludes a long journey towards replacing the old board files
  with devictree description on the Cirrus Logic EP93xx platform.

  Nikita Shubin has been working on this for a long time, for details
  see the last post on

    https://lore.kernel.org/lkml/20240909-ep93xx-v12-0-e86ab2423d4b@maquefel.me/"

* tag 'soc-ep93xx-dt-6.12' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc: (47 commits)
  dt-bindings: gpio: ep9301: Add missing "#interrupt-cells" to examples
  MAINTAINERS: Update EP93XX ARM ARCHITECTURE maintainer
  soc: ep93xx: drop reference to removed EP93XX_SOC_COMMON config
  net: cirrus: use u8 for addr to calm down sparse
  dmaengine: cirrus: use snprintf() to calm down gcc 13.3.0
  dmaengine: ep93xx: Fix a NULL vs IS_ERR() check in probe()
  pinctrl: ep93xx: Fix raster pins typo
  spi: ep93xx: update kerneldoc comments for ep93xx_spi
  clk: ep93xx: Fix off by one in ep93xx_div_recalc_rate()
  clk: ep93xx: add module license
  dmaengine: cirrus: remove platform code
  ASoC: cirrus: edb93xx: Delete driver
  ARM: ep93xx: soc: drop defines
  ARM: ep93xx: delete all boardfiles
  ata: pata_ep93xx: remove legacy pinctrl use
  pwm: ep93xx: drop legacy pinctrl
  ARM: ep93xx: DT for the Cirrus ep93xx SoC platforms
  ARM: dts: ep93xx: Add EDB9302 DT
  ARM: dts: ep93xx: add ts7250 board
  ARM: dts: add Cirrus EP93XX SoC .dtsi
  ...
2024-09-26 12:00:25 -07:00
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
Nikita Shubin
8f67b1f028 gpio: ep93xx: add DT support for gpio-ep93xx
Add OF ID match table.

Signed-off-by: Nikita Shubin <nikita.shubin@maquefel.me>
Tested-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Mark Brown <broonie@kernel.org>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Acked-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2024-09-12 14:33:11 +00:00
Nikita Shubin
cbe8e464eb gpio: ep93xx: split device in multiple
Prepare ep93xx SOC gpio to convert into device tree driver:
- dropped banks and legacy defines
- split AB IRQ and make it shared

We are relying on IRQ number information A, B ports have single shared
IRQ, while F port have dedicated IRQ for each line.

Also we had to split single ep93xx platform_device into multiple, one
for each port, without this we can't do a full working transition from
legacy platform code into device tree capable. All GPIO_LOOKUP were
change to match new chip namings.

Signed-off-by: Nikita Shubin <nikita.shubin@maquefel.me>
Tested-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>
Acked-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2024-09-12 14:33:10 +00: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