aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpio
AgeCommit message (Collapse)AuthorFilesLines
2020-12-17Merge tag 'gpio-v5.11-1' of ↵Linus Torvalds32-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 ...
2020-12-16Merge tag 'mfd-next-5.11' of ↵Linus Torvalds1-6/+6
git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd Pull MFD updates from Lee Jones: "New Drivers - Add support for Intel's Platform Monitoring Technology (PMT) New Device Support: - Add support for PM660/PM660L to QCom SPMI PMIC - Add support for lots of new devices to Kontron Core New Functionality: - Provide syscon_regmap_lookup_by_phandle_optional() to SysCon API Fix-ups: - Constify; da9xxx-core; intel_*, tps65xxx, wm8xxx-core, lp8788, stmpe, sun4i-gpadc, 88pm800, hi655x-pmic, ioc3, etc - Remove superfluous code; madera, tps65910 - Use raw APIs (rid abstractions); tps65911-comparator, tps65910 - Whitespace/formatting fix-ups; tps65910 - Device Tree changes/updates; bd71837-pmic, syscon - Use helpers/APIs (no hand rolling); altera-sysmgr - Mark of_match tables as __maybe_unused; twl6030-irq - Fix spelling; si476x-core Bug Fixes: - Reset on resume to ensure known state; madera-core - Correct ordering issues; madera-core, tps65910, kempld-core - Remove erroneous passing of of_compatible strings; at91-usart - Fix potential I2C adaptor leak; htc-i2cpld - Correct errorneous defines; rt5033-private - Resolve Kconfig issues; MFD_SL28CPLD, MFD_OMAP_USB_HOST - Fix dev_err_probe() handling; stmfx - Repair interrupt regression; motorola-cpcap - Allow ACPI matching of DT tables; bcm590xx, da9xx, ene-kb3930, fsl-imx25-tsadc, max77650, mt6397-core, rt5033, stmfx, max77686, sun4i-gpadc, wm8994-core, axp20x-i2c" [ The PMT updates already came in through the x86 platform tree ] * tag 'mfd-next-5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (48 commits) mfd: kempld-core: Add support for additional devices mfd: si476x-core.h: Fix "regulator" spelling in comment mfd: twl6030: Mark of_device_id table as maybe unused mfd: axp20x: Skip of_device_id table when !CONFIG_OF mfd: wm8994: Drop of_match_ptr from of_device_id table mfd: sun4i: Drop of_match_ptr from of_device_id table mfd: max77686: Drop of_match_ptr from of_device_id table mfd: stmfx: Drop of_match_ptr from of_device_id table mfd: rt5033: Drop of_match_ptr from of_device_id table mfd: mt6397: Drop of_match_ptr from of_device_id table mfd: max77650: Drop of_match_ptr from of_device_id table mfd: fsl-imx25: Drop of_match_ptr from of_device_id table mfd: ene-kb3930: Drop of_match_ptr from of_device_id table mfd: da9150: Drop of_match_ptr from of_device_id table mfd: da9063: Drop of_match_ptr from of_device_id table mfd: da9062: Drop of_match_ptr from of_device_id table mfd: da9055: Drop of_match_ptr from of_device_id table mfd: bcm590xx: Drop of_match_ptr from of_device_id table mfd: omap-usb: Depend on COMMON_CLK to fix compile tests mfd: kempld-core: Check for DMI definition before ACPI ...
2020-12-16gpio: hisi: Do not require ACPI for COMPILE_TESTAndy Shevchenko1-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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2020-12-16MAINTAINERS: Add maintainer for HiSilicon GPIO driverLuo Jiaxing1-5/+0
Here add maintainer information for HiSilicon GPIO driver. Signed-off-by: Luo Jiaxing <[email protected]> Link: https://lore.kernel.org/r/[email protected] [Dropped some dead code when applying] Signed-off-by: Linus Walleij <[email protected]>
2020-12-14gpio: gpio-hisi: Add HiSilicon GPIO supportLuo Jiaxing3-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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2020-12-12gpio: cs5535: Simplify the return expression of cs5535_gpio_probe()Zheng Yongjun1-6/+2
Simplify the return expression. Signed-off-by: Zheng Yongjun <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2020-12-12gpiolib: irq hooks: fix recursion in gpiochip_irq_unmaskNikita Shubin1-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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2020-12-09Merge tag 'gpio-updates-for-v5.11' of ↵Linus Walleij18-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
2020-12-09gpiolib: cdev: Flag invalid GPIOs as usedMarc Zyngier1-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 <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2020-12-09gpio: eic-sprd: break loop when getting NULL device resourceChunyan Zhang1-1/+1
EIC controller have unfixed numbers of banks on different Spreadtrum SoCs, and each bank has its own base address, the loop of getting there base address in driver should break if the resource gotten via platform_get_resource() is NULL already. The later ones would be all NULL even if the loop continues. Fixes: 25518e024e3a ("gpio: Add Spreadtrum EIC driver support") Signed-off-by: Chunyan Zhang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2020-12-08gpio: put virtual gpio device into their own submenuEnrico Weigelt, metux IT consult1-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 <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
2020-12-08drivers: gpio: amd8111: use SPDX-License-IdentifierEnrico Weigelt, metux IT consult1-4/+1
Prefer SPDX-License-Identifier over hand-written texts. Signed-off-by: Enrico Weigelt, metux IT consult <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2020-12-08drivers: gpio: amd8111: prefer dev_err()/dev_info() over raw printkEnrico Weigelt, metux IT consult1-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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2020-12-08drivers: gpio: bt8xx: prefer dev_err()/dev_warn() over of raw printkEnrico Weigelt, metux IT consult1-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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2020-12-06gpio: Add TODO item for debugfs interfaceLinus Walleij1-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 <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Cc: Geert Uytterhoeven <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-12-05gpio: just plain warning when nonexisting gpio requestedEnrico Weigelt1-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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2020-12-05gpiolib: cdev: allow edge event timestamps to be configured as REALTIMEKent Gibson2-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 <[email protected]> Signed-off-by: Kent Gibson <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2020-12-05gpio: msc313: MStar MSC313 GPIO driverDaniel Palmer3-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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2020-12-04gpio: mxs: Remove unused .id_table supportFabio Estevam1-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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2020-12-04gpio: tegra186: Set affinity callback to parentLinus Walleij1-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 <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Cc: Thierry Reding <[email protected]> Cc: Vidya Sagar <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-12-04gpio: sifive: Set affinity callback to parentLinus Walleij1-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 <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Cc: Yash Shah <[email protected]> Cc: Wesley W. Terpstra <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-12-04gpio: sysfs: Enforce character deviceLinus Walleij1-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 <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2020-12-02gpio: mvebu: switch pwm duration registers to regmapBaruch Siach1-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 <[email protected]> Signed-off-by: Baruch Siach <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
2020-12-02gpio: mvebu: update Armada XP per-CPU commentBaruch Siach1-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 <[email protected]> Fixes: 2233bf7a92e7 ("gpio: mvebu: switch to regmap for register access") Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: Baruch Siach <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
2020-12-02gpio: mvebu: fix potential user-after-free on probeBaruch Siach1-5/+11
When mvebu_pwm_probe() fails IRQ domain is not released. Move pwm probe before IRQ domain allocation. Add pwm cleanup code to the failure path. Fixes: 757642f9a584 ("gpio: mvebu: Add limited PWM support") Reported-by: Andrew Lunn <[email protected]> Signed-off-by: Baruch Siach <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
2020-12-02gpio: zynq: fix reference leak in zynq_gpio functionsQinglang Miao1-2/+2
pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to putting operation will result in a reference leak here. A new function pm_runtime_resume_and_get is introduced in [0] to keep usage counter balanced. So We fix the reference leak by replacing it with new funtion. [0] dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter") Fixes: c2df3de0d07e ("gpio: zynq: properly support runtime PM for GPIO used as interrupts") Reported-by: Hulk Robot <[email protected]> Signed-off-by: Qinglang Miao <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
2020-12-02gpiolib: Don't free if pin ranges are not definedEdmond Chung1-0/+5
A similar check was added in gpiochip_generic_request, but not in free. This has caused an imbalance count of request vs. free calls to the pinctrl driver. This patch is targeted to fix that issue. Fixes: 2ab73c6d8323 ("gpio: Support GPIO controllers without pin-ranges") Signed-off-by: Edmond Chung <[email protected]> Signed-off-by: Andrew Chant <[email protected]> Signed-off-by: Will McVicker <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
2020-12-02gpio: dwapb: fix NULL pointer dereference at dwapb_gpio_suspend()Luo Jiaxing1-0/+2
Following Calltrace is found when running echo freeze > /sys/power/state. [ 272.755506] Unable to handle kernel NULL pointer dereference at virtual address 0000000000000010 [ 272.755585] Call trace: [ 272.755587] dwapb_gpio_suspend+0x18/0x318 [ 272.755588] pm_generic_suspend+0x2c/0x48 [ 272.755595] acpi_subsys_suspend+0x60/0x70 [ 272.755599] dpm_run_callback.isra.18+0x40/0xe0 [ 272.755601] __device_suspend+0xf4/0x360 The reason is platform_set_drvdata() is deleted, and dwapb_gpio_suspend() get *gpio by dev_get_drvdata(). Fixes: feeaefd378ca ("gpio: dwapb: Use resource managed GPIO-chip add data method") Signed-off-by: Luo Jiaxing <[email protected]> Acked-by: Serge Semin <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
2020-12-02gpio: arizona: disable pm_runtime in case of failureZheng Liang1-0/+1
pm_runtime_enable will increase power disable depth. Thus a pairing decrement is needed on the error handling path to keep it balanced. Fixes:27a49ed17e224(gpio: arizona: Add support for GPIOs that) Reported-by: Hulk Robot <[email protected]> Signed-off-by: Zheng Liang <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
2020-12-01gpiolib: do not print err message for EPROBE_DEFERGrygorii Strashko1-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 <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
2020-12-01gpio: ath79: Fix fall-through warning for ClangGustavo A. R. Silva1-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 <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
2020-12-01gpiolib: acpi: Fix fall-through warnings for ClangGustavo A. R. Silva1-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 <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
2020-11-30gpio: omap: handle deferred probe with dev_err_probe() for gpiochip_add_data()Grygorii Strashko1-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 <[email protected]> Acked-by: Tony Lindgren <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
2020-11-30gpio: xra1403: remove unneeded spi_set_drvdata()Alexandru Ardelean1-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 <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
2020-11-30gpio: dwapb: Remove unnecessary error messageDamien Le Moal1-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 <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
2020-11-25gpio: exar: use devm action for freeing the IDA and drop remove()Bartosz Golaszewski1-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 <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]>
2020-11-25gpio: exar: switch to using regmapBartosz Golaszewski2-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 <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]>
2020-11-25gpio: exar: unduplicate address and offset computationBartosz Golaszewski1-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 <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]>
2020-11-25gpio: exar: use a helper variable for &pdev->devBartosz Golaszewski1-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 <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]>
2020-11-25gpio: exar: switch to a simpler IDA interfaceBartosz Golaszewski1-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 <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]>
2020-11-25gpio: exar: include idr.hBartosz Golaszewski1-0/+1
This driver uses IDA APIs but doesn't include the relevant header. This fixes it. Signed-off-by: Bartosz Golaszewski <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]>
2020-11-25gpio: exar: add a newline after the copyright noticeBartosz Golaszewski1-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 <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]>
2020-11-19gpio: tps65910: use regmap accessorsMichał Mirosław1-6/+6
Use regmap accessors directly for register manipulation - removing one layer of abstraction. Signed-off-by: Michał Mirosław <[email protected]> Acked-by: Bartosz Golaszewski <[email protected]> Acked-by: Linus Walleij <[email protected]> Signed-off-by: Lee Jones <[email protected]>
2020-11-18gpio: sifive: To get gpio irq offset from device tree dataGreentime Hu1-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 <[email protected]> Signed-off-by: Bartosz Golaszewski <[email protected]>
2020-11-18gpio: mxc: Convert the driver to DT-onlyFabio Estevam1-80/+22
Since 5.10-rc1 i.MX is a devicetree-only platform, so simplify the code by removing the unused non-DT support. Signed-off-by: Fabio Estevam <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2020-11-18gpio: gpio-xilinx: Check return value of of_property_read_u32Srinivas Neeli1-3/+5
In two different instances the return value of "of_property_read_u32" API was neither captured nor checked. Fixed it by capturing the return value and then checking for any error. Signed-off-by: Srinivas Neeli <[email protected]> Acked-by: Michal Simek <[email protected]> Addresses-Coverity: "check_return" Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2020-11-18gpio: gpio-xilinx: Add remove functionSrinivas Neeli1-0/+18
Added remove function support. Signed-off-by: Srinivas Neeli <[email protected]> Acked-by: Michal Simek <[email protected]> Link: https://lore.kernel.org/r/[email protected] [dropped pm disable call] Signed-off-by: Linus Walleij <[email protected]>
2020-11-18gpio: gpio-xilinx: Add clock supportSrinivas Neeli1-0/+17
Adds clock support to the Xilinx GPIO driver. Signed-off-by: Srinivas Neeli <[email protected]> Acked-by: Michal Simek <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2020-11-18gpio: gpio-xilinx: Arrange headers in sorting orderSrinivas Neeli1-3/+3
Arrange header files in sorted order. Signed-off-by: Srinivas Neeli <[email protected]> Acked-by: Michal Simek <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
2020-11-16gpiolib: acpi: Use BIT() macro to increase readabilityAndy Shevchenko1-2/+1
We may use BIT() macro to increase readability in acpi_gpio_adr_space_handler(). Signed-off-by: Andy Shevchenko <[email protected]> Acked-by: Linus Walleij <[email protected]> Reviewed-by: Hans de Goede <[email protected]> Reviewed-by: Mika Westerberg <[email protected]>