Commit 2c96606a authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'gpio-updates-for-v6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux

Pull gpio updates from Bartosz Golaszewski:
 "We have some new drivers, significant refactoring of existing intel
  platforms, lots of improvements all around, mass conversion to using
  immutable irqchips by drivers that had not been converted individually
  yet and some changes in the core library code.

  Summary:

  New drivers:
   - add a driver for the Loongson GPIO controller
   - add a driver for the fxl6408 I2C GPIO expander
   - add a GPIO module containing code common for Intel Elkhart Lake and
     Merrifield platforms
   - add a driver for the Intel Elkhart Lake platform reusing the code
     from the intel tangier library

  GPIOLIB core:
   - GPIO ACPI improvements
   - simplify gpiochip_add_data_with_keys() fwnode handling
   - cleanup header inclusions (remove unneeded ones, order the rest
     alphabetically)
   - remove duplicate code (reuse krealloc() instead of open-coding it,
     drop a duplicated check in gpiod_find_and_request())
   - reshuffle the code to remove unnecessary forward declarations
   - coding style cleanups and improvements
   - add a helper for accessing device fwnodes
   - small updates in docs

  Driver improvements:
   - convert all remaining GPIO irqchip drivers to using immutable
     irqchips
   - drop unnecessary of_match_ptr() macro expansions
   - shrink the code in gpio-merrifield significantly by reusing the
     code from gpio-tangier + minor tweaks to the driver code
   - remove MODULE_LICENSE() from drivers that can only be built-in
   - add device-tree support to gpio-loongson1
   - use new regmap features in gpio-104-dio-48e and gpio-pcie-idio-24
   - minor tweaks and fixes to gpio-xra1403, gpio-sim, gpio-tegra194,
     gpio-omap, gpio-aspeed, gpio-raspberrypi-exp
   - shrink code in gpio-ich and gpio-pxa
   - Kconfig tweak for gpio-pmic-eic-sprd"

* tag 'gpio-updates-for-v6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: (99 commits)
  gpio: gpiolib: Simplify gpiochip_add_data_with_key() fwnode
  gpiolib: Add gpiochip_set_data() helper
  gpiolib: Move gpiochip_get_data() higher in the code
  gpiolib: Check array_info for NULL only once in gpiod_get_array()
  gpiolib: Replace open coded krealloc()
  gpiolib: acpi: Add a ignore wakeup quirk for Clevo NL5xNU
  gpiolib: acpi: Move ACPI device NULL check to acpi_get_driver_gpio_data()
  gpiolib: acpi: use the fwnode in acpi_gpiochip_find()
  gpio: mm-lantiq: Fix typo in the newly added header filename
  sh: mach-x3proto: Add missing #include <linux/gpio/driver.h>
  powerpc/40x: Add missing select OF_GPIO_MM_GPIOCHIP
  gpio: xlp: Convert to immutable irq_chip
  gpio: xilinx: Convert to immutable irq_chip
  gpio: xgs-iproc: Convert to immutable irq_chip
  gpio: visconti: Convert to immutable irq_chip
  gpio: tqmx86: Convert to immutable irq_chip
  gpio: thunderx: Convert to immutable irq_chip
  gpio: stmpe: Convert to immutable irq_chip
  gpio: siox: Convert to immutable irq_chip
  gpio: rda: Convert to immutable irq_chip
  ...
parents d8495579 8a4adcf6
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -145,7 +145,7 @@ requested using gpio_request()::
	/* export the GPIO to userspace */
	int gpiod_export(struct gpio_desc *desc, bool direction_may_change);

	/* reverse gpio_export() */
	/* reverse gpiod_export() */
	void gpiod_unexport(struct gpio_desc *desc);

	/* create a sysfs link to an exported GPIO node */
+58 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/gpio/fcs,fxl6408.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Fairchild FXL6408 I2C GPIO Expander

maintainers:
  - Emanuele Ghidoli <emanuele.ghidoli@toradex.com>

properties:
  compatible:
    enum:
      - fcs,fxl6408

  reg:
    maxItems: 1

  "#gpio-cells":
    const: 2

  gpio-controller: true

  gpio-line-names:
    minItems: 1
    maxItems: 8

patternProperties:
  "^(hog-[0-9]+|.+-hog(-[0-9]+)?)$":
    required:
      - gpio-hog

required:
  - compatible
  - reg
  - gpio-controller
  - "#gpio-cells"

additionalProperties: false

examples:
  - |
    i2c {
        #address-cells = <1>;
        #size-cells = <0>;

        gpio_expander_43: gpio-expander@43 {
            compatible = "fcs,fxl6408";
            reg = <0x43>;
            gpio-controller;
            #gpio-cells = <2>;
            gpio-line-names = "Wi-Fi_W_DISABLE", "Wi-Fi_WKUP_WLAN",
                              "PWR_EN_+V3.3_WiFi_N", "PCIe_REF_CLK_EN",
                              "USB_RESET_N", "USB_BYPASS_N", "Wi-Fi_PDn",
                              "Wi-Fi_WKUP_BT";
        };
    };
+29 −12
Original line number Diff line number Diff line
@@ -154,18 +154,35 @@ of the GPIOs that can't be used.

Optionally, a GPIO controller may have a "gpio-line-names" property. This is
an array of strings defining the names of the GPIO lines going out of the
GPIO controller. This name should be the most meaningful producer name
for the system, such as a rail name indicating the usage. Package names
such as pin name are discouraged: such lines have opaque names (since they
are by definition generic purpose) and such names are usually not very
helpful. For example "MMC-CD", "Red LED Vdd" and "ethernet reset" are
reasonable line names as they describe what the line is used for. "GPIO0"
is not a good name to give to a GPIO line. Placeholders are discouraged:
rather use the "" (blank string) if the use of the GPIO line is undefined
in your design. The names are assigned starting from line offset 0 from
left to right from the passed array. An incomplete array (where the number
of passed named are less than ngpios) will still be used up until the last
provided valid line index.
GPIO controller.

For lines which are routed to on-board devices, this name should be
the most meaningful producer name for the system, such as a rail name
indicating the usage. Package names, such as a pin name, are discouraged:
such lines have opaque names (since they are by definition general-purpose)
and such names are usually not very helpful. For example "MMC-CD", "Red LED
Vdd" and "ethernet reset" are reasonable line names as they describe what
the line is used for. "GPIO0" is not a good name to give to a GPIO line
that is hard-wired to a specific device.

However, in the case of lines that are routed to a general purpose header
(e.g. the Raspberry Pi 40-pin header), and therefore are not hard-wired to
specific devices, using a pin number or the names on the header is fine
provided these are real (preferably unique) names. Using an SoC's pad name
or package name, or names made up from kernel-internal software constructs,
are strongly discouraged. For example "pin8 [gpio14/uart0_txd]" is fine
if the board's documentation labels pin 8 as such. However "PortB_24" (an
example of a name from an SoC's reference manual) would not be desirable.

In either case placeholders are discouraged: rather use the "" (blank
string) if the use of the GPIO line is undefined in your design. Ideally,
try to add comments to the dts file describing the naming the convention
you have chosen, and specifying from where the names are derived.

The names are assigned starting from line offset 0, from left to right,
from the passed array. An incomplete array (where the number of passed
names is less than ngpios) will be used up until the last provided valid
line index.

Example:

+126 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/gpio/loongson,ls-gpio.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Loongson GPIO controller.

maintainers:
  - Yinbo Zhu <zhuyinbo@loongson.cn>

properties:
  compatible:
    enum:
      - loongson,ls2k-gpio
      - loongson,ls7a-gpio

  reg:
    maxItems: 1

  ngpios:
    minimum: 1
    maximum: 64

  "#gpio-cells":
    const: 2

  gpio-controller: true

  gpio-ranges: true

  interrupts:
    minItems: 1
    maxItems: 64

required:
  - compatible
  - reg
  - ngpios
  - "#gpio-cells"
  - gpio-controller
  - gpio-ranges
  - interrupts

additionalProperties: false

examples:
  - |
    #include <dt-bindings/interrupt-controller/irq.h>

    gpio0: gpio@1fe00500 {
      compatible = "loongson,ls2k-gpio";
      reg = <0x1fe00500 0x38>;
      ngpios = <64>;
      #gpio-cells = <2>;
      gpio-controller;
      gpio-ranges = <&pctrl 0 0 15>,
                    <&pctrl 16 16 15>,
                    <&pctrl 32 32 10>,
                    <&pctrl 44 44 20>;
      interrupt-parent = <&liointc1>;
      interrupts = <28 IRQ_TYPE_LEVEL_LOW>,
                   <29 IRQ_TYPE_LEVEL_LOW>,
                   <30 IRQ_TYPE_LEVEL_LOW>,
                   <30 IRQ_TYPE_LEVEL_LOW>,
                   <26 IRQ_TYPE_LEVEL_LOW>,
                   <26 IRQ_TYPE_LEVEL_LOW>,
                   <26 IRQ_TYPE_LEVEL_LOW>,
                   <26 IRQ_TYPE_LEVEL_LOW>,
                   <26 IRQ_TYPE_LEVEL_LOW>,
                   <26 IRQ_TYPE_LEVEL_LOW>,
                   <26 IRQ_TYPE_LEVEL_LOW>,
                   <26 IRQ_TYPE_LEVEL_LOW>,
                   <26 IRQ_TYPE_LEVEL_LOW>,
                   <26 IRQ_TYPE_LEVEL_LOW>,
                   <26 IRQ_TYPE_LEVEL_LOW>,
                   <>,
                   <26 IRQ_TYPE_LEVEL_LOW>,
                   <26 IRQ_TYPE_LEVEL_LOW>,
                   <26 IRQ_TYPE_LEVEL_LOW>,
                   <26 IRQ_TYPE_LEVEL_LOW>,
                   <26 IRQ_TYPE_LEVEL_LOW>,
                   <26 IRQ_TYPE_LEVEL_LOW>,
                   <26 IRQ_TYPE_LEVEL_LOW>,
                   <26 IRQ_TYPE_LEVEL_LOW>,
                   <26 IRQ_TYPE_LEVEL_LOW>,
                   <26 IRQ_TYPE_LEVEL_LOW>,
                   <26 IRQ_TYPE_LEVEL_LOW>,
                   <26 IRQ_TYPE_LEVEL_LOW>,
                   <26 IRQ_TYPE_LEVEL_LOW>,
                   <26 IRQ_TYPE_LEVEL_LOW>,
                   <26 IRQ_TYPE_LEVEL_LOW>,
                   <26 IRQ_TYPE_LEVEL_LOW>,
                   <27 IRQ_TYPE_LEVEL_LOW>,
                   <27 IRQ_TYPE_LEVEL_LOW>,
                   <27 IRQ_TYPE_LEVEL_LOW>,
                   <27 IRQ_TYPE_LEVEL_LOW>,
                   <27 IRQ_TYPE_LEVEL_LOW>,
                   <>,
                   <27 IRQ_TYPE_LEVEL_LOW>,
                   <27 IRQ_TYPE_LEVEL_LOW>,
                   <27 IRQ_TYPE_LEVEL_LOW>,
                   <27 IRQ_TYPE_LEVEL_LOW>,
                   <>,
                   <>,
                   <27 IRQ_TYPE_LEVEL_LOW>,
                   <27 IRQ_TYPE_LEVEL_LOW>,
                   <27 IRQ_TYPE_LEVEL_LOW>,
                   <27 IRQ_TYPE_LEVEL_LOW>,
                   <27 IRQ_TYPE_LEVEL_LOW>,
                   <27 IRQ_TYPE_LEVEL_LOW>,
                   <27 IRQ_TYPE_LEVEL_LOW>,
                   <27 IRQ_TYPE_LEVEL_LOW>,
                   <27 IRQ_TYPE_LEVEL_LOW>,
                   <27 IRQ_TYPE_LEVEL_LOW>,
                   <27 IRQ_TYPE_LEVEL_LOW>,
                   <27 IRQ_TYPE_LEVEL_LOW>,
                   <27 IRQ_TYPE_LEVEL_LOW>,
                   <27 IRQ_TYPE_LEVEL_LOW>,
                   <27 IRQ_TYPE_LEVEL_LOW>,
                   <27 IRQ_TYPE_LEVEL_LOW>,
                   <27 IRQ_TYPE_LEVEL_LOW>,
                   <27 IRQ_TYPE_LEVEL_LOW>,
                   <27 IRQ_TYPE_LEVEL_LOW>,
                   <27 IRQ_TYPE_LEVEL_LOW>;
    };
+49 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/gpio/loongson,ls1x-gpio.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Loongson-1 GPIO controller

maintainers:
  - Keguang Zhang <keguang.zhang@gmail.com>

properties:
  compatible:
    const: loongson,ls1x-gpio

  reg:
    maxItems: 1

  gpio-controller: true

  "#gpio-cells":
    const: 2

  ngpios:
    minimum: 1
    maximum: 32

required:
  - compatible
  - reg
  - gpio-controller
  - "#gpio-cells"
  - ngpios

additionalProperties: false

examples:
  - |
    gpio0: gpio@1fd010c0 {
        compatible = "loongson,ls1x-gpio";
        reg = <0x1fd010c0 0x4>;

        gpio-controller;
        #gpio-cells = <2>;

        ngpios = <32>;
    };

...
Loading