1
0
Fork 0
Commit Graph

932768 Commits (4ee82256ee57db5c929d3c2f81f6620a0b31b4cd)

Author SHA1 Message Date
Dmitry Osipenko 4ee82256ee gpio: max77620: Replace 8 with MAX77620_GPIO_NR
The MAX77620_GPIO_NR enum value represents the total number of GPIOs,
let's use it instead of a raw value in order to improve the code's
readability a tad.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Link: https://lore.kernel.org/r/20200709171203.12950-2-digetx@gmail.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2020-07-16 10:50:40 +02:00
Linus Walleij 1752911c6d gpio updates for v5.9 - part 2
- several improvements and minor tweaks to the GPIO character device code
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEFp3rbAvDxGAT0sefEacuoBRx13IFAl8KyGQACgkQEacuoBRx
 13L/IA/+PTpXnNNWZ7xu8elXRG5WV7+5QQM4TpNDmdac7CHYYej6B3iF60dtNtG3
 pneS87GICkDhYaYjXKHkCX7OYzEHWrxY7E3avlUavsAMkyWTdzClkl+e+7ADaPsn
 2n9UeeZ5p694m2w9vcamlEXRulHoR9j94pzZyDk6ps8Lsm9TGschasZzefeTJie/
 oRo8SMx88BVmYB3a9bwZL6K92YdY3fIQaNZ/rMV56P0Vc57vW7ENWQBTVPMS6PAF
 o/Kr2I0Zmdl+Z5TZWXaPtrry173y+DJ4XziCR0h6jHSPNDu1PIeC3zbKI5h/6d0B
 nuFVarLmhD9wE8MOPP98WBqgOIqOgWfyIy5FNQSZ9YNe3G06XsvLkoPqEXB4oLwf
 XoQpoC3de9tBc0TyEaqTFRgEn79ni0QAZP0W11CeGU57NKYfshZIBwRubIF+wp9J
 MSH1zH0zrWqYcW7GN2r9wg2+Vm32XSu9z2HSfqtBeftPXyz9wjXiBcj9894c8n1q
 l7CDDivTnu3s6V1gBHnGZWloCwTcKrnOEeonXZaDhmOOW2dcbifJ1LxSiBKzhi4T
 W+L4fSrDxRRCVyzxgxijngufd61fj3KLc9aOLLJIdb7h4HnEDqtLOxB+g0IHlNpV
 HLOI+4XoapjKxPz2iu3ZMoxhdX4ywgGmqDJQAtKVoG2IVDdYthw=
 =HAhm
 -----END PGP SIGNATURE-----

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

gpio updates for v5.9 - part 2

- several improvements and minor tweaks to the GPIO character device code
2020-07-13 23:20:33 +02:00
Kent Gibson df51f402e3 tools: gpio: fix spurious close warning in gpio-event-mon
Fix bogus close warning that occurs when opening the character device
fails.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-07-12 10:22:01 +02:00
Kent Gibson e890678f69 tools: gpio: fix spurious close warning in gpio-utils
Fix bogus close warning that occurs when opening the character device
fails.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-07-12 10:22:01 +02:00
Kent Gibson ef3c61a082 tools: gpio: fix spurious close warning in lsgpio
Fix bogus close warning that occurs when opening the character device
fails.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-07-12 10:22:01 +02:00
Kent Gibson 21249616f0 gpio: uapi: fix misplaced comment line
The second line of the description for event_type is before the first.
Move it to after the first line.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-07-12 10:22:01 +02:00
Kent Gibson 4682427241 gpiolib: cdev: refactor lineevent cleanup into lineevent_free
Consolidate the cleanup of lineevents, currently duplicated in
lineevent_create and lineevent_release, into a helper function
lineevent_free.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-07-12 10:22:01 +02:00
Kent Gibson 883f919818 gpiolib: cdev: refactor linehandle cleanup into linehandle_free
Consolidate the cleanup of linehandles, currently duplicated in
linehandle_create and linehandle_release, into a helper function
linehandle_free.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-07-12 10:22:01 +02:00
Kent Gibson 1bf7ba4001 gpiolib: cdev: remove recalculation of offset
Remove recalculation of offset from desc, where desc itself was calculated
from offset.

There is no benefit from the desc -> hwgpio conversion in this context.
The only implicit benefit of the offset -> desc -> hwgpio is
the range check in the offset -> desc, but where desc is required you
still get that, and where desc isn't required it is simpler to perform
the range check directly.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-07-12 10:22:01 +02:00
Kent Gibson f30ef3e837 gpiolib: cdev: fix minor race in GET_LINEINFO_WATCH
Merge separate usage of test_bit/set_bit into test_and_set_bit to remove
the possibility of a race between the test and set.

Similarly test_bit and clear_bit.

In the existing code it is possible for two threads to race past the
test_bit and then set or clear the watch bit, and neither return EBUSY.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-07-12 10:22:01 +02:00
Kent Gibson e2b781c5f0 gpiolib: cdev: rename priv to cdev
Rename priv to cdev to improve readability.

The name "priv" indicates that the object is pointed to by
file->private_data, not what the object is actually is.
As it is always used to point to a struct gpio_chardev_data, renaming
it to cdev is more appropriate.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-07-12 10:22:00 +02:00
Kent Gibson 6accc376a7 gpiolib: cdev: use blocking notifier call chain instead of atomic
Replace usage of atomic_notifier_call_chain with
blocking_notifier_call_chain as the notifier function,
lineinfo_changed_notify, calls gpio_desc_to_lineinfo,
which calls pinctrl_gpio_can_use_line, which can sleep.

The chain isn't being called from an atomic context so the
the blocking notifier is a suitable substitute.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-07-12 10:22:00 +02:00
Kent Gibson 0cdc85a371 gpiolib: cdev: remove pointless decrement of i
Remove pointless decrement of variable, and associated comment.

While i is used subsequently, it is re-initialized so this decrement
serves no purpose.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-07-12 10:22:00 +02:00
Kent Gibson 52b7b596dd gpiolib: cdev: rename numdescs to num_descs
Rename numdescs to num_descs to be more consistent with the naming of
other counters and improve readability.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-07-12 10:22:00 +02:00
Kent Gibson 49bc52798d gpiolib: cdev: rename 'filep' and 'filp' to 'file' to be consistent with other use
Rename 'filep' and 'filp' to 'file' to be consistent with other use
and improve readability.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-07-12 10:22:00 +02:00
Kent Gibson c274b58a4b gpiolib: cdev: refactor gpiohandle_flags_to_desc_flags
Refactor the mapping from handle flags to desc flags into a helper
function.

The assign_bit is overkill where it is replacing the set_bit cases, as is
rechecking bits known to be clear in some circumstances, but the DRY
simplification more than makes up for any performance degradation,
especially as this is not a hot path.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-07-12 10:22:00 +02:00
Kent Gibson a18512e3f1 gpiolib: cdev: minor indentation fixes
Make indentation consistent with other use to improve readability.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-07-12 10:22:00 +02:00
Kent Gibson d189f6270f gpiolib: cdev: sort includes
Sort the includes of gpiolib-cdev.c to make it easier to identify if a
module is included and to avoid duplication.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-07-12 10:22:00 +02:00
Kent Gibson ef087d8e95 gpiolib: move gpiolib-sysfs function declarations into their own header
Move gpiolib-sysfs function declarations into their own header.

These functions are in gpiolib-sysfs.c, and are only required by gpiolib.c,
and so should be in a module header, not gpiolib.h.

This brings gpiolib-sysfs into line with gpiolib-cdev, and is another step
towards removing the sysfs inferface.

Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
2020-07-12 10:22:00 +02:00
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