platform/kernel/linux-rpi.git
15 months agogpio: gpiolib: Simplify gpiochip_add_data_with_key() fwnode
Linus Walleij [Tue, 11 Apr 2023 08:28:06 +0000 (10:28 +0200)]
gpio: gpiolib: Simplify gpiochip_add_data_with_key() fwnode

The code defaulting to the parents fwnode if no fwnode was assigned
is unnecessarily convoluted, probably due to refactoring. Simplify
it and make it more human-readable.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Anders Roxell <anders.roxell@linaro.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
15 months agoMerge tag 'intel-gpio-v6.4-2' of git://git.kernel.org/pub/scm/linux/kernel/git/andy...
Bartosz Golaszewski [Thu, 6 Apr 2023 08:39:45 +0000 (10:39 +0200)]
Merge tag 'intel-gpio-v6.4-2' of git://git./linux/kernel/git/andy/linux-gpio-intel into gpio/for-next

intel-gpio for v6.4-2

* Fixed suspend issue on Clevo NL5xNU
* Split a new Intel Tangier (library) driver for current and new platforms
* Introduced a new driver for Intel Elkhart Lake PSE GPIO (see also above)
* Contained a few fixes for the previous of_gpio.h cleanup
* Miscellaneous cleanups here and there

The following is an automated git shortlog grouped by driver:

elkhartlake:
 -  Introduce Intel Elkhart Lake PSE GPIO

gpiolib:
 -  acpi: Add a ignore wakeup quirk for Clevo NL5xNU
 -  acpi: Move ACPI device NULL check to acpi_get_driver_gpio_data()
 -  acpi: use the fwnode in acpi_gpiochip_find()

ich:
 -  Use devm_gpiochip_add_data() to simplify remove path

merrifield:
 -  Utilise temporary variable for struct device
 -  Use dev_err_probe()
 -  Adapt to Intel Tangier GPIO driver

mips:
 -  ar7: include linux/gpio/driver.h

mm-lantiq:
 -  Fix typo in the newly added header filename

powerpc/40x:
 -  Add missing select OF_GPIO_MM_GPIOCHIP

sh:
 -  mach-x3proto: Add missing #include <linux/gpio/driver.h>

tangier:
 -  Introduce Intel Tangier GPIO driver

15 months agogpiolib: Add gpiochip_set_data() helper
Andy Shevchenko [Tue, 21 Mar 2023 13:53:32 +0000 (15:53 +0200)]
gpiolib: Add gpiochip_set_data() helper

There are too many 'data' parameters here and there.

For the better maintenance keep access GPIO device data
via getter and setter.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
15 months agogpiolib: Move gpiochip_get_data() higher in the code
Andy Shevchenko [Tue, 21 Mar 2023 13:53:31 +0000 (15:53 +0200)]
gpiolib: Move gpiochip_get_data() higher in the code

Move gpiochip_get_data() higher in the code as a preparation
for further refactoring.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
[Bartosz: tweak the commit message]
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpiolib: Check array_info for NULL only once in gpiod_get_array()
Andy Shevchenko [Tue, 21 Mar 2023 13:54:12 +0000 (15:54 +0200)]
gpiolib: Check array_info for NULL only once in gpiod_get_array()

gpiod_get_array() has a long if-else-if branching where each of them
tests for the same variable to be not NULL. Instead, check for NULL
before even going to that flow.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpiolib: Replace open coded krealloc()
Andy Shevchenko [Tue, 21 Mar 2023 13:54:11 +0000 (15:54 +0200)]
gpiolib: Replace open coded krealloc()

gpiod_get_array() does a new allocation in some cases, followed
by copying previously allocated placeholder for the descriptors.

Replace that with krealloc(__GFP_ZERO), since it was kzalloc()
originally.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpiolib: acpi: Add a ignore wakeup quirk for Clevo NL5xNU
Werner Sembach [Wed, 22 Mar 2023 12:15:47 +0000 (13:15 +0100)]
gpiolib: acpi: Add a ignore wakeup quirk for Clevo NL5xNU

commit 1796f808e4bb ("HID: i2c-hid: acpi: Stop setting wakeup_capable")
changed the policy such that I2C touchpads may be able to wake up the
system by default if the system is configured as such.

However on Clevo NL5xNU there is a mistake in the ACPI tables that the
TP_ATTN# signal connected to GPIO 9 is configured as ActiveLow and level
triggered but connected to a pull up. As soon as the system suspends the
touchpad loses power and then the system wakes up.

To avoid this problem, introduce a quirk for this model that will prevent
the wakeup capability for being set for GPIO 9.

This patch is analoge to a very similar patch for NL5xRU, just the DMI
string changed.

Signed-off-by: Werner Sembach <wse@tuxedocomputers.com>
Cc: stable@vger.kernel.org
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
16 months agogpiolib: acpi: Move ACPI device NULL check to acpi_get_driver_gpio_data()
Andy Shevchenko [Mon, 30 Jan 2023 16:13:45 +0000 (18:13 +0200)]
gpiolib: acpi: Move ACPI device NULL check to acpi_get_driver_gpio_data()

It's logical to check ACPI device for NULL inside
acpi_get_driver_gpio_data() instead of requiring that
in each caller.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
16 months agogpiolib: acpi: use the fwnode in acpi_gpiochip_find()
Benjamin Tissoires [Fri, 10 Mar 2023 13:38:10 +0000 (14:38 +0100)]
gpiolib: acpi: use the fwnode in acpi_gpiochip_find()

While trying to set up an SSDT override for a USB-2-I2C chip [0],
I realized that the function acpi_gpiochip_find() was using the parent
of the gpio_chip to do the ACPI matching.

This works fine on my Ice Lake laptop because AFAICT, the DSDT presents
the PCI device INT3455 as the "Device (GPI0)", but is in fact handled
by the pinctrl driver in Linux.
The pinctrl driver then creates a gpio_chip device. This means that the
gc->parent device in that case is the GPI0 device from ACPI and everything
works.

However, in the hid-cp2112 case, the parent is the USB device, and the
gpio_chip is directly under that USB device. Which means that in this case
gc->parent points at the USB device, and so we can not do an ACPI match
towards the GPIO device.

I think it is safe to resolve the ACPI matching through the fwnode
because when we call gpiochip_add_data(), the first thing it does is
setting a proper gc->fwnode: if it is not there, it borrows the fwnode
of the parent.

So in my Ice Lake case, gc->fwnode is the one from the parent, meaning
that the ACPI handle we will get is the one from the GPI0 in the DSDT
(the pincrtl one). And in the hid-cp2112 case, we get the actual
fwnode from the gpiochip we created in the HID device, making it working.

Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Link: https://lore.kernel.org/linux-input/20230227140758.1575-1-kaehndan@gmail.com/T/#m592f18081ef3b95b618694a612ff864420c5aaf3
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
16 months agogpio: mm-lantiq: Fix typo in the newly added header filename
Andy Shevchenko [Tue, 14 Mar 2023 10:55:09 +0000 (12:55 +0200)]
gpio: mm-lantiq: Fix typo in the newly added header filename

The header with legacy struct of_mmio_gpio_chip and accompanying
APIs is called legacy-of-mm-gpiochip.h. Remove repetitive '.h'
at the end.

Fixes: a99cc66807d6 ("gpiolib: split of_mm_gpio_chip out of linux/of_gpio.h")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
16 months agosh: mach-x3proto: Add missing #include <linux/gpio/driver.h>
Geert Uytterhoeven [Thu, 9 Mar 2023 14:41:13 +0000 (15:41 +0100)]
sh: mach-x3proto: Add missing #include <linux/gpio/driver.h>

shx3_defconfig:

    arch/sh/boards/mach-x3proto/setup.c: In function ‘x3proto_devices_setup’:
    arch/sh/boards/mach-x3proto/setup.c:246:62: error: invalid use of undefined type ‘struct gpio_chip’
      246 |                 baseboard_buttons[i].gpio = x3proto_gpio_chip.base + i;
  |                                                              ^

Fix this by replacing the include of the legacy <linux/gpio.h> by
<linux/gpio/driver.h>.

Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
Link: https://lore.kernel.org/r/CA+G9fYs7suzGsEDK40G0pzxXyR1o2V4Pn-oy1owTsTWRVEVHog@mail.gmail.com
Fixes: 21d9526d13b5467b ("gpiolib: Make the legacy <linux/gpio.h> consumer-only")
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
16 months agopowerpc/40x: Add missing select OF_GPIO_MM_GPIOCHIP
Andy Shevchenko [Thu, 23 Mar 2023 14:18:19 +0000 (16:18 +0200)]
powerpc/40x: Add missing select OF_GPIO_MM_GPIOCHIP

Since the split of the legacy of_mm_gpio_chip to a separate
file and a specific build configuration option, the users
must select it when needed. The PowerPC 40x code misses this,
so we have to add the select here.

Fixes: a99cc66807d6 ("gpiolib: split of_mm_gpio_chip out of linux/of_gpio.h")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
16 months agogpio: xlp: Convert to immutable irq_chip
Linus Walleij [Mon, 20 Mar 2023 09:55:16 +0000 (10:55 +0100)]
gpio: xlp: Convert to immutable irq_chip

Convert the driver to immutable irq-chip with a bit of
intuition.

In this case the driver uses .mask_ack() and .unmask()
and since I have a vague idea about the semantics of
.mask_ack() I added .irq_enable() to the existing .irq_disable()
and called into the gpiolib core from those callbacks
instead of mask/unmask.

Cc: Marc Zyngier <maz@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: xilinx: Convert to immutable irq_chip
Linus Walleij [Mon, 20 Mar 2023 09:55:15 +0000 (10:55 +0100)]
gpio: xilinx: Convert to immutable irq_chip

Convert the driver to immutable irq-chip with a bit of
intuition.

Cc: Marc Zyngier <maz@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: xgs-iproc: Convert to immutable irq_chip
Linus Walleij [Mon, 20 Mar 2023 09:55:14 +0000 (10:55 +0100)]
gpio: xgs-iproc: Convert to immutable irq_chip

Convert the driver to immutable irq-chip with a bit of
intuition.

Cc: Marc Zyngier <maz@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: visconti: Convert to immutable irq_chip
Linus Walleij [Mon, 20 Mar 2023 09:55:13 +0000 (10:55 +0100)]
gpio: visconti: Convert to immutable irq_chip

Convert the driver to immutable irq-chip with a bit of
intuition.

The driver is for a hierarchical chip so some extra care
needs to be taken to introduce two new callbacks.

Cc: Marc Zyngier <maz@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: tqmx86: Convert to immutable irq_chip
Linus Walleij [Mon, 20 Mar 2023 09:55:12 +0000 (10:55 +0100)]
gpio: tqmx86: Convert to immutable irq_chip

Convert the driver to immutable irq-chip with a bit of
intuition.

Cc: Marc Zyngier <maz@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: thunderx: Convert to immutable irq_chip
Linus Walleij [Mon, 20 Mar 2023 09:55:11 +0000 (10:55 +0100)]
gpio: thunderx: Convert to immutable irq_chip

Convert the driver to immutable irq-chip with a bit of
intuition.

Whereas in most cases we put the gpiochip_[enable|disable]_irq()
calls in the .irq_mask() and .irq_unmask() callbacks, here
we need to put them in the .irq_enable() and .irq_disable()
callbacks, as this driver uses both .irq_mask() and
.irq_mask_ack().

Cc: Marc Zyngier <maz@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: stmpe: Convert to immutable irq_chip
Linus Walleij [Mon, 20 Mar 2023 09:55:10 +0000 (10:55 +0100)]
gpio: stmpe: Convert to immutable irq_chip

Convert the driver to immutable irq-chip with a bit of
intuition.

Cc: Marc Zyngier <maz@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: siox: Convert to immutable irq_chip
Linus Walleij [Mon, 20 Mar 2023 09:55:09 +0000 (10:55 +0100)]
gpio: siox: Convert to immutable irq_chip

Convert the driver to immutable irq-chip with a bit of
intuition.

In this case I had to figure out a way to get to the
struct gpio_chip that would work even when the irq_chip
is not part of the driver state container. I did this by
just doing what most other GPIO drivers do and pass
the state struct as data to devm_gpiochip_add_data()
and rewrite accordingly.

Cc: Marc Zyngier <maz@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: rda: Convert to immutable irq_chip
Linus Walleij [Mon, 20 Mar 2023 09:55:08 +0000 (10:55 +0100)]
gpio: rda: Convert to immutable irq_chip

Convert the driver to immutable irq-chip with a bit of
intuition.

Cc: Marc Zyngier <maz@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Manivannan Sadhasivam <mani@kernel.org>
Reviewed-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: loongson1: Add DT support
Keguang Zhang [Wed, 15 Mar 2023 11:06:49 +0000 (19:06 +0800)]
gpio: loongson1: Add DT support

This patch adds DT support for Loongson-1 GPIO driver.

Signed-off-by: Keguang Zhang <keguang.zhang@gmail.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agodt-bindings: gpio: Add Loongson-1 GPIO
Keguang Zhang [Wed, 15 Mar 2023 11:06:50 +0000 (19:06 +0800)]
dt-bindings: gpio: Add Loongson-1 GPIO

Add devicetree binding document for Loongson-1 GPIO.

Signed-off-by: Keguang Zhang <keguang.zhang@gmail.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: loongson1: Introduce ls1x_gpio_chip struct
Keguang Zhang [Wed, 15 Mar 2023 11:06:48 +0000 (19:06 +0800)]
gpio: loongson1: Introduce ls1x_gpio_chip struct

This patch introduces and allocates ls1x_gpio_chip struct containing
gpio_chip and reg_base to avoid global gpio_reg_base.

Signed-off-by: Keguang Zhang <keguang.zhang@gmail.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: loongson1: Convert to SPDX identifier
Keguang Zhang [Wed, 15 Mar 2023 11:06:47 +0000 (19:06 +0800)]
gpio: loongson1: Convert to SPDX identifier

Use SPDX-License-Identifier instead of the license text.

The current author name is unofficial, change it to my real name.

Signed-off-by: Keguang Zhang <keguang.zhang@gmail.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: 104-dio-48e: Utilize no_status regmap-irq flag
William Breathitt Gray [Mon, 27 Feb 2023 16:45:23 +0000 (11:45 -0500)]
gpio: 104-dio-48e: Utilize no_status regmap-irq flag

The 104-DIO-48E lacks an IRQ status register. Rather than use the Clear
Interrupt register as the status register, set the no_status flag to
true and thus avoid such a hack.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agoMerge tag 'regmap-no-status' of https://git.kernel.org/pub/scm/linux/kernel/git/broon...
Bartosz Golaszewski [Wed, 22 Mar 2023 16:46:14 +0000 (17:46 +0100)]
Merge tag 'regmap-no-status' of https://git./linux/kernel/git/broonie/regmap into gpio/for-next

regmap: Add no_status support

This patch adds support for devices which don't support readback of
individual interrupt statuses, we report all interrupts as firing and
hope the consumers do the right thing.

16 months agogpio: pxa: remove unused gpio_is_pxa_type function
Tom Rix [Sun, 19 Mar 2023 14:36:40 +0000 (10:36 -0400)]
gpio: pxa: remove unused gpio_is_pxa_type function

clang with W=1 reports
drivers/gpio/gpio-pxa.c:174:19: error: unused function
  'gpio_is_pxa_type' [-Werror,-Wunused-function]
static inline int gpio_is_pxa_type(int type)
                  ^
This function is not used, so remove it.

Signed-off-by: Tom Rix <trix@redhat.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: fxl6408: add I2C GPIO expander driver
Emanuele Ghidoli [Mon, 13 Mar 2023 17:09:50 +0000 (18:09 +0100)]
gpio: fxl6408: add I2C GPIO expander driver

Add minimal driver for Fairchild FXL6408 8-bit I2C-controlled GPIO expander
using the generic regmap based GPIO driver (GPIO_REGMAP).

The driver implements setting the GPIO direction, reading inputs
and writing outputs.

In addition to that the FXL6408 has the following functionalities:
- allows to monitor input ports for data transitions with an interrupt pin
- all inputs can be configured with pull-up or pull-down resistors

Datasheet: https://www.onsemi.com/download/data-sheet/pdf/fxl6408-d.pdf
Signed-off-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>
Co-developed-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
[Bartosz: order includes alphabetically]
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agodt-bindings: gpio: add fcs,fxl6408
Emanuele Ghidoli [Mon, 13 Mar 2023 17:09:49 +0000 (18:09 +0100)]
dt-bindings: gpio: add fcs,fxl6408

Add Fairchild FXL6408 8-bit I2C-controlled GPIO expander.

Signed-off-by: Emanuele Ghidoli <emanuele.ghidoli@toradex.com>
Signed-off-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: pcie-idio-24: Prune superfluous license boilerplate
William Breathitt Gray [Thu, 9 Mar 2023 23:39:29 +0000 (18:39 -0500)]
gpio: pcie-idio-24: Prune superfluous license boilerplate

The SPDX License Identifier line renders the GPL boilerplate text
superfluous, so let's remove it.

Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agoDocumentation: gpio: Input mode is not true Hi-Z
Andy Shevchenko [Wed, 30 Nov 2022 15:55:17 +0000 (17:55 +0200)]
Documentation: gpio: Input mode is not true Hi-Z

The true Hi-Z (a.k.a. high impedance) mode is when pin is completely
disconnected from the chip. This includes input buffer as well.
Nevertheless, some hardware may not support that mode and they are
considering input only as Hi-Z, but more precisely it is an equivalent
to that, in electronics it's basically "an antenna mode".

Sligthly correct documentation to take the above into consideration.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpiolib: Use IRQ hardware number getter instead of direct access
Andy Shevchenko [Thu, 9 Mar 2023 18:58:19 +0000 (20:58 +0200)]
gpiolib: Use IRQ hardware number getter instead of direct access

IRQ framework provides special type and getter to transform
the Linux IRQ to the hardware pin. Use that type and getter
function instead of direct access.

While at it, amend an indentation in a couple of places.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpiolib: Remove duplicative check in gpiod_find_and_request()
Andy Shevchenko [Thu, 9 Mar 2023 18:56:26 +0000 (20:56 +0200)]
gpiolib: Remove duplicative check in gpiod_find_and_request()

The gpiod_find_by_fwnode() already checks for NULL and returns
correct error code in case fwnode is invalid. Drop the respective
check and assignment in the gpiod_find_and_request().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpiolib: Move gpiodevice_*() to gpiodev namespace
Andy Shevchenko [Tue, 7 Mar 2023 18:25:57 +0000 (20:25 +0200)]
gpiolib: Move gpiodevice_*() to gpiodev namespace

The functions that operates on the same device object would
have the same namespace for better code understanding and
maintenance.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: Use of_property_read_bool() for boolean properties
Rob Herring [Tue, 14 Mar 2023 15:41:17 +0000 (10:41 -0500)]
gpio: Use of_property_read_bool() for boolean properties

It is preferred to use typed property access functions (i.e.
of_property_read_<type> functions) rather than low-level
of_get_property/of_find_property functions for reading properties.
Convert reading boolean properties to to of_property_read_bool().

Signed-off-by: Rob Herring <robh@kernel.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpiolib: Get rid of devprop prefix in one function
Andy Shevchenko [Thu, 9 Mar 2023 18:56:00 +0000 (20:56 +0200)]
gpiolib: Get rid of devprop prefix in one function

The devprop prefix in the devprop_gpiochip_set_names() adds confusion.
Get rid of it.

Note we have more than one function in the same module that handles
one or more device properties. This change will unify the naming schema
for all of them.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: raspberrypi-exp: mark OF related data as maybe unused
Krzysztof Kozlowski [Sat, 11 Mar 2023 11:13:07 +0000 (12:13 +0100)]
gpio: raspberrypi-exp: mark OF related data as maybe unused

The driver can be compile tested with !CONFIG_OF making certain data
unused:

  drivers/gpio/gpio-raspberrypi-exp.c:237:34: error: ‘rpi_exp_gpio_ids’ defined but not used [-Werror=unused-const-variable=]

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: xra1403: mark OF related data as maybe unused
Krzysztof Kozlowski [Sat, 11 Mar 2023 11:13:06 +0000 (12:13 +0100)]
gpio: xra1403: mark OF related data as maybe unused

The driver can be compile tested with !CONFIG_OF making certain data
unused:

  drivers/gpio/gpio-xra1403.c:198:34: error: ‘xra1403_spi_of_match’ defined but not used [-Werror=unused-const-variable=]

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: sama5d2-piobu: drop of_match_ptr for ID table
Krzysztof Kozlowski [Sat, 11 Mar 2023 11:13:05 +0000 (12:13 +0100)]
gpio: sama5d2-piobu: drop of_match_ptr for ID table

The driver can match only via the DT table so the table should be always
used and the of_match_ptr does not have any sense (this also allows ACPI
matching via PRP0001, even though it might not be relevant here).

  drivers/gpio/gpio-sama5d2-piobu.c:230:34: error: ‘sama5d2_piobu_ids’ defined but not used [-Werror=unused-const-variable=]

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: sifive: drop of_match_ptr for ID table
Krzysztof Kozlowski [Sat, 11 Mar 2023 11:13:04 +0000 (12:13 +0100)]
gpio: sifive: drop of_match_ptr for ID table

The driver can match only via the DT table so the table should be always
used and the of_match_ptr does not have any sense (this also allows ACPI
matching via PRP0001, even though it might not be relevant here).

  drivers/gpio/gpio-sifive.c:263:34: error: ‘sifive_gpio_match’ defined but not used [-Werror=unused-const-variable=]

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: visconti: drop of_match_ptr for ID table
Krzysztof Kozlowski [Sat, 11 Mar 2023 11:13:03 +0000 (12:13 +0100)]
gpio: visconti: drop of_match_ptr for ID table

The driver can match only via the DT table so the table should be always
used and the of_match_ptr does not have any sense (this also allows ACPI
matching via PRP0001, even though it might not be relevant here).

  drivers/gpio/gpio-visconti.c:187:34: error: ‘visconti_gpio_of_match’ defined but not used [-Werror=unused-const-variable=]

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: rcar: drop of_match_ptr for ID table
Krzysztof Kozlowski [Sat, 11 Mar 2023 11:13:02 +0000 (12:13 +0100)]
gpio: rcar: drop of_match_ptr for ID table

The driver can match only via the DT table so the table should be always
used and the of_match_ptr does not have any sense (this also allows ACPI
matching via PRP0001, even though it might not be relevant here).

  drivers/gpio/gpio-rcar.c:435:34: error: ‘gpio_rcar_of_table’ defined but not used [-Werror=unused-const-variable=]

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: altera: drop of_match_ptr for ID table
Krzysztof Kozlowski [Sat, 11 Mar 2023 11:13:01 +0000 (12:13 +0100)]
gpio: altera: drop of_match_ptr for ID table

The driver can match only via the DT table so the table should be always
used and the of_match_ptr does not have any sense (this also allows ACPI
matching via PRP0001, even though it might not be relevant here).

  drivers/gpio/gpio-altera.c:324:34: error: ‘altera_gpio_of_match’ defined but not used [-Werror=unused-const-variable=]

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: ftgpio010: drop of_match_ptr for ID table
Krzysztof Kozlowski [Sat, 11 Mar 2023 11:13:00 +0000 (12:13 +0100)]
gpio: ftgpio010: drop of_match_ptr for ID table

The driver can match only via the DT table so the table should be always
used and the of_match_ptr does not have any sense (this also allows ACPI
matching via PRP0001, even though it might not be relevant here).

  drivers/gpio/gpio-ftgpio010.c:336:34: error: ‘ftgpio_gpio_of_match’ defined but not used [-Werror=unused-const-variable=]

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agoMAINTAINERS: gpio: xra1403: drop Semi Malinen
Krzysztof Kozlowski [Sat, 11 Mar 2023 11:25:13 +0000 (12:25 +0100)]
MAINTAINERS: gpio: xra1403: drop Semi Malinen

Emails bounce: 550 5.1.1 No such user - pp

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: sim: Deactivate device in reversed order
Andy Shevchenko [Thu, 9 Mar 2023 18:46:35 +0000 (20:46 +0200)]
gpio: sim: Deactivate device in reversed order

Run the steps to deactivate device in the reserved order to what
it has been done in gpio_sim_device_activate_unlocked().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: loongson: Remove unnecessary .owner
Jiapeng Chong [Thu, 9 Mar 2023 03:17:55 +0000 (11:17 +0800)]
gpio: loongson: Remove unnecessary .owner

Remove .owner field if calls are used which set it automatically.

./drivers/gpio/gpio-loongson-64bit.c:225:3-8: No need to set .owner here. The core will do it.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=4450
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: pcie-idio-24: Convert to immutable irq_chip
Linus Walleij [Thu, 9 Mar 2023 07:46:05 +0000 (08:46 +0100)]
gpio: pcie-idio-24: Convert to immutable irq_chip

Convert the driver to immutable irq-chip with a bit of
intuition.

Cc: Marc Zyngier <maz@kernel.org>
Acked-by: William Breathitt Gray <william.gray@linaro.org>
Acked-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: pci-idio-16: Convert to immutable irq_chip
Linus Walleij [Thu, 9 Mar 2023 07:46:04 +0000 (08:46 +0100)]
gpio: pci-idio-16: Convert to immutable irq_chip

Convert the driver to immutable irq-chip with a bit of
intuition.

Cc: Marc Zyngier <maz@kernel.org>
Acked-by: William Breathitt Gray <william.gray@linaro.org>
Acked-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: omap: Convert to immutable irq_chip
Linus Walleij [Thu, 9 Mar 2023 07:46:03 +0000 (08:46 +0100)]
gpio: omap: Convert to immutable irq_chip

Convert the driver to immutable irq-chip with a bit of
intuition.

This driver require some special care: .irq_ack() was copied
from dummy_irq_chip where it was defined as noop. This only
makes sense if using handle_edge_irq() that will unconditionally
call .irq_ack() to avoid a crash, but this driver is not ever
using handle_edge_irq() so just avoid assigning .irq_ack().

A separate chip had to be created for the non-wakeup instance.

Cc: Marc Zyngier <maz@kernel.org>
Reviewed-by: Tony Lindgren <tony@atomide.com>
Tested-by: Tony Lindgren <tony@atomide.com>
Acked-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: omap: Drop irq_base
Linus Walleij [Thu, 9 Mar 2023 07:46:02 +0000 (08:46 +0100)]
gpio: omap: Drop irq_base

The OMAP1 at one point was using static irqs but that time is gone,
OMAP1 uses sparse irqs like all other multiplatform targets so this
static allocation of descriptors should just go.

Cc: Janusz Krzysztofik <jmkrzyszt@gmail.com>
Cc: Tony Lindgren <tony@atomide.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: max732x: Convert to immutable irq_chip
Linus Walleij [Thu, 9 Mar 2023 07:46:01 +0000 (08:46 +0100)]
gpio: max732x: Convert to immutable irq_chip

Convert the driver to immutable irq-chip with a bit of
intuition.

Cc: Marc Zyngier <maz@kernel.org>
Acked-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: mlxbf2: Convert to immutable irq_chip
Linus Walleij [Thu, 9 Mar 2023 07:46:00 +0000 (08:46 +0100)]
gpio: mlxbf2: Convert to immutable irq_chip

Convert the driver to immutable irq-chip with a bit of
intuition.

Cc: Marc Zyngier <maz@kernel.org>
Acked-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: msc313: Convert to immutable irq_chip
Linus Walleij [Thu, 9 Mar 2023 07:45:59 +0000 (08:45 +0100)]
gpio: msc313: Convert to immutable irq_chip

Convert the driver to immutable irq-chip with a bit of
intuition.

This conversion follows the pattern of the gpio-ixp4xx
hierarchical GPIO interrupt driver.

Cc: Marc Zyngier <maz@kernel.org>
Acked-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: idt3243x: Convert to immutable irq_chip
Linus Walleij [Thu, 9 Mar 2023 07:45:58 +0000 (08:45 +0100)]
gpio: idt3243x: Convert to immutable irq_chip

Convert the driver to immutable irq-chip with a bit of
intuition.

Cc: Marc Zyngier <maz@kernel.org>
Tested-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Acked-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: hlwd: Convert to immutable irq_chip
Linus Walleij [Thu, 9 Mar 2023 07:45:57 +0000 (08:45 +0100)]
gpio: hlwd: Convert to immutable irq_chip

Convert the driver to immutable irq-chip with a bit of
intuition.

Cc: Marc Zyngier <maz@kernel.org>
Acked-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: hisi: Convert to immutable irq_chip
Linus Walleij [Thu, 9 Mar 2023 07:45:56 +0000 (08:45 +0100)]
gpio: hisi: Convert to immutable irq_chip

Convert the driver to immutable irq-chip with a bit of
intuition.

The IRQ chip was unnamed which seems unwise, so we just
assign the name "HISI-GPIO".

Cc: Marc Zyngier <maz@kernel.org>
Acked-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: cadence: Convert to immutable irq_chip
Linus Walleij [Thu, 9 Mar 2023 07:45:55 +0000 (08:45 +0100)]
gpio: cadence: Convert to immutable irq_chip

Convert the driver to immutable irq-chip with a bit of
intuition.

Cc: Marc Zyngier <maz@kernel.org>
Acked-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: ath79: Convert to immutable irq_chip
Linus Walleij [Thu, 9 Mar 2023 07:45:54 +0000 (08:45 +0100)]
gpio: ath79: Convert to immutable irq_chip

Convert the driver to immutable irq-chip with a bit of
intuition.

Cc: Marc Zyngier <maz@kernel.org>
Acked-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: aspeed-sgpio: Convert to immutable irq_chip
Linus Walleij [Thu, 9 Mar 2023 07:45:53 +0000 (08:45 +0100)]
gpio: aspeed-sgpio: Convert to immutable irq_chip

Convert the driver to immutable irq-chip with a bit of
intuition.

Cc: Marc Zyngier <maz@kernel.org>
Acked-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: aspeed: Convert to immutable irq_chip
Linus Walleij [Thu, 9 Mar 2023 07:45:52 +0000 (08:45 +0100)]
gpio: aspeed: Convert to immutable irq_chip

Convert the driver to immutable irq-chip with a bit of
intuition.

Cc: Marc Zyngier <maz@kernel.org>
Tested-by: Joel Stanley <joel@jms.id.au>
Acked-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: aspeed: Always register the irqchip
Joel Stanley [Thu, 9 Mar 2023 07:45:51 +0000 (08:45 +0100)]
gpio: aspeed: Always register the irqchip

The driver was implemented in a way that made the irqchip optional, if a
irq was not present in the device tree. However, all of the device trees
have always had an irq, so the optional-ness has never been used.

Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: adnp: Convert to immutable irq_chip
Linus Walleij [Thu, 9 Mar 2023 07:45:50 +0000 (08:45 +0100)]
gpio: adnp: Convert to immutable irq_chip

Convert the driver to immutable irq-chip with a bit of
intuition.

Cc: Marc Zyngier <maz@kernel.org>
Acked-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: altera: Convert to immutable irq_chip
Linus Walleij [Thu, 9 Mar 2023 07:45:49 +0000 (08:45 +0100)]
gpio: altera: Convert to immutable irq_chip

Convert the driver to immutable irq-chip with a bit of
intuition.

Cc: Marc Zyngier <maz@kernel.org>
Acked-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agomips: ar7: include linux/gpio/driver.h
Arnd Bergmann [Wed, 8 Mar 2023 14:52:53 +0000 (15:52 +0100)]
mips: ar7: include linux/gpio/driver.h

The change to remove the implicit gpio/driver.h include was done
after fixing all the other users, but the ar7 file still needs
the same change.

Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Fixes: 21d9526d13b5 ("gpiolib: Make the legacy <linux/gpio.h> consumer-only")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
16 months agogpio: loongson: fixup the warning about OF_GPIO direct dependencies
Yinbo Zhu [Thu, 9 Mar 2023 11:14:07 +0000 (19:14 +0800)]
gpio: loongson: fixup the warning about OF_GPIO direct dependencies

WARNING: unmet direct dependencies detected for OF_GPIO
  Depends on [n]: GPIOLIB [=y] && OF [=n] && HAS_IOMEM [=y]
  Selected by [y]:
  - GPIO_LOONGSON_64BIT [=y] && GPIOLIB [=y] && HAS_IOMEM [=y] && (LOONGARCH || COMPILE_TEST [=y])

Signed-off-by: Yinbo Zhu <zhuyinbo@loongson.cn>
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/oe-kbuild-all/202303091728.UUe6LWye-lkp@intel.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: ich: Use devm_gpiochip_add_data() to simplify remove path
Andrew Davis [Tue, 7 Mar 2023 16:54:27 +0000 (10:54 -0600)]
gpio: ich: Use devm_gpiochip_add_data() to simplify remove path

Use devm version of gpiochip add function to handle removal for us.

Signed-off-by: Andrew Davis <afd@ti.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
16 months agogpiolib: Get rid of gpio_bus_match() forward declaration
Andy Shevchenko [Tue, 7 Mar 2023 18:25:56 +0000 (20:25 +0200)]
gpiolib: Get rid of gpio_bus_match() forward declaration

There is nothing specific about gpio_bus_match(), so we may
simply move it to the top of the file and get rid of forward
declaration.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpiolib: Access device's fwnode via dev_fwnode()
Andy Shevchenko [Tue, 7 Mar 2023 18:25:55 +0000 (20:25 +0200)]
gpiolib: Access device's fwnode via dev_fwnode()

GPIO device's fwnode should be accessed via dev_fwnode().
Make sure that gpiochip_setup_dev() follows that.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agoMerge tag 'intel-gpio-v6.4-1' of git://git.kernel.org/pub/scm/linux/kernel/git/andy...
Bartosz Golaszewski [Wed, 8 Mar 2023 10:04:32 +0000 (11:04 +0100)]
Merge tag 'intel-gpio-v6.4-1' of git://git./linux/kernel/git/andy/linux-gpio-intel into gpio/for-next

intel-gpio for v6.4-1

* Remove some of the legacy APIs that are not used anymore
* Clean up headers in the GPIO library and drivers

The following is an automated git shortlog grouped by driver:

aggregator:
 -  Add missing header(s)

ARM:
 -  s3c64xx: Use the right include
 -  orion/gpio: Use the right include

gpiolib:
 -  Clean up headers
 -  Group forward declarations in consumer.h
 -  Deduplicate forward declarations in consumer.h
 -  Drop unused forward declaration from driver.h
 -  split of_mm_gpio_chip out of linux/of_gpio.h
 -  split linux/gpio/driver.h out of linux/gpio.h
 -  remove legacy gpio_export()
 -  remove gpio_set_debounce()
 -  remove asm-generic/gpio.h
 -  coldfire: remove custom asm/gpio.h
 -  remove empty asm/gpio.h files
 -  Make the legacy <linux/gpio.h> consumer-only

hte:
 -  tegra-194: Use proper includes

reg:
 -  Add missing header(s)

regmap:
 -  Add missing header(s)

16 months agogpio: elkhartlake: Introduce Intel Elkhart Lake PSE GPIO
Pandith N [Thu, 16 Feb 2023 18:36:08 +0000 (20:36 +0200)]
gpio: elkhartlake: Introduce Intel Elkhart Lake PSE GPIO

This driver adds support for Intel Elkhart Lake PSE GPIO controller,
using Intel Tangier as a library driver.

Signed-off-by: Pandith N <pandith.n@intel.com>
Co-developed-by: Raag Jadav <raag.jadav@intel.com>
Signed-off-by: Raag Jadav <raag.jadav@intel.com>
Co-developed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
16 months agogpio: merrifield: Utilise temporary variable for struct device
Andy Shevchenko [Thu, 16 Feb 2023 18:03:42 +0000 (20:03 +0200)]
gpio: merrifield: Utilise temporary variable for struct device

We have a temporary variable to keep pointer to struct device.
Utilise it inside the ->probe() implementation.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
16 months agogpio: merrifield: Use dev_err_probe()
Andy Shevchenko [Mon, 16 Jan 2023 14:44:46 +0000 (15:44 +0100)]
gpio: merrifield: Use dev_err_probe()

Improve error handling in the probe() function with dev_err_probe().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
16 months agogpio: merrifield: Adapt to Intel Tangier GPIO driver
Pandith N [Thu, 16 Feb 2023 18:34:19 +0000 (20:34 +0200)]
gpio: merrifield: Adapt to Intel Tangier GPIO driver

Make use of Intel Tangier GPIO as a library driver for Merrifield.

Signed-off-by: Pandith N <pandith.n@intel.com>
Co-developed-by: Raag Jadav <raag.jadav@intel.com>
Signed-off-by: Raag Jadav <raag.jadav@intel.com>
Co-developed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
16 months agogpio: tangier: Introduce Intel Tangier GPIO driver
Pandith N [Thu, 16 Feb 2023 13:23:54 +0000 (18:53 +0530)]
gpio: tangier: Introduce Intel Tangier GPIO driver

Intel Elkhart Lake and Merrifield platforms have same GPIO IP.
Intel Tangier implements the common GPIO functionalities for both
Elkhart Lake and Merrifield platforms.

Signed-off-by: Pandith N <pandith.n@intel.com>
Co-developed-by: Raag Jadav <raag.jadav@intel.com>
Signed-off-by: Raag Jadav <raag.jadav@intel.com>
Co-developed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
16 months agogpiolib: Clean up headers
Andy Shevchenko [Wed, 8 Feb 2023 17:07:28 +0000 (19:07 +0200)]
gpiolib: Clean up headers

There is a few things done:
- include only the headers we are direct user of
- when pointer is in use, provide a forward declaration
- add missing headers
- group generic headers and subsystem headers
- sort each group alphabetically

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
16 months agogpiolib: Group forward declarations in consumer.h
Andy Shevchenko [Tue, 7 Feb 2023 14:29:51 +0000 (16:29 +0200)]
gpiolib: Group forward declarations in consumer.h

For better maintenance group the forward declarations together.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
16 months agogpiolib: Deduplicate forward declarations in consumer.h
Andy Shevchenko [Tue, 7 Feb 2023 14:29:50 +0000 (16:29 +0200)]
gpiolib: Deduplicate forward declarations in consumer.h

The struct fwnode_handle pointer is used in both branches of ifdeffery,
no need to have a copy of the same in each of them, just make it global.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
16 months agogpiolib: Drop unused forward declaration from driver.h
Andy Shevchenko [Tue, 7 Feb 2023 14:29:49 +0000 (16:29 +0200)]
gpiolib: Drop unused forward declaration from driver.h

There is no struct device_node pointers anywhere in the header,
drop unused forward declaration.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
16 months agogpio: regmap: Add missing header(s)
Andy Shevchenko [Tue, 7 Feb 2023 14:29:48 +0000 (16:29 +0200)]
gpio: regmap: Add missing header(s)

Do not imply that some of the generic headers may be always included.
Instead, include explicitly what we are direct user of.

While at it, split out the GPIO group of headers.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
16 months agogpio: reg: Add missing header(s)
Andy Shevchenko [Tue, 7 Feb 2023 14:29:48 +0000 (16:29 +0200)]
gpio: reg: Add missing header(s)

Do not imply that some of the generic headers may be always included.
Instead, include explicitly what we are direct user of.

While at it, split out the GPIO group of headers.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
16 months agogpio: aggregator: Add missing header(s)
Andy Shevchenko [Tue, 7 Feb 2023 14:29:48 +0000 (16:29 +0200)]
gpio: aggregator: Add missing header(s)

Do not imply that some of the generic headers may be always included.
Instead, include explicitly what we are direct user of.

While at it, drop unused linux/gpio.h and split out the GPIO group of
headers.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
16 months agogpiolib: split of_mm_gpio_chip out of linux/of_gpio.h
Arnd Bergmann [Tue, 7 Feb 2023 14:29:47 +0000 (16:29 +0200)]
gpiolib: split of_mm_gpio_chip out of linux/of_gpio.h

This is a rarely used feature that has nothing to do with the
client-side of_gpio.h.

Split it out with a separate header file and Kconfig option
so it can be removed on its own timeline aside from removing
the of_gpio consumer interfaces.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
16 months agogpiolib: split linux/gpio/driver.h out of linux/gpio.h
Arnd Bergmann [Wed, 8 Feb 2023 15:41:47 +0000 (17:41 +0200)]
gpiolib: split linux/gpio/driver.h out of linux/gpio.h

Almost all gpio drivers include linux/gpio/driver.h, and other
files should not rely on includes from this header.

Remove the indirect include from here and include the correct
headers directly from where they are used.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Lee Jones <lee@kernel.org>
16 months agogpiolib: remove legacy gpio_export()
Arnd Bergmann [Tue, 7 Feb 2023 14:29:45 +0000 (16:29 +0200)]
gpiolib: remove legacy gpio_export()

There are only a handful of users of gpio_export() and
related functions.

As these are just wrappers around the modern gpiod_export()
helper, remove the wrappers and open-code the gpio_to_desc
in all callers to shrink the legacy API.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
16 months agogpiolib: remove gpio_set_debounce()
Arnd Bergmann [Tue, 7 Feb 2023 14:29:44 +0000 (16:29 +0200)]
gpiolib: remove gpio_set_debounce()

gpio_set_debounce() only has a single user, which is trivially
converted to gpiod_set_debounce().

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
16 months agogpiolib: remove asm-generic/gpio.h
Arnd Bergmann [Wed, 8 Feb 2023 15:37:22 +0000 (17:37 +0200)]
gpiolib: remove asm-generic/gpio.h

The asm-generic/gpio.h file is now always included when
using gpiolib, so just move its contents into linux/gpio.h
with a few minor simplifications.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
16 months agogpiolib: coldfire: remove custom asm/gpio.h
Arnd Bergmann [Tue, 7 Feb 2023 14:29:42 +0000 (16:29 +0200)]
gpiolib: coldfire: remove custom asm/gpio.h

Now that coldfire is the only user of a custom asm/gpio.h, it seems
better to remove this as well, and have the same interface everywhere.

For the gpio_get_value()/gpio_set_value()/gpio_to_irq(), gpio_cansleep()
functions, the custom version is only a micro-optimization to inline the
function for constant GPIO numbers. However, in the coldfire defconfigs,
I was unable to find a single instance where this micro-optimization
was even used, and according to Geert the only user appears to be the
QSPI chip that is disabled everywhere.

The custom gpio_request_one() function is even less useful, as it is
guarded by an #ifdef that is never true.

Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
16 months agogpiolib: remove empty asm/gpio.h files
Arnd Bergmann [Tue, 7 Feb 2023 14:29:41 +0000 (16:29 +0200)]
gpiolib: remove empty asm/gpio.h files

The arm and sh versions of this file are identical to the generic
versions and can just be removed.

The drivers that actually use the sh3 specific version also include
cpu/gpio.h directly, with the exception of magicpanelr2, which is
easily fixed. This leaves coldfire as the only gpio driver
that needs something custom for gpiolib.

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
16 months agogpiolib: Make the legacy <linux/gpio.h> consumer-only
Linus Walleij [Fri, 3 Jul 2020 13:04:51 +0000 (15:04 +0200)]
gpiolib: Make the legacy <linux/gpio.h> consumer-only

The legacy <linux/gpio.h> header was an all-inclusive header used
by drivers and consumers alike. After eliminating the last users
of the driver defines, we can drop the inclusion of the
<linux/gpio/driver.h> header.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
16 months agohte: tegra-194: Use proper includes
Linus Walleij [Fri, 13 Jan 2023 09:44:01 +0000 (10:44 +0100)]
hte: tegra-194: Use proper includes

The test driver uses the gpiod consumer API so include the right
<linux/gpio/consumer.h> header. This may cause a problem with
struct of_device_id being implcitly pulled in by the legacy
header <linux/gpio.h> so include <linux/mod_devicetable.h>
explicitly as well.

While at it, drop explicit moduleparam.h (it's included with module.h)
and sort the headers.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
16 months agoARM: s3c64xx: Use the right include
Linus Walleij [Fri, 13 Jan 2023 09:56:17 +0000 (10:56 +0100)]
ARM: s3c64xx: Use the right include

The file s3c64xx.c is including <linux/gpio.h> despite using no
symbols from the file, however it needs it to implicitly bring in
of_have_populated_dt() so include <linux/of.h> explicitly instead.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
16 months agoARM: orion/gpio: Use the right include
Linus Walleij [Fri, 13 Jan 2023 09:51:34 +0000 (10:51 +0100)]
ARM: orion/gpio: Use the right include

This is a GPIO driver so include <linux/gpio/driver.h> and not
the legacy <linux/gpio.h> header. Switch a single call to the
legacy API and use <linux/gpio/consumer.h> as well.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
16 months agokbuild, gpio: gpio-aspeed-sgpio: remove MODULE_LICENSE in non-modules
Nick Alcock [Wed, 22 Feb 2023 12:14:53 +0000 (12:14 +0000)]
kbuild, gpio: gpio-aspeed-sgpio: remove MODULE_LICENSE in non-modules

Since commit 8b41fc4454e ("kbuild: create modules.builtin without
Makefile.modbuiltin or tristate.conf"), MODULE_LICENSE declarations
are used to identify modules. As a consequence, uses of the macro
in non-modules will cause modprobe to misidentify their containing
object file as a module when it is not (false positives), and modprobe
might succeed rather than failing with a suitable error message.

So remove it in the files in this commit, none of which can be built as
modules.

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Suggested-by: Luis Chamberlain <mcgrof@kernel.org>
Cc: Luis Chamberlain <mcgrof@kernel.org>
Cc: linux-modules@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: Hitomi Hasegawa <hasegawa-hitomi@fujitsu.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Joel Stanley <joel@jms.id.au>
Cc: linux-gpio@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-aspeed@lists.ozlabs.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agokbuild, gpio: remove MODULE_LICENSE in non-modules
Nick Alcock [Fri, 17 Feb 2023 14:10:55 +0000 (14:10 +0000)]
kbuild, gpio: remove MODULE_LICENSE in non-modules

Since commit 8b41fc4454e ("kbuild: create modules.builtin without
Makefile.modbuiltin or tristate.conf"), MODULE_LICENSE declarations
are used to identify modules. As a consequence, uses of the macro
in non-modules will cause modprobe to misidentify their containing
object file as a module when it is not (false positives), and modprobe
might succeed rather than failing with a suitable error message.

So remove it in the files in this commit, none of which can be built as
modules.

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Suggested-by: Luis Chamberlain <mcgrof@kernel.org>
Cc: Luis Chamberlain <mcgrof@kernel.org>
Cc: linux-modules@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: Hitomi Hasegawa <hasegawa-hitomi@fujitsu.com>
Cc: Manivannan Sadhasivam <mani@kernel.org>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-unisoc@lists.infradead.org
Cc: linux-gpio@vger.kernel.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agodt-bindings: gpio.txt: expand gpio-line-names recommendations
Trevor Woerner [Sat, 11 Feb 2023 03:06:45 +0000 (22:06 -0500)]
dt-bindings: gpio.txt: expand gpio-line-names recommendations

Provide more guidance to differentiate between recommendations for names of
lines which are hard-wired to on-board devices, versus recommendations for
names of lines which are connected to general-purpose pin headers.

Signed-off-by: Trevor Woerner <twoerner@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: pmic-eic-sprd: Move Kconfig to MFD expanders
Linus Walleij [Thu, 16 Feb 2023 09:19:09 +0000 (10:19 +0100)]
gpio: pmic-eic-sprd: Move Kconfig to MFD expanders

The Spreadtrum PMIC EIC interrupt controller is part of an
MFD expander and should thus be in the MFD GPIO expander
menu section with the rest. Move it.

Cc: Cixi Geng <cixi.geng1@unisoc.com>
Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: 104-dio-48e: Utilize mask_buf_def in handle_mask_sync() callback
William Breathitt Gray [Wed, 8 Feb 2023 10:55:42 +0000 (05:55 -0500)]
gpio: 104-dio-48e: Utilize mask_buf_def in handle_mask_sync() callback

The mask_buf_def argument provides a mask of all the maskable lines.
Utilize mask_buf_def rather than hardcode an "all_masked" mask.

Signed-off-by: William Breathitt Gray <william.gray@linaro.org>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
16 months agogpio: remove MODULE_LICENSE in non-modules
Nick Alcock [Fri, 24 Feb 2023 15:07:45 +0000 (15:07 +0000)]
gpio: remove MODULE_LICENSE in non-modules

Since commit 8b41fc4454e ("kbuild: create modules.builtin without
Makefile.modbuiltin or tristate.conf"), MODULE_LICENSE declarations
are used to identify modules. As a consequence, uses of the macro
in non-modules will cause modprobe to misidentify their containing
object file as a module when it is not (false positives), and modprobe
might succeed rather than failing with a suitable error message.

So remove it in the files in this commit, none of which can be built as
modules.

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Suggested-by: Luis Chamberlain <mcgrof@kernel.org>
Cc: Luis Chamberlain <mcgrof@kernel.org>
Cc: linux-modules@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: Hitomi Hasegawa <hasegawa-hitomi@fujitsu.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: linux-gpio@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>