Commit d5f74114 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

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

Pull gpio updates from Bartosz Golaszewski:
 "There are two new drivers and support for more models in existing
  ones.

  The generic GPIO API has been reworked and all users converted
  which allowed us to move the fields specific to the generic GPIO
  implementation out of the high-level struct gpio_chip into its own
  structure that wraps the gpio_chip.

  Other than that, there's nothing too exciting. Mostly minor tweaks and
  fixes all over the place, some refactoring and some small new features
  in helper modules.

  GPIO core:
   - add support for sparse pin ranges to the glue between GPIO and
     pinctrl
   - use a common prefix across all GPIO descriptor flags for improved
     namespacing

  New drivers:
   - add new GPIO driver for the Nuvoton NCT6694
   - add new GPIO driver for MAX7360

  Driver improvements:
   - add support for Tegra 256 to the gpio-tegra186 driver
   - add support for Loongson-2K0300 to the gpio-loongson-64bit driver
   - refactor the gpio-aggregator module to expose its GPIO forwarder
     API to other in-kernel users (to enable merging of a new pinctrl
     driver that uses it)
   - convert all remaining drivers to using the modernized generic GPIO
     chip API and remove the old interface
   - stop displaying global GPIO numbers in debugfs output of controller
     drivers
   - extend the gpio-regmap helper with a new config option and improve
     its support for GPIO interrupts
   - remove redundant fast_io parameter from regmap configs in GPIO
     drivers that already use MMIO regmaps which imply it
   - add support for a new model in gpio-mmio: ixp4xx expansion bus
   - order includes alphabetically in a few drivers for better
     readability
   - use generic device properties where applicable
   - use devm_mutex_init() where applicable
   - extend build coverage of drivers by enabling more to be compiled
     with COMPILE_TEST enabled
   - allow building gpio-stmpe as a module
   - use dev_err_probe() where it makes sense in drivers

  Late driver fixes:
   - fix setting GPIO direction to output in gpio-mpfs

  Documentation:
   - document the usage of software nodes with GPIO chips

  Device-tree bindings:
   - Add DT bindings documents for new hardware: Tegra256, MAX7360
   - Document a new model in Loongson bindings: LS2K0300
   - Document a new model using the generic GPIO binding: IXP4xx
   - Convert the DT binding for fsl,mxs-pinctrl to YAML
   - fix the schema ID in the "trivial" GPIO schema
   - describe GPIO hogs in the generic GPIO binding"

* tag 'gpio-updates-for-v6.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: (122 commits)
  gpio: mpfs: fix setting gpio direction to output
  gpio: generic: move GPIO_GENERIC_ flags to the correct header
  gpio: generic: rename BGPIOF_ flags to GPIO_GENERIC_
  gpio: nomadik: fix the debugfs helper stub
  MAINTAINERS: Add entry on MAX7360 driver
  input: misc: Add support for MAX7360 rotary
  input: keyboard: Add support for MAX7360 keypad
  gpio: max7360: Add MAX7360 gpio support
  gpio: regmap: Allow to provide init_valid_mask callback
  gpio: regmap: Allow to allocate regmap-irq device
  pwm: max7360: Add MAX7360 PWM support
  pinctrl: Add MAX7360 pinctrl driver
  mfd: Add max7360 support
  dt-bindings: mfd: gpio: Add MAX7360
  rtc: Add Nuvoton NCT6694 RTC support
  hwmon: Add Nuvoton NCT6694 HWMON support
  watchdog: Add Nuvoton NCT6694 WDT support
  can: Add Nuvoton NCT6694 CANFD support
  i2c: Add Nuvoton NCT6694 I2C support
  gpio: Add Nuvoton NCT6694 GPIO support
  ...
parents c050daf6 bc061143
Loading
Loading
Loading
Loading
+35 −1
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ properties:
      - brcm,bcm6345-gpio
      - ni,169445-nand-gpio
      - wd,mbl-gpio # Western Digital MyBook Live memory-mapped GPIO controller
      - intel,ixp4xx-expansion-bus-mmio-gpio

  big-endian: true

@@ -89,6 +90,20 @@ properties:
    description:
      If this property is present, the controller cannot drive the GPIO lines.

if:
  properties:
    compatible:
      contains:
        const: intel,ixp4xx-expansion-bus-mmio-gpio
then:
  $ref: /schemas/memory-controllers/intel,ixp4xx-expansion-peripheral-props.yaml#

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

required:
  - compatible
  - reg
@@ -96,7 +111,7 @@ required:
  - '#gpio-cells'
  - gpio-controller

additionalProperties: false
unevaluatedProperties: false

examples:
  - |
@@ -126,3 +141,22 @@ examples:
      gpio-controller;
      #gpio-cells = <2>;
    };

    bus@c4000000 {
        compatible = "intel,ixp42x-expansion-bus-controller", "syscon";
        reg = <0xc4000000 0x30>;
        native-endian;
        #address-cells = <2>;
        #size-cells = <1>;
        ranges = <0 0x0 0x50000000 0x01000000>;
        dma-ranges = <0 0x0 0x50000000 0x01000000>;
        gpio@1,0 {
            compatible = "intel,ixp4xx-expansion-bus-mmio-gpio";
            gpio-controller;
            #gpio-cells = <2>;
            big-endian;
            reg = <1 0x00000000 0x2>;
            reg-names = "dat";
            intel,ixp4xx-eb-write-enable = <1>;
        };
    };
+75 −5
Original line number Diff line number Diff line
@@ -18,9 +18,13 @@ description: |

properties:
  compatible:
    enum:
    items:
      - enum:
          - fsl,imx23-pinctrl
          - fsl,imx28-pinctrl
      # Over 10 years old devices, driver use simple-bus to probe child gpio
      # Devices. Keep it as it to be compatible existed dts files.
      - const: simple-bus

  '#address-cells':
    const: 1
@@ -31,7 +35,65 @@ properties:
    maxItems: 1

patternProperties:
  "gpio@[0-9]+$":
  "^(?!gpio@)[^@]+@[0-9]+$":
    type: object
    properties:
      fsl,pinmux-ids:
        $ref: /schemas/types.yaml#/definitions/uint32-array
        description: |
          An integer array.  Each integer in the array specify a pin
          with given mux function, with bank, pin and mux packed as below.

          [15..12] : bank number
          [11..4]  : pin number
          [3..0]   : mux selection

          This integer with mux selection packed is used as an entity by both group
          and config nodes to identify a pin.  The mux selection in the integer takes
          effects only on group node, and will get ignored by driver with config node,
          since config node is only meant to set up pin configurations.

          Valid values for these integers are listed below.

      reg:
        items:
          - description: |
              pin group index. NOTE: it is supposed wrong use reg property
              here. But it is over 10 years devices. Just keep it as it.

      fsl,drive-strength:
        $ref: /schemas/types.yaml#/definitions/uint32
        enum: [0, 1, 2, 3]
        description: |
          0: MXS_DRIVE_4mA
          1: MXS_DRIVE_8mA
          2: MXS_DRIVE_12mA
          3: MXS_DRIVE_16mA

      fsl,voltage:
        $ref: /schemas/types.yaml#/definitions/uint32
        enum: [0, 1]
        description: |
          0: MXS_VOLTAGE_LOW  - 1.8 V
          1: MXS_VOLTAGE_HIGH - 3.3 V

      fsl,pull-up:
        $ref: /schemas/types.yaml#/definitions/uint32
        enum: [0, 1]
        description: |
          0: MXS_PULL_DISABLE - Disable the internal pull-up
          1: MXS_PULL_ENABLE  - Enable the internal pull-up

          Note that when enabling the pull-up, the internal pad keeper gets disabled.
          Also, some pins doesn't have a pull up, in that case, setting the fsl,pull-up
          will only disable the internal pad keeper.

    required:
      - fsl,pinmux-ids

    additionalProperties: false

  "^gpio@[0-9]+$":
    type: object
    properties:
      compatible:
@@ -80,7 +142,7 @@ examples:
    pinctrl@80018000 {
        #address-cells = <1>;
        #size-cells = <0>;
        compatible = "fsl,imx28-pinctrl";
        compatible = "fsl,imx28-pinctrl", "simple-bus";
        reg = <0x80018000 0x2000>;

        gpio@0 {
@@ -132,4 +194,12 @@ examples:
            interrupt-controller;
            #interrupt-cells = <2>;
        };

        lcdif-apx4@5 {
            reg = <5>;
            fsl,pinmux-ids = <0x1181 0x1191>;
            fsl,drive-strength = <0>;
            fsl,voltage = <0>;
            fsl,pull-up = <0>;
        };
    };
+27 −1
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ properties:
    oneOf:
      - enum:
          - loongson,ls2k-gpio
          - loongson,ls2k0300-gpio
          - loongson,ls2k0500-gpio0
          - loongson,ls2k0500-gpio1
          - loongson,ls2k2000-gpio0
@@ -36,7 +37,7 @@ properties:

  ngpios:
    minimum: 1
    maximum: 64
    maximum: 128

  "#gpio-cells":
    const: 2
@@ -49,6 +50,14 @@ properties:
    minItems: 1
    maxItems: 64

  "#interrupt-cells":
    const: 2

  interrupt-controller: true

  resets:
    maxItems: 1

required:
  - compatible
  - reg
@@ -58,6 +67,23 @@ required:
  - gpio-ranges
  - interrupts

allOf:
  - if:
      properties:
        compatible:
          contains:
            const: loongson,ls2k0300-gpio
    then:
      required:
        - "#interrupt-cells"
        - interrupt-controller
        - resets
    else:
      properties:
        "#interrupts-cells": false
        interrupt-controller: false
        resets: false

additionalProperties: false

examples:
+83 −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/maxim,max7360-gpio.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Maxim MAX7360 GPIO controller

maintainers:
  - Kamel Bouhara <kamel.bouhara@bootlin.com>
  - Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>

description: |
  Maxim MAX7360 GPIO controller, in MAX7360 chipset
  https://www.analog.com/en/products/max7360.html

  The device provides two series of GPIOs, referred here as GPIOs and GPOs.

  PORT0 to PORT7 pins can be used as GPIOs, with support for interrupts and
  constant-current mode. These pins will also be used by the rotary encoder and
  PWM functionalities.

  COL2 to COL7 pins can be used as GPOs, there is no input capability. COL pins
  will be partitioned, with the first pins being affected to the keypad
  functionality and the last ones as GPOs.

properties:
  compatible:
    enum:
      - maxim,max7360-gpio
      - maxim,max7360-gpo

  gpio-controller: true

  "#gpio-cells":
    const: 2

  interrupt-controller: true

  "#interrupt-cells":
    const: 2

  maxim,constant-current-disable:
    $ref: /schemas/types.yaml#/definitions/uint32
    description:
      Bit field, each bit disables constant-current output of the associated
      GPIO, starting from the least significant bit for the first GPIO.
    maximum: 0xff

required:
  - compatible
  - gpio-controller

allOf:
  - if:
      properties:
        compatible:
          contains:
            enum:
              - maxim,max7360-gpio
        ngpios: false
    then:
      required:
        - interrupt-controller
    else:
      properties:
        interrupt-controller: false
        maxim,constant-current-disable: false

additionalProperties: false

examples:
  - |
    gpio {
      compatible = "maxim,max7360-gpio";

      gpio-controller;
      #gpio-cells = <2>;
      maxim,constant-current-disable = <0x06>;

      interrupt-controller;
      #interrupt-cells = <2>;
    };
+2 −0
Original line number Diff line number Diff line
@@ -85,6 +85,7 @@ properties:
      - nvidia,tegra194-gpio-aon
      - nvidia,tegra234-gpio
      - nvidia,tegra234-gpio-aon
      - nvidia,tegra256-gpio

  reg-names:
    items:
@@ -155,6 +156,7 @@ allOf:
              - nvidia,tegra186-gpio
              - nvidia,tegra194-gpio
              - nvidia,tegra234-gpio
              - nvidia,tegra256-gpio
    then:
      properties:
        interrupts:
Loading