[v9,1/2] dt-bindings: mfd: Add dt-schema MAX5970 and MAX5978

Message ID 20221114075739.4117439-2-Naresh.Solanki@9elements.com
State New
Headers
Series mfd: max597x: Add support for max597x |

Commit Message

Naresh Solanki Nov. 14, 2022, 7:57 a.m. UTC
  From: Marcello Sylvester Bauer <sylv@sylv.io>

The MAX597x is a hot swap controller with configurable fault protection.
It also has 10bit ADC for current & voltage measurements.

Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Signed-off-by: Marcello Sylvester Bauer <sylv@sylv.io>
Signed-off-by: Naresh Solanki <Naresh.Solanki@9elements.com>
---
 .../bindings/mfd/maxim,max5970.yaml           | 172 ++++++++++++++++++
 1 file changed, 172 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/maxim,max5970.yaml
  

Comments

Krzysztof Kozlowski Nov. 14, 2022, 8:10 a.m. UTC | #1
On 14/11/2022 08:57, Naresh Solanki wrote:
> From: Marcello Sylvester Bauer <sylv@sylv.io>

Subject: I asked to drop the redundant words, but you re-added now in
different form. So again, drop "dt-schema".

> 
> The MAX597x is a hot swap controller with configurable fault protection.
> It also has 10bit ADC for current & voltage measurements.
> 
> Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
> Signed-off-by: Marcello Sylvester Bauer <sylv@sylv.io>
> Signed-off-by: Naresh Solanki <Naresh.Solanki@9elements.com>
> ---
>  .../bindings/mfd/maxim,max5970.yaml           | 172 ++++++++++++++++++
>  1 file changed, 172 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/mfd/maxim,max5970.yaml
> 
> diff --git a/Documentation/devicetree/bindings/mfd/maxim,max5970.yaml b/Documentation/devicetree/bindings/mfd/maxim,max5970.yaml
> new file mode 100644
> index 000000000000..a93b6e009b9a
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/maxim,max5970.yaml
> @@ -0,0 +1,172 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/mfd/maxim,max5970.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Regulator for MAX5970 smart switch from Maxim Integrated.
> +
> +maintainers:
> +  - Patrick Rudolph <patrick.rudolph@9elements.com>
> +
> +description: |
> +  The smart switch provides no output regulation, but independent fault protection
> +  and voltage and current sensing.
> +  Programming is done through I2C bus.
> +
> +  Datasheets:
> +    https://datasheets.maximintegrated.com/en/ds/MAX5970.pdf
> +    https://datasheets.maximintegrated.com/en/ds/MAX5978.pdf
> +
> +properties:
> +  compatible:
> +    enum:
> +      - maxim,max5970
> +      - maxim,max5978
> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  leds:
> +    type: object
> +    description:
> +      Properties for four LEDS.
> +
> +    properties:
> +      "#address-cells":
> +        const: 1
> +
> +      "#size-cells":
> +        const: 0
> +
> +    patternProperties:
> +      "^led@[0-3]$":
> +        $ref: /schemas/leds/common.yaml#
> +        type: object
> +
> +    additionalProperties: false
> +
> +  vss1-supply:
> +    description: Supply of the first channel.
> +
> +  vss2-supply:
> +    description: Supply of the second channel.
> +
> +  "#io-channel-cells":
> +    const: 1
> +
> +  regulators:
> +    type: object
> +    description:
> +      Properties for regulator.

That's not correct description. This is not one regulator.

> +
> +    patternProperties:
> +      "^sw[0-1]$":
> +        $ref: /schemas/regulator/regulator.yaml#
> +        type: object

unevaluatedProperties: false

> +        properties:
> +          shunt-resistor-micro-ohms:
> +            description: |
> +              The value of curent sense resistor in microohms.

Typo: current

> +
> +        required:
> +          - shunt-resistor-micro-ohms
> +
> +    additionalProperties: false
> +
> +required:
> +  - compatible
> +  - reg
> +  - regulators
> +  - vss1-supply
> +
> +allOf:
> +  - if:
> +      properties:
> +        compatible:
> +          enum:
> +            - maxim,max5970
> +    then:
> +      properties:
> +        io-channels:
> +          items:
> +            - description: voltage first channel
> +            - description: current first channel
> +            - description: voltage second channel
> +            - description: current second channel
> +          description: |
> +            Voltage and current for first and second channel.
> +      required:
> +        - vss2-supply

This is a friendly reminder during the review process.

It seems my previous comments were not fully addressed. Maybe my
feedback got lost between the quotes, maybe you just forgot to apply it.
Please go back to the previous discussion and either implement all
requested changes or keep discussing them.

Comment was:
"Also, add it in the existing example."

> +    else:
> +      properties:
> +        io-channels:
> +          items:
> +            - description: voltage first channel
> +            - description: current first channel
> +          description: |
> +            Voltage and current for first channel.
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    i2c {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +        regulator@3a {
> +           compatible = "maxim,max5978";
> +           reg = <0x3a>;
> +           vss1-supply = <&p3v3>;
> +
> +           regulators {
> +               sw0_ref_0: sw0 {
> +                      regulator-compatible = "SW0";

Use 4 spaces for example indentation.

> +                      shunt-resistor-micro-ohms = <12000>;
> +               };
> +           };
> +
> +           leds {
> +               #address-cells = <1>;
> +               #size-cells = <0>;
> +               led@0 {
> +                   reg = <0>;
> +                   label = "led0";
> +                   default-state = "on";
> +               };
> +               led@1 {
> +                   reg = <1>;
> +                   label = "led1";
> +                   default-state = "on";
> +               };
> +           };
> +        };
> +    };
> +
> +  - |
> +    i2c {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        regulator@3a {
> +            compatible = "maxim,max5970";
> +            reg = <0x3a>;
> +            vss1-supply = <&p3v3>;
> +            vss2-supply = <&p5v>;
> +
> +            regulators {
> +                sw0_ref_1: sw0 {
> +                    regulator-compatible = "SW0";
> +                    shunt-resistor-micro-ohms = <12000>;
> +                };
> +                sw1_ref_1: sw1 {
> +                    regulator-compatible = "SW1";
> +                    shunt-resistor-micro-ohms = <10000>;
> +                };
> +            };
> +        };
> +    };
> +...

Best regards,
Krzysztof
  
Naresh Solanki Nov. 14, 2022, 5:58 p.m. UTC | #2
Hi Krzysztof,

On 14-11-2022 01:40 pm, Krzysztof Kozlowski wrote:
> On 14/11/2022 08:57, Naresh Solanki wrote:
>> From: Marcello Sylvester Bauer <sylv@sylv.io>
> 
> Subject: I asked to drop the redundant words, but you re-added now in
> different form. So again, drop "dt-schema".
Sure
> 
>>
>> The MAX597x is a hot swap controller with configurable fault protection.
>> It also has 10bit ADC for current & voltage measurements.
>>
>> Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
>> Signed-off-by: Marcello Sylvester Bauer <sylv@sylv.io>
>> Signed-off-by: Naresh Solanki <Naresh.Solanki@9elements.com>
>> ---
>>   .../bindings/mfd/maxim,max5970.yaml           | 172 ++++++++++++++++++
>>   1 file changed, 172 insertions(+)
>>   create mode 100644 Documentation/devicetree/bindings/mfd/maxim,max5970.yaml
>>
>> diff --git a/Documentation/devicetree/bindings/mfd/maxim,max5970.yaml b/Documentation/devicetree/bindings/mfd/maxim,max5970.yaml
>> new file mode 100644
>> index 000000000000..a93b6e009b9a
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/mfd/maxim,max5970.yaml
>> @@ -0,0 +1,172 @@
>> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/mfd/maxim,max5970.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Regulator for MAX5970 smart switch from Maxim Integrated.
>> +
>> +maintainers:
>> +  - Patrick Rudolph <patrick.rudolph@9elements.com>
>> +
>> +description: |
>> +  The smart switch provides no output regulation, but independent fault protection
>> +  and voltage and current sensing.
>> +  Programming is done through I2C bus.
>> +
>> +  Datasheets:
>> +    https://datasheets.maximintegrated.com/en/ds/MAX5970.pdf
>> +    https://datasheets.maximintegrated.com/en/ds/MAX5978.pdf
>> +
>> +properties:
>> +  compatible:
>> +    enum:
>> +      - maxim,max5970
>> +      - maxim,max5978
>> +
>> +  reg:
>> +    maxItems: 1
>> +
>> +  interrupts:
>> +    maxItems: 1
>> +
>> +  leds:
>> +    type: object
>> +    description:
>> +      Properties for four LEDS.
>> +
>> +    properties:
>> +      "#address-cells":
>> +        const: 1
>> +
>> +      "#size-cells":
>> +        const: 0
>> +
>> +    patternProperties:
>> +      "^led@[0-3]$":
>> +        $ref: /schemas/leds/common.yaml#
>> +        type: object
>> +
>> +    additionalProperties: false
>> +
>> +  vss1-supply:
>> +    description: Supply of the first channel.
>> +
>> +  vss2-supply:
>> +    description: Supply of the second channel.
>> +
>> +  "#io-channel-cells":
>> +    const: 1
>> +
>> +  regulators:
>> +    type: object
>> +    description:
>> +      Properties for regulator.
> 
> That's not correct description. This is not one regulator.
Sure. Will add description something like:
Properties for both regulators. Also specify value for shunt resistor 
used for current sense.
> 
>> +
>> +    patternProperties:
>> +      "^sw[0-1]$":
>> +        $ref: /schemas/regulator/regulator.yaml#
>> +        type: object
> 
> unevaluatedProperties: false
Sure will add this.
> 
>> +        properties:
>> +          shunt-resistor-micro-ohms:
>> +            description: |
>> +              The value of curent sense resistor in microohms.
> 
> Typo: current
Sure. will fix this.
> 
>> +
>> +        required:
>> +          - shunt-resistor-micro-ohms
>> +
>> +    additionalProperties: false
>> +
>> +required:
>> +  - compatible
>> +  - reg
>> +  - regulators
>> +  - vss1-supply
>> +
>> +allOf:
>> +  - if:
>> +      properties:
>> +        compatible:
>> +          enum:
>> +            - maxim,max5970
>> +    then:
>> +      properties:
>> +        io-channels:
>> +          items:
>> +            - description: voltage first channel
>> +            - description: current first channel
>> +            - description: voltage second channel
>> +            - description: current second channel
>> +          description: |
>> +            Voltage and current for first and second channel.
>> +      required:
>> +        - vss2-supply
> 
> This is a friendly reminder during the review process.
> 
> It seems my previous comments were not fully addressed. Maybe my
> feedback got lost between the quotes, maybe you just forgot to apply it.
> Please go back to the previous discussion and either implement all
> requested changes or keep discussing them.
> 
> Comment was:
> "Also, add it in the existing example."
This property isn't used. hence will remove in next version.
> 
>> +    else:
>> +      properties:
>> +        io-channels:
>> +          items:
>> +            - description: voltage first channel
>> +            - description: current first channel
>> +          description: |
>> +            Voltage and current for first channel.
>> +
>> +additionalProperties: false
>> +
>> +examples:
>> +  - |
>> +    i2c {
>> +        #address-cells = <1>;
>> +        #size-cells = <0>;
>> +        regulator@3a {
>> +           compatible = "maxim,max5978";
>> +           reg = <0x3a>;
>> +           vss1-supply = <&p3v3>;
>> +
>> +           regulators {
>> +               sw0_ref_0: sw0 {
>> +                      regulator-compatible = "SW0";
> 
> Use 4 spaces for example indentation.
Yeah. some place have 3 spaces instead. Will fix in next version for sure.
> 
>> +                      shunt-resistor-micro-ohms = <12000>;
>> +               };
>> +           };
>> +
>> +           leds {
>> +               #address-cells = <1>;
>> +               #size-cells = <0>;
>> +               led@0 {
>> +                   reg = <0>;
>> +                   label = "led0";
>> +                   default-state = "on";
>> +               };
>> +               led@1 {
>> +                   reg = <1>;
>> +                   label = "led1";
>> +                   default-state = "on";
>> +               };
>> +           };
>> +        };
>> +    };
>> +
>> +  - |
>> +    i2c {
>> +        #address-cells = <1>;
>> +        #size-cells = <0>;
>> +
>> +        regulator@3a {
>> +            compatible = "maxim,max5970";
>> +            reg = <0x3a>;
>> +            vss1-supply = <&p3v3>;
>> +            vss2-supply = <&p5v>;
>> +
>> +            regulators {
>> +                sw0_ref_1: sw0 {
>> +                    regulator-compatible = "SW0";
>> +                    shunt-resistor-micro-ohms = <12000>;
>> +                };
>> +                sw1_ref_1: sw1 {
>> +                    regulator-compatible = "SW1";
>> +                    shunt-resistor-micro-ohms = <10000>;
>> +                };
>> +            };
>> +        };
>> +    };
>> +...
> 
> Best regards,
> Krzysztof
> 

Regards,
Naresh
  

Patch

diff --git a/Documentation/devicetree/bindings/mfd/maxim,max5970.yaml b/Documentation/devicetree/bindings/mfd/maxim,max5970.yaml
new file mode 100644
index 000000000000..a93b6e009b9a
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/maxim,max5970.yaml
@@ -0,0 +1,172 @@ 
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mfd/maxim,max5970.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Regulator for MAX5970 smart switch from Maxim Integrated.
+
+maintainers:
+  - Patrick Rudolph <patrick.rudolph@9elements.com>
+
+description: |
+  The smart switch provides no output regulation, but independent fault protection
+  and voltage and current sensing.
+  Programming is done through I2C bus.
+
+  Datasheets:
+    https://datasheets.maximintegrated.com/en/ds/MAX5970.pdf
+    https://datasheets.maximintegrated.com/en/ds/MAX5978.pdf
+
+properties:
+  compatible:
+    enum:
+      - maxim,max5970
+      - maxim,max5978
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  leds:
+    type: object
+    description:
+      Properties for four LEDS.
+
+    properties:
+      "#address-cells":
+        const: 1
+
+      "#size-cells":
+        const: 0
+
+    patternProperties:
+      "^led@[0-3]$":
+        $ref: /schemas/leds/common.yaml#
+        type: object
+
+    additionalProperties: false
+
+  vss1-supply:
+    description: Supply of the first channel.
+
+  vss2-supply:
+    description: Supply of the second channel.
+
+  "#io-channel-cells":
+    const: 1
+
+  regulators:
+    type: object
+    description:
+      Properties for regulator.
+
+    patternProperties:
+      "^sw[0-1]$":
+        $ref: /schemas/regulator/regulator.yaml#
+        type: object
+        properties:
+          shunt-resistor-micro-ohms:
+            description: |
+              The value of curent sense resistor in microohms.
+
+        required:
+          - shunt-resistor-micro-ohms
+
+    additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - regulators
+  - vss1-supply
+
+allOf:
+  - if:
+      properties:
+        compatible:
+          enum:
+            - maxim,max5970
+    then:
+      properties:
+        io-channels:
+          items:
+            - description: voltage first channel
+            - description: current first channel
+            - description: voltage second channel
+            - description: current second channel
+          description: |
+            Voltage and current for first and second channel.
+      required:
+        - vss2-supply
+    else:
+      properties:
+        io-channels:
+          items:
+            - description: voltage first channel
+            - description: current first channel
+          description: |
+            Voltage and current for first channel.
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+        regulator@3a {
+           compatible = "maxim,max5978";
+           reg = <0x3a>;
+           vss1-supply = <&p3v3>;
+
+           regulators {
+               sw0_ref_0: sw0 {
+                      regulator-compatible = "SW0";
+                      shunt-resistor-micro-ohms = <12000>;
+               };
+           };
+
+           leds {
+               #address-cells = <1>;
+               #size-cells = <0>;
+               led@0 {
+                   reg = <0>;
+                   label = "led0";
+                   default-state = "on";
+               };
+               led@1 {
+                   reg = <1>;
+                   label = "led1";
+                   default-state = "on";
+               };
+           };
+        };
+    };
+
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        regulator@3a {
+            compatible = "maxim,max5970";
+            reg = <0x3a>;
+            vss1-supply = <&p3v3>;
+            vss2-supply = <&p5v>;
+
+            regulators {
+                sw0_ref_1: sw0 {
+                    regulator-compatible = "SW0";
+                    shunt-resistor-micro-ohms = <12000>;
+                };
+                sw1_ref_1: sw1 {
+                    regulator-compatible = "SW1";
+                    shunt-resistor-micro-ohms = <10000>;
+                };
+            };
+        };
+    };
+...