Commit Graph

932749 Commits

Author SHA1 Message Date
Linus Walleij
4672a4a9fb Merge branch 'devel' into for-next 2020-07-09 17:06:28 +02:00
Linus Walleij
a6175e894d Merge branch 'lee-fixes' into devel 2020-07-08 09:24:37 +02:00
Lee Jones
a7a9ad232f gpio: gpio-mlxbf2.c: Provide __releases() annotation to stop confusing Sparse
Sparse cannot peer into other functions to see when and if locks are
acquired and released, thus it simply warns that a 'context imbalance'
is detected instead.  Let's be kind to Sparse and let it know that
this behaviour is intentional.

 drivers/gpio/gpio-mlxbf2.c:125:12: warning: context imbalance in 'mlxbf2_gpio_lock_acquire' - different lock contexts for basic block
 drivers/gpio/gpio-mlxbf2.c:151:13: warning: context imbalance in 'mlxbf2_gpio_lock_release' - unexpected unlock

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Asmaa Mnebhi <asmaa@mellanox.com>
Cc: Asmaa Mnebhi <Asmaa@mellanox.com>
Link: https://lore.kernel.org/r/20200630133345.2232932-11-lee.jones@linaro.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-07-08 09:24:08 +02:00
Lee Jones
2f9bce5f38 gpio: gpio-mlxbf2: Tell the compiler that ACPI functions may not be use
... as is the case when !CONFIG_ACPI.

Fixes the following W=1 kernel build warning:

 drivers/gpio/gpio-mlxbf2.c:312:36: warning: ‘mlxbf2_gpio_acpi_match’ defined but not used [-Wunused-const-variable=]
 312 | static const struct acpi_device_id mlxbf2_gpio_acpi_match[] = {
 | ^~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Asmaa Mnebhi <asmaa@mellanox.com>
Cc: Asmaa Mnebhi <Asmaa@mellanox.com>
Link: https://lore.kernel.org/r/20200630133345.2232932-10-lee.jones@linaro.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-07-08 09:24:08 +02:00
Lee Jones
6ac2de953b gpio: gpio-mlxbf: Tell the compiler that ACPI functions may not be used
... as is the case when !CONFIG_ACPI.

Fixes the following W=1 kernel build warning:

 drivers/gpio/gpio-mlxbf.c:130:36: warning: ‘mlxbf_gpio_acpi_match’ defined but not used [-Wunused-const-variable=]
 130 | static const struct acpi_device_id mlxbf_gpio_acpi_match[] = {
 | ^~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Cc: Shravan Kumar Ramani <sramani@mellanox.com>
Link: https://lore.kernel.org/r/20200630133345.2232932-9-lee.jones@linaro.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-07-08 09:24:08 +02:00
Lee Jones
4e2912901e gpio: gpio-it87: Fix formatting issues which confuse kerneldoc
Kerneldoc expects struct properties to be documented using the syntax
'@.*: ', but no ':' has been provided in 'struct it87_gpio's
header.  Add them to stop confusing kerneldoc.

Fixes the following W=1 warnings:

 drivers/gpio/gpio-it87.c:69: warning: Function parameter or member 'chip' not described in 'it87_gpio'
 drivers/gpio/gpio-it87.c:69: warning: Function parameter or member 'lock' not described in 'it87_gpio'
 drivers/gpio/gpio-it87.c:69: warning: Function parameter or member 'io_base' not described in 'it87_gpio'
 drivers/gpio/gpio-it87.c:69: warning: Function parameter or member 'io_size' not described in 'it87_gpio'
 drivers/gpio/gpio-it87.c:69: warning: Function parameter or member 'output_base' not described in 'it87_gpio'
 drivers/gpio/gpio-it87.c:69: warning: Function parameter or member 'simple_base' not described in 'it87_gpio'
 drivers/gpio/gpio-it87.c:69: warning: Function parameter or member 'simple_size' not described in 'it87_gpio'

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Cc: "Diego Elio Pettenò" <flameeyes@flameeyes.eu>
Link: https://lore.kernel.org/r/20200630133345.2232932-8-lee.jones@linaro.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-07-08 09:24:08 +02:00
Lee Jones
5f3beb67b5 gpio: gpio-syscon: Fix formatting issues which confuse kerneldoc
Kerneldoc expects struct properties to be documented using the syntax
'@.*: ', but no '@' has been provided in 'struct syscon_gpio_data's
header.  Add them to stop confusing kerneldoc.

Fixes the following W=1 warnings:

 drivers/gpio/gpio-syscon.c:48: warning: Function parameter or member 'compatible' not described in 'syscon_gpio_data'
 drivers/gpio/gpio-syscon.c:48: warning: Function parameter or member 'flags' not described in 'syscon_gpio_data'
 drivers/gpio/gpio-syscon.c:48: warning: Function parameter or member 'bit_count' not described in 'syscon_gpio_data'
 drivers/gpio/gpio-syscon.c:48: warning: Function parameter or member 'dat_bit_offset' not described in 'syscon_gpio_data'
 drivers/gpio/gpio-syscon.c:48: warning: Function parameter or member 'dir_bit_offset' not described in 'syscon_gpio_data'
 drivers/gpio/gpio-syscon.c:48: warning: Function parameter or member 'set' not described in 'syscon_gpio_data'

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Cc: Alexander Shiyan <shc_work@mail.ru>
Link: https://lore.kernel.org/r/20200630133345.2232932-7-lee.jones@linaro.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-07-08 09:24:08 +02:00
Lee Jones
392a584698 gpio: gpio-sama5d2-piobu: Demote all kerneldoc headers to basic comment blocks
No attempt has been made to provide proper descriptions for each of
the function arguments throughout the file.  Simply demote all
kerneldoc headers to basic function headers.

Fixes the following W=1 kernel build warnings:

 drivers/gpio/gpio-sama5d2-piobu.c:59: warning: Function parameter or member 'chip' not described in 'sama5d2_piobu_setup_pin'
 drivers/gpio/gpio-sama5d2-piobu.c:59: warning: Function parameter or member 'pin' not described in 'sama5d2_piobu_setup_pin'
 drivers/gpio/gpio-sama5d2-piobu.c:81: warning: Function parameter or member 'chip' not described in 'sama5d2_piobu_write_value'
 drivers/gpio/gpio-sama5d2-piobu.c:81: warning: Function parameter or member 'pin' not described in 'sama5d2_piobu_write_value'
 drivers/gpio/gpio-sama5d2-piobu.c:81: warning: Function parameter or member 'mask' not described in 'sama5d2_piobu_write_value'
 drivers/gpio/gpio-sama5d2-piobu.c:81: warning: Function parameter or member 'value' not described in 'sama5d2_piobu_write_value'
 drivers/gpio/gpio-sama5d2-piobu.c:97: warning: Function parameter or member 'chip' not described in 'sama5d2_piobu_read_value'
 drivers/gpio/gpio-sama5d2-piobu.c:97: warning: Function parameter or member 'pin' not described in 'sama5d2_piobu_read_value'
 drivers/gpio/gpio-sama5d2-piobu.c:97: warning: Function parameter or member 'mask' not described in 'sama5d2_piobu_read_value'
 drivers/gpio/gpio-sama5d2-piobu.c:116: warning: Function parameter or member 'chip' not described in 'sama5d2_piobu_get_direction'
 drivers/gpio/gpio-sama5d2-piobu.c:116: warning: Function parameter or member 'pin' not described in 'sama5d2_piobu_get_direction'
 drivers/gpio/gpio-sama5d2-piobu.c:131: warning: Function parameter or member 'chip' not described in 'sama5d2_piobu_direction_input'
 drivers/gpio/gpio-sama5d2-piobu.c:131: warning: Function parameter or member 'pin' not described in 'sama5d2_piobu_direction_input'
 drivers/gpio/gpio-sama5d2-piobu.c:140: warning: Function parameter or member 'chip' not described in 'sama5d2_piobu_direction_output'
 drivers/gpio/gpio-sama5d2-piobu.c:140: warning: Function parameter or member 'pin' not described in 'sama5d2_piobu_direction_output'
 drivers/gpio/gpio-sama5d2-piobu.c:140: warning: Function parameter or member 'value' not described in 'sama5d2_piobu_direction_output'
 drivers/gpio/gpio-sama5d2-piobu.c:154: warning: Function parameter or member 'chip' not described in 'sama5d2_piobu_get'
 drivers/gpio/gpio-sama5d2-piobu.c:154: warning: Function parameter or member 'pin' not described in 'sama5d2_piobu_get'
 drivers/gpio/gpio-sama5d2-piobu.c:174: warning: Function parameter or member 'chip' not described in 'sama5d2_piobu_set'
 drivers/gpio/gpio-sama5d2-piobu.c:174: warning: Function parameter or member 'pin' not described in 'sama5d2_piobu_set'
 drivers/gpio/gpio-sama5d2-piobu.c:174: warning: Function parameter or member 'value' not described in 'sama5d2_piobu_set'

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Cc: Ludovic Desroches <ludovic.desroches@microchip.com>
Cc: Andrei Stefanescu <andrei.stefanescu@microchip.com>
Link: https://lore.kernel.org/r/20200630133345.2232932-6-lee.jones@linaro.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-07-08 09:24:07 +02:00
Lee Jones
3cd7f770fe gpio: gpio-pmic-eic-sprd: Fix incorrectly named property 'map'
A good attempt has been made to properly document 'struct
sprd_pmic_eic', but 'map' has been incorrectly described as
'regmap' since the driver's inception in 2018.

Fixes the following W=1 kernel build warning:

 drivers/gpio/gpio-pmic-eic-sprd.c:65: warning: Function parameter or member 'map' not described in 'sprd_pmic_eic'

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Reviewed-by: Baolin Wang <baolin.wang7@gmail.com>
Cc: Orson Zhai <orsonzhai@gmail.com>
Cc: Baolin Wang <baolin.wang7@gmail.com>
Cc: Chunyan Zhang <zhang.lyra@gmail.com>
Link: https://lore.kernel.org/r/20200630133345.2232932-5-lee.jones@linaro.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-07-08 09:24:07 +02:00
Lee Jones
670647d7c4 gpio: gpio-altera: Add missing kerneldoc entry and demote comment
'struct altera_gpio_chip's 'irq_chip' property is undocumented.  So
add property description to the struct's kerneldoc header.  Also
demote comment block which is clearly not in kerneldoc format.

Fixes the following W=1 warnings:

 drivers/gpio/gpio-altera.c:34: warning: Function parameter or member 'irq_chip' not described in 'altera_gpio_chip'
 drivers/gpio/gpio-altera.c:78: warning: Function parameter or member 'd' not described in 'altera_gpio_irq_set_type'
 drivers/gpio/gpio-altera.c:78: warning: Function parameter or member 'type' not described in 'altera_gpio_irq_set_type'

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Cc: Joyce Ooi <joyce.ooi@intel.com>
Cc: Tien Hock Loh <thloh@altera.com>
Link: https://lore.kernel.org/r/20200630133345.2232932-3-lee.jones@linaro.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-07-08 09:24:07 +02:00
Lee Jones
c5a66b970a gpio: gpiolib-of: Provide documentation for of_gpio_spi_cs_get_count()
Descriptions for of_gpio_spi_cs_get_count()'s 2 arguments are
missing.  Document both 'dev' and 'con_id'.

Fixes the following W=1 kernel build warnings:

 drivers/gpio/gpiolib-of.c:36: warning: Function parameter or member 'dev' not described in 'of_gpio_spi_cs_get_count'
 drivers/gpio/gpiolib-of.c:36: warning: Function parameter or member 'con_id' not described in 'of_gpio_spi_cs_get_count'

Signed-off-by: Lee Jones <lee.jones@linaro.org>
Cc: Anton Vorontsov <avorontsov@ru.mvista.com>
Link: https://lore.kernel.org/r/20200630133345.2232932-2-lee.jones@linaro.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-07-08 09:24:07 +02:00
Geert Uytterhoeven
ec75039d55 gpio: aggregator: Use bitmap_parselist() for parsing GPIO offsets
Replace the custom code to parse GPIO offsets and/or GPIO offset ranges
by a call to bitmap_parselist(), and an iteration over the returned bit
mask.

This should have no impact on the format of the configuration parameters
written to the "new_device" virtual file in sysfs.

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20200701114212.8520-3-geert+renesas@glider.be
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-07-07 14:30:27 +02:00
Geert Uytterhoeven
2073ea3ab1 gpio: aggregator: Drop pre-initialization in get_arg()
In get_arg(), the variable start is pre-initialized, but overwritten
again in the first statement.  Rework the assignment to not rely on
pre-initialization, to make the code easier to read.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/r/20200701114212.8520-2-geert+renesas@glider.be
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-07-07 14:30:27 +02:00
Linus Walleij
8cbdc5045d gpio: Add gpio-charger to the documentation
The GPIO-based charger is another of the helpful devices built
on top of GPIO.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Cc: Sebastian Reichel <sebastian.reichel@collabora.com>
Link: https://lore.kernel.org/r/20200620201248.28843-1-linus.walleij@linaro.org
2020-07-07 13:52:33 +02:00
Linus Walleij
b239e4454e gpio updates for v5.9
- use kobj_to_dev() in sysfs interface
 - kerneldoc and documentation fixes
 - relax the interrupt flags in gpio-mpc8xxx
 - support new model in gpio-pca953x
 - remove a redundant check from gpio-max732x
 - support a new platform in gpio-zynq (+ some minor fixes)
 - don't depend on GPIOLIB when already inside the "if GPIOLIB" in Kconfig
 - support PM ops for suspend in gpio-omap
 - minor tweaks in gpiolib
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEFp3rbAvDxGAT0sefEacuoBRx13IFAl77GHcACgkQEacuoBRx
 13JBIQ/+PEo8o7hVqpXETQ3NYwoPC4Hov0sE3Ig/ecoAEmTG2FPXU/qcACiO4z64
 n9bXadS8iTPBHpblmbTx5MwzWk081GwSR+y3P8mxZUjO6FdVt8v/TZnkgMaat0cv
 xIM18MbBYzmlwNvpqaIHn7ZlC20mGHeFEBM600QIBkf5+fN0gCZF8cB62jqVZp2e
 rg1dzmdd7GWMXVIZ+D+XAdPuRsSDNBeGoQG/Ip4sio4VsU64FoSu279V3WGHFbHu
 2yfz4QxXOblhXRxT9swMtuPYAON8aai23YlcEDpt6K/j2TJtVibJRlRBDUQAYmNH
 K2XA7phKcEVCN47rG8XR9v2l5Qkf49eVCOS2Y0f6G+GL9KwezD2WZL/4d+Nyx7CZ
 YDSIM+ti0FHUb7b6wSFQHJbdKk2sdtqpYaakirNmRAPKPBT+rzyRaNx6XLu2/wMi
 CVC+LCdxdlsHpnPVcCTjNeGHmZrloDJiQb0A0kpZnPagHXrQaI5tw7OKDKoPi+DA
 bkYxW++Iq96QRjEvExu0V/3gRNWPjXpWd+sfMJ6b/Lb4orbmlnJcjgVDXDQvqj0N
 Oga87Mgg5U/pfPYvLvuxwwpMwp1QZv9ex8dG91M62V0Ta+Ja4nOdtpIERHEKKP6d
 ehKBXzU7F6tREIG3EU+DMm33RWRnM/DYrg7RnPgIHzxDB6Wj18c=
 =TwKk
 -----END PGP SIGNATURE-----

Merge tag 'gpio-updates-for-v5.9-part1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux into devel

gpio updates for v5.9

- use kobj_to_dev() in sysfs interface
- kerneldoc and documentation fixes
- relax the interrupt flags in gpio-mpc8xxx
- support new model in gpio-pca953x
- remove a redundant check from gpio-max732x
- support a new platform in gpio-zynq (+ some minor fixes)
- don't depend on GPIOLIB when already inside the "if GPIOLIB" in Kconfig
- support PM ops for suspend in gpio-omap
- minor tweaks in gpiolib
2020-06-30 23:53:11 +02:00
Andy Shevchenko
ae66eca000 gpiolib: Deduplicate find_first_zero_bit() call
bitmap_full() is a shortcut to find_first_zero_bit().
Thus, no need to call it twice.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-06-30 12:39:14 +02:00
Tony Lindgren
f02a03985d gpio: omap: Add missing PM ops for suspend
We've had the legacy platform code take care of suspend for us but
this no longer is the case when probed without legacy mode with
ti-sysc. We need to configure PM ops like standard Linux device
drivers do.

As we still have some SoCs booting also the legacy mode, we need to
add omap_gpio_suspend() and omap_gpio_resume(), and check for the
is_suspended flag to avoid legacy _od_suspend_noirq() calling them
on an already suspended GPIO instance.

Once we have no SoCs booting in legacy mode, we can just switch to
using the standard PM ops with pm_runtime_force_suspend() and
pm_runtime_force_resume().

Signed-off-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-06-30 11:02:45 +02:00
Linus Walleij
93e0272a43 gpio fixes for v5.8-rc3
- several fixes for gpio-pca953x
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEFp3rbAvDxGAT0sefEacuoBRx13IFAl70y50ACgkQEacuoBRx
 13JHERAApkTYdZoR3mA6BeG/bWv0FGlLUxf2kl/vKuznqli9fKZGAGBku1C5ozbN
 JyxC5ciKc5f9ha3fm8/Ib1Rm6Zc6uHf9D16kW+XvOYCQyCn9qgIIF99Nrcum766K
 07qrGZwloVCSGZK8F4Tp6WfmuiR2GXBB+FtWHGnETxzy53PzwoUceqlybRmzX0s0
 SuKPi0eNxhrsbEJ2b289Wo4734CAOkfAY/DnnA6n7SbeQumqLjCGLCr17jMVg9Y/
 DBlT2HZyppxwao5N/i6uLCU51mAcR6Ode3YAG0DBUUyVpFRRADeLhsyl2Xw4uxyZ
 Ky2ZBxxj0jiETer2h+eI4KVMksGShlnAZ8J6qFxaR23Ug2zGM+LYG40hh73NiFI2
 ef4WvCKkW21fMC20d1tarli5yFnA7kxyEuijeiSAzTwGtaKyq+CFrBns7RkW9Hhe
 jN3xPKGcka9hwopuKUUDko8CY3GsX7rK2vECXInx3s58NOhPner9iCHpoBdwW5qi
 j64wCqtj3X8gpyW9QGi1TlqebIC+nl/3SWs+PC3xkPIi1i1dQqUTpjOxlDtBZrSx
 c9ZnvL4mkYjOMe3hdSkM4QLX2zOUP1tjWMRC7RnsQqi4LP43anU3P1ZAjhIfTNP/
 /1I6m73LE1zYmlWpuG87OMc+GtV0EWrQ6zf21yTllvI8WtQIClQ=
 =Qg1z
 -----END PGP SIGNATURE-----

Merge tag 'gpio-fixes-for-v5.8-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux into fixes

gpio fixes for v5.8-rc3

- several fixes for gpio-pca953x
2020-06-26 23:53:25 +02:00
Geert Uytterhoeven
e4c6a52c64 gpio: Drop superfluous dependencies on GPIOLIB
All config options for GPIO drivers are inside a big "if GPIOLIB ...
endif" block, so there is no reason for individual config options to
have expicit dependencies on GPIOLIB.  Hence remove them.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-06-24 12:19:47 +02:00
Shubhrajyoti Datta
0077428118 gpio: zynq: Remove error prints in EPROBE_DEFER
In case of probe is deferred do not print the errors.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-06-24 12:17:12 +02:00
Shubhrajyoti Datta
73c612fe2a gpio: zynq: Add pmc gpio support
Add PMC gpio support.
Only bank 0,1, 3 and 4 are connected to the multiplexed Input output
pins. Bank 0 and 1 to mio and bank 3 and 4 to extended multiplexed input
output pins.

Versal devices are the industry's first adaptive compute
acceleration platforms.
https://www.xilinx.com/support/documentation/data_sheets/ds950-versal-overview.pdf

On the Versal platform, we are using two customized GPIO controllers(IP)
which were used in Zynq/ZynqMp platform.
One of them present in the Platform Management Controller(PMC) block and
other in Processing System(PS) block.

In PMC_GPIO only Bank0,1,3 & 4 are enabled and in PS_GPIO only
Bank 0 & 3 are enabled.

You can find more details of GPIO IP in ZynqMP TRM General Purpose
I/O(Chapter-27).
https://www.xilinx.com/support/documentation/user_guides/ug1085-zynq-ultrascale-trm.pdf

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-06-24 12:16:57 +02:00
Shubhrajyoti Datta
26ebdbf8c2 gpio: zynq: Disable the irq if it is not a wakeup source
If gpio is not set to wake disable the interrupt. ATF set all slaves with
enabled interrupts as wakeup sources and if gpio is used in r5 then it
wakes up linux.

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-06-24 12:16:39 +02:00
Shubhrajyoti Datta
675002448e gpio: zynq: Add Versal support
Add Versal support in gpio.
Only bank 0 and 3 are connected to the Multiplexed Input output pins.
Bank 0 to mio and bank3 to fabric Multiplexed input output pins.

Versal devices are the industry's first adaptive compute
acceleration platforms.
https://www.xilinx.com/support/documentation/data_sheets/ds950-versal-overview.pdf

On the Versal platform, we are using two customized GPIO controllers(IP)
which were used in Zynq/ZynqMp platform.
One of them present in the Platform Management Controller(PMC) block and
other in Processing System(PS) block.

In PMC_GPIO only Bank0,1,3 & 4 are enabled and in PS_GPIO only
Bank 0 & 3 are enabled.

You can find more details of GPIO IP in ZynqMP TRM General Purpose
I/O(Chapter-27).
https://www.xilinx.com/support/documentation/user_guides/ug1085-zynq-ultrascale-trm.pdf

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-06-24 12:15:50 +02:00
Shubhrajyoti Datta
c0178b8e24 dt-bindings: gpio: Add pmc gpio node to gpio-zynq
Add the pmc gpio node to the device tree.

Versal devices are the industry's first adaptive compute
acceleration platforms.
https://www.xilinx.com/support/documentation/data_sheets/ds950-versal-overview.pdf

On the Versal platform, we are using two customized GPIO controllers(IP)
which were used in Zynq/ZynqMp platform.
One of them present in the Platform Management Controller(PMC) block and
other in Processing System(PS) block.

In PMC_GPIO only Bank0,1,3 & 4 are enabled and in PS_GPIO only
Bank 0 & 3 are enabled.

You can find more details of GPIO IP in ZynqMP TRM General Purpose
I/O(Chapter-27).
https://www.xilinx.com/support/documentation/user_guides/ug1085-zynq-ultrascale-trm.pdf

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-06-24 12:11:31 +02:00
Shubhrajyoti Datta
3e1ad2b858 dt-bindings: gpio: Add binding for Versal gpio
Add binding for Versal binding.

Versal devices are the industry's first adaptive compute
acceleration platforms.
https://www.xilinx.com/support/documentation/data_sheets/ds950-versal-overview.pdf

On the Versal platform, we are using two customized GPIO controllers(IP)
which were used in Zynq/ZynqMp platform.
One of them present in the Platform Management Controller(PMC) block and
other in Processing System(PS) block.

In PMC_GPIO only Bank0,1,3 & 4 are enabled and in PS_GPIO only
Bank 0 & 3 are enabled.

You can find more details of GPIO IP in ZynqMP TRM General Purpose
I/O(Chapter-27).
https://www.xilinx.com/support/documentation/user_guides/ug1085-zynq-ultrascale-trm.pdf

Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-06-24 12:10:37 +02:00
Glenn Langedock
fdcfec11b2 gpio: zynq: protect direction in/out with a spinlock
Fix race condition when changing the direction (in/out) of the GPIO pin.
The read-modify-write sequence (as coded in the driver) isn't atomic and
requires synchronization (spinlock).

Signed-off-by: Glenn Langedock <Glenn.Langedock@barco.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Srinivas Neeli <srinivas.neeli@xilinx.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-06-24 12:10:09 +02:00
Andy Shevchenko
5d8913504c gpio: pca953x: Fix GPIO resource leak on Intel Galileo Gen 2
When adding a quirk for IRQ on Intel Galileo Gen 2 the commit ba8c90c618
("gpio: pca953x: Override IRQ for one of the expanders on Galileo Gen 2")
missed GPIO resource release. We can safely do this in the same quirk, since
IRQ will be locked by GPIO framework when requested and unlocked on freeing.

Fixes: ba8c90c618 ("gpio: pca953x: Override IRQ for one of the expanders on Galileo Gen 2")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-06-22 18:51:53 +02:00
Gaurav Singh
8346b92ecd gpio: max732x: remove redundant check from probe()
The pdata is already checked for its validity.
Remove the redundant check.

Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-06-22 18:50:01 +02:00
Linus Walleij
84651e81ee Merge branch 'ib-for-each-requested' into devel 2020-06-20 23:13:49 +02:00
Andy Shevchenko
5bae1f08e2 pinctrl: at91: Make use of for_each_requested_gpio()
Make use of for_each_requested_gpio() instead of home grown analogue.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Ludovic Desroches <ludovic.desroches@microchip.com>
Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20200615150545.87964-6-andriy.shevchenko@linux.intel.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-06-20 23:13:27 +02:00
Andy Shevchenko
7796cdc911 gpio: xra1403: Make use of for_each_requested_gpio()
Make use of for_each_requested_gpio() instead of home grown analogue.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Nandor Han <nandor.han@ge.com>
Cc: Semi Malinen <semi.malinen@ge.com>
Link: https://lore.kernel.org/r/20200615150545.87964-5-andriy.shevchenko@linux.intel.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-06-20 23:13:27 +02:00
Andy Shevchenko
86661fd7fa gpio: mvebu: Make use of for_each_requested_gpio()
Make use of for_each_requested_gpio() instead of home grown analogue.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Thierry Reding <thierry.reding@gmail.com>
Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Cc: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20200615150545.87964-4-andriy.shevchenko@linux.intel.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-06-20 23:13:27 +02:00
Andy Shevchenko
aed8fa1255 ARM/orion/gpio: Make use of for_each_requested_gpio()
Make use of for_each_requested_gpio() instead of home grown analogue.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: Gregory Clement <gregory.clement@bootlin.com>
Link: https://lore.kernel.org/r/20200615150545.87964-3-andriy.shevchenko@linux.intel.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-06-20 23:13:27 +02:00
Andy Shevchenko
b3337eb248 gpiolib: Introduce for_each_requested_gpio_in_range() macro
Introduce for_each_requested_gpio_in_range() macro which helps
to iterate over requested GPIO in a range. There are already
potential users of it, which are going to be converted
by the following patches.

For most of them for_each_requested_gpio() shortcut has been added.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20200615150545.87964-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-06-20 23:13:26 +02:00
Kent Gibson
925ca36913 gpiolib: split character device into gpiolib-cdev
Split the cdev specific functionality out of gpiolib.c and into
gpiolib-cdev.c. This improves the readability and maintainability of both
the cdev and core gpiolib code.

Suggested-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Link: https://lore.kernel.org/r/20200616093615.5167-1-warthog618@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-06-20 22:38:37 +02:00
Gaurav Singh
1f6bd574e9 gpio: max732x: remove redundant check
The pdata is already checked for its validity. Remove
this redundant check.

Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
Link: https://lore.kernel.org/r/20200610113630.11922-1-gaurav1086@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-06-20 22:15:39 +02:00
Andy Shevchenko
ec3decd213 gpio: pca953x: disable regmap locking for automatic address incrementing
It's a repetition of the commit aa58a21ae3
  ("gpio: pca953x: disable regmap locking")
which states the following:

  This driver uses its own locking but regmap silently uses
  a mutex for all operations too. Add the option to disable
  locking to the regmap config struct.

Fixes: bcf41dc480 ("gpio: pca953x: fix handling of automatic address incrementing")
Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-06-16 11:22:56 +02:00
Andy Shevchenko
0b22c25e1b gpio: pca953x: Fix direction setting when configure an IRQ
The commit 0f25fda840 ("gpio: pca953x: Zap ad-hoc reg_direction cache")
seems inadvertently made a typo in pca953x_irq_bus_sync_unlock().

When the direction bit is 1 it means input, and the piece of code in question
was looking for output ones that should be turned to inputs.

Fix direction setting when configure an IRQ by injecting a bitmap complement
operation.

Fixes: 0f25fda840 ("gpio: pca953x: Zap ad-hoc reg_direction cache")
Depends-on: 35d13d9489 ("gpio: pca953x: convert to use bitmap API")
Cc: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-06-16 11:22:41 +02:00
Andy Shevchenko
ba8c90c618 gpio: pca953x: Override IRQ for one of the expanders on Galileo Gen 2
ACPI table on Intel Galileo Gen 2 has wrong pin number for IRQ resource
of one of the I²C GPIO expanders. Since we know what that number is and
luckily have GPIO bases fixed for SoC's controllers, we may use a simple
DMI quirk to match the platform and retrieve GpioInt() pin on it for
the expander in question.

Mika suggested the way to avoid a quirk in the GPIO ACPI library and
here is the second, almost rewritten version of it.

Fixes: f32517bf1a ("gpio: pca953x: support ACPI devices found on Galileo Gen2")
Depends-on: 25e3ef894e ("gpio: acpi: Split out acpi_gpio_get_irq_resource() helper")
Suggested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-06-16 11:22:20 +02:00
Andy Shevchenko
064c73afe7 gpio: pca953x: Synchronize interrupt handler properly
Since the commit aa58a21ae3 ("gpio: pca953x: disable regmap locking")
the locking of regmap is disabled and that immediately introduces
a synchronization issue. It's easy to see when we try to monitor
more than one interrupt from the same chip.

It seems that the problem exists from the day one and even commit
6e20fb1805 ("drivers/gpio/pca953x.c: add a mutex to fix race condition")
missed this.

Below are the traces and shell reproducers before and after proposed change.
Note duplicates in the IRQ events. /proc/interrupts also shows a deviation,
i.e. sum of children interrupts higher than parent's one.

When locking is disabled for regmap and no protection in IRQ handler
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ...
 gpioset-194          regmap_hw_write_start: i2c-INT3491:02 reg=2 count=1
 irq/31-i2c-INT3-139  regmap_hw_read_start: i2c-INT3491:02 reg=4c count=2
 gpioset-194          regmap_hw_write_done: i2c-INT3491:02 reg=2 count=1
 gpioset-194          regmap_reg_read_cache: i2c-INT3491:02 reg=6 val=f5
 gpioset-194          regmap_reg_write: i2c-INT3491:02 reg=6 val=f5
 gpioset-194          regmap_hw_write_start: i2c-INT3491:02 reg=6 count=1
 irq/31-i2c-INT3-139  regmap_hw_read_done: i2c-INT3491:02 reg=4c count=2
 ...

 % gpiomon gpiochip3 0 &
 % gpioset gpiochip3 1=0
 % gpioset gpiochip3 1=1
 event:  RISING EDGE offset: 0 timestamp: [     302.782583765]
 % gpiomon gpiochip3 2 &
 % gpioset gpiochip3 1=0
 event:  RISING EDGE offset: 2 timestamp: [     312.033148829]
 event: FALLING EDGE offset: 0 timestamp: [     312.022757525]
 % gpioset gpiochip3 1=1
 event:  RISING EDGE offset: 2 timestamp: [     316.201148473]
 event:  RISING EDGE offset: 0 timestamp: [     316.191759599]

When locking is disabled for regmap and protection in IRQ handler
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 ...
 gpioset-202          regmap_hw_write_start: i2c-INT3491:02 reg=2 count=1
 gpioset-202          regmap_hw_write_done: i2c-INT3491:02 reg=2 count=1
 gpioset-202          regmap_reg_read_cache: i2c-INT3491:02 reg=6 val=fd
 gpioset-202          regmap_reg_write: i2c-INT3491:02 reg=6 val=fd
 gpioset-202          regmap_hw_write_start: i2c-INT3491:02 reg=6 count=1
 gpioset-202          regmap_hw_write_done: i2c-INT3491:02 reg=6 count=1
 irq/31-i2c-INT3-139  regmap_hw_read_start: i2c-INT3491:02 reg=4c count=2
 irq/31-i2c-INT3-139  regmap_hw_read_done: i2c-INT3491:02 reg=4c count=2
 ...

 % gpiomon gpiochip3 0 &
 % gpioset gpiochip3 1=0
 event: FALLING EDGE offset: 0 timestamp: [     531.330078107]
 % gpioset gpiochip3 1=1
 event:  RISING EDGE offset: 0 timestamp: [     532.912239128]
 % gpiomon gpiochip3 2 &
 % gpioset gpiochip3 1=0
 event: FALLING EDGE offset: 0 timestamp: [     539.633669484]
 % gpioset gpiochip3 1=1
 event:  RISING EDGE offset: 0 timestamp: [     542.256978461]

Fixes: 6e20fb1805 ("drivers/gpio/pca953x.c: add a mutex to fix race condition")
Depends-on: 35d13d9489 ("gpio: pca953x: convert to use bitmap API")
Depends-on: 4942723276 ("gpio: pca953x: Perform basic regmap conversion")
Cc: Marek Vasut <marek.vasut@gmail.com>
Cc: Roland Stigge <stigge@antcom.de>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-06-16 11:21:51 +02:00
Jan Kiszka
3ba3ff5c09 gpio: pca953x: Add support for the PCAL9535
The PCAL9535 is compatible to the PCA9535. Additionally, it comes with
interrupt support and input latching. Other features are not supported
by the GPIO subsystem.

Datasheet: https://www.nxp.com/docs/en/data-sheet/PCAL9535A.pdf
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-06-16 10:49:18 +02:00
Jan Kiszka
ee0f054fb5 dt-bindings: gpio: pca953x: add nxp,pcal9535
The NXP PCAL9535 is an extended variant of the PCA9535.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-06-16 10:49:04 +02:00
Navid Emamdoost
861254d826 gpio: arizona: put pm_runtime in case of failure
Calling pm_runtime_get_sync increments the counter even in case of
failure, causing incorrect ref count if pm_runtime_put is not called in
error handling paths. Call pm_runtime_put if pm_runtime_get_sync fails.

Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20200605030052.78235-1-navid.emamdoost@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-06-16 10:38:07 +02:00
Navid Emamdoost
e6f390a834 gpio: arizona: handle pm_runtime_get_sync failure case
Calling pm_runtime_get_sync increments the counter even in case of
failure, causing incorrect ref count. Call pm_runtime_put if
pm_runtime_get_sync fails.

Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20200605025207.65719-1-navid.emamdoost@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-06-16 10:38:07 +02:00
Kieran Bingham
3abda79aa1 drivers: gpio: Fix trivial spelling
The word 'descriptor' is misspelled throughout the tree.

Fix it up accordingly:
    decriptors -> descriptors

Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-06-15 10:15:29 +02:00
Song Hui
3d5bfbd971 gpio: mpc8xxx: change the gpio interrupt flags.
Delete the interrupt IRQF_NO_THREAD flags in order to gpio interrupts
can be threaded to allow high-priority processes to preempt.

Signed-off-by: Song Hui <hui.song_1@nxp.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-06-15 10:14:37 +02:00
Wang Qing
97cd738c44 gpiolib: sysfs: use kobj_to_dev
Use kobj_to_dev() API instead of container_of().

Signed-off-by: Wang Qing <wangqing@vivo.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-06-15 10:07:49 +02:00
Mauro Carvalho Chehab
e012d15a23 gpio: driver.h: fix kernel-doc markup
There is one parameter with a wrong name at kernel-doc macro:

./include/linux/gpio/driver.h:499: warning: Function parameter or member 'gc' not described in 'gpiochip_add_data'
./include/linux/gpio/driver.h:499: warning: Excess function parameter 'chip' description in 'gpiochip_add_data'

Fix it.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-06-15 10:05:30 +02:00
Linus Torvalds
b3a9e3b962 Linux 5.8-rc1 2020-06-14 12:45:04 -07:00
Linus Torvalds
4a87b197c1 Add additional LSM hooks for SafeSetID
SafeSetID is capable of making allow/deny decisions for set*uid calls
 on a system, and we want to add similar functionality for set*gid
 calls. The work to do that is not yet complete, so probably won't make
 it in for v5.8, but we are looking to get this simple patch in for
 v5.8 since we have it ready. We are planning on the rest of the work
 for extending the SafeSetID LSM being merged during the v5.9 merge
 window.
 
 This patch was sent to the security mailing list and there were no objections.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEgvWslnM+qUy+sgVg5n2WYw6TPBAFAl7mZCoACgkQ5n2WYw6T
 PBAk1RAAl8t3/m3lELf8qIir4OAd4nK0kc4e+7W8WkznX2ljUl2IetlNxDCBmEXr
 T5qoW6uPsr6kl5AKnbl9Ii7WpW/halsslpKSUNQCs6zbecoVdxekJ8ISW7xHuboZ
 SvS1bqm+t++PM0c0nWSFEr7eXYmPH8OGbCqu6/+nnbxPZf2rJX03e5LnHkEFDFnZ
 0D/rsKgzMt01pdBJQXeoKk79etHO5MjuAkkYVEKJKCR1fM16lk7ECaCp0KJv1Mmx
 I88VncbLvI+um4t82d1Z8qDr2iLgogjJrMZC4WKfxDTmlmxox2Fz9ZJo+8sIWk6k
 T3a95x0s/mYCO4gWtpCVICt9+71Z3ie9T2iaI+CIe/kJvI/ysb+7LSkF+PD33bdz
 0yv6Y9+VMRdzb3pW69R28IoP4wdYQOJRomsY49z6ypH0RgBWcBvyE6e4v+WJGRNK
 E164Imevf6rrZeqJ0kGSBS1nL9WmQHMaXabAwxg1jK1KRZD+YZj3EKC9S/+PAkaT
 1qXUgvGuXHGjQrwU0hclQjgc6BAudWfAGdfrVr7IWwNKJmjgBf6C35my/azrkOg9
 wHCEpUWVmZZLIZLM69/6QXdmMA+iR+rPz5qlVnWhWTfjRYJUXM455Zk+aNo+Qnwi
 +saCcdU+9xqreLeDIoYoebcV/ctHeW0XCQi/+ebjexXVlyeSfYs=
 =I+0L
 -----END PGP SIGNATURE-----

Merge tag 'LSM-add-setgid-hook-5.8-author-fix' of git://github.com/micah-morton/linux

Pull SafeSetID update from Micah Morton:
 "Add additional LSM hooks for SafeSetID

  SafeSetID is capable of making allow/deny decisions for set*uid calls
  on a system, and we want to add similar functionality for set*gid
  calls.

  The work to do that is not yet complete, so probably won't make it in
  for v5.8, but we are looking to get this simple patch in for v5.8
  since we have it ready.

  We are planning on the rest of the work for extending the SafeSetID
  LSM being merged during the v5.9 merge window"

* tag 'LSM-add-setgid-hook-5.8-author-fix' of git://github.com/micah-morton/linux:
  security: Add LSM hooks to set*gid syscalls
2020-06-14 11:39:31 -07:00