summaryrefslogtreecommitdiffstats
path: root/drivers/gpio
AgeCommit message (Collapse)Author
2020-07-12gpiolib: cdev: rename numdescs to num_descsKent Gibson
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-12gpiolib: cdev: rename 'filep' and 'filp' to 'file' to be consistent with ↵Kent Gibson
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-12gpiolib: cdev: refactor gpiohandle_flags_to_desc_flagsKent Gibson
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-12gpiolib: cdev: minor indentation fixesKent Gibson
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-12gpiolib: cdev: sort includesKent Gibson
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-12gpiolib: move gpiolib-sysfs function declarations into their own headerKent Gibson
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-09Merge branch 'devel' into for-nextLinus Walleij
2020-07-08Merge branch 'lee-fixes' into develLinus Walleij
2020-07-08gpio: gpio-mlxbf2.c: Provide __releases() annotation to stop confusing SparseLee Jones
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-08gpio: gpio-mlxbf2: Tell the compiler that ACPI functions may not be useLee Jones
... 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-08gpio: gpio-mlxbf: Tell the compiler that ACPI functions may not be usedLee Jones
... 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-08gpio: gpio-it87: Fix formatting issues which confuse kerneldocLee Jones
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-08gpio: gpio-syscon: Fix formatting issues which confuse kerneldocLee Jones
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-08gpio: gpio-sama5d2-piobu: Demote all kerneldoc headers to basic comment blocksLee Jones
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-08gpio: gpio-pmic-eic-sprd: Fix incorrectly named property 'map'Lee Jones
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-08gpio: gpio-altera: Add missing kerneldoc entry and demote commentLee Jones
'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-08gpio: gpiolib-of: Provide documentation for of_gpio_spi_cs_get_count()Lee Jones
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-07gpio: aggregator: Use bitmap_parselist() for parsing GPIO offsetsGeert Uytterhoeven
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-07gpio: aggregator: Drop pre-initialization in get_arg()Geert Uytterhoeven
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-02gpio: pch: Move IRQ status message to verbose debug levelAndy Shevchenko
If one of the devices which share the same IRQ line doesn't care about interrupt GPIO will spam the log with status equal to 0x00. Move IRQ status message to verbose debug level (it still might be useful). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-06-30Merge tag 'gpio-updates-for-v5.9-part1' of ↵Linus Walleij
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-30gpio: gpio-ml-ioh: Fix missing ':' in 'struct ioh_gpio_reg_dataLee Jones
'struct ioh_gpio_reg_data's 'ien_reg' property is missing a ':' which confuses the kerneldoc tooling/parsers/validators. Replacing it squashes the following W=1 warning: drivers/gpio/gpio-ml-ioh.c:63: warning: Function parameter or member 'ien_reg' not described in 'ioh_gpio_reg_data' Cc: Andy Shevchenko <andy@kernel.org> Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2020-06-30gpiolib: Deduplicate find_first_zero_bit() callAndy Shevchenko
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-30gpio: omap: Add missing PM ops for suspendTony Lindgren
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-26Merge tag 'gpio-fixes-for-v5.8-rc3' of ↵Linus Walleij
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-24gpio: Drop superfluous dependencies on GPIOLIBGeert Uytterhoeven
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-24gpio: zynq: Remove error prints in EPROBE_DEFERShubhrajyoti Datta
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-24gpio: zynq: Add pmc gpio supportShubhrajyoti Datta
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-24gpio: zynq: Disable the irq if it is not a wakeup sourceShubhrajyoti Datta
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-24gpio: zynq: Add Versal supportShubhrajyoti Datta
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-24gpio: zynq: protect direction in/out with a spinlockGlenn Langedock
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-22gpio: pca953x: Fix GPIO resource leak on Intel Galileo Gen 2Andy Shevchenko
When adding a quirk for IRQ on Intel Galileo Gen 2 the commit ba8c90c61847 ("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: ba8c90c61847 ("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-22gpio: max732x: remove redundant check from probe()Gaurav Singh
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-20Merge branch 'ib-for-each-requested' into develLinus Walleij
2020-06-20gpio: xra1403: Make use of for_each_requested_gpio()Andy Shevchenko
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-20gpio: mvebu: Make use of for_each_requested_gpio()Andy Shevchenko
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-20gpiolib: split character device into gpiolib-cdevKent Gibson
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-20gpio: max732x: remove redundant checkGaurav Singh
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-16gpio: pca953x: disable regmap locking for automatic address incrementingAndy Shevchenko
It's a repetition of the commit aa58a21ae378 ("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: bcf41dc480b1 ("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-16gpio: pca953x: Fix direction setting when configure an IRQAndy Shevchenko
The commit 0f25fda840a9 ("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: 0f25fda840a9 ("gpio: pca953x: Zap ad-hoc reg_direction cache") Depends-on: 35d13d94893f ("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-16gpio: pca953x: Override IRQ for one of the expanders on Galileo Gen 2Andy Shevchenko
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: f32517bf1ae0 ("gpio: pca953x: support ACPI devices found on Galileo Gen2") Depends-on: 25e3ef894eef ("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-16gpio: pca953x: Synchronize interrupt handler properlyAndy Shevchenko
Since the commit aa58a21ae378 ("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 6e20fb18054c ("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: 6e20fb18054c ("drivers/gpio/pca953x.c: add a mutex to fix race condition") Depends-on: 35d13d94893f ("gpio: pca953x: convert to use bitmap API") Depends-on: 49427232764d ("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-16gpio: pca953x: Add support for the PCAL9535Jan Kiszka
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-16gpio: arizona: put pm_runtime in case of failureNavid Emamdoost
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-16gpio: arizona: handle pm_runtime_get_sync failure caseNavid Emamdoost
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-15drivers: gpio: Fix trivial spellingKieran Bingham
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-15gpio: mpc8xxx: change the gpio interrupt flags.Song Hui
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-15gpiolib: sysfs: use kobj_to_devWang Qing
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-14treewide: replace '---help---' in Kconfig files with 'help'Masahiro Yamada
Since commit 84af7a6194e4 ("checkpatch: kconfig: prefer 'help' over '---help---'"), the number of '---help---' has been gradually decreasing, but there are still more than 2400 instances. This commit finishes the conversion. While I touched the lines, I also fixed the indentation. There are a variety of indentation styles found. a) 4 spaces + '---help---' b) 7 spaces + '---help---' c) 8 spaces + '---help---' d) 1 space + 1 tab + '---help---' e) 1 tab + '---help---' (correct indentation) f) 1 tab + 1 space + '---help---' g) 1 tab + 2 spaces + '---help---' In order to convert all of them to 1 tab + 'help', I ran the following commend: $ find . -name 'Kconfig*' | xargs sed -i 's/^[[:space:]]*---help---/\thelp/' Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
2020-06-07Merge tag 'usb-5.8-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb Pull USB/PHY driver updates from Greg KH: "Here are the large set of USB and PHY driver updates for 5.8-rc1. Nothing huge, just lots of little things: - USB gadget fixes and additions all over the place - new PHY drivers - PHY driver fixes and updates - XHCI driver updates - musb driver updates - more USB-serial driver ids added - various USB quirks added - thunderbolt minor updates and fixes - typec updates and additions All of these have been in linux-next for a while with no reported issues" * tag 'usb-5.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (245 commits) usb: dwc3: meson-g12a: fix USB2 PHY initialization on G12A and A1 SoCs usb: dwc3: meson-g12a: fix error path when fetching the reset line fails Revert "dt-bindings: usb: qcom,dwc3: Convert USB DWC3 bindings" Revert "dt-bindings: usb: qcom,dwc3: Add compatible for SC7180" Revert "dt-bindings: usb: qcom,dwc3: Introduce interconnect properties for Qualcomm DWC3 driver" USB: serial: ch341: fix lockup of devices with limited prescaler USB: serial: ch341: add basis for quirk detection CDC-ACM: heed quirk also in error handling USB: serial: option: add Telit LE910C1-EUX compositions usb: musb: Fix runtime PM imbalance on error usb: musb: jz4740: Prevent lockup when CONFIG_SMP is set usb: musb: mediatek: add reset FADDR to zero in reset interrupt handle usb: musb: use true for 'use_dma' usb: musb: start session in resume for host port usb: musb: return -ESHUTDOWN in urb when three-strikes error happened USB: serial: qcserial: add DW5816e QDL support thunderbolt: Add trivial .shutdown usb: dwc3: keystone: Turn on USB3 PHY before controller dt-bindings: usb: ti,keystone-dwc3.yaml: Add USB3.0 PHY property dt-bindings: usb: convert keystone-usb.txt to YAML ...