summaryrefslogtreecommitdiffstats
path: root/drivers/gpio
Commit message (Collapse)AuthorAgeFilesLines
* Merge tag 'gpio-v5.11-1' of ↵Linus Torvalds2020-12-1732-681/+1402
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio Pull GPIO updates from Linus Walleij: "This is the bulk of the GPIO changes for the v5.11 kernel cycle: Core changes: - Retired the old set-up function for GPIO IRQ chips. All chips now use the template struct gpio_irq_chip and pass that to the core to be set up alongside the gpio_chip. We can finally get rid of the old cruft. - Some refactoring and clean up of the core code. - Support edge event timestamps to be stamped using REALTIME (wall clock) timestamps. We have found solid use cases for this, so we support it. New drivers: - MStar MSC313 GPIO driver. - HiSilicon GPIO driver. Driver improvements: - The PCA953x driver now also supports the NXP PCAL9554B/C chips. - The mockup driver can now be probed from the device tree which is pretty useful for virtual prototyping of devices. - The Rcar driver now supports .get_multiple() - The MXC driver dropped some legacy and became a pure device tree client. - The Exar driver was moved over to the IDA interface for enumerating, and also switched over to using regmap for register access" * tag 'gpio-v5.11-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (87 commits) MAINTAINERS: Remove reference to non-existing file gpio: hisi: Do not require ACPI for COMPILE_TEST MAINTAINERS: Add maintainer for HiSilicon GPIO driver gpio: gpio-hisi: Add HiSilicon GPIO support gpio: cs5535: Simplify the return expression of cs5535_gpio_probe() gpiolib: irq hooks: fix recursion in gpiochip_irq_unmask dt-bindings: mt7621-gpio: convert bindings to YAML format gpiolib: cdev: Flag invalid GPIOs as used gpio: put virtual gpio device into their own submenu drivers: gpio: amd8111: use SPDX-License-Identifier drivers: gpio: amd8111: prefer dev_err()/dev_info() over raw printk drivers: gpio: bt8xx: prefer dev_err()/dev_warn() over of raw printk gpio: Add TODO item for debugfs interface gpio: just plain warning when nonexisting gpio requested tools: gpio: add option to report wall-clock time to gpio-event-mon tools: gpio: add support for reporting realtime event clock to lsgpio gpiolib: cdev: allow edge event timestamps to be configured as REALTIME gpio: msc313: MStar MSC313 GPIO driver dt-bindings: gpio: Binding for MStar MSC313 GPIO controller dt-bindings: gpio: Add a binding header for the MSC313 GPIO driver ...
| * gpio: hisi: Do not require ACPI for COMPILE_TESTAndy Shevchenko2020-12-161-1/+1
| | | | | | | | | | | | | | | | | | | | Make it clear that ACPI needs to be present only to get driver functional. It is not required for compilation. Fixes: 356b01a986a5 ("gpio: gpio-hisi: Add HiSilicon GPIO support") Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20201214165524.43843-1-andriy.shevchenko@linux.intel.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
| * MAINTAINERS: Add maintainer for HiSilicon GPIO driverLuo Jiaxing2020-12-161-5/+0
| | | | | | | | | | | | | | | | | | Here add maintainer information for HiSilicon GPIO driver. Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com> Link: https://lore.kernel.org/r/1607934255-52544-3-git-send-email-luojiaxing@huawei.com [Dropped some dead code when applying] Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
| * gpio: gpio-hisi: Add HiSilicon GPIO supportLuo Jiaxing2020-12-143-0/+340
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This GPIO driver is for HiSilicon's ARM SoC. HiSilicon's GPIO controller support double-edge interrupt and multi-core concurrent access. ACPI table example for this GPIO controller: Device (GPO0) { Name (_HID, "HISI0184") Device (PRTA) { Name (_ADR, Zero) Name (_UID, Zero) Name (_DSD, Package (0x01) { Package (0x02) { "ngpios", 0x20 } }) } } Signed-off-by: Luo Jiaxing <luojiaxing@huawei.com> Link: https://lore.kernel.org/r/1607934255-52544-2-git-send-email-luojiaxing@huawei.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
| * gpio: cs5535: Simplify the return expression of cs5535_gpio_probe()Zheng Yongjun2020-12-121-6/+2
| | | | | | | | | | | | | | | | Simplify the return expression. Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com> Link: https://lore.kernel.org/r/20201210135609.1372-1-zhengyongjun3@huawei.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
| * gpiolib: irq hooks: fix recursion in gpiochip_irq_unmaskNikita Shubin2020-12-121-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | irqchip shared with multiple gpiochips, leads to recursive call of gpiochip_irq_mask/gpiochip_irq_unmask which was assigned to rqchip->irq_mask/irqchip->irq_unmask, these happens becouse of only irqchip->irq_enable == gpiochip_irq_enable is checked. Let's add an additional check to make sure shared irqchip is detected even if irqchip->irq_enable wasn't defined. Fixes: a8173820f441 ("gpio: gpiolib: Allow GPIO IRQs to lazy disable") Signed-off-by: Nikita Shubin <nikita.shubin@maquefel.me> Link: https://lore.kernel.org/r/20201210070514.13238-1-nikita.shubin@maquefel.me Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
| * Merge tag 'gpio-updates-for-v5.11' of ↵Linus Walleij2020-12-0918-229/+279
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux into devel gpio updates for v5.11-rc1 - several refactoring patches of the core gpiolib code - add support for NXP PCAL9554B/C to gpio-pca953x - allow probing mockup devices from device tree - refactoring and improvements to gpio-rcar - improvements to locking in gpio-tegra - code shrink in gpiolib devres - get the irq offset from device tree in gpio-sifive - major refactoring of gpio-exar - convert gpio-mvebu pwm access to regmap - create a new submenu for virtual GPIO drivers - fix clang fall-through warnings treewide - minor driver refactoring and tweaks sprinkled all over
| | * gpio: put virtual gpio device into their own submenuEnrico Weigelt, metux IT consult2020-12-081-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | Since we already have a few virtual GPIO drivers, and more to come, this category deserves its own submenu. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
| | * gpio: mvebu: switch pwm duration registers to regmapBaruch Siach2020-12-021-32/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 2233bf7a92e ("gpio: mvebu: switch to regmap for register access") changed most readl/writel registers access calls to the regmap API in preparation for Armada 7K/8K support. PWM duration registers were left using readl/writel, as the driver does not support PWM for Armada 7K/8K. Switch PWM duration registers to regmap as first step in adding Armada 7K/8K PWM functionality support. Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
| | * gpio: mvebu: update Armada XP per-CPU commentBaruch Siach2020-12-021-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 2233bf7a92e ("gpio: mvebu: switch to regmap for register access") introduced percpu_regs to replace percpu_membase. Update the comment to match. Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Fixes: 2233bf7a92e7 ("gpio: mvebu: switch to regmap for register access") Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
| | * gpiolib: do not print err message for EPROBE_DEFERGrygorii Strashko2020-12-011-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The gpiochip may have dependencies from pinmux and so got deferred. Now it will print error message every time -EPROBE_DEFER is returned which is unnecessary: "gpiochip_add_data_with_key: GPIOs 0..31 (gpio-0-31) failed to register, -517" Hence, do suppress error message for -EPROBE_DEFER case. Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
| | * gpio: ath79: Fix fall-through warning for ClangGustavo A. R. Silva2020-12-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning by explicitly adding a fallthrough pseudo-keyword to indicate that the code is intended to fall through to the next case. Link: https://github.com/KSPP/linux/issues/115 Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
| | * gpiolib: acpi: Fix fall-through warnings for ClangGustavo A. R. Silva2020-12-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In preparation to enable -Wimplicit-fallthrough for Clang, fix a warning by explicitly adding a break statement instead of letting the code fall through to the next case. Link: https://github.com/KSPP/linux/issues/115 Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
| | * gpio: omap: handle deferred probe with dev_err_probe() for gpiochip_add_data()Grygorii Strashko2020-11-301-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The gpiochip_add_data() may return -EPROBE_DEFER which is not handled properly by TI GPIO driver and causes unnecessary boot log messages. Hence, add proper deferred probe handling with new dev_err_probe() API. Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
| | * gpio: xra1403: remove unneeded spi_set_drvdata()Alexandru Ardelean2020-11-301-9/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is no matching spi_get_drvdata() call in the driver, so there is no need to do spi_set_drvdata(). This looks like it probably was copied from a driver that used both spi_set_drvdata() & spi_get_drvdata(). Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
| | * gpio: dwapb: Remove unnecessary error messageDamien Le Moal2020-11-301-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In dwapb_get_reset(), if devm_reset_control_get_optional_shared() fails, an error message is printed even if the failure is the benign EPROBE_DEFER error due to the reset controller not yet being initialized. Use dev_err_probe() to handle devm_reset_control_get_optional_shared() errors to avoid unnecessarilly printing an error message for the deferred probe error. Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
| | * gpio: exar: use devm action for freeing the IDA and drop remove()Bartosz Golaszewski2020-11-251-15/+12
| | | | | | | | | | | | | | | | | | | | | | | | We can simplify the error path in probe() and drop remove() entirely if we provide a devm action for freeing the device ID. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| | * gpio: exar: switch to using regmapBartosz Golaszewski2020-11-252-54/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | We can simplify the code in gpio-exar by using regmap. This allows us to drop the mutex (regmap provides its own locking) and we can also reuse regmap's bit operations instead of implementing our own update function. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| | * gpio: exar: unduplicate address and offset computationBartosz Golaszewski2020-11-251-12/+28
| | | | | | | | | | | | | | | | | | | | | | | | Provide and use helpers for calculating the register address and bit offset instead of hand coding it in every function. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| | * gpio: exar: use a helper variable for &pdev->devBartosz Golaszewski2020-11-251-8/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | It's more elegant to use a helper local variable to store the address of the underlying struct device than to dereference pdev everywhere. It also has the benefit of avoiding unnecessary line breaks. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| | * gpio: exar: switch to a simpler IDA interfaceBartosz Golaszewski2020-11-251-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We don't need to specify any ranges when allocating IDs so we can switch to ida_alloc() and ida_free() instead of the ida_simple_ counterparts. ida_simple_get(ida, 0, 0, gfp) is equivalent to ida_alloc_range(ida, 0, UINT_MAX, gfp) which is equivalent to ida_alloc(ida, gfp). Note: IDR will never actually allocate an ID larger than INT_MAX. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| | * gpio: exar: include idr.hBartosz Golaszewski2020-11-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | This driver uses IDA APIs but doesn't include the relevant header. This fixes it. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| | * gpio: exar: add a newline after the copyright noticeBartosz Golaszewski2020-11-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | It's customary to have a newline between the copyright header and the includes. Add one to gpio-exar. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| | * gpio: sifive: To get gpio irq offset from device tree dataGreentime Hu2020-11-181-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | We can get hwirq number of the gpio by its irq_data->hwirq so that we don't need to add more macros for different platforms. This patch is tested in SiFive Unleashed board and SiFive Unmatched board. Signed-off-by: Greentime Hu <greentime.hu@sifive.com> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
| | * gpiolib: devres: shrink devm_gpiochip_add_data_with_key()Bartosz Golaszewski2020-11-161-15/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | If all we want to manage is a single pointer, there's no need to manually allocate and add a new devres. We can simply use devm_add_action_or_reset() and shrink the code by a good bit. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
| | * gpio: tegra: Use raw_spinlockDmitry Osipenko2020-11-061-5/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use raw_spinlock in order to fix spurious messages about invalid context when spinlock debugging is enabled. This happens because there is a legit nested raw_spinlock->spinlock locking usage within IRQ-related code. IRQ core uses raw spinlock and then Tegra GPIO driver uses a nested spinlock. The debug code can't recognize and handle this case, hence we need to use raw spinlock in the GPIO driver. [ BUG: Invalid wait context ] ... (dump_stack) from (__lock_acquire) (__lock_acquire) from (lock_acquire) (lock_acquire) from (_raw_spin_lock_irqsave) (_raw_spin_lock_irqsave) from (tegra_gpio_irq_set_type) (tegra_gpio_irq_set_type) from (__irq_set_trigger) (__irq_set_trigger) from (__setup_irq) (__setup_irq) from (request_threaded_irq) (request_threaded_irq) from (devm_request_threaded_irq) (devm_request_threaded_irq) from (elants_i2c_probe) (elants_i2c_probe) from (i2c_device_probe) ... Tested-by: Peter Geis <pgwipeout@gmail.com> Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
| | * gpio: tegra: Add lockdep classDmitry Osipenko2020-11-061-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add lockdep class in order to fix debug warnings that are coming from a legit nested use of irq_set_irq_wake() by the Tegra GPIO driver. WARNING: possible recursive locking detected ... (irq_set_irq_wake) from (tegra_gpio_irq_set_wake) (tegra_gpio_irq_set_wake) from (irq_set_irq_wake) (irq_set_irq_wake) from (brcmf_sdiod_intr_register [brcmfmac]) ... Tested-by: Peter Geis <pgwipeout@gmail.com> Reported-by: Peter Geis <pgwipeout@gmail.com> Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
| | * gpio: rcar: Implement gpio_chip.get_multiple()Geert Uytterhoeven2020-10-301-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | Add support for getting the state of multiple pins using a minimum of register reads. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
| | * gpio: rcar: Rework hardware features handlingGeert Uytterhoeven2020-10-301-13/+11
| | | | | | | | | | | | | | | | | | | | | | | | Reuse gpio_rcar_info inside gpio_rcar_priv instead of duplicating the individual members, so gpio_rcar_parse_dt() can copy them in one go. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
| | * gpio: rcar: Align register offsetsGeert Uytterhoeven2020-10-301-13/+13
| | | | | | | | | | | | | | | | | | | | | Improve readability by aligning the offsets in the register definitions. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
| | * gpio: rcar: Cache gpiochip_get_data() return valueGeert Uytterhoeven2020-10-301-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since commit 43c54ecade400cf6 ("gpio: move the subdriver data pointer into gpio_device") changed gpiochip_get_data() to an out-of-line function, it is now worthwhile to avoid multiple calls in a row by caching its return value in a local variable. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
| | * gpiolib: cdev: add GPIO_V2_LINE_FLAG_EDGE_BOTH and use it in edge_irq_thread()Kent Gibson2020-10-301-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add GPIO_V2_LINE_FLAG_EDGE_BOTH macro and use it in edge_irq_thread() to improve readability of edge handling cases. Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Kent Gibson <warthog618@gmail.com> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
| | * gpio: mockup: Allow probing from device treeVincent Whitchurch2020-10-291-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow the mockup driver to be probed via the device tree without any module parameters, allowing it to be used to configure and test higher level drivers like the leds-gpio driver and corresponding userspace before actual hardware is available. Signed-off-by: Vincent Whitchurch <vincent.whitchurch@axis.com> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
| | * gpiolib: split error path in gpiod_request_commit()Andy Shevchenko2020-10-261-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | For better maintenance and micro optimization split error path in the gpiod_request_commit(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
| | * gpiolib: Unify expectations about ->request() returned valueAndy Shevchenko2020-10-262-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Half of the code in the GPIO library is written in an expectation that any non-zero value returned from the ->request() callback is an error code, while some code checks only for negative values. Unify expectations about ->request() returned value to be non-zero for an error and 0 for the success. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
| | * gpiolib: of: Use named item for enum gpiod_flags variableAndy Shevchenko2020-10-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Use named item instead of plain integer for enum gpiod_flags to make it clear that even 0 has its own meaning. Cc: 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>
| | * gpiolib: cdev: document that line eflags are sharedKent Gibson2020-10-261-11/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The line.eflags field is shared so document this fact and highlight it throughout using READ_ONCE() and WRITE_ONCE() accessors. Also use a local copy of the eflags in edge_irq_thread() to ensure consistent control flow even if eflags changes. This is only a defensive measure as edge_irq_thread() is currently disabled when the eflags are changed. Signed-off-by: Kent Gibson <warthog618@gmail.com> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
| | * gpiolib: Extract gpiod_not_found() helperAndy Shevchenko2020-10-264-18/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Several places in the code are using same idiom, i.e. IS_ERR(desc) && PTR_ERR(desc) == -ENOENT which meaning is GPIO description is not found. For better readability extract gpiod_not_found() helper and use it. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
| * | gpiolib: cdev: Flag invalid GPIOs as usedMarc Zyngier2020-12-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When reporting the state of a GPIO to userspace, we never check for the actual validity of the line, meaning we report invalid lines as being usable. A subsequent request will fail though, which is an inconsistent behaviour from a userspace perspective. Instead, let's check for the validity of the line and report it as used if it is invalid. This allows a tool such as gpioinfo to report something sensible: gpiochip3 - 4 lines: line 0: unnamed unused input active-high line 1: unnamed kernel input active-high [used] line 2: unnamed kernel input active-high [used] line 3: unnamed unused input active-high In this example, lines 1 and 2 are invalid, and cannot be used by userspace. Signed-off-by: Marc Zyngier <maz@kernel.org> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20201204164739.781812-2-maz@kernel.org Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
| * | drivers: gpio: amd8111: use SPDX-License-IdentifierEnrico Weigelt, metux IT consult2020-12-081-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | Prefer SPDX-License-Identifier over hand-written texts. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net> Link: https://lore.kernel.org/r/20201203182423.5499-3-info@metux.net Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
| * | drivers: gpio: amd8111: prefer dev_err()/dev_info() over raw printkEnrico Weigelt, metux IT consult2020-12-081-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | For logging in device contexts, dev_*() functions are preferred over raw printk(), which also print out device name. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net> Link: https://lore.kernel.org/r/20201203182423.5499-2-info@metux.net Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
| * | drivers: gpio: bt8xx: prefer dev_err()/dev_warn() over of raw printkEnrico Weigelt, metux IT consult2020-12-081-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | For logging in device contexts, dev_*() functions are preferred over raw printk(), which also print out device name. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net> Link: https://lore.kernel.org/r/20201203182423.5499-1-info@metux.net Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
| * | gpio: Add TODO item for debugfs interfaceLinus Walleij2020-12-061-0/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The idea to create a debugfs to replace the aging and dangerous sysfs ABI for hacking and tinkering came up on the list. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Cc: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/r/20201204083533.65830-1-linus.walleij@linaro.org
| * | gpio: just plain warning when nonexisting gpio requestedEnrico Weigelt2020-12-051-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When trying to export an nonexisting gpio ID, the kernel prints out a big warning w/ stacktrace, sounding like a huge problem. In fact it's a pretty normal situation, like file or device not found. So, just print a more relaxed warning instead. changes v2: drop defining pr_fmt() Signed-off-by: Enrico Weigelt <info@metux.net> Link: https://lore.kernel.org/r/20201202133754.32045-1-info@metux.net Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
| * | gpiolib: cdev: allow edge event timestamps to be configured as REALTIMEKent Gibson2020-12-052-3/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using CLOCK_REALTIME as the source for event timestamps is crucial for some specific applications, particularly those requiring timetamps relative to a PTP clock, so provide an option to switch the event timestamp source from the default CLOCK_MONOTONIC to CLOCK_REALTIME. Note that CLOCK_REALTIME was the default source clock for GPIO until Linux 5.7 when it was changed to CLOCK_MONOTONIC due to issues with the shifting of the realtime clock. Providing this option maintains the CLOCK_MONOTONIC as the default, while also providing a path forward for those dependent on the pre-5.7 behaviour. Suggested-by: Jack Winch <sunt.un.morcov@gmail.com> Signed-off-by: Kent Gibson <warthog618@gmail.com> Link: https://lore.kernel.org/r/20201014231158.34117-2-warthog618@gmail.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
| * | gpio: msc313: MStar MSC313 GPIO driverDaniel Palmer2020-12-053-0/+472
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a driver that supports the GPIO block found in MStar/SigmaStar ARMv7 SoCs. The controller seems to have enough register for 128 lines but where they are wired up differs between chips and no currently known chip uses anywhere near 128 lines so there needs to be some per-chip data to collect together what lines actually have physical pins attached and map the right names to them. The core peripherals seem to use the same lines on the currently known chips but the lines used for the sensor interface, lcd controller etc pins seem to be totally different between the infinity and mercury chips The code tries to collect all of the re-usable names, offsets etc together so that it's easy to build the extra per-chip data for other chips in the future. So far this only supports the MSC313 and MSC313E chips. Support for the SSC8336N (mercury5) is trivial to add once all of the lines have been mapped out. Signed-off-by: Daniel Palmer <daniel@0x0f.com> Link: https://lore.kernel.org/r/20201129110803.2461700-4-daniel@0x0f.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
| * | gpio: mxs: Remove unused .id_table supportFabio Estevam2020-12-041-14/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mxs is a devicetree-only platform and hence it does not make use of the id_table mechanism. Get rid of the .id_table as it is unused. Signed-off-by: Fabio Estevam <festevam@gmail.com> Link: https://lore.kernel.org/r/20201118191938.32693-1-festevam@gmail.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
| * | gpio: tegra186: Set affinity callback to parentLinus Walleij2020-12-041-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This assigns the .irq_set_affinity to the parent callback. I assume the Tegra186 is an SMP system so this would be beneficial. I used the pattern making the hirerarchy tolerant for missing parent as in Marc's earlier patch. Suggested-by: Marc Zyngier <maz@kernel.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Cc: Thierry Reding <treding@nvidia.com> Cc: Vidya Sagar <vidyas@nvidia.com> Link: https://lore.kernel.org/r/20201117213351.249668-2-linus.walleij@linaro.org
| * | gpio: sifive: Set affinity callback to parentLinus Walleij2020-12-041-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This assigns the .irq_set_affinity to the parent callback. I assume the sifive GPIO can be used in systems with SMP. I used the pattern making the hirerarchy tolerant for missing parent as in Marc's earlier patches. Suggested-by: Marc Zyngier <maz@kernel.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Cc: Yash Shah <yash.shah@sifive.com> Cc: Wesley W. Terpstra <wesley@sifive.com> Link: https://lore.kernel.org/r/20201117213351.249668-1-linus.walleij@linaro.org
| * | gpio: sysfs: Enforce character deviceLinus Walleij2020-12-041-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If users select sysfs support they get the character device as well so that end-users cannot complain that they "only have sysfs on my system". They should have the character device at all times. If someone is in so dire need of stripping out the character device while still enabling the sysfs ABI they can very well patch the kernel. Also only show this obsolete option to expert users. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20201110142724.14760-1-linus.walleij@linaro.org