diff mbox series

[2/8] dt-bindings: Add MAX7360 subdevices

Message ID 20241219-mdb-max7360-support-v1-2-8e8317584121@bootlin.com
State New
Headers show
Series Add support for MAX7360 multifunction device | expand

Commit Message

Mathieu Dubois-Briand Dec. 19, 2024, 4:21 p.m. UTC
Add device tree bindings for Maxim Integrated MAX7360 MFD functions:
keypad, rotary, gpios and pwm.

Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
---
 .../devicetree/bindings/gpio/max7360-gpio.yaml     | 96 ++++++++++++++++++++++
 .../devicetree/bindings/input/max7360-keypad.yaml  | 67 +++++++++++++++
 .../devicetree/bindings/input/max7360-rotary.yaml  | 52 ++++++++++++
 .../devicetree/bindings/pwm/max7360-pwm.yaml       | 35 ++++++++
 4 files changed, 250 insertions(+)

Comments

Krzysztof Kozlowski Dec. 21, 2024, 8:34 p.m. UTC | #1
On 19/12/2024 17:21, Mathieu Dubois-Briand wrote:
> ---
>  .../devicetree/bindings/gpio/max7360-gpio.yaml     | 96 ++++++++++++++++++++++
>  .../devicetree/bindings/input/max7360-keypad.yaml  | 67 +++++++++++++++
>  .../devicetree/bindings/input/max7360-rotary.yaml  | 52 ++++++++++++
>  .../devicetree/bindings/pwm/max7360-pwm.yaml       | 35 ++++++++
>  4 files changed, 250 insertions(+)


I don't understand how this patchset was split. MFD binding cannot be
empty and cannot be before child devices.

All filenames are wrong here: use compatibles.


> 
> diff --git a/Documentation/devicetree/bindings/gpio/max7360-gpio.yaml b/Documentation/devicetree/bindings/gpio/max7360-gpio.yaml
> new file mode 100644
> index 000000000000..3c006dc0380b
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/gpio/max7360-gpio.yaml
> @@ -0,0 +1,96 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/gpio/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 MFD
> +  https://www.analog.com/en/products/max7360.html
> +
> +properties:
> +  compatible:
> +    enum:
> +      - maxim,max7360-gpio
> +      - maxim,max7360-gpo

Why? What are the differences?

> +
> +  gpio-controller: true
> +
> +  "#gpio-cells":
> +    const: 2
> +
> +  ngpios:
> +    minimum: 0
> +    maximum: 8

Why this is flexible?

> +
> +  interrupt-controller: true
> +
> +  "#interrupt-cells":
> +    const: 2
> +
> +  interrupts:
> +    description: The interrupt line the device is connected to.

Drop

> +    maxItems: 1
> +
> +  constant-current-disable:

You always need vendor prefix.

> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    description: Bit field, each bit disables constant-current output of the
> +                 associated GPIO.

Oddly aligned.

Missing constraints.

> +
> +
> +required:
> +  - compatible
> +  - gpio-controller
> +  - ngpios
> +
> +if:
> +  properties:
> +    compatible:
> +      contains:
> +        enum:
> +          - maxim,max7360-gpio
> +then:
> +  required:
> +    - interrupt-controller
> +    - interrupts
> +else:
> +  properties:
> +    interrupt-controller: false
> +    interrupts: false
> +    constant-current-disable: false
> +
> +    ngpios:
> +      maximum: 6
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> +
> +    max7360_gpo: max7360_gpo {

Plaese follow DTS coding style.

Keep only one, complete example.

> +            compatible = "maxim,max7360-gpo";
> +            gpio-controller;
> +            #gpio-cells = <0x2>;
> +            ngpios = <4>;

Odd indentation. Your MFD patch had very different one.

> +    };
> +
> +    max7360_gpio: max7360_gpio {
> +            compatible = "maxim,max7360-gpio";
> +
> +            gpio-controller;
> +            #gpio-cells = <0x2>;
> +            ngpios = <8>;
> +            constant-current-disable = <0x06>;
> +
> +            interrupt-controller;
> +            #interrupt-cells = <0x2>;
> +            interrupt-parent = <&gpio1>;
> +            interrupts = <23 IRQ_TYPE_LEVEL_LOW>;
> +    };
> diff --git a/Documentation/devicetree/bindings/input/max7360-keypad.yaml b/Documentation/devicetree/bindings/input/max7360-keypad.yaml
> new file mode 100644
> index 000000000000..8bc3c841465b
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/max7360-keypad.yaml
> @@ -0,0 +1,67 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/input/max7360-keypad.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Maxim MAX7360 Keypad Controller
> +
> +maintainers:
> +  - Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
> +
> +description: |
> +  Maxim MAX7360 Keypad Controller, in MAX7360 MFD
> +  https://www.analog.com/en/products/max7360.html
> +
> +allOf:
> +  - $ref: matrix-keymap.yaml#
> +  - $ref: input.yaml#
> +
> +properties:
> +  compatible:
> +    enum:
> +      - maxim,max7360-keypad
> +
> +  interrupts:
> +    description: The interrupt line the device is connected to.


Really? Each separate device has its own interrupt line? How is it
possible if diagram here:
https://www.analog.com/en/products/max7360.html

has only one interrupt?

Fold the binding into the parent node.


> +    maxItems: 1
> +
> +  debounce-delay-ms:
> +    description: Debounce delay in ms
> +    minimum: 9
> +    maximum: 40
> +    default: 9
> +
> +  linux,input-no-autorepeat:
> +    description: If present, the keys will not autorepeat when pressed
> +
> +required:
> +  - compatible
> +  - interrupts
> +  - linux,keymap
> +
> +unevaluatedProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/interrupt-controller/arm-gic.h>
> +    #include <dt-bindings/input/input.h>
> +
> +    max7360_keypad {

Node names should be generic. See also an explanation and list of
examples (not exhaustive) in DT specification:
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation


Please read and follow DTS coding style.

> +      compatible = "maxim,max7360-keypad";
> +
> +      keypad,num-rows = <8>;
> +      keypad,num-columns = <4>;
> +
> +      linux,keymap = <
> +        MATRIX_KEY(0x00, 0x00, KEY_F5)
> +        MATRIX_KEY(0x01, 0x00, KEY_F4)
> +        MATRIX_KEY(0x02, 0x01, KEY_F6)
> +        >;
> +
> +      interrupt-parent = <&gpio1>;
> +      interrupts = <23 IRQ_TYPE_LEVEL_LOW>;
> +
> +      debounce-delay-ms = <10>;
> +      linux,input-no-autorepeat;
> +    };
> diff --git a/Documentation/devicetree/bindings/input/max7360-rotary.yaml b/Documentation/devicetree/bindings/input/max7360-rotary.yaml
> new file mode 100644
> index 000000000000..19afa8344249
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/input/max7360-rotary.yaml
> @@ -0,0 +1,52 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/input/max7360-rotary.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Maxim MAX7360 Rotary Encoder
> +
> +maintainers:
> +  - Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
> +
> +description: |
> +  Maxim MAX7360 Rotary Encoder, in MAX7360 MFD
> +  https://www.analog.com/en/products/max7360.html
> +
> +properties:
> +  compatible:
> +    enum:
> +      - maxim,max7360-rotary
> +
> +  interrupts:
> +    description: The interrupt line the device is connected to.
> +    maxItems: 1
> +
> +  debounce-delay-ms:
> +    description: Debounce delay in ms
> +    minimum: 0
> +    maximum: 15
> +    default: 0
> +
> +  linux,axis:
> +    description: The input subsystem axis to map to this rotary encoder.
> +

Fold into parent node.

> +description: |
> +  Maxim MAX7360 PWM controller, in MAX7360 MFD
> +  https://www.analog.com/en/products/max7360.html
> +
> +properties:
> +  compatible:
> +    enum:
> +      - maxim,max7360-pwm
> +
> +  "#pwm-cells":
> +    const: 2
> +
> +


Fold into parent.



Best regards,
Krzysztof
Mathieu Dubois-Briand Dec. 23, 2024, 3:20 p.m. UTC | #2
On Sat Dec 21, 2024 at 9:34 PM CET, Krzysztof Kozlowski wrote:
> On 19/12/2024 17:21, Mathieu Dubois-Briand wrote:
> > ---
> >  .../devicetree/bindings/gpio/max7360-gpio.yaml     | 96 ++++++++++++++++++++++
> >  .../devicetree/bindings/input/max7360-keypad.yaml  | 67 +++++++++++++++
> >  .../devicetree/bindings/input/max7360-rotary.yaml  | 52 ++++++++++++
> >  .../devicetree/bindings/pwm/max7360-pwm.yaml       | 35 ++++++++
> >  4 files changed, 250 insertions(+)
>
>
> I don't understand how this patchset was split. MFD binding cannot be
> empty and cannot be before child devices.
>

Ok, my bad. So I believe squashing both dt-bindings commit should fix
this.

> > diff --git a/Documentation/devicetree/bindings/gpio/max7360-gpio.yaml b/Documentation/devicetree/bindings/gpio/max7360-gpio.yaml
> > new file mode 100644
> > index 000000000000..3c006dc0380b
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/gpio/max7360-gpio.yaml
> > @@ -0,0 +1,96 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/gpio/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 MFD
> > +  https://www.analog.com/en/products/max7360.html
> > +
> > +properties:
> > +  compatible:
> > +    enum:
> > +      - maxim,max7360-gpio
> > +      - maxim,max7360-gpo
>
> Why? What are the differences?
>

Ok, so maybe my approach here is completely wrong. I'm not sure what
would be the best way to describe the device here, if you have any
suggestion I would be happy to use it. Let me try to summarize the GPIO
setup of the chip.

First we have two series of GPIOs on the chips, which I tend to think
about as two separate "banks". Thus two separate subnodes of the max7360
node.

- On one side we have what I refer to as GPIOs, here with
  maxim,max7360-gpio:
  - PORT0 to PORT7 pins of the chip.
  - Shared with PWM and rotary encoder functionalities. Functionality
    selection can be made independently for each pin. This selection is
    not described here. Runtime will have to ensure the same pin is not
    used by two drivers at the same time. E.g. we cannot have at the
    same time GPIO4 and PWM4.
  - Supports input and interrupts.
  - Outputs may be configured as constant current.
  - 8 GPIOS supported, so ngpios maximum is 8. Thinking about it now, we
    should probably also set minimum to 8, I don't see any reason to
    have ngpios set to something less.

On the other side, we have what I refer to as GPOs, here with
maxim,max7360-gpo compatible:
  - COL2 to COL7 pins of the chip.
  - Shared with the keypad functionality. Selections is made by
    partitioning the pins: first pins for keypad columns, last pins for
    GPOs. Partition is described here by ngpios and on keypad node by
    keypad,num-columns. Runtime will have to ensure values are coherent
    and configure the chip accordingly.
  - Only support outputs.
  - No support for constant current mode.
  - Supports 0 to 6 GPOs, so ngpios maximum is 6.

> > +
> > +  gpio-controller: true
> > +
> > +  "#gpio-cells":
> > +    const: 2
> > +
> > +  ngpios:
> > +    minimum: 0
> > +    maximum: 8
>
> Why this is flexible?
>

I believe this makes sense, as this keypad/gpos partition really changes
the actual number of GPIOS. Yet we could argue that this is just runtime
configuration. Tell me what you think about it, if you think this should
be a fixed value, I will find a way.

>
> Best regards,
> Krzysztof

Thanks a lot for your review. I am preparing a new version of this
series that should address all of your other comments.
Krzysztof Kozlowski Dec. 24, 2024, 9 a.m. UTC | #3
On 23/12/2024 16:20, Mathieu Dubois-Briand wrote:
> On Sat Dec 21, 2024 at 9:34 PM CET, Krzysztof Kozlowski wrote:
>> On 19/12/2024 17:21, Mathieu Dubois-Briand wrote:
>>> ---
>>>  .../devicetree/bindings/gpio/max7360-gpio.yaml     | 96 ++++++++++++++++++++++
>>>  .../devicetree/bindings/input/max7360-keypad.yaml  | 67 +++++++++++++++
>>>  .../devicetree/bindings/input/max7360-rotary.yaml  | 52 ++++++++++++
>>>  .../devicetree/bindings/pwm/max7360-pwm.yaml       | 35 ++++++++
>>>  4 files changed, 250 insertions(+)
>>
>>
>> I don't understand how this patchset was split. MFD binding cannot be
>> empty and cannot be before child devices.
>>
> 
> Ok, my bad. So I believe squashing both dt-bindings commit should fix
> this.
> 
>>> diff --git a/Documentation/devicetree/bindings/gpio/max7360-gpio.yaml b/Documentation/devicetree/bindings/gpio/max7360-gpio.yaml
>>> new file mode 100644
>>> index 000000000000..3c006dc0380b
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/gpio/max7360-gpio.yaml
>>> @@ -0,0 +1,96 @@
>>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>>> +%YAML 1.2
>>> +---
>>> +$id: http://devicetree.org/schemas/gpio/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 MFD
>>> +  https://www.analog.com/en/products/max7360.html
>>> +
>>> +properties:
>>> +  compatible:
>>> +    enum:
>>> +      - maxim,max7360-gpio
>>> +      - maxim,max7360-gpo
>>
>> Why? What are the differences?
>>
> 
> Ok, so maybe my approach here is completely wrong. I'm not sure what
> would be the best way to describe the device here, if you have any
> suggestion I would be happy to use it. Let me try to summarize the GPIO
> setup of the chip.
> 
> First we have two series of GPIOs on the chips, which I tend to think
> about as two separate "banks". Thus two separate subnodes of the max7360
> node.

First, splitting MFD device into multiple children is pretty often wrong
approach because it tries to mimic Linux driver design.

Such split in DT makes sense if these are really separate blocks, e.g.
separate I2C addresses, re-usable on different designs.

In this case Functional Block Diagram shows separate blocks, but still
the same I2C block. This can be one device. This can be also two devices
if that's easier to represent in DT.

But in any case binding description should explain this.

> 
> - On one side we have what I refer to as GPIOs, here with
>   maxim,max7360-gpio:
>   - PORT0 to PORT7 pins of the chip.
>   - Shared with PWM and rotary encoder functionalities. Functionality
>     selection can be made independently for each pin. This selection is
>     not described here. Runtime will have to ensure the same pin is not
>     used by two drivers at the same time. E.g. we cannot have at the
>     same time GPIO4 and PWM4.
>   - Supports input and interrupts.
>   - Outputs may be configured as constant current.
>   - 8 GPIOS supported, so ngpios maximum is 8. Thinking about it now, we
>     should probably also set minimum to 8, I don't see any reason to
>     have ngpios set to something less.
> 
> On the other side, we have what I refer to as GPOs, here with
> maxim,max7360-gpo compatible:
>   - COL2 to COL7 pins of the chip.
>   - Shared with the keypad functionality. Selections is made by
>     partitioning the pins: first pins for keypad columns, last pins for
>     GPOs. Partition is described here by ngpios and on keypad node by
>     keypad,num-columns. Runtime will have to ensure values are coherent
>     and configure the chip accordingly.
>   - Only support outputs.
>   - No support for constant current mode.
>   - Supports 0 to 6 GPOs, so ngpios maximum is 6.
> 
>>> +
>>> +  gpio-controller: true
>>> +
>>> +  "#gpio-cells":
>>> +    const: 2
>>> +
>>> +  ngpios:
>>> +    minimum: 0
>>> +    maximum: 8
>>
>> Why this is flexible?
>>
> 
> I believe this makes sense, as this keypad/gpos partition really changes
> the actual number of GPIOS. Yet we could argue that this is just runtime
> configuration. Tell me what you think about it, if you think this should
> be a fixed value, I will find a way.

Depends whether this is actual runtime configuration. If you configure
keypad in DT, then the pins go away from GPIOs (especially considering
that board might have these pins really connected to keypad). Anyway,
explain this briefly in binding description.

> 
Best regards,
Krzysztof
Mathieu Dubois-Briand Dec. 24, 2024, 12:10 p.m. UTC | #4
On Tue Dec 24, 2024 at 10:00 AM CET, Krzysztof Kozlowski wrote:
> On 23/12/2024 16:20, Mathieu Dubois-Briand wrote:
> > On Sat Dec 21, 2024 at 9:34 PM CET, Krzysztof Kozlowski wrote:
> >> On 19/12/2024 17:21, Mathieu Dubois-Briand wrote:
> >>> ---
> >>> diff --git a/Documentation/devicetree/bindings/gpio/max7360-gpio.yaml b/Documentation/devicetree/bindings/gpio/max7360-gpio.yaml
> >>> new file mode 100644
> >>> index 000000000000..3c006dc0380b
> >>> --- /dev/null
> >>> +++ b/Documentation/devicetree/bindings/gpio/max7360-gpio.yaml
> >>> @@ -0,0 +1,96 @@
> >>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> >>> +%YAML 1.2
> >>> +---
> >>> +$id: http://devicetree.org/schemas/gpio/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 MFD
> >>> +  https://www.analog.com/en/products/max7360.html
> >>> +
> >>> +properties:
> >>> +  compatible:
> >>> +    enum:
> >>> +      - maxim,max7360-gpio
> >>> +      - maxim,max7360-gpo
> >>
> >> Why? What are the differences?
> >>
> > 
> > Ok, so maybe my approach here is completely wrong. I'm not sure what
> > would be the best way to describe the device here, if you have any
> > suggestion I would be happy to use it. Let me try to summarize the GPIO
> > setup of the chip.
> > 
> > First we have two series of GPIOs on the chips, which I tend to think
> > about as two separate "banks". Thus two separate subnodes of the max7360
> > node.
>
> First, splitting MFD device into multiple children is pretty often wrong
> approach because it tries to mimic Linux driver design.
>
> Such split in DT makes sense if these are really separate blocks, e.g.
> separate I2C addresses, re-usable on different designs.
>
> In this case Functional Block Diagram shows separate blocks, but still
> the same I2C block. This can be one device. This can be also two devices
> if that's easier to represent in DT.

Ok, I get it. So I could try to remove the children, but I'm not really
sure about the way to go:
- About the two series of GPIOs, how should I represent them? In a
  continuous way, like 0-7 is gpios and 8+ is gpos? Or maybe setting
  #gpio-cells to 3 and using the added cell to select between gpios and
  gpos ?
- About the interrupt-controller: today we have a children where all
  gpios have a corresponding interrupt and another one without any
  interrupt. If I remove the children, we will have a mix of both. I
  don't think there is anything preventing to do this, but is this ok?

So I'm keeping the two children for now, but I'm open to the possibility
of removing them.

>
> But in any case binding description should explain this.
>

Ok, I will add some documentation.

> > 
> > - On one side we have what I refer to as GPIOs, here with
> >   maxim,max7360-gpio:
> >   - PORT0 to PORT7 pins of the chip.
> >   - Shared with PWM and rotary encoder functionalities. Functionality
> >     selection can be made independently for each pin. This selection is
> >     not described here. Runtime will have to ensure the same pin is not
> >     used by two drivers at the same time. E.g. we cannot have at the
> >     same time GPIO4 and PWM4.
> >   - Supports input and interrupts.
> >   - Outputs may be configured as constant current.
> >   - 8 GPIOS supported, so ngpios maximum is 8. Thinking about it now, we
> >     should probably also set minimum to 8, I don't see any reason to
> >     have ngpios set to something less.
> > 
> > On the other side, we have what I refer to as GPOs, here with
> > maxim,max7360-gpo compatible:
> >   - COL2 to COL7 pins of the chip.
> >   - Shared with the keypad functionality. Selections is made by
> >     partitioning the pins: first pins for keypad columns, last pins for
> >     GPOs. Partition is described here by ngpios and on keypad node by
> >     keypad,num-columns. Runtime will have to ensure values are coherent
> >     and configure the chip accordingly.
> >   - Only support outputs.
> >   - No support for constant current mode.
> >   - Supports 0 to 6 GPOs, so ngpios maximum is 6.
> > 
> >>> +
> >>> +  gpio-controller: true
> >>> +
> >>> +  "#gpio-cells":
> >>> +    const: 2
> >>> +
> >>> +  ngpios:
> >>> +    minimum: 0
> >>> +    maximum: 8
> >>
> >> Why this is flexible?
> >>
> > 
> > I believe this makes sense, as this keypad/gpos partition really changes
> > the actual number of GPIOS. Yet we could argue that this is just runtime
> > configuration. Tell me what you think about it, if you think this should
> > be a fixed value, I will find a way.
>
> Depends whether this is actual runtime configuration. If you configure
> keypad in DT, then the pins go away from GPIOs (especially considering
> that board might have these pins really connected to keypad). Anyway,
> explain this briefly in binding description.

Keypad is configured in DT and yes, the pins partition is a consequence
of the hardware implementation on the board. So on second thought I
believe this is cannot be a runtime configuration and should be
described in the DT.

I will add some documentation about it.

>
> > 
> Best regards,
> Krzysztof

Thanks again for your review.
Mathieu
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/gpio/max7360-gpio.yaml b/Documentation/devicetree/bindings/gpio/max7360-gpio.yaml
new file mode 100644
index 000000000000..3c006dc0380b
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/max7360-gpio.yaml
@@ -0,0 +1,96 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/gpio/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 MFD
+  https://www.analog.com/en/products/max7360.html
+
+properties:
+  compatible:
+    enum:
+      - maxim,max7360-gpio
+      - maxim,max7360-gpo
+
+  gpio-controller: true
+
+  "#gpio-cells":
+    const: 2
+
+  ngpios:
+    minimum: 0
+    maximum: 8
+
+  interrupt-controller: true
+
+  "#interrupt-cells":
+    const: 2
+
+  interrupts:
+    description: The interrupt line the device is connected to.
+    maxItems: 1
+
+  constant-current-disable:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: Bit field, each bit disables constant-current output of the
+                 associated GPIO.
+
+
+required:
+  - compatible
+  - gpio-controller
+  - ngpios
+
+if:
+  properties:
+    compatible:
+      contains:
+        enum:
+          - maxim,max7360-gpio
+then:
+  required:
+    - interrupt-controller
+    - interrupts
+else:
+  properties:
+    interrupt-controller: false
+    interrupts: false
+    constant-current-disable: false
+
+    ngpios:
+      maximum: 6
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+    max7360_gpo: max7360_gpo {
+            compatible = "maxim,max7360-gpo";
+            gpio-controller;
+            #gpio-cells = <0x2>;
+            ngpios = <4>;
+    };
+
+    max7360_gpio: max7360_gpio {
+            compatible = "maxim,max7360-gpio";
+
+            gpio-controller;
+            #gpio-cells = <0x2>;
+            ngpios = <8>;
+            constant-current-disable = <0x06>;
+
+            interrupt-controller;
+            #interrupt-cells = <0x2>;
+            interrupt-parent = <&gpio1>;
+            interrupts = <23 IRQ_TYPE_LEVEL_LOW>;
+    };
diff --git a/Documentation/devicetree/bindings/input/max7360-keypad.yaml b/Documentation/devicetree/bindings/input/max7360-keypad.yaml
new file mode 100644
index 000000000000..8bc3c841465b
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/max7360-keypad.yaml
@@ -0,0 +1,67 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/input/max7360-keypad.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Maxim MAX7360 Keypad Controller
+
+maintainers:
+  - Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
+
+description: |
+  Maxim MAX7360 Keypad Controller, in MAX7360 MFD
+  https://www.analog.com/en/products/max7360.html
+
+allOf:
+  - $ref: matrix-keymap.yaml#
+  - $ref: input.yaml#
+
+properties:
+  compatible:
+    enum:
+      - maxim,max7360-keypad
+
+  interrupts:
+    description: The interrupt line the device is connected to.
+    maxItems: 1
+
+  debounce-delay-ms:
+    description: Debounce delay in ms
+    minimum: 9
+    maximum: 40
+    default: 9
+
+  linux,input-no-autorepeat:
+    description: If present, the keys will not autorepeat when pressed
+
+required:
+  - compatible
+  - interrupts
+  - linux,keymap
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+    #include <dt-bindings/input/input.h>
+
+    max7360_keypad {
+      compatible = "maxim,max7360-keypad";
+
+      keypad,num-rows = <8>;
+      keypad,num-columns = <4>;
+
+      linux,keymap = <
+        MATRIX_KEY(0x00, 0x00, KEY_F5)
+        MATRIX_KEY(0x01, 0x00, KEY_F4)
+        MATRIX_KEY(0x02, 0x01, KEY_F6)
+        >;
+
+      interrupt-parent = <&gpio1>;
+      interrupts = <23 IRQ_TYPE_LEVEL_LOW>;
+
+      debounce-delay-ms = <10>;
+      linux,input-no-autorepeat;
+    };
diff --git a/Documentation/devicetree/bindings/input/max7360-rotary.yaml b/Documentation/devicetree/bindings/input/max7360-rotary.yaml
new file mode 100644
index 000000000000..19afa8344249
--- /dev/null
+++ b/Documentation/devicetree/bindings/input/max7360-rotary.yaml
@@ -0,0 +1,52 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/input/max7360-rotary.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Maxim MAX7360 Rotary Encoder
+
+maintainers:
+  - Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
+
+description: |
+  Maxim MAX7360 Rotary Encoder, in MAX7360 MFD
+  https://www.analog.com/en/products/max7360.html
+
+properties:
+  compatible:
+    enum:
+      - maxim,max7360-rotary
+
+  interrupts:
+    description: The interrupt line the device is connected to.
+    maxItems: 1
+
+  debounce-delay-ms:
+    description: Debounce delay in ms
+    minimum: 0
+    maximum: 15
+    default: 0
+
+  linux,axis:
+    description: The input subsystem axis to map to this rotary encoder.
+
+required:
+  - compatible
+  - interrupts
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/arm-gic.h>
+
+    max7360_rotary: max7360_rotary {
+      compatible = "maxim,max7360-rotary";
+
+      debounce-delay-ms = <2>;
+      linux,axis = <0>; /* REL_X */
+
+      interrupt-parent = <&gpio1>;
+      interrupts = <23 IRQ_TYPE_LEVEL_LOW>;
+    };
diff --git a/Documentation/devicetree/bindings/pwm/max7360-pwm.yaml b/Documentation/devicetree/bindings/pwm/max7360-pwm.yaml
new file mode 100644
index 000000000000..68d48969e542
--- /dev/null
+++ b/Documentation/devicetree/bindings/pwm/max7360-pwm.yaml
@@ -0,0 +1,35 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/pwm/max7360-pwm.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Maxim MAX7360 PWM controller
+
+maintainers:
+  - Kamel Bouhara <kamel.bouhara@bootlin.com>
+
+description: |
+  Maxim MAX7360 PWM controller, in MAX7360 MFD
+  https://www.analog.com/en/products/max7360.html
+
+properties:
+  compatible:
+    enum:
+      - maxim,max7360-pwm
+
+  "#pwm-cells":
+    const: 2
+
+
+required:
+  - compatible
+
+additionalProperties: false
+
+examples:
+  - |
+    max7360_pwm: max7360_pwm {
+      compatible = "maxim,max7360-pwm";
+      #pwm-cells = <2>;
+    };