aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'pcmcia-next' of ↵Linus Torvalds2022-01-1112-320/+43
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/brodo/linux Pull pcmcia updates from Dominik Brodowski: "A number of odd cleanups and fixes, including one for a small race in the handling of the pccardd kernel thread" * 'pcmcia-next' of git://git.kernel.org/pub/scm/linux/kernel/git/brodo/linux: pcmcia: fix setting of kthread task states MAINTAINERS: update PCMCIA tree pcmcia: use sysfs_emit{,_at} for sysfs output pcmcia: make pcmcia_release_io() void, as no-one is interested in return value pcmcia: rsrc_nonstatic: Fix a NULL pointer dereference in nonstatic_find_mem_region() pcmcia: rsrc_nonstatic: Fix a NULL pointer dereference in __nonstatic_find_io_region() pcmcia: comment out unused exca_readw() function pcmcia: Make use of the helper macro SET_NOIRQ_SYSTEM_SLEEP_PM_OPS() pcmcia: clean up dead drivers for CompuLab CM-X255/CM-X270 boards
| * pcmcia: fix setting of kthread task statesDominik Brodowski2022-01-091-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We need to set TASK_INTERRUPTIBLE before calling kthread_should_stop(). Otherwise, kthread_stop() might see that the pccardd thread is still in TASK_RUNNING state and fail to wake it up. Additionally, we only need to set the state back to TASK_RUNNING if kthread_should_stop() breaks the loop. Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reported-by: Al Viro <viro@ZenIV.linux.org.uk> Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org> Fixes: d3046ba809ce ("pcmcia: fix a boot time warning in pcmcia cs code") Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
| * MAINTAINERS: update PCMCIA treeTom Saeger2022-01-061-1/+1
| | | | | | | | | | | | | | Update location of PCMCIA tree. Signed-off-by: Tom Saeger <tom.saeger@oracle.com> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
| * pcmcia: use sysfs_emit{,_at} for sysfs outputDominik Brodowski2022-01-064-30/+28
| | | | | | | | | | | | | | Convert the PCMCIA core and yenta_socket.c to use sysfs_emit or sysfs_emit_at when providing output in sysfs. Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
| * pcmcia: make pcmcia_release_io() void, as no-one is interested in return valueDominik Brodowski2022-01-021-4/+1
| | | | | | | | | | | | | | | | | | As the only user of pcmcia_release_io() is not interested in its return value, and we cannot do anything on failure, convert the function to return void. Reported-by: Jason Wang <wangborong@cdjrlc.com> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
| * pcmcia: rsrc_nonstatic: Fix a NULL pointer dereference in ↵Zhou Qingyang2022-01-021-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | nonstatic_find_mem_region() In nonstatic_find_mem_region(), pcmcia_make_resource() is assigned to res and used in pci_bus_alloc_resource(). There a dereference of res in pci_bus_alloc_resource(), which could lead to a NULL pointer dereference on failure of pcmcia_make_resource(). Fix this bug by adding a check of res. This bug was found by a static analyzer. The analysis employs differential checking to identify inconsistent security operations (e.g., checks or kfrees) between two code paths and confirms that the inconsistent operations are not recovered in the current function or the callers, so they constitute bugs. Note that, as a bug found by static analysis, it can be a false positive or hard to trigger. Multiple researchers have cross-reviewed the bug. Builds with CONFIG_PCCARD_NONSTATIC=y show no new warnings, and our static analyzer no longer warns about this code. Fixes: 49b1153adfe1 ("pcmcia: move all pcmcia_resource_ops providers into one module") Signed-off-by: Zhou Qingyang <zhou1615@umn.edu> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
| * pcmcia: rsrc_nonstatic: Fix a NULL pointer dereference in ↵Zhou Qingyang2022-01-021-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | __nonstatic_find_io_region() In __nonstatic_find_io_region(), pcmcia_make_resource() is assigned to res and used in pci_bus_alloc_resource(). There is a dereference of res in pci_bus_alloc_resource(), which could lead to a NULL pointer dereference on failure of pcmcia_make_resource(). Fix this bug by adding a check of res. This bug was found by a static analyzer. The analysis employs differential checking to identify inconsistent security operations (e.g., checks or kfrees) between two code paths and confirms that the inconsistent operations are not recovered in the current function or the callers, so they constitute bugs. Note that, as a bug found by static analysis, it can be a false positive or hard to trigger. Multiple researchers have cross-reviewed the bug. Builds with CONFIG_PCCARD_NONSTATIC=y show no new warnings, and our static analyzer no longer warns about this code. Fixes: 49b1153adfe1 ("pcmcia: move all pcmcia_resource_ops providers into one module") Signed-off-by: Zhou Qingyang <zhou1615@umn.edu> [linux@dominikbrodowski.net: Fix typo in commit message] Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
| * pcmcia: comment out unused exca_readw() functionDominik Brodowski2022-01-021-0/+2
| | | | | | | | | | | | | | The exca_readw() function is currently unused; therefore, comment it out. Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
| * pcmcia: Make use of the helper macro SET_NOIRQ_SYSTEM_SLEEP_PM_OPS()Cai Huoqing2022-01-021-6/+1
| | | | | | | | | | | | | | | | | | | | | | Use the helper macro SET_NOIRQ_SYSTEM_SLEEP_PM_OPS() instead of the verbose operators ".suspend_noirq /.resume_noirq/.freeze_noirq/ .thaw_noirq/.poweroff_noirq/.restore_noirq", because the SET_NOIRQ_SYSTEM_SLEEP_PM_OPS() is a nice helper macro that could be brought in to make code a little clearer, a little more concise. Signed-off-by: Cai Huoqing <caihuoqing@baidu.com> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
| * pcmcia: clean up dead drivers for CompuLab CM-X255/CM-X270 boardsLukas Bulwahn2022-01-025-274/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 9d3239147d6d ("ARM: pxa: remove Compulab pxa2xx boards") removes the config MACH_ARMCORE in ./arch/arm/mach-pxa/Kconfig. Hence, ./scripts/checkkconfigsymbols.py warns on non-existing configs: MACH_ARMCORE Referencing files: drivers/pcmcia/Kconfig, drivers/pcmcia/Makefile Clean up the dead remains of pcmcia drivers for Compulab pxa2xx boards. Signed-off-by: Lukas Bulwahn <lukas.bulwahn@gmail.com> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
* | Merge tag 'gpio-updates-for-v5.17' of ↵Linus Torvalds2022-01-1175-634/+3415
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux Pull gpio updates from Bartosz Golaszewski: "The gpio-sim module is back, this time without any changes to configfs. This results in a less elegant user-space interface but I never got any follow-up on the committable items and didn't want to delay this module for several more months. Other than that we have support for several new models and some support going away. We started working on converting GPIO drivers to using fwnode exclusively in order to limit references to OF symbols to gpiolib-of.c exclusively. We also have regular tweaks and improvements all over the place. Summary: - new testing module: gpio-sim that is scheduled to replace gpio-mockup - initial changes aiming at converting all GPIO drivers to using the fwnode interface and limiting any references to OF symbols to gpiolib-of.c - add support for Tegra234 and Tegra241 to gpio-tegra186 - add support for new models (SSD201 and SSD202D) to gpio-msc313 - add basic support for interrupts to gpio-aggregator - add support for AMDIF031 HID device to gpio-amdpt - drop support for unused platforms in gpio-xlp - cleanup leftovers from the removal of the legacy Samsung Exynos GPIO driver - use raw spinlocks in gpio-aspeed and gpio-aspeed-sgpio to make PREEMPT_RT happy - generalize the common 'ngpios' device property by reading it in the core gpiolib code so that we can remove duplicate reads from drivers - allow line names from device properties to override names set by drivers - code shrink in gpiod_add_lookup_table() - add new model to the DT bindings for gpio-vf610 - convert DT bindings for tegra devices to YAML - improvements to interrupt handling in gpio-rcar and gpio-rockchip - updates to intel drivers from Andy (details in the merge commit) - some minor tweaks, improvements and coding-style fixes all around the subsystem" * tag 'gpio-updates-for-v5.17' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: (59 commits) gpio: rcar: Propagate errors from devm_request_irq() gpio: rcar: Use platform_get_irq() to get the interrupt gpio: ts5500: Use platform_get_irq() to get the interrupt gpio: dwapb: Switch to use fwnode instead of of_node gpiolib: acpi: make fwnode take precedence in struct gpio_chip dt-bindings: gpio: samsung: drop unused bindings gpio: max3191x: Use bitmap_free() to free bitmap gpio: regmap: Switch to use fwnode instead of of_node gpio: tegra186: Add support for Tegra241 dt-bindings: gpio: Add Tegra241 support gpio: brcmstb: Use local variable to access OF node gpio: Remove unused local OF node pointers gpio: sim: add missing fwnode_handle_put() in gpio_sim_probe() gpio: msc313: Add support for SSD201 and SSD202D gpio: msc313: Code clean ups dt-bindings: gpio: msc313: Add offsets for ssd20xd dt-bindings: gpio: msc313: Add compatible for ssd20xd gpio: sim: fix uninitialized ret variable gpio: Propagate firmware node from a parent device gpio: Setup parent device and get rid of unnecessary of_node assignment ...
| * | gpio: rcar: Propagate errors from devm_request_irq()Lad Prabhakar2022-01-051-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The driver overrides the error code returned by devm_request_irq() to -ENOENT. Switch to propagating the error code upstream. Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
| * | gpio: rcar: Use platform_get_irq() to get the interruptLad Prabhakar2022-01-051-8/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static allocation of IRQ resources in DT core code, this causes an issue when using hierarchical interrupt domains using "interrupts" property in the node as this bypassed the hierarchical setup and messed up the irq chaining. In preparation for removal of static setup of IRQ resource from DT core code use platform_get_irq(). Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
| * | gpio: ts5500: Use platform_get_irq() to get the interruptLad Prabhakar2022-01-051-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | platform_get_resource(pdev, IORESOURCE_IRQ, ..) relies on static allocation of IRQ resources in DT core code, this causes an issue when using hierarchical interrupt domains using "interrupts" property in the node as this bypassed the hierarchical setup and messed up the irq chaining. In preparation for removal of static setup of IRQ resource from DT core code use platform_get_irq(). Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
| * | gpio: dwapb: Switch to use fwnode instead of of_nodeAndy Shevchenko2022-01-031-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GPIO library now accepts fwnode as a firmware node, so switch the driver to use it and hence rectify the ACPI case which uses software nodes. Note, in this case it's rather logical fix that doesn't affect functionality, thus no backporting required. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Serge Semin <fancer.lancer@gmail.com> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
| * | gpiolib: acpi: make fwnode take precedence in struct gpio_chipAndy Shevchenko2022-01-031-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the driver sets the fwnode in struct gpio_chip, let it take precedence over the parent's fwnode. This is a follow up to the commit 9126a738edc1 ("gpiolib: of: make fwnode take precedence in struct gpio_chip"). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
| * | dt-bindings: gpio: samsung: drop unused bindingsKrzysztof Kozlowski2022-01-031-41/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | The commit 6c56c6cd8031 ("gpio: samsung: Drop support for Exynos SoCs") removed support for the Samsung Exynos SoC in lrgacy GPIO driver, since it was moved to new pinctrl driver. Remove old, unused bindings. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
| * | gpio: max3191x: Use bitmap_free() to free bitmapChristophe JAILLET2022-01-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | kfree() and bitmap_free() are the same. But using the later is more consistent when freeing memory allocated with bitmap_alloc(). Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
| * | gpio: regmap: Switch to use fwnode instead of of_nodeAndy Shevchenko2021-12-231-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | GPIO library now accepts fwnode as a firmware node, so switch the driver to use it. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Michael Walle <michael@walle.cc> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
| * | gpio: tegra186: Add support for Tegra241Akhil R2021-12-231-0/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Extend the existing Tegra186 GPIO controller driver with support for the GPIO controller found on Tegra241 (Grace). While the programming model remains the same, the number of pins has slightly changed. Signed-off-by: Akhil R <akhilrajeev@nvidia.com> Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
| * | dt-bindings: gpio: Add Tegra241 supportAkhil R2021-12-231-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add the port definitions for the main and AON GPIO controllers found on Tegra241 (Grace). Signed-off-by: Akhil R <akhilrajeev@nvidia.com> Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
| * | gpio: brcmstb: Use local variable to access OF nodeAndy Shevchenko2021-12-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | We already have a local variable that contains a copy of OF node pointer. Use it instead of dereferencing it again from struct device. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
| * | gpio: Remove unused local OF node pointersAndy Shevchenko2021-12-223-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After the commit 448cf90513d9 ("gpio: Get rid of duplicate of_node assignment in the drivers") the OF node local pointers become unused. Remove them for good and make compiler happy about. Fixes: 448cf90513d9 ("gpio: Get rid of duplicate of_node assignment in the drivers") Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> [Bart: removed unrelated change in gpio-brcmstb] Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
| * | gpio: sim: add missing fwnode_handle_put() in gpio_sim_probe()Yang Yingliang2021-12-211-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Calling fwnode_handle_put() when break out of device_for_each_child_node(), or the device node reference will be leakd. Fixes: 83960fcf4818 ("gpio: sim: new testing module") Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
| * | gpio: msc313: Add support for SSD201 and SSD202DDaniel Palmer2021-12-201-0/+261
| | | | | | | | | | | | | | | | | | | | | | | | This adds GPIO support for the SSD201 and SSD202D chips. Signed-off-by: Daniel Palmer <daniel@0x0f.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
| * | gpio: msc313: Code clean upsDaniel Palmer2021-12-201-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | - Remove the unneeded assignment of ret before returning it. - Remove an unneeded blank line Signed-off-by: Daniel Palmer <daniel@0x0f.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
| * | dt-bindings: gpio: msc313: Add offsets for ssd20xdDaniel Palmer2021-12-201-0/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add the gpio offsets for the SSD201 and SSD202D chips. Signed-off-by: Daniel Palmer <daniel@0x0f.com> Acked-by: Rob Herring <robh@kernel.org> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
| * | dt-bindings: gpio: msc313: Add compatible for ssd20xdDaniel Palmer2021-12-201-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a compatible string for "ssd20xd" for the SigmaStar SSD201 and SSD202D chips. These chips are the same die with different memory bonded so they don't need their own strings. Signed-off-by: Daniel Palmer <daniel@0x0f.com> Acked-by: Rob Herring <robh@kernel.org> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
| * | gpio: sim: fix uninitialized ret variableTom Rix2021-12-191-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Building with clang returns this error: gpio-sim.c:889:7: error: variable 'ret' is uninitialized when used here ret should be the status of the call to gpio_sim_make_bank_swnode stored in bank->swnode. Fixes: 83960fcf4818 ("gpio: sim: new testing module") Signed-off-by: Tom Rix <trix@redhat.com> Reviewed-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
| * | gpio: Propagate firmware node from a parent deviceAndy Shevchenko2021-12-175-15/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When creating MFD platform devices the firmware node is left unset. This, in particular, prevents GPIO library to use it for different purposes. Propagate firmware node from the parent device and let GPIO library do the right thing. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
| * | gpio: Setup parent device and get rid of unnecessary of_node assignmentAndy Shevchenko2021-12-174-8/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some of the drivers do not set parent device. This may lead to obstacles during debugging or understanding the device relations from the Linux point of view. Assign parent device for GPIO chips created by these drivers. While at it, let GPIO library to assign of_node from the parent device. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
| * | gpio: Get rid of duplicate of_node assignment in the driversAndy Shevchenko2021-12-1725-36/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GPIO library does copy the of_node from the parent device of the GPIO chip, there is no need to repeat this in the individual drivers. Remove these assignment all at once. For the details one may look into the of_gpio_dev_init() implementation. While at it, remove duplicate parent device assignment where it is the case. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-By: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
| * | Merge tag 'intel-gpio-v5.17-1' of ↵Bartosz Golaszewski2021-12-176-84/+75
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | gitolite.kernel.org:pub/scm/linux/kernel/git/andy/linux-gpio-intel into gpio/for-next intel-gpio for v5.17-1 - Don't set type for IRQ already in use in case of ACPI - Drop unused call from GPIO ACPI library - Clean up ML IOH and PCH GPIO drivers to make it closer to each other - Clarify use of register file version in DesignWare driver - other minor tweaks
| | * | gpio: sch: fix typo in a commentJason Wang2021-12-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The double `the' in the comment in line 142 is repeated. Remove one of them from the comment. Signed-off-by: Jason Wang <wangborong@cdjrlc.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| | * | gpio: dwapb: clarify usage of the register file versionAndy Shevchenko2021-12-011-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | First of all, it's obvious that different versions can't be provided simultaneously. Hence, versions can't be bit masks. Second, due to above we have to mask out the version field in the flags and only that can be evaluated against the certain version. Clarify all above by: - introducing GPIO_REG_OFFSET_V1 and GPIO_REG_OFFSET_MASK - replacing conditional to mask out bits and compare to a version Luckily there is no functional change, so no need to backport this. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Serge Semin <fancer.lancer@gmail.com> Reviewed-by: Bartosz Golaszewski <brgl@bgdev.pl>
| | * | gpio: ml-ioh: Change whitespace to match gpio-pch.cBjorn Helgaas2021-12-011-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ML IOH driver is very similar to the PCH driver. To make it more similar, tweak the whitespace in ioh_gpio_direction_output() and ioh_gpio_direction_input(). No functional change intended. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| | * | gpio: ml-ioh: Use BIT() to match gpio-pch.cBjorn Helgaas2021-12-011-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The ML IOH driver is very similar to the PCH driver. To make it more similar, replace "1 << nr" with "BIT(nr)". No functional change intended. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| | * | gpio: ml-ioh: Cache &pdev->dev to reduce repetitionBjorn Helgaas2021-12-011-11/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ioh_gpio_probe() repeats the "&pdev->dev" expression several times. Cache the result as "struct device *dev" to reduce the repetition. No functional change intended. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| | * | gpio: pch: Cache &pdev->dev to reduce repetitionBjorn Helgaas2021-12-011-10/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | pch_gpio_probe() repeats the "&pdev->dev" expression several times. Cache the result as "struct device *dev" to reduce the repetition. No functional change intended. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| | * | gpio: pch: Use .driver_data instead of checking Device IDs againBjorn Helgaas2021-12-011-12/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, pch_gpio_probe() tested the Device ID to determine the type of IOH. But the driver core has already matched the Device ID with one of the IDs in the pch_gpio_pcidev_id[] table, and we can supply the IOH type there as .driver_data. Use the pci_device_id.driver_data to learn the IOH type instead of testing the Device ID again. No functional change intended. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| | * | gpiolib: acpi: Unify debug and other messages formatAndy Shevchenko2021-11-251-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | When ACPI device pointer available use it, otherwise take parent of GPIO chip. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| | * | gpiolib: acpi: Do not set the IRQ type if the IRQ is already in useHans de Goede2021-11-251-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the IRQ is already in use, then acpi_dev_gpio_irq_get_by() really should not change the type underneath the current owner. I specifically hit an issue with this an a Chuwi Hi8 Super (CWI509) Bay Trail tablet, when the Boot OS selection in the BIOS is set to Android. In this case _STA for a MAX17047 ACPI I2C device wrongly returns 0xf and the _CRS resources for this device include a GpioInt pointing to a GPIO already in use by an _AEI handler, with a different type then specified in the _CRS for the MAX17047 device. Leading to the acpi_dev_gpio_irq_get() call done by the i2c-core-acpi.c code changing the type breaking the _AEI handler. Now this clearly is a bug in the DSDT of this tablet (in Android mode), but in general calling irq_set_irq_type() on an IRQ which already is in use seems like a bad idea. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| | * | gpiolib: acpi: shrink devm_acpi_dev_add_driver_gpios()Andy Shevchenko2021-11-151-13/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| | * | gpiolib: acpi: Remove never used devm_acpi_dev_remove_driver_gpios()Andy Shevchenko2021-11-152-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove never used devm_acpi_dev_remove_driver_gpios(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
| * | | gpiolib: allow line names from device props to override driver namesPeter Rosin2021-12-171-5/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some GPIO providers set names for GPIO lines that match the names of the pins on the SoC, or variations on that theme. These names are generic more often that not, such as pioC12 in the at91 case. These generic names block the possibility to set more useful GPIO line names with device properties (i.e. gpio-line-names). Allow overriding a generic name given by the GPIO driver if there is a name given to the GPIO line using device properties, but leave the generic name alone if no better name is available. However, there is a risk. If user space is depending on the above mentioned fixed GPIO names, AND there are device properties that previously did not reach the surface, the name change might cause regressions. But hopefully this stays below the radar... Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Tested-by: Alexander Dahl <ada@thorsis.com> Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
| * | | selftests: gpio: gpio-sim: avoid forking test twiceBartosz Golaszewski2021-12-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use '-o' within [] in order to avoid spawning two processes for test. Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
| * | | selftests: gpio: gpio-sim: remove bashismsBartosz Golaszewski2021-12-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | '==' is a bashisms and not understood by POSIX shell. Drop it from gpio-sim selftests. Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
| * | | gpio: amdpt: add new device ID and 24-pin supportHsu Yuchang2021-12-171-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add an ACPI HID(AMDIF031) and pin number in the pt_gpio_acpi_match. Signed-off-by: Yuchang Hsu <Richard_Hsu@asmedia.com.tw> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
| * | | gpio: tegra186: Add support for Tegra234Prathamesh Shete2021-12-171-0/+76
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Extend the existing Tegra186 GPIO controller driver with support for the GPIO controller found on Tegra234. While the programming model remains the same, the number of pins has slightly changed. Signed-off-by: Prathamesh Shete <pshete@nvidia.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
| * | | dt-bindings: gpio: Add Tegra234 supportPrathamesh Shete2021-12-172-0/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Extend the existing Tegra186 GPIO controller device tree bindings with support for the GPIO controller found on Tegra234. The number of pins is slightly different, but the programming model remains the same. Signed-off-by: Prathamesh Shete <pshete@nvidia.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Rob Herring <robh@kernel.org> [treding@nvidia.com: update device tree bindings] Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>