[PATCH 1/6] dt-binbings: mfd: Add bindings for the LTC4283 Swap Controller

Nuno Sá via B4 Relay posted 6 patches 1 month, 3 weeks ago
[PATCH 1/6] dt-binbings: mfd: Add bindings for the LTC4283 Swap Controller
Posted by Nuno Sá via B4 Relay 1 month, 3 weeks ago
From: Nuno Sá <nuno.sa@analog.com>

The LTC4283 is a negative voltage hot swap controller that drives an
external N-channel MOSFET to allow a board to be safely inserted and
removed from a live backplane.

Main usage is as an Hardware Monitoring device. However, it has up to 8
pins that can be configured and used as GPIOs and hence, the device can
also be a GPIO controller.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
---
 .../devicetree/bindings/mfd/adi,ltc4283.yaml       | 85 ++++++++++++++++++++++
 MAINTAINERS                                        |  7 ++
 2 files changed, 92 insertions(+)

diff --git a/Documentation/devicetree/bindings/mfd/adi,ltc4283.yaml b/Documentation/devicetree/bindings/mfd/adi,ltc4283.yaml
new file mode 100644
index 0000000000000000000000000000000000000000..c5e8aec887d9cfad9052a7c28783396efd6804a9
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/adi,ltc4283.yaml
@@ -0,0 +1,85 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mfd/adi,ltc4283.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: LTC4283 I2C Negative Voltage Hot Swap Controller
+
+maintainers:
+  - Nuno Sá <nuno.sa@analog.com>
+
+description: |
+  The LTC4283 negative voltage hot swap controller drives an external N-channel
+  MOSFET to allow a board to be safely inserted and removed from a live
+  backplane.
+
+  https://www.analog.com/media/en/technical-documentation/data-sheets/ltc4283.pdf
+
+properties:
+  compatible:
+    enum:
+      - adi,ltc4283
+
+  reg:
+    maxItems: 1
+
+  gpio:
+    $ref: /schemas/gpio/adi,ltc4283.yaml
+  hwmon:
+    $ref: /schemas/hwmon/adi,ltc4283.yaml
+
+  adi,gpio-pins:
+    description:
+      The pins to use as GPIOs. The device has 4 ADIO and 4 PGIO
+      pins than can be used as GPIOs. The ADIO pins are numbered from 0 to 3
+      and the PGIO pins are numbered from 4 to 7.
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+    minItems: 1
+    maxItems: 8
+    items:
+      minimum: 0
+      maximum: 7
+
+dependencies:
+  gpio:
+    - adi,gpio-pins
+
+required:
+  - compatible
+  - reg
+  - hwmon
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        swap-controller@15 {
+            compatible = "adi,ltc4283";
+            reg = <0x15>;
+
+            /* pgio1 to pgio4 as gpios */
+            adi,gpio-pins = <0 1 2 3>;
+
+            gpio {
+                compatible = "adi,ltc4283-gpio";
+                gpio-controller;
+                #gpio-cells = <2>;
+            };
+
+            hwmon {
+                compatible = "adi,ltc4283-hwmon";
+
+                adi,rsense-nano-ohms = <500>;
+                adi,current-limit-sense-microvolt = <25000>;
+                adi,current-limit-foldback-factor = <10>;
+                adi,cooling-delay-ms = <8190>;
+                adi,fet-bad-timer-delay-ms = <512>;
+            };
+        };
+    };
+...
diff --git a/MAINTAINERS b/MAINTAINERS
index e90710a9b40d7b32c151472a9ac3b02efd95f346..413bb77d5eebe2b51aa9c3af86e7cfd5ab142044 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -14500,6 +14500,13 @@ F:	Documentation/devicetree/bindings/hwmon/adi,ltc4282.yaml
 F:	Documentation/hwmon/ltc4282.rst
 F:	drivers/hwmon/ltc4282.c
 
+lTC4283 HARDWARE MONITOR AND GPIO DRIVER
+M:	Nuno Sá <nuno.sa@analog.com>
+L:	linux-hwmon@vger.kernel.org
+L:	linux-gpio@vger.kernel.org
+S:	Supported
+F:	Documentation/devicetree/bindings/mfd/adi,ltc4283.yaml
+
 LTC4286 HARDWARE MONITOR DRIVER
 M:	Delphine CC Chiu <Delphine_CC_Chiu@Wiwynn.com>
 L:	linux-hwmon@vger.kernel.org

-- 
2.50.1


Re: [PATCH 1/6] dt-binbings: mfd: Add bindings for the LTC4283 Swap Controller
Posted by Rob Herring 1 month, 2 weeks ago
On Thu, Aug 14, 2025 at 11:52:23AM +0100, Nuno Sá wrote:
> The LTC4283 is a negative voltage hot swap controller that drives an
> external N-channel MOSFET to allow a board to be safely inserted and
> removed from a live backplane.

What's a binbing?

When you fix that, don't say 'bindings' twice in the subject. Subject 
space is precious.

> 
> Main usage is as an Hardware Monitoring device. However, it has up to 8
> pins that can be configured and used as GPIOs and hence, the device can
> also be a GPIO controller.
> 
> Signed-off-by: Nuno Sá <nuno.sa@analog.com>
> ---
>  .../devicetree/bindings/mfd/adi,ltc4283.yaml       | 85 ++++++++++++++++++++++
>  MAINTAINERS                                        |  7 ++
>  2 files changed, 92 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/mfd/adi,ltc4283.yaml b/Documentation/devicetree/bindings/mfd/adi,ltc4283.yaml
> new file mode 100644
> index 0000000000000000000000000000000000000000..c5e8aec887d9cfad9052a7c28783396efd6804a9
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/adi,ltc4283.yaml
> @@ -0,0 +1,85 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/mfd/adi,ltc4283.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: LTC4283 I2C Negative Voltage Hot Swap Controller
> +
> +maintainers:
> +  - Nuno Sá <nuno.sa@analog.com>
> +
> +description: |
> +  The LTC4283 negative voltage hot swap controller drives an external N-channel
> +  MOSFET to allow a board to be safely inserted and removed from a live
> +  backplane.
> +
> +  https://www.analog.com/media/en/technical-documentation/data-sheets/ltc4283.pdf
> +
> +properties:
> +  compatible:
> +    enum:
> +      - adi,ltc4283
> +
> +  reg:
> +    maxItems: 1
> +
> +  gpio:
> +    $ref: /schemas/gpio/adi,ltc4283.yaml
> +  hwmon:
> +    $ref: /schemas/hwmon/adi,ltc4283.yaml

This patch has to come after these are added. However...

> +
> +  adi,gpio-pins:
> +    description:
> +      The pins to use as GPIOs. The device has 4 ADIO and 4 PGIO
> +      pins than can be used as GPIOs. The ADIO pins are numbered from 0 to 3
> +      and the PGIO pins are numbered from 4 to 7.
> +    $ref: /schemas/types.yaml#/definitions/uint32-array
> +    minItems: 1
> +    maxItems: 8
> +    items:
> +      minimum: 0
> +      maximum: 7
> +
> +dependencies:
> +  gpio:
> +    - adi,gpio-pins
> +
> +required:
> +  - compatible
> +  - reg
> +  - hwmon
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    i2c {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        swap-controller@15 {
> +            compatible = "adi,ltc4283";
> +            reg = <0x15>;
> +
> +            /* pgio1 to pgio4 as gpios */
> +            adi,gpio-pins = <0 1 2 3>;
> +
> +            gpio {
> +                compatible = "adi,ltc4283-gpio";
> +                gpio-controller;
> +                #gpio-cells = <2>;
> +            };
> +
> +            hwmon {
> +                compatible = "adi,ltc4283-hwmon";
> +
> +                adi,rsense-nano-ohms = <500>;

Seems like a current sense resistor might be a common thing.

> +                adi,current-limit-sense-microvolt = <25000>;
> +                adi,current-limit-foldback-factor = <10>;
> +                adi,cooling-delay-ms = <8190>;
> +                adi,fet-bad-timer-delay-ms = <512>;

All these child node properties can be moved to the parent node.

> +            };
> +        };
> +    };
> +...
> diff --git a/MAINTAINERS b/MAINTAINERS
> index e90710a9b40d7b32c151472a9ac3b02efd95f346..413bb77d5eebe2b51aa9c3af86e7cfd5ab142044 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -14500,6 +14500,13 @@ F:	Documentation/devicetree/bindings/hwmon/adi,ltc4282.yaml
>  F:	Documentation/hwmon/ltc4282.rst
>  F:	drivers/hwmon/ltc4282.c
>  
> +lTC4283 HARDWARE MONITOR AND GPIO DRIVER
> +M:	Nuno Sá <nuno.sa@analog.com>
> +L:	linux-hwmon@vger.kernel.org
> +L:	linux-gpio@vger.kernel.org
> +S:	Supported
> +F:	Documentation/devicetree/bindings/mfd/adi,ltc4283.yaml
> +
>  LTC4286 HARDWARE MONITOR DRIVER
>  M:	Delphine CC Chiu <Delphine_CC_Chiu@Wiwynn.com>
>  L:	linux-hwmon@vger.kernel.org
> 
> -- 
> 2.50.1
> 
Re: [PATCH 1/6] dt-binbings: mfd: Add bindings for the LTC4283 Swap Controller
Posted by Nuno Sá 1 month, 1 week ago
On Thu, Aug 14, 2025 at 04:57:24PM -0500, Rob Herring wrote:
> On Thu, Aug 14, 2025 at 11:52:23AM +0100, Nuno Sá wrote:
> > The LTC4283 is a negative voltage hot swap controller that drives an
> > external N-channel MOSFET to allow a board to be safely inserted and
> > removed from a live backplane.
> 
> What's a binbing?
> 
> When you fix that, don't say 'bindings' twice in the subject. Subject 
> space is precious.

oh, sure...

> 
> > 
> > Main usage is as an Hardware Monitoring device. However, it has up to 8
> > pins that can be configured and used as GPIOs and hence, the device can
> > also be a GPIO controller.
> > 
> > Signed-off-by: Nuno Sá <nuno.sa@analog.com>
> > ---
> >  .../devicetree/bindings/mfd/adi,ltc4283.yaml       | 85 ++++++++++++++++++++++
> >  MAINTAINERS                                        |  7 ++
> >  2 files changed, 92 insertions(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/mfd/adi,ltc4283.yaml b/Documentation/devicetree/bindings/mfd/adi,ltc4283.yaml
> > new file mode 100644
> > index 0000000000000000000000000000000000000000..c5e8aec887d9cfad9052a7c28783396efd6804a9
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/mfd/adi,ltc4283.yaml
> > @@ -0,0 +1,85 @@
> > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/mfd/adi,ltc4283.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: LTC4283 I2C Negative Voltage Hot Swap Controller
> > +
> > +maintainers:
> > +  - Nuno Sá <nuno.sa@analog.com>
> > +
> > +description: |
> > +  The LTC4283 negative voltage hot swap controller drives an external N-channel
> > +  MOSFET to allow a board to be safely inserted and removed from a live
> > +  backplane.
> > +
> > +  https://www.analog.com/media/en/technical-documentation/data-sheets/ltc4283.pdf
> > +
> > +properties:
> > +  compatible:
> > +    enum:
> > +      - adi,ltc4283
> > +
> > +  reg:
> > +    maxItems: 1
> > +
> > +  gpio:
> > +    $ref: /schemas/gpio/adi,ltc4283.yaml
> > +  hwmon:
> > +    $ref: /schemas/hwmon/adi,ltc4283.yaml
> 
> This patch has to come after these are added. However...
>

Yeah, I realized that when I got your bot build failure email.

> > +
> > +  adi,gpio-pins:
> > +    description:
> > +      The pins to use as GPIOs. The device has 4 ADIO and 4 PGIO
> > +      pins than can be used as GPIOs. The ADIO pins are numbered from 0 to 3
> > +      and the PGIO pins are numbered from 4 to 7.
> > +    $ref: /schemas/types.yaml#/definitions/uint32-array
> > +    minItems: 1
> > +    maxItems: 8
> > +    items:
> > +      minimum: 0
> > +      maximum: 7
> > +
> > +dependencies:
> > +  gpio:
> > +    - adi,gpio-pins
> > +
> > +required:
> > +  - compatible
> > +  - reg
> > +  - hwmon
> > +
> > +additionalProperties: false
> > +
> > +examples:
> > +  - |
> > +    i2c {
> > +        #address-cells = <1>;
> > +        #size-cells = <0>;
> > +
> > +        swap-controller@15 {
> > +            compatible = "adi,ltc4283";
> > +            reg = <0x15>;
> > +
> > +            /* pgio1 to pgio4 as gpios */
> > +            adi,gpio-pins = <0 1 2 3>;
> > +
> > +            gpio {
> > +                compatible = "adi,ltc4283-gpio";
> > +                gpio-controller;
> > +                #gpio-cells = <2>;
> > +            };
> > +
> > +            hwmon {
> > +                compatible = "adi,ltc4283-hwmon";
> > +
> > +                adi,rsense-nano-ohms = <500>;
> 
> Seems like a current sense resistor might be a common thing.
>

At least ltc4282 has the same property so I can add a common property if
you want me too.

> > +                adi,current-limit-sense-microvolt = <25000>;
> > +                adi,current-limit-foldback-factor = <10>;
> > +                adi,cooling-delay-ms = <8190>;
> > +                adi,fet-bad-timer-delay-ms = <512>;
> 
> All these child node properties can be moved to the parent node.
>

Hmm, if I move to the auxiliary device, this will "fix" itself but just
out of curiosity, why should it be on the parent node? These properties
only make sense for the hwmon device.

- Nuno Sá

> > +            };
> > +        };
> > +    };
> > +...
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index e90710a9b40d7b32c151472a9ac3b02efd95f346..413bb77d5eebe2b51aa9c3af86e7cfd5ab142044 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -14500,6 +14500,13 @@ F:	Documentation/devicetree/bindings/hwmon/adi,ltc4282.yaml
> >  F:	Documentation/hwmon/ltc4282.rst
> >  F:	drivers/hwmon/ltc4282.c
> >  
> > +lTC4283 HARDWARE MONITOR AND GPIO DRIVER
> > +M:	Nuno Sá <nuno.sa@analog.com>
> > +L:	linux-hwmon@vger.kernel.org
> > +L:	linux-gpio@vger.kernel.org
> > +S:	Supported
> > +F:	Documentation/devicetree/bindings/mfd/adi,ltc4283.yaml
> > +
> >  LTC4286 HARDWARE MONITOR DRIVER
> >  M:	Delphine CC Chiu <Delphine_CC_Chiu@Wiwynn.com>
> >  L:	linux-hwmon@vger.kernel.org
> > 
> > -- 
> > 2.50.1
> > 
Re: [PATCH 1/6] dt-binbings: mfd: Add bindings for the LTC4283 Swap Controller
Posted by Rob Herring (Arm) 1 month, 3 weeks ago
On Thu, 14 Aug 2025 11:52:23 +0100, Nuno Sá wrote:
> The LTC4283 is a negative voltage hot swap controller that drives an
> external N-channel MOSFET to allow a board to be safely inserted and
> removed from a live backplane.
> 
> Main usage is as an Hardware Monitoring device. However, it has up to 8
> pins that can be configured and used as GPIOs and hence, the device can
> also be a GPIO controller.
> 
> Signed-off-by: Nuno Sá <nuno.sa@analog.com>
> ---
>  .../devicetree/bindings/mfd/adi,ltc4283.yaml       | 85 ++++++++++++++++++++++
>  MAINTAINERS                                        |  7 ++
>  2 files changed, 92 insertions(+)
> 

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mfd/adi,ltc4283.yaml:
	Error in referenced schema matching $id: http://devicetree.org/schemas/gpio/adi,ltc4283.yaml
	Tried these paths (check schema $id if path is wrong):
	/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/gpio/adi,ltc4283.yaml
	/usr/local/lib/python3.13/dist-packages/dtschema/schemas/gpio/adi,ltc4283.yaml

/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mfd/adi,ltc4283.example.dtb: swap-controller@15 (adi,ltc4283): gpio: {'compatible': ['adi,ltc4283-gpio'], 'gpio-controller': True, '#gpio-cells': 2} should not be valid under {'description': "Can't find referenced schema: http://devicetree.org/schemas/gpio/adi,ltc4283.yaml#"}
	from schema $id: http://devicetree.org/schemas/mfd/adi,ltc4283.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/mfd/adi,ltc4283.example.dtb: swap-controller@15 (adi,ltc4283): hwmon: {'compatible': ['adi,ltc4283-hwmon'], 'adi,rsense-nano-ohms': [500], 'adi,current-limit-sense-microvolt': [[25000]], 'adi,current-limit-foldback-factor': [10], 'adi,cooling-delay-ms': [8190], 'adi,fet-bad-timer-delay-ms': [512]} should not be valid under {'description': "Can't find referenced schema: http://devicetree.org/schemas/hwmon/adi,ltc4283.yaml#"}
	from schema $id: http://devicetree.org/schemas/mfd/adi,ltc4283.yaml#
Documentation/devicetree/bindings/mfd/adi,ltc4283.example.dtb: /example-0/i2c/swap-controller@15/gpio: failed to match any schema with compatible: ['adi,ltc4283-gpio']
Documentation/devicetree/bindings/mfd/adi,ltc4283.example.dtb: /example-0/i2c/swap-controller@15/hwmon: failed to match any schema with compatible: ['adi,ltc4283-hwmon']

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20250814-ltc4283-support-v1-1-88b2cef773f2@analog.com

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.