aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpio
AgeCommit message (Collapse)AuthorFilesLines
2020-08-18gpio: aggregator: Refactor ->{get, set}_multiple() to make Sparse happyAndy Shevchenko1-27/+43
Sparse can't see locking scheme used in ->get_multiple() and ->set_multiple() callbacks. CHECK .../drivers/gpio/gpio-aggregator.c .../spinlock.h:409:9: warning: context imbalance in 'gpio_fwd_get_multiple' - unexpected unlock .../spinlock.h:409:9: warning: context imbalance in 'gpio_fwd_set_multiple' - unexpected unlock Refactor them to have better readability and make Sparse happy. Code size impact is +52 bytes with arm-linux-gnueabihf-gcc 7.5.0. Signed-off-by: Andy Shevchenko <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
2020-08-18gpio: stp-xway: automatically drive GPHY leds on ar10 and grx390Aleksander Jan Bajkowski1-6/+48
Ar10 (xr300) has 3 and grx390 (xrx330) has 4 built-in GPHY. PHY LEDs are connected via STP. STP is a peripheral controller used to drive external shift register cascades. The hardware is able to allow the GPHY to drive some GPIO of the cascade automatically.This patch allows for this on ar10 and grx390. Tested on D-Link DWR-966 with OpenWRT. Signed-off-by: Aleksander Jan Bajkowski <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
2020-08-05Merge tag 'gpio-v5.9-1' of ↵Linus Torvalds48-1579/+1949
git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio Pull GPIO updates from Linus Walleij: "This is the bulk of GPIO changes for the v5.9 kernel cycle. There is nothing too exciting in it, but a new macro that fixes a build failure on a minor ARM32 platform that appeared yesterday is part of it so we better merge it. Core changes: - Introduce the for_each_requested_gpio() macro to help in dependent code all over the place. Also patch a few locations to use it while we are at it. - Split out the sysfs code into its own file. - Split out the character device code into its own file, then make a set of refactorings and improvements to this code. We are setting the stage to revamp the userspace API a bit in the next cycle. - Fix a whole slew of kerneldoc that was wrong or missing. New drivers: - The PCA953x driver now supports the PCAL9535. Driver improvements: - A host of incremental modernizations and improvements to the PCA953x driver. - Incremental improvements to the Xilinx Zynq driver. - Some improvements to the GPIO aggregator driver. - I ran all over the place switching all threaded and other drivers requesting their own IRQ while using the core GPIO IRQ helpers to pass the GPIO irq chip as a template instead of calling the explicit set-up functions. Next merge window we may retire the old code altogether" * tag 'gpio-v5.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (97 commits) gpio: wcove: Request IRQ after all initialisation done gpio: crystalcove: Free IRQ on error path gpio: pca953x: Request IRQ after all initialisation done gpio: don't use same lockdep class for all devm_gpiochip_add_data users gpio: max732x: Use irqchip template gpio: stmpe: Move chip registration gpio: rcar: Use irqchip template gpio: regmap: fix type clash gpio: Correct kernel-doc inconsistency gpio: pci-idio-16: Use irqchip template gpio: pcie-idio-24: Use irqchip template gpio: 104-idio-16: Use irqchip template gpio: 104-idi-48: Use irqchip template gpio: 104-dio-48e: Use irqchip template gpio: ws16c48: Use irqchip template gpio: omap: improve coding style for pin config flags gpio: dln2: Use irqchip template gpio: sch: Add a blank line between declaration and code gpio: sch: changed every 'unsigned' to 'unsigned int' gpio: ich: changed every 'unsigned' to 'unsigned int' ...
2020-08-04gpio: wcove: Request IRQ after all initialisation doneAndy Shevchenko1-7/+7
There is logically better to request IRQ when we initialise all structures. Align the driver with the rest on the same matter. Signed-off-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2020-08-04gpio: crystalcove: Free IRQ on error pathAndy Shevchenko1-15/+3
It appears that all, but request_irq(), calls in the driver are device managed. In unlikely case of devm_gpiochip_add_data() failure the IRQ left requested. Free IRQ on error path by switching to devm_request_threaded_irq() API. Byproduct of this change is a drop of ->remove() callback completely. Fixes: 945e72db36bd ("gpio: crystalcove: Use irqchip template") Signed-off-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2020-08-04gpio: pca953x: Request IRQ after all initialisation doneAndy Shevchenko1-11/+11
There is logically better to request IRQ when we initialise all structures. Align the driver with the rest on the same matter. Signed-off-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2020-08-04gpio: don't use same lockdep class for all devm_gpiochip_add_data usersAhmad Fatoum1-5/+8
Commit 959bc7b22bd2 ("gpio: Automatically add lockdep keys") documents in its commits message its intention to "create a unique class key for each driver". It does so by having gpiochip_add_data add in-place the definition of two static lockdep classes for LOCKDEP use. That way, every caller of the macro adds their gpiochip with unique lockdep classes. There are many indirect callers of gpiochip_add_data, however, via use of devm_gpiochip_add_data. devm_gpiochip_add_data has external linkage and all its users will share the same lockdep classes, which probably is not intended. Fix this by replicating the gpio_chip_add_data statics-in-macro for the devm_ version as well. Fixes: 959bc7b22bd2 ("gpio: Automatically add lockdep keys") Signed-off-by: Ahmad Fatoum <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Reviewed-by: Bartosz Golaszewski <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2020-08-04gpio: max732x: Use irqchip templateLinus Walleij1-15/+15
This makes the driver use the irqchip template to assign properties to the gpio_irq_chip instead of using the explicit calls to gpiochip_irqchip_add_nested() and gpiochip_set_nested_irqchip(). The irqchip is instead added while adding the gpiochip. Signed-off-by: Linus Walleij <[email protected]> Tested-by: Sam Protsenko <[email protected]> Reviewed-by: Sam Protsenko <[email protected]> Cc: Sam Protsenko <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-08-04gpio: stmpe: Move chip registrationLinus Walleij1-6/+6
Make sure to register the GPIO chip after requesting the interrupt and setting up the IRQ members of the irqchip. Fixes: 9745079609df ("gpio: stmpe: Use irqchip template") Reported-by: Serge Semin <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Cc: Patrice Chotard <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-07-30gpio: rcar: Use irqchip templateLinus Walleij1-7/+10
This makes the driver use the irqchip template to assign properties to the gpio_irq_chip instead of using the explicit call to gpiochip_irqchip_add(). The irqchip is instead added while adding the gpiochip. Signed-off-by: Linus Walleij <[email protected]> Cc: Biju Das <[email protected]> Cc: Geert Uytterhoeven <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-07-29Merge remote-tracking branch 'spi/for-5.9' into spi-nextMark Brown1-4/+6
2020-07-23gpio: pci-idio-16: Use irqchip templateLinus Walleij1-11/+22
This makes the driver use the irqchip template to assign properties to the gpio_irq_chip instead of using the explicit call to gpiochip_irqchip_add(). The irqchip is instead added while adding the gpiochip. Also move the IRQ initialization to the special .init_hw() callback. Signed-off-by: Linus Walleij <[email protected]> Acked-by: William Breathitt Gray <[email protected]> Cc: William Breathitt Gray <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-07-23gpio: pcie-idio-24: Use irqchip templateLinus Walleij1-7/+10
This makes the driver use the irqchip template to assign properties to the gpio_irq_chip instead of using the explicit call to gpiochip_irqchip_add(). The irqchip is instead added while adding the gpiochip. Signed-off-by: Linus Walleij <[email protected]> Acked-by: William Breathitt Gray <[email protected]> Cc: William Breathitt Gray <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-07-23gpio: 104-idio-16: Use irqchip templateLinus Walleij1-11/+22
This makes the driver use the irqchip template to assign properties to the gpio_irq_chip instead of using the explicit call to gpiochip_irqchip_add(). The irqchip is instead added while adding the gpiochip. Also move the IRQ initialization to the special .init_hw() callback. Signed-off-by: Linus Walleij <[email protected]> Acked-by: William Breathitt Gray <[email protected]> Cc: William Breathitt Gray <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-07-23gpio: 104-idi-48: Use irqchip templateLinus Walleij1-11/+22
This makes the driver use the irqchip template to assign properties to the gpio_irq_chip instead of using the explicit call to gpiochip_irqchip_add(). The irqchip is instead added while adding the gpiochip. Also move the IRQ initialization to the special .init_hw() callback. Signed-off-by: Linus Walleij <[email protected]> Acked-by: William Breathitt Gray <[email protected]> Cc: William Breathitt Gray <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-07-23gpio: 104-dio-48e: Use irqchip templateLinus Walleij1-12/+23
This makes the driver use the irqchip template to assign properties to the gpio_irq_chip instead of using the explicit call to gpiochip_irqchip_add(). The irqchip is instead added while adding the gpiochip. Also move the IRQ initialization to the special .init_hw() callback. Signed-off-by: Linus Walleij <[email protected]> Acked-by: William Breathitt Gray <[email protected]> Cc: William Breathitt Gray <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-07-23gpio: ws16c48: Use irqchip templateLinus Walleij1-14/+25
This makes the driver use the irqchip template to assign properties to the gpio_irq_chip instead of using the explicit call to gpiochip_irqchip_add(). The irqchip is instead added while adding the gpiochip. Also move the IRQ initialization to the special .init_hw() callback. Signed-off-by: Linus Walleij <[email protected]> Acked-by: William Breathitt Gray <[email protected]> Cc: William Breathitt Gray <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-07-23gpio: omap: improve coding style for pin config flagsDrew Fustini1-4/+9
Change the handling of pin config flags from if/else to switch statement to make the code more readable and cleaner. Suggested-by: Gustavo A. R. Silva <[email protected]> Signed-off-by: Drew Fustini <[email protected]> Acked-by: Gustavo A. R. Silva <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2020-07-23gpio: dln2: Use irqchip templateLinus Walleij1-7/+10
This makes the driver use the irqchip template to assign properties to the gpio_irq_chip instead of using the explicit calls to gpiochip_irqchip_add(). The irqchip is instead added while adding the gpiochip. Signed-off-by: Linus Walleij <[email protected]> Tested-by: Andy Shevchenko <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Reviewed-by: Daniel Baluta <[email protected]> Cc: Daniel Baluta <[email protected]> Cc: Octavian Purdila <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-07-22Merge tag 'intel-gpio-v5.9-1' of ↵Linus Walleij6-59/+70
git://git.kernel.org/pub/scm/linux/kernel/git/andy/linux-gpio-intel into devel intel-gpio for v5.9-1 * Move GPIO PMIC drivers to use IRQ chip template * Introduce for_each_requested_gpio() and convert existing users * Replace unsigned by unsigned int in few drivers * Fix an issue in kernel doc that validator complains about * Move to verbose debug level the IRQ status message in gpio-pch The following is an automated git shortlog grouped by driver: ARM/orion/gpio: - Make use of for_each_requested_gpio() crystalcove: - Use irqchip template - changed every 'unsigned' to 'unsigned int' gpiolib: - Introduce for_each_requested_gpio_in_range() macro gpio-ml-ioh: - Fix missing ':' in 'struct ioh_gpio_reg_data ich: - changed every 'unsigned' to 'unsigned int' mvebu: - Make use of for_each_requested_gpio() pch: - Add a blank line between declaration and code - changed every 'unsigned' to 'unsigned int' - Move IRQ status message to verbose debug level pinctrl: - at91: Make use of for_each_requested_gpio() sch: - Add a blank line between declaration and code - changed every 'unsigned' to 'unsigned int' wcove: - Use irqchip template xra1403: - Make use of for_each_requested_gpio()
2020-07-22gpio: sch: Add a blank line between declaration and codeAbanoub Sameh1-0/+1
Added a lined between a declaration and other statements according to the kernel coding style. Signed-off-by: Abanoub Sameh <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]>
2020-07-22gpio: sch: changed every 'unsigned' to 'unsigned int'Abanoub Sameh1-11/+11
Changed 'unsigned' to 'unsigned int'. This makes the code more uniform, and compliant with the kernel coding style. Signed-off-by: Abanoub Sameh <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]>
2020-07-22gpio: ich: changed every 'unsigned' to 'unsigned int'Abanoub Sameh1-13/+13
Changed 'unsigned' to 'unsigned int'. This makes the code more uniform, and compliant with the kernel coding style. Signed-off-by: Abanoub Sameh <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]>
2020-07-22gpio: wcove: Use irqchip templateLinus Walleij1-14/+16
This makes the driver use the irqchip template to assign properties to the gpio_irq_chip instead of using the explicit calls to gpiochip_irqchip_add_nested() and gpiochip_set_nested_irqchip(). The irqchip is instead added while adding the gpiochip. Cc: Bin Gao <[email protected]> Cc: Andy Shevchenko <[email protected]> Cc: Hans de Goede <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Tested-by: Hans de Goede <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]>
2020-07-22gpio: crystalcove: Use irqchip templateLinus Walleij1-9/+15
This makes the driver use the irqchip template to assign properties to the gpio_irq_chip instead of using the explicit calls to gpiochip_irqchip_add_nested() and gpiochip_set_nested_irqchip(). The irqchip is instead added while adding the gpiochip. Cc: Andy Shevchenko <[email protected]> Cc: Kuppuswamy Sathyanarayanan <[email protected]> Cc: Hans de Goede <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Reviewed-by: Kuppuswamy Sathyanarayanan <[email protected]> Tested-by: Hans de Goede <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]>
2020-07-22spi: ppc4xx: Convert to use GPIO descriptorsLinus Walleij1-4/+6
This converts the PPC4xx SPI driver to use GPIO descriptors. The driver is already just picking some GPIOs from the device tree so the conversion is pretty straight forward. However this driver is looking form a pure "gpios" property rather than the standard binding "cs-gpios" so we need to add a new exception to the gpiolib OF parser to allow this for this driver's compatibles. Signed-off-by: Linus Walleij <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
2020-07-21gpio: crystalcove: changed every 'unsigned' to 'unsigned int'Abanoub Sameh1-5/+5
Changed 'unsigned' to 'unsigned int'. This makes the code more uniform, and compliant with the kernel coding style. Signed-off-by: Abanoub Sameh <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]>
2020-07-21gpio: pch: Add a blank line between declaration and codeAbanoub Sameh1-0/+1
Added a lined between a declaration and other statements according to the kernel coding style. Signed-off-by: Abanoub Sameh <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]>
2020-07-21gpio: pch: changed every 'unsigned' to 'unsigned int'Abanoub Sameh1-5/+5
Changed 'unsigned' to 'unsigned int'. This makes the code more uniform, and compliant with the kernel coding style. Signed-off-by: Abanoub Sameh <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]>
2020-07-20gpio: pca953x: Use irqchip templateLinus Walleij1-12/+13
This makes the driver use the irqchip template to assign properties to the gpio_irq_chip instead of using the explicit calls to gpiochip_irqchip_add_nested() and gpiochip_set_nested_irqchip(). The irqchip is instead added while adding the gpiochip. Signed-off-by: Linus Walleij <[email protected]> Tested-by: Andy Shevchenko <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Cc: Andy Shevchenko <[email protected]> Cc: Marek Vasut <[email protected]> Cc: Uwe Kleine-König <[email protected]> Cc: Adam Ford <[email protected]> Cc: Vignesh Raghavendra <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-07-20gpio: omap: handle pin config bias flagsDrew Fustini1-5/+11
Modify omap_gpio_set_config() to handle pin config bias flags by calling gpiochip_generic_config(). The pin group for the gpio line must have the corresponding pinconf properties: PIN_CONFIG_BIAS_PULL_UP requires "pinctrl-single,bias-pullup" PIN_CONFIG_BIAS_PULL_DOWN requires "pinctrl-single,bias-pulldown" This is necessary for pcs_pinconf_set() to find the requested bias parameter in the PIN_MAP_TYPE_CONFIGS_GROUP pinctrl map. Signed-off-by: Drew Fustini <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Acked-by: Grygorii Strashko <[email protected]> Acked-by: Tony Lindgren <[email protected]> Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected]
2020-07-20gpio: pcf857x: Use irqchip templateLinus Walleij1-23/+24
This makes the driver use the irqchip template to assign properties to the gpio_irq_chip instead of using the explicit calls to gpiochip_irqchip_add_nested() and gpiochip_set_nested_irqchip(). The irqchip is instead added while adding the gpiochip. Signed-off-by: Linus Walleij <[email protected]> Cc: Geert Uytterhoeven <[email protected]> Cc: Anders Darander <[email protected]> Cc: Roger Quadros <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-07-20gpio: adp5588: Use irqchip templateLinus Walleij1-15/+24
This makes the driver use the irqchip template to assign properties to the gpio_irq_chip instead of using the explicit calls to gpiochip_irqchip_add_nested() and gpiochip_set_nested_irqchip(). The irqchip is instead added while adding the gpiochip. Signed-off-by: Linus Walleij <[email protected]> Acked-by: Michael Hennerich <[email protected]> Cc: Nikolaus Voss <[email protected]> Cc: Michael Hennerich <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-07-20gpio: adnp: Use irqchip templateLinus Walleij1-47/+48
This makes the driver use the irqchip template to assign properties to the gpio_irq_chip instead of using the explicit calls to gpiochip_irqchip_add_nested() and gpiochip_set_nested_irqchip(). The irqchip is instead added while adding the gpiochip. Signed-off-by: Linus Walleij <[email protected]> Cc: Roland Stigge <[email protected]> Cc: Lars Poeschel <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-07-20gpio: stmpe: Use irqchip templateLinus Walleij1-13/+11
This makes the driver use the irqchip template to assign properties to the gpio_irq_chip instead of using the explicit calls to gpiochip_irqchip_add_nested() and gpiochip_set_nested_irqchip(). The irqchip is instead added while adding the gpiochip. Signed-off-by: Linus Walleij <[email protected]> Cc: Patrice Chotard <[email protected]> Cc: Alexandre TORGUE <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-07-20gpio: tc35892: Use irqchip templateLinus Walleij1-15/+11
This makes the driver use the irqchip template to assign properties to the gpio_irq_chip instead of using the explicit calls to gpiochip_irqchip_add_nested() and gpiochip_set_nested_irqchip(). The irqchip is instead added while adding the gpiochip. Signed-off-by: Linus Walleij <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-07-17gpio: max77620: Use helper variable and clarifyLinus Walleij1-5/+11
Most other drivers fill out the gpio_irq_chip using a struct gpio_irq_chip *girq helper variable for ease of reading. We also make a habit of explicitly assigning NULL and zero to the parent IRQs when using ordinary IRQ handlers in the driver, mostly for code readability and maintenance. Signed-off-by: Linus Walleij <[email protected]> Reviewed-by: Dmitry Osipenko <[email protected]> Cc: Dmitry Osipenko <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-07-16gpio: mmio: replace open-coded for_each_set_bit()Andy Shevchenko1-13/+7
Use for_each_set_bit() instead of open-coding it to simplify the code. Signed-off-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2020-07-16gpio: pca9570: add GPO driver for PCA9570Sungbo Eo3-0/+155
NXP PCA9570 is a 4-bit I2C GPO expander without interrupt functionality. Its ports are controlled only by a data byte without register address. Signed-off-by: Sungbo Eo <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Datasheet: https://www.nxp.com/docs/en/data-sheet/PCA9570.pdf Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2020-07-16gpio: max77620: Initialize hardware state of interruptsDmitry Osipenko1-0/+25
I noticed on Nexus 7 that after rebooting from downstream kernel to upstream, the GPIO interrupt is triggering non-stop despite interrupts being disabled for all of GPIOs. This happens because Nexus 7 uses a soft-reboot, meaning that bootloader should take care of resetting hardware, but the bootloader doesn't do it well. As a result, GPIO interrupt may be left ON at a boot time. Let's mask all GPIO interrupts at the driver's initialization time in order to resolve the issue. Signed-off-by: Dmitry Osipenko <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Acked-by: Laxman Dewangan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2020-07-16gpio: max77620: Use irqchip templateDmitry Osipenko1-8/+6
This change addresses one of the GPIO-core TODOs for the MAX77620 driver which requires modern drivers to use the irqchip template. Instead of using the GPIO's irqchip-helpers for creating the IRQ domain, the gpio_irq_chip structure is now filled by the driver itself and then gpiochip_add_data() takes care of instantiating the IRQ domain for us. Suggested-by: Andy Shevchenko <[email protected]> Signed-off-by: Dmitry Osipenko <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Acked-by: Laxman Dewangan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2020-07-16gpio: max77620: Don't shadow error code of platform_get_irq()Dmitry Osipenko1-4/+6
The platform_get_irq() returns a positive interrupt number on success and negative error code on failure (zero shouldn't ever happen in practice, it would produce a noisy warning). Hence let's return the error code directly instead of overriding it with -ENODEV. Suggested-by: Andy Shevchenko <[email protected]> Signed-off-by: Dmitry Osipenko <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Acked-by: Laxman Dewangan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2020-07-16gpio: max77620: Don't set of_nodeDmitry Osipenko1-4/+1
The gpiochip_add_data() takes care of setting the of_node to the parent's device of_node, hence there is no need to do it manually in the driver's code. This patch corrects the parent's device pointer and removes the unnecessary setting of the of_node. Suggested-by: Andy Shevchenko <[email protected]> Signed-off-by: Dmitry Osipenko <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Acked-by: Laxman Dewangan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2020-07-16gpio: max77620: Fix missing release of interruptDmitry Osipenko1-2/+3
The requested interrupt is never released by the driver. Fix this by using the resource-managed variant of request_threaded_irq(). Fixes: ab3dd9cc24d4 ("gpio: max77620: Fix interrupt handling") Signed-off-by: Dmitry Osipenko <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Acked-by: Laxman Dewangan <[email protected]> Cc: <[email protected]> # 5.5+ Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2020-07-16gpio: max77620: Replace 8 with MAX77620_GPIO_NRDmitry Osipenko1-3/+3
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 <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Acked-by: Laxman Dewangan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2020-07-12gpiolib: cdev: refactor lineevent cleanup into lineevent_freeKent Gibson1-23/+21
Consolidate the cleanup of lineevents, currently duplicated in lineevent_create and lineevent_release, into a helper function lineevent_free. Signed-off-by: Kent Gibson <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
2020-07-12gpiolib: cdev: refactor linehandle cleanup into linehandle_freeKent Gibson1-20/+19
Consolidate the cleanup of linehandles, currently duplicated in linehandle_create and linehandle_release, into a helper function linehandle_free. Signed-off-by: Kent Gibson <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
2020-07-12gpiolib: cdev: remove recalculation of offsetKent Gibson1-13/+7
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 <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
2020-07-12gpiolib: cdev: fix minor race in GET_LINEINFO_WATCHKent Gibson1-5/+5
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 <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
2020-07-12gpiolib: cdev: rename priv to cdevKent Gibson1-45/+45
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 <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>