summaryrefslogtreecommitdiffstats
path: root/drivers/gpio
Commit message (Collapse)AuthorAgeFilesLines
* gpio: siox: Add struct device *dev helper variableLinus Walleij2019-07-031-5/+5
| | | | | | | This makes the code easier to read. Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: siox: Pass irqchip when adding gpiochipLinus Walleij2019-07-031-9/+7
| | | | | | | | | | | | We need to convert all old gpio irqchips to pass the irqchip setup along when adding the gpio_chip. For chained irqchips this is a pretty straight-forward conversion. Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Cc: Thierry Reding <treding@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* drivers: gpio: amd-fch: make resource struct constEnrico Weigelt2019-07-031-1/+1
| | | | | | | | | The struct resource field is statically initialized and may never change. Therefore make it const. Signed-off-by: Enrico Weigelt <info@metux.net> Link: https://lore.kernel.org/r/1560787211-15443-1-git-send-email-info@metux.net Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: ath79: Pass irqchip when adding gpiochipLinus Walleij2019-06-271-39/+27
| | | | | | | | | | | | | | | | We need to convert all old gpio irqchips to pass the irqchip setup along when adding the gpio_chip. For chained irqchips this is a pretty straight-forward conversion. Take this opportunity to add a local dev pointer and use devm_gpiochip_add() so we can get rid of the remove() callback altogether. Cc: linux-mips@linux-mips.org Acked-by: Alban Bedel <albeu@free.fr> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: tegra: Clean-up debugfs initialisationJon Hunter2019-06-271-15/+3
| | | | | | | | | | | | | | The function tegra_gpio_debuginit() just calls debugfs_create_file() and given that there is already a stub function implemented for debugfs_create_file() when CONFIG_DEBUG_FS is not enabled, there is no need for the function tegra_gpio_debuginit() and so remove it. Finally, use a space and not a tab between the #ifdef and CONFIG_DEBUG_FS. Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Reviewed-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* Merge tag 'gpio-v5.3-updates-for-linus' of ↵Linus Walleij2019-06-274-74/+32
|\ | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux into devel gpio: updates for v5.3 - add include/linux/gpio.h to .gitignore in /tools - improve and simplify code in the em driver - simplify code in max732x by using devm helpers (including the new devm_i2c_new_dummy_device()) - fix SPDX header for madera - remove checking of return values of debugfs routines in gpio-mockup
| * gpio: mockup: no need to check return value of debugfs_create functionsGreg Kroah-Hartman2019-06-271-16/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Cc: Bamvor Jian Zhang <bamv2005@gmail.com> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com> Cc: linux-gpio@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> [Bartosz: removed one more check for debugfs return value] Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
| * gpio: madera: Fixup SPDX headersCharles Keepax2019-06-261-5/+1
| | | | | | | | | | | | | | | | GPL-2.0-only is the preferred way of expressing v2 of the GPL, so switch to that and remove some redundant copyright notices. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
| * gpio: max732x: use devm_gpiochip_add_data()Bartosz Golaszewski2019-05-311-6/+2
| | | | | | | | | | | | | | We can simplify the code a bit with a resource managed variant of gpiochip_add_data(). Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
| * gpio: max732x: use i2c_new_dummy_device()Bartosz Golaszewski2019-05-311-23/+14
| | | | | | | | | | | | | | | | We now have a resource managed version of i2c_new_dummy_device() that also returns an actual error code instead of a NULL-pointer. Use it in the max732x GPIO driver and simplify code in the process. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
| * gpio: em: use the managed version of gpiochip_add_data()Bartosz Golaszewski2019-05-311-3/+1
| | | | | | | | | | | | | | | | | | Use the managed variant of gpiochip_add_data() and remove the call to gpiochip_remove(). Cc: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
| * gpio: em: Return early on error in em_gio_probe()Geert Uytterhoeven2019-05-281-19/+9
| | | | | | | | | | | | | | | | | | | | | | | | em_gio_probe() uses managed initializations for everything but creating the IRQ domain. Hence in most failure cases, no cleanup needs to be performed at all. Make this clearer for the casual reviewer by returning early, instead of jumping to an out-of-sight label. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
| * gpio: em: Remove error messages on out-of-memory conditionsGeert Uytterhoeven2019-05-281-4/+2
| | | | | | | | | | | | | | | | | | | | | | There is no need to print error messages when memory allocations or related operations fail, as the core will take care of that. Change the returned error codes to -ENOMEM to match the failure cause while at it. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
* | gpio: siox: Switch to IRQ_TYPE_NONELinus Walleij2019-06-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | The siox driver is hardcoding a default type of IRQ_TYPE_EDGE_RISING to the irq helper, but this should only be applicable to old boardfiles and odd device tree irqchips with just onecell irq (no flags). I doubt this is the case with the siox, I think all consumers specify the flags they use in the device tree. Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | gpio: siox: Do not call gpiochip_remove() on errorpathLinus Walleij2019-06-271-5/+2
| | | | | | | | | | | | | | | | | | | | gpiochip_remove() was called on the errorpath if gpiochip_add() failed: this is wrong, if the chip failed to add it is not there so it should not be removed. Fixes: be8c8facc707 ("gpio: new driver to work with a 8x12 siox") Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | gpio: pl061: Pass irqchip when adding gpiochipLinus Walleij2019-06-271-14/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | We need to convert all old gpio irqchips to pass the irqchip setup along when adding the gpio_chip. For chained irqchips this is a pretty straight-forward conversion. Cc: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> Reviewed-by: Sudeep Holla <sudeep.holla@arm.com> Tested-by: Sudeep Holla <sudeep.holla@arm.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | gpio: tegra: No need to cast away return value of debugfs_create_file()Greg Kroah-Hartman2019-06-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | It is fine to ignore the return value (and encouraged), so no need to cast away the return value, you will not get a build warning at all. Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com> Cc: linux-gpio@vger.kernel.org Cc: linux-tegra@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Acked-by: Jon Hunter <jonathanh@nvidia.com> Acked-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | gpio: No need to cast away return value of debugfs_create_file()Greg Kroah-Hartman2019-06-271-2/+2
| | | | | | | | | | | | | | | | | | | | It is fine to ignore the return value (and encouraged), so need to cast away the return value, you will not get a build warning at all. Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com> Cc: linux-gpio@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | gpio: Sort GPIO drivers in MakefileGeert Uytterhoeven2019-06-271-148/+148
| | | | | | | | | | | | | | | | | | Sort the definitions for the individual GPIO drivers in the Makefile by object file name. Align all entries while we're at it. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | gpio: siox: Use module_siox_driver()Enrico Weigelt2019-06-271-12/+1
| | | | | | | | | | | | | | | | Reduce driver init boilerplate by using the new module_siox_driver() macro. Signed-off-by: Enrico Weigelt <info@metux.net> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | gpio: eic-sprd: Use devm_platform_ioremap_resource()Enrico Weigelt, metux IT consult2019-06-271-7/+2
| | | | | | | | | | | | | | | | | | Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net> Reviewed-by: Baolin Wang <baolin.wang@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | gpio: vr41xx: Use devm_platform_ioremap_resource()Enrico Weigelt, metux IT consult2019-06-271-14/+5
| | | | | | | | | | | | | | | | | | | | | | Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together. this driver deserves a bit more cleanup, to get rid of the global variable giu_base, which makes it single-instance-only. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | gpio: janz-ttl: Drop unneccessary temp variable devEnrico Weigelt, metux IT consult2019-06-271-5/+4
| | | | | | | | | | | | | | don't need the temporary variable "dev", directly use &pdev->dev Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | gpio: grgpio: Use devm_platform_ioremap_resource()Enrico Weigelt, metux IT consult2019-06-271-3/+1
| | | | | | | | | | | | | | | | Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | gpio: ep93xx: Use devm_platform_ioremap_resource()Enrico Weigelt, metux IT consult2019-06-271-5/+2
| | | | | | | | | | | | | | | | Use the new helper that wraps the calls to platform_get_resource() and devm_ioremap_resource() together. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | gpio: amdpt: Drop unneeded deref of &pdev->devEnrico Weigelt, metux IT consult2019-06-271-5/+5
| | | | | | | | | | | | | | | | We already have the struct device* pointer in a local variable, so we can write this a bit shorter. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | gpio: rcar: Pedantic formattingEnrico Weigelt, metux IT consult2019-06-271-1/+1
| | | | | | | | | | | | | | | | A tab sneaked in, where it shouldn't be. Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | gpio: amd: Drop unused pdev pointer in privata dataEnrico Weigelt2019-06-271-2/+0
| | | | | | | | | | | | | | | | The pointer to the struct platform_device in the driver's private data struct is never used and therefore can be dropped. Signed-off-by: Enrico Weigelt <info@metux.net> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | gpio: Drop the parent_irq from gpio_irq_chipLinus Walleij2019-06-141-11/+19
| | | | | | | | | | | | | | | | | | | | We already have an array named "parents" so instead of letting one point to the other, simply allocate a dynamic array to hold the parents, just one if desired and drop the number of members in gpio_irq_chip by 1. Rename gpiochip to gc in the process. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | gpio: Add GPIOLIB_IRQCHIP cleanup to TODOLinus Walleij2019-06-141-0/+40
| | | | | | | | | | | | | | | | We now have two APIs for registering GPIOLIB_IRQCHIP, this is not working and creating confusion. Add a TODO item to fix it up. Cc: Thierry Reding <treding@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | gpio: ftgpio: Pass irqchip when adding gpiochipLinus Walleij2019-06-141-16/+19
| | | | | | | | | | | | | | | | | | | | | | We need to convert all old gpio irqchips to pass the irqchip setup along when adding the gpio_chip. For chained irqchips this is a pretty straight-forward conversion. Cc: Thierry Reding <treding@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | gpio: omap: Fix lost edge wake-up interruptsTony Lindgren2019-06-121-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If an edge interrupt triggers while entering idle just before we save GPIO datain register to saved_datain, the triggered GPIO will not be noticed on wake-up. This is because the saved_datain and GPIO datain are the same on wake-up in omap_gpio_unidle(). Let's fix this by ignoring any pending edge interrupts for saved_datain. This issue affects only idle states where the GPIO module internal wake-up path is operational. For deeper idle states where the GPIO module gets powered off, Linux generic wakeirqs must be used for the padconf wake-up events with pinctrl-single driver. For examples, please see "interrupts-extended" dts usage in many drivers. This issue can be somewhat easily reproduced by pinging an idle system with smsc911x Ethernet interface configured IRQ_TYPE_EDGE_FALLING. At some point the smsc911x interrupts will just stop triggering. Also if WLCORE WLAN is used with EDGE interrupt like it's documentation specifies, we can see lost interrupts without this patch. Note that in the long run we may be able to cancel entering idle by returning an error in gpio_omap_cpu_notifier() on pending interrupts. But let's fix the bug first. Also note that because of the recent clean-up efforts this patch does not apply directly to older kernels. This does fix a long term issue though, and can be backported as needed. Cc: Aaro Koskinen <aaro.koskinen@iki.fi> Cc: Grygorii Strashko <grygorii.strashko@ti.com> Cc: Keerthy <j-keerthy@ti.com> Cc: Ladislav Michl <ladis@linux-mips.org> Cc: Peter Ujfalusi <peter.ujfalusi@ti.com> Cc: Russell King <rmk+kernel@armlinux.org.uk> Cc: Tero Kristo <t-kristo@ti.com> Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | gpio: omap: clean up register access in omap2_set_gpio_debounce()Russell King2019-06-121-3/+1
| | | | | | | | | | | | | | Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | gpio: omap: irq_startup() must not return error codesRussell King2019-06-121-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | The irq_startup() method returns an unsigned int, but in __irq_startup() it is assigned to an int. However, nothing checks for errors, so any error that is returned is ignored. Remove the check for GPIO-input mode and the error return. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | gpio: omap: clean up wakeup handlingRussell King2019-06-121-23/+13
| | | | | | | | | | | | | | Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | gpio: omap: constify register tablesRussell King2019-06-121-6/+6
| | | | | | | | | | | | | | | | | | | | We must never alter the register tables; these are read-only as far as the driver is concerned. Constify these tables. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | gpio: omap: clean up omap_gpio_restore_context()Russell King2019-06-121-21/+15
| | | | | | | | | | | | | | | | | | | | | | | | Use local variables to store the base iomem address and regs table pointer like omap_gpio_init_context() does. Not only does this make the function neater, it also avoids unnecessary reloads of the same data multiple times. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | gpio: omap: remove dataout variation in context handlingRussell King2019-06-121-10/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | When a GPIO block has the set/clear dataout registers implemented, it also has the normal dataout register implemented. Reading this register reads the current GPIO output state, and writing it sets the GPIOs to the explicit state. This is the behaviour that we want when saving and restoring the context, so use the dataout register exclusively. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | gpio: omap: simplify omap_set_gpio_irqenable()Russell King2019-06-121-46/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | omap_set_gpio_irqenable() calls two helpers that are almost the same apart from whether they set or clear bits. We can consolidate these: - in the set/clear bit register case, we can perform the operation on our saved context copy and write the appropriate set/clear register. - otherwise, we can use our read-modify-write helper and invert enable if irqenable_inv is set. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | gpio: omap: simplify omap_toggle_gpio_edge_triggering()Russell King2019-06-121-18/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This function open-codes an exclusive-or bitwise operation using an if() statement and explicitly setting or clearing the bit. Instead, use an exclusive-or operation instead, and simplify the function. We can combine the preprocessor conditional using IS_ENABLED() and gain some additional compilation coverage. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | gpio: omap: simplify read-modify-writeRussell King2019-06-121-53/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | We already have a read-modify-write helper, but there's more that can be done with a read-modify-write helper if it returned the new value. Modify the existing helper to return the new value, and arrange for it to take one less argument by having the caller compute the register address. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | gpio: omap: simplify bank->level_maskRussell King2019-06-121-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | bank->level_mask is merely the bitwise or of the level detection context which we have already read in this function. Rather than repeating additional reads, compute it from the values already read. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | gpio: omap: simplify set_multiple()Russell King2019-06-121-38/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One of the reasons for set_multiple() to exist is to allow multiple GPIOs on the same chip to be changed simultaneously - see commit 5f42424354f5 ("gpiolib: allow simultaneous setting of multiple GPIO outputs"): - Simultaneous glitch-free setting of multiple pins on any kind of parallel bus attached to GPIOs provided they all reside on the same chip and bank. In order for this to work, we should not use the atomic set/clear registers, but instead read-modify-write the dataout register. We already take the spinlock to ensure that happens atomically, so move the code into the set_multiple() function and kill the two helper functions. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | gpio: omap: simplify get_multiple()Russell King2019-06-121-25/+11
| | | | | | | | | | | | | | | | | | | | | | There is no reason to have helper functions to read the datain and dataout registers when they are only used in one location. Simplify this code to make it more readable. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | gpio: omap: simplify get() methodRussell King2019-06-121-19/+6
| | | | | | | | | | | | | | | | | | | | | | | | omap_gpio_get() calls omap_get_gpio_datain() or omap_get_gpio_dataout() to read the GPIO state. These two functions are only called from this method, so they don't add much value. Move their contents into omap_gpio_get() method and simplify. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | gpio: omap: simplify omap_gpio_get_direction()Russell King2019-06-121-10/+3
| | | | | | | | | | | | | | | | | | | | | | Architectures are single-copy atomic, which means that simply reading a register is an inherently atomic operation. There is no need to take a spinlock here. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | gpio: omap: move omap_gpio_request() and omap_gpio_free()Russell King2019-06-121-32/+32
| | | | | | | | | | | | | | | | | | | | | | Move these two functions to live beside the rest of the gpio chip implementation, rather than in the middle of the irq chip implementation. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | gpio: omap: remove irq_ack methodRussell King2019-06-121-14/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The irq_ack method does not fit our hardware requirements. Edge interrupts must be cleared before we handle them, and level interrupts must be cleared after handling them. We handle the interrupt clearance in our interrupt handler for edge IRQs and in the unmask method for level IRQs. Replace the irq_ack method with the no-op method from the dummy irq chip. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | gpio: omap: clean up edge interrupt handlingRussell King2019-06-121-11/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The edge interrupt handling was effectively: isr = ISR_reg & enabled; if (bank->level_mask) level_mask = bank->level_mask & enabled; else level_mask = 0; edge = isr & ~level_mask; When bank->level_mask is zero, level_mask will be computed as zero anyway, so the if() statement is redundant. We are then left with: isr = ISR_reg & enabled; level_mask = bank->level_mask & enabled; edge = isr & ~level_mask; This can be simplified further to: isr = ISR_reg & enabled; edge = isr & ~bank->level_mask; since the second mask with 'enabled' is redundant. Improve the associated comment as well. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | gpio: omap: remove remainder of list managementRussell King2019-06-121-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | Commit c4791bc6e3a6 ("gpio: omap: drop omap_gpio_list") removed the list head and addition to the list head of each gpio bank, but failed to remove the list_del() call and the node inside struct gpio_bank. Remove these too. Fixes: c4791bc6e3a6 ("gpio: omap: drop omap_gpio_list") Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>