Skip to contentSkip to conversation

mfd: max597x: Add support for max597x

PATCH Superseded Naresh Solanki 3 participants 8 messages Nov 15, 2022 – Nov 16, 2022

Subsystems (2)

v10 of 12 Superseded Latest is v12 →

lore
Share & tools
lore
#0 lore raw

v10 cover mfd: max597x: Add support for max597x

max597x is multifunction device with hot swap controller, fault protection & upto four indication leds.

max5978 has single hot swap controller whereas max5970 has two hot swap controllers.

Changes in V10:
- Cleanup unused properties
- removed superfluous comments
- Update description for regulators property
- Fix typo
- Update 4 spaces indentation in example
Changes in V9:
- Update properties description
- update required property
Change in V8:
- Set additionalproperties to false
Change in V7:
- Update id
- Remove empty line
Changes in V6:
- Update missing vendor prefix
- Update indentation in example
Changes in V5:
- Fix dt schema error
Changes in V4:
- Add NULL entry for of_device_id
- Memory allocation check
Changes in V3:
- Address code review comment
Changes in V2:
- Update depends in Kconfig.

Marcello Sylvester Bauer (1):
dt-bindings: mfd: Add MAX5970 and MAX5978

Patrick Rudolph (1):
mfd: max597x: Add support for MAX5970 and MAX5978

 .../bindings/mfd/maxim,max5970.yaml           | 154 ++++++++++++++++++
 drivers/mfd/Kconfig                           |  12 ++
 drivers/mfd/Makefile                          |   1 +
 drivers/mfd/max597x.c                         |  93 +++++++++++
 include/linux/mfd/max597x.h                   | 102 ++++++++++++
 5 files changed, 362 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/maxim,max5970.yaml
 create mode 100644 drivers/mfd/max597x.c
 create mode 100644 include/linux/mfd/max597x.h

base-commit: 6b780408be034213edfb5946889882cb29f8f159

Signature · 1 line
2.37.3
#1 lore raw

PATCH v10 1/2 dt-bindings: mfd: Add MAX5970 and MAX5978

From: Marcello Sylvester Bauer <[email protected]>

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

---
 .../bindings/mfd/maxim,max5970.yaml           | 154 ++++++++++++++++++
 1 file changed, 154 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/maxim,max5970.yaml
Documentation/devicetree/bindings/mfd/maxim,max5970.yaml new file +154 -0
new file mode 100644
index 000000000000..edf0c23db4ca
@@ -0,0 +1,154 @@
+# 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 <[email protected]>
+
+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.
+
+  regulators:
+    type: object
+    description:
+      Properties for both regulators. Also set value for shunt resistor used.
+
+    patternProperties:
+      "^sw[0-1]$":
+        $ref: /schemas/regulator/regulator.yaml#
+        type: object
+        properties:
+          shunt-resistor-micro-ohms:
+            description: |
+              The value of current sense resistor in microohms.
+
+        required:
+          - shunt-resistor-micro-ohms
+
+      unevaluatedProperties: false
+
+    additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - regulators
+  - vss1-supply
+
+allOf:
+  - if:
+      properties:
+        compatible:
+          enum:
+            - maxim,max5970
+    then:
+      required:
+        - vss2-supply
+
+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>;
+                };
+            };
+        };
+    };
+...
Signature · 1 line
2.37.3
#2 lore raw

Re: [PATCH v10 1/2] dt-bindings: mfd: Add MAX5970 and MAX5978

Quoted 72 lines · Naresh Solanki

From: Marcello Sylvester Bauer <[email protected]>

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

---
 .../bindings/mfd/maxim,max5970.yaml           | 154 ++++++++++++++++++
 1 file changed, 154 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/maxim,max5970.yaml
Documentation/devicetree/bindings/mfd/maxim,max5970.yaml new file +51 -0
new file mode 100644
index 000000000000..edf0c23db4ca
@@ -0,0 +1,154 @@
+# 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 <[email protected]>
+
+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
+

Documentation/devicetree/bindings/mfd/maxim,max5970.yaml line 61

Quoted 10 lines
Documentation/devicetree/bindings/mfd/maxim,max5970.yaml new file +10 -0
+  vss1-supply:
+    description: Supply of the first channel.
+
+  vss2-supply:
+    description: Supply of the second channel.
+
+  regulators:
+    type: object
+    description:
+      Properties for both regulators. Also set value for shunt resistor used.

You should explain not the syntax, but what part of hardware this nodes represents. Therefore "Also set value" does not fit at all. Hardware sets value?

I looked at datasheets to figure it out but they do not refer to any configurable regulator, LDO nor "sw0/sw1/sw2". Therefore I have no clue what to expect here...

Quoted 4 lines
Documentation/devicetree/bindings/mfd/maxim,max5970.yaml new file +4 -0
+
+    patternProperties:
+      "^sw[0-1]$":
+        $ref: /schemas/regulator/regulator.yaml#

Documentation/devicetree/bindings/mfd/maxim,max5970.yaml line 75

Quoted 10 lines
Documentation/devicetree/bindings/mfd/maxim,max5970.yaml new file +10 -0
+        type: object
+        properties:
+          shunt-resistor-micro-ohms:
+            description: |
+              The value of current sense resistor in microohms.
+
+        required:
+          - shunt-resistor-micro-ohms
+
+      unevaluatedProperties: false

I don't think it has proper indentation. Did you test the binding?

Quoted 59 lines
Documentation/devicetree/bindings/mfd/maxim,max5970.yaml new file +59 -0
+
+    additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - regulators
+  - vss1-supply
+
+allOf:
+  - if:
+      properties:
+        compatible:
+          enum:
+            - maxim,max5970
+    then:
+      required:
+        - vss2-supply
+
+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>;

Documentation/devicetree/bindings/mfd/maxim,max5970.yaml line 144

Quoted 10 lines
Documentation/devicetree/bindings/mfd/maxim,max5970.yaml new file +10 -0
+
+        regulator@3a {
+            compatible = "maxim,max5970";
+            reg = <0x3a>;
+            vss1-supply = <&p3v3>;
+            vss2-supply = <&p5v>;
+
+            regulators {
+                sw0_ref_1: sw0 {
+                    regulator-compatible = "SW0";

This property is deprecated, isn't it? Again - did you test this?

Best regards,
Krzysztof

#3 lore raw

Re: [PATCH v10 1/2] dt-bindings: mfd: Add MAX5970 and MAX5978

Hi Krzysztof,

Quoted 79 lines · Krzysztof Kozlowski
Quoted 78 lines · Naresh Solanki

From: Marcello Sylvester Bauer <[email protected]>

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

---
  .../bindings/mfd/maxim,max5970.yaml           | 154 ++++++++++++++++++
  1 file changed, 154 insertions(+)

create mode 100644 Documentation/devicetree/bindings/mfd/maxim,max5970.yaml

Documentation/devicetree/bindings/mfd/maxim,max5970.yaml new file +57 -0
new file mode 100644
index 000000000000..edf0c23db4ca
@@ -0,0 +1,154 @@
+# 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 <[email protected]>
+
+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.
+
Quoted 8 lines

Documentation/devicetree/bindings/mfd/maxim,max5970.yaml line 61

Quoted 4 lines
Documentation/devicetree/bindings/mfd/maxim,max5970.yaml new file +4 -0
+  regulators:
+    type: object
+    description:
+      Properties for both regulators. Also set value for shunt resistor used.

You should explain not the syntax, but what part of hardware this nodes represents. Therefore "Also set value" does not fit at all. Hardware sets value?

You mean something like: Properties for power switch

Quoted 4 lines

I looked at datasheets to figure it out but they do not refer to any configurable regulator, LDO nor "sw0/sw1/sw2". Therefore I have no clue what to expect here...

Yes this is for power switch part of max5970/8

Quoted 17 lines
Quoted 5 lines
Documentation/devicetree/bindings/mfd/maxim,max5970.yaml new file +4 -0
+
+    patternProperties:
+      "^sw[0-1]$":
+        $ref: /schemas/regulator/regulator.yaml#

Documentation/devicetree/bindings/mfd/maxim,max5970.yaml line 75

Quoted 10 lines
Documentation/devicetree/bindings/mfd/maxim,max5970.yaml new file +10 -0
+        type: object
+        properties:
+          shunt-resistor-micro-ohms:
+            description: |
+              The value of current sense resistor in microohms.
+
+        required:
+          - shunt-resistor-micro-ohms
+
+      unevaluatedProperties: false

I don't think it has proper indentation. Did you test the binding?

Definitely tested the bindings before I push the patch.

Quoted 64 lines
Quoted 64 lines
Documentation/devicetree/bindings/mfd/maxim,max5970.yaml new file +63 -0
+
+    additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - regulators
+  - vss1-supply
+
+allOf:
+  - if:
+      properties:
+        compatible:
+          enum:
+            - maxim,max5970
+    then:
+      required:
+        - vss2-supply
+
+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>;
Quoted 8 lines

Documentation/devicetree/bindings/mfd/maxim,max5970.yaml line 144

Quoted 6 lines
Documentation/devicetree/bindings/mfd/maxim,max5970.yaml new file +6 -0
+            vss1-supply = <&p3v3>;
+            vss2-supply = <&p5v>;
+
+            regulators {
+                sw0_ref_1: sw0 {
+                    regulator-compatible = "SW0";

This property is deprecated, isn't it? Again - did you test this?

Yes tested.

Quoted 4 lines

Best regards,
Krzysztof

Regards,
Naresh

#4 lore raw

Re: [PATCH v10 1/2] dt-bindings: mfd: Add MAX5970 and MAX5978

Quoted 90 lines · Naresh Solanki

Hi Krzysztof,

Quoted 79 lines · Krzysztof Kozlowski
Quoted 78 lines · Naresh Solanki

From: Marcello Sylvester Bauer <[email protected]>

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

---
  .../bindings/mfd/maxim,max5970.yaml           | 154 ++++++++++++++++++
  1 file changed, 154 insertions(+)

create mode 100644 Documentation/devicetree/bindings/mfd/maxim,max5970.yaml

Documentation/devicetree/bindings/mfd/maxim,max5970.yaml new file +57 -0
new file mode 100644
index 000000000000..edf0c23db4ca
@@ -0,0 +1,154 @@
+# 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 <[email protected]>
+
+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.
+
Quoted 8 lines

Documentation/devicetree/bindings/mfd/maxim,max5970.yaml line 61

Quoted 4 lines
Documentation/devicetree/bindings/mfd/maxim,max5970.yaml new file +4 -0
+  regulators:
+    type: object
+    description:
+      Properties for both regulators. Also set value for shunt resistor used.

You should explain not the syntax, but what part of hardware this nodes represents. Therefore "Also set value" does not fit at all. Hardware sets value?

Quoted 6 lines

You mean something like: Properties for power switch

Quoted 4 lines

I looked at datasheets to figure it out but they do not refer to any configurable regulator, LDO nor "sw0/sw1/sw2". Therefore I have no clue what to expect here...

Yes this is for power switch part of max5970/8

Nothing in max5970 datasheet about "power switch". "switch" fives two results, not really related/explaining.

Bindings, your naming and explanation use terms not existing in datasheet, so it does not look like you are describing hardware.

Quoted 17 lines
Quoted 17 lines
Quoted 5 lines
Documentation/devicetree/bindings/mfd/maxim,max5970.yaml new file +4 -0
+
+    patternProperties:
+      "^sw[0-1]$":
+        $ref: /schemas/regulator/regulator.yaml#

Documentation/devicetree/bindings/mfd/maxim,max5970.yaml line 75

Quoted 10 lines
Documentation/devicetree/bindings/mfd/maxim,max5970.yaml new file +10 -0
+        type: object
+        properties:
+          shunt-resistor-micro-ohms:
+            description: |
+              The value of current sense resistor in microohms.
+
+        required:
+          - shunt-resistor-micro-ohms
+
+      unevaluatedProperties: false

I don't think it has proper indentation. Did you test the binding?

Quoted 1 line

Definitely tested the bindings before I push the patch.

Anyway it is wrong. It must be on the level of properties.

Best regards,
Krzysztof

#5 lore raw

Re: [PATCH v10 1/2] dt-bindings: mfd: Add MAX5970 and MAX5978

Hi Krzystof,

Quoted 93 lines · Krzysztof Kozlowski
Quoted 92 lines · Naresh Solanki

Hi Krzysztof,

Quoted 79 lines · Krzysztof Kozlowski
Quoted 78 lines · Naresh Solanki

From: Marcello Sylvester Bauer <[email protected]>

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

---
   .../bindings/mfd/maxim,max5970.yaml           | 154 ++++++++++++++++++
   1 file changed, 154 insertions(+)

create mode 100644 Documentation/devicetree/bindings/mfd/maxim,max5970.yaml

Documentation/devicetree/bindings/mfd/maxim,max5970.yaml new file +57 -0
new file mode 100644
index 000000000000..edf0c23db4ca
@@ -0,0 +1,154 @@
+# 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 <[email protected]>
+
+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.
+
Quoted 8 lines

Documentation/devicetree/bindings/mfd/maxim,max5970.yaml line 61

Quoted 4 lines
Documentation/devicetree/bindings/mfd/maxim,max5970.yaml new file +4 -0
+  regulators:
+    type: object
+    description:
+      Properties for both regulators. Also set value for shunt resistor used.

You should explain not the syntax, but what part of hardware this nodes represents. Therefore "Also set value" does not fit at all. Hardware sets value?

You mean something like: Properties for power switch

Quoted 1 line
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines

I looked at datasheets to figure it out but they do not refer to any configurable regulator, LDO nor "sw0/sw1/sw2". Therefore I have no clue what to expect here...

Yes this is for power switch part of max5970/8

Nothing in max5970 datasheet about "power switch". "switch" fives two results, not really related/explaining.

In datasheet the term used is hot swap controller & uses external fet. Although it gives output 1:1 i.e., doesnt steps up/down the input supply. i.e., regulator driver is used here.

Quoted 21 lines

Bindings, your naming and explanation use terms not existing in datasheet, so it does not look like you are describing hardware.

Quoted 17 lines
Quoted 17 lines
Quoted 5 lines
Documentation/devicetree/bindings/mfd/maxim,max5970.yaml new file +4 -0
+
+    patternProperties:
+      "^sw[0-1]$":
+        $ref: /schemas/regulator/regulator.yaml#

Documentation/devicetree/bindings/mfd/maxim,max5970.yaml line 75

Quoted 10 lines
Documentation/devicetree/bindings/mfd/maxim,max5970.yaml new file +10 -0
+        type: object
+        properties:
+          shunt-resistor-micro-ohms:
+            description: |
+              The value of current sense resistor in microohms.
+
+        required:
+          - shunt-resistor-micro-ohms
+
+      unevaluatedProperties: false

I don't think it has proper indentation. Did you test the binding?

Quoted 3 lines
Quoted 1 line

Definitely tested the bindings before I push the patch.

Anyway it is wrong. It must be on the level of properties.

Will update in next version.

Quoted 5 lines

Best regards,
Krzysztof

Regards,
Naresh

maintainer
#6 lore raw

Re: [PATCH v10 1/2] dt-bindings: mfd: Add MAX5970 and MAX5978

In reply to Naresh Solanki
Quoted 113 lines · Naresh Solanki

Hi Krzysztof,

Quoted 79 lines · Krzysztof Kozlowski
Quoted 78 lines · Naresh Solanki

From: Marcello Sylvester Bauer <[email protected]>

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

---
  .../bindings/mfd/maxim,max5970.yaml           | 154 ++++++++++++++++++
  1 file changed, 154 insertions(+)

create mode 100644 Documentation/devicetree/bindings/mfd/maxim,max5970.yaml

Documentation/devicetree/bindings/mfd/maxim,max5970.yaml new file +57 -0
new file mode 100644
index 000000000000..edf0c23db4ca
@@ -0,0 +1,154 @@
+# 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 <[email protected]>
+
+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.
+
Quoted 8 lines

Documentation/devicetree/bindings/mfd/maxim,max5970.yaml line 61

Quoted 4 lines
Documentation/devicetree/bindings/mfd/maxim,max5970.yaml new file +4 -0
+  regulators:
+    type: object
+    description:
+      Properties for both regulators. Also set value for shunt resistor used.

You should explain not the syntax, but what part of hardware this nodes represents. Therefore "Also set value" does not fit at all. Hardware sets value?

You mean something like: Properties for power switch

Quoted 4 lines

I looked at datasheets to figure it out but they do not refer to any configurable regulator, LDO nor "sw0/sw1/sw2". Therefore I have no clue what to expect here...

Yes this is for power switch part of max5970/8

Quoted 17 lines
Quoted 5 lines
Documentation/devicetree/bindings/mfd/maxim,max5970.yaml new file +4 -0
+
+    patternProperties:
+      "^sw[0-1]$":
+        $ref: /schemas/regulator/regulator.yaml#

Documentation/devicetree/bindings/mfd/maxim,max5970.yaml line 75

Quoted 10 lines
Documentation/devicetree/bindings/mfd/maxim,max5970.yaml new file +10 -0
+        type: object
+        properties:
+          shunt-resistor-micro-ohms:
+            description: |
+              The value of current sense resistor in microohms.
+
+        required:
+          - shunt-resistor-micro-ohms
+
+      unevaluatedProperties: false

I don't think it has proper indentation. Did you test the binding?

Quoted 1 line

Definitely tested the bindings before I push the patch.

This kind of error was checked for 'properties', but not 'patternProperties'. Now fixed.

Rob

#7 lore raw

PATCH v10 2/2 mfd: max597x: Add support for MAX5970 and MAX5978

In reply to Naresh Solanki

From: Patrick Rudolph <[email protected]>

Implement a regulator driver with IRQ support for fault management. Written against documentation [1] and [2] and tested on real hardware.

Every channel has its own regulator supplies nammed 'vss1-supply' and 'vss2-supply'. The regulator supply is used to determine the output voltage, as the smart switch provides no output regulation. The driver requires the 'shunt-resistor-micro-ohms' property to be present in Device Tree to properly calculate current related values.

Datasheet links:
1: https://datasheets.maximintegrated.com/en/ds/MAX5970.pdf
2: https://datasheets.maximintegrated.com/en/ds/MAX5978.pdf

---
 drivers/mfd/Kconfig         |  12 +++++
 drivers/mfd/Makefile        |   1 +
 drivers/mfd/max597x.c       |  93 ++++++++++++++++++++++++++++++++
 include/linux/mfd/max597x.h | 102 ++++++++++++++++++++++++++++++++++++
 4 files changed, 208 insertions(+)
 create mode 100644 drivers/mfd/max597x.c
 create mode 100644 include/linux/mfd/max597x.h
drivers/mfd/Kconfig +12 -0
index 8b93856de432..416fe7986b7b 100644
@@ -253,6 +253,18 @@ config MFD_MADERA_SPI
 	  Support for the Cirrus Logic Madera platform audio SoC
 	  core functionality controlled via SPI.
 
+config MFD_MAX597X
+	tristate "Maxim 597x Power Switch and Monitor"
+	depends on I2C
+	depends on OF
+	select MFD_CORE
+	select REGMAP_I2C
+	help
+	  This driver controls a Maxim 5970/5978 switch via I2C bus.
+	  The MAX5970/5978 is a smart switch with no output regulation, but
+	  fault protection and voltage and current monitoring capabilities.
+	  Also it supports upto 4 indication LEDs.
+
 config MFD_CS47L15
 	bool "Cirrus Logic CS47L15"
 	select PINCTRL_CS47L15
drivers/mfd/Makefile +1 -0
index 7ed3ef4a698c..819d711fa748 100644
@@ -161,6 +161,7 @@ obj-$(CONFIG_MFD_DA9063)	+= da9063.o
 obj-$(CONFIG_MFD_DA9150)	+= da9150-core.o
 
 obj-$(CONFIG_MFD_MAX14577)	+= max14577.o
+obj-$(CONFIG_MFD_MAX597X)	+= max597x.o
 obj-$(CONFIG_MFD_MAX77620)	+= max77620.o
 obj-$(CONFIG_MFD_MAX77650)	+= max77650.o
 obj-$(CONFIG_MFD_MAX77686)	+= max77686.o
drivers/mfd/max597x.c new file +93 -0

93 lines not on this page · raw message

include/linux/mfd/max597x.h new file +102 -0

102 lines not on this page · raw message

Signature · 1 line
2.37.3