Skip to contentSkip to conversation

regulator: max77826: Add MAX77826 support

PATCH Superseded Iskren Chernev 3 participants 11 messages Apr 13, 2020 – Apr 24, 2020

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover regulator: max77826: Add MAX77826 support

The MAX77826 is a PMIC found on the Samsung Galaxy S5 (klte) and possibly other devices. It is produced by Maxim Integrated and contains 15 LDOs a buck and a buck boost regulator.

Iskren Chernev (3):
regulator: max77826: Add max77826 regulator driver
dt-bindings: regulator: Add document bindings for max77826
ARM: dts: qcom: msm8974-klte: Add max77826 pmic node

 .../bindings/regulator/maxim,max77826.yaml    |  70 ++++
 .../boot/dts/qcom-msm8974-samsung-klte.dts    | 110 +++++++
 arch/arm/boot/dts/qcom-msm8974.dtsi           |  11 +
 drivers/regulator/Kconfig                     |  10 +
 drivers/regulator/Makefile                    |   1 +
 drivers/regulator/max77826-regulator.c        | 301 ++++++++++++++++++
 6 files changed, 503 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/maxim,max77826.yaml
 create mode 100644 drivers/regulator/max77826-regulator.c

base-commit: 3b2804993d1e9f2b01f4264993009d3e48722e0d --
2.26.0

#1 lore raw

PATCH 1/3 regulator: max77826: Add max77826 regulator driver

Adding regulator driver for the Maxim max77826 device.
The max77826 PMIC contains a high-efficiency BUCK regulator, a BUCK BOOST regulator and 15 LDOs. It is designed for smartphone and tablet applications and is accessed over I2C.

---
 drivers/regulator/Kconfig              |  10 +
 drivers/regulator/Makefile             |   1 +
 drivers/regulator/max77826-regulator.c | 301 +++++++++++++++++++++++++
 3 files changed, 312 insertions(+)
 create mode 100644 drivers/regulator/max77826-regulator.c
drivers/regulator/Kconfig +10 -0
index f4b72cb098ef..e8f7a0965ae9 100644
@@ -585,6 +585,16 @@ config REGULATOR_MAX77802
 	  Exynos5420/Exynos5800 SoCs to control various voltages.
 	  It includes support for control of voltage and ramp speed.
 
+config REGULATOR_MAX77826
+	tristate "Maxim 77826 regulator"
+	depends on I2C
+	select REGMAP_I2C
+	help
+	  This driver controls a Maxim 77826 regulator via I2C bus.
+	  The regulator include 15 LDOs, BUCK and BUCK BOOST regulator.
+	  It includes support for control of output voltage. This
+	  regulator is found on the Samsung Galaxy S5 (klte) smartphone.
+
 config REGULATOR_MC13XXX_CORE
 	tristate
 
drivers/regulator/Makefile +1 -0
index 6610ee001d9a..e8f163371071 100644
@@ -74,6 +74,7 @@ obj-$(CONFIG_REGULATOR_MAX8998) += max8998.o
 obj-$(CONFIG_REGULATOR_MAX77686) += max77686-regulator.o
 obj-$(CONFIG_REGULATOR_MAX77693) += max77693-regulator.o
 obj-$(CONFIG_REGULATOR_MAX77802) += max77802-regulator.o
+obj-$(CONFIG_REGULATOR_MAX77826) += max77826-regulator.o
 obj-$(CONFIG_REGULATOR_MC13783) += mc13783-regulator.o
 obj-$(CONFIG_REGULATOR_MC13892) += mc13892-regulator.o
 obj-$(CONFIG_REGULATOR_MC13XXX_CORE) +=  mc13xxx-regulator-core.o
drivers/regulator/max77826-regulator.c new file +301 -0

301 lines not on this page · raw message

Signature · 1 line
2.26.0
#3 lore raw

PATCH 2/3 dt-bindings: regulator: Add document bindings for max77826

In reply to Iskren Chernev

Add device tree binding information for max77826 regulator driver. Example bindings for max77826 are added.

---
 .../bindings/regulator/maxim,max77826.yaml    | 70 +++++++++++++++++++
 1 file changed, 70 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/maxim,max77826.yaml
Documentation/devicetree/bindings/regulator/maxim,max77826.yaml new file +70 -0
new file mode 100644
index 000000000000..3cd449a746b0
@@ -0,0 +1,70 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/maxim,max77826.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Maxim Integrated MAX77826 PMIC
+
+maintainers:
+  - Iskren Chernev <[email protected]>
+
+properties:
+  $nodename:
+    pattern: "pmic@[0-9a-f]{1,2}"
+  compatible:
+    enum:
+      - maxim,max77826-regulator
+
+  reg:
+    maxItems: 1
+
+  regulators:
+    type: object
+    allOf:
+      - $ref: regulator.yaml#
+    description: |
+      list of regulators provided by this controller, must be named
+      after their hardware counterparts LDO[1-15], BUCK and BUCKBOOST
+
+    patternProperties:
+      "^LDO([1-9]|1[0-5])$":
+        type: object
+        allOf:
+          - $ref: regulator.yaml#
+
+      "^BUCK|BUCKBOOST$":
+        type: object
+        allOf:
+          - $ref: regulator.yaml#
+
+      additionalProperties: false
+    additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - regulators
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        pmic@69 {
+            compatible = "maxim,max77826-regulator";
+            reg = <0x69>;
+
+            regulators {
+                LDO2 {
+                    regulator-name = "ldo2";
+                    regulator-min-microvolt = <650000>;
+                    regulator-max-microvolt = <3587500>;
+                };
+            };
+       };
+     };
+...
Signature · 1 line
2.26.0
#7 lore raw

PATCH 3/3 ARM: dts: qcom: msm8974-klte: Add max77826 pmic node

In reply to Iskren Chernev

This introduces the MAX77826 PMIC that powers some pheripherals on the klte, like the touchpad, touchkeys and camera.

---
 .../boot/dts/qcom-msm8974-samsung-klte.dts    | 110 ++++++++++++++++++
 arch/arm/boot/dts/qcom-msm8974.dtsi           |  11 ++
 2 files changed, 121 insertions(+)
arch/arm/boot/dts/qcom-msm8974-samsung-klte.dts +110 -0
index eaa1001d0a46..f6d3a9dcf0de 100644
@@ -21,4 +21,114 @@ serial@f991e000 {
 		status = "ok";
 	};
 
+	pinctrl@fd510000 {
+		i2c6_pins: i2c6 {
+			mux {
+				pins = "gpio29", "gpio30";
+				function = "blsp_i2c6";
+
+				drive-strength = <2>;
+				bias-disable;
+			};
+		};
+	};
+
+	i2c@f9928000 {
+		status = "okay";
+
+		pinctrl-names = "default";
+		pinctrl-0 = <&i2c6_pins>;
+
+		pmic@60 {
+			reg = <0x60>;
+			compatible = "maxim,max77826-regulator";
+
+			regulators {
+				max77826_ldo1: LDO1 {
+					regulator-min-microvolt = <1200000>;
+					regulator-max-microvolt = <1200000>;
+				};
+
+				max77826_ldo2: LDO2 {
+					regulator-min-microvolt = <1000000>;
+					regulator-max-microvolt = <1000000>;
+				};
+
+				max77826_ldo3: LDO3 {
+					regulator-min-microvolt = <1200000>;
+					regulator-max-microvolt = <1200000>;
+				};
+
+				max77826_ldo4: LDO4 {
+					regulator-min-microvolt = <1800000>;
+					regulator-max-microvolt = <1800000>;
+				};
+
+				max77826_ldo5: LDO5 {
+					regulator-min-microvolt = <1800000>;
+					regulator-max-microvolt = <1800000>;
+				};
+
+				max77826_ldo6: LDO6 {
+					regulator-min-microvolt = <1800000>;
+					regulator-max-microvolt = <3300000>;
+				};
+
+				max77826_ldo7: LDO7 {
+					regulator-min-microvolt = <1800000>;
+					regulator-max-microvolt = <1800000>;
+				};
+
+				max77826_ldo8: LDO8 {
+					regulator-min-microvolt = <1800000>;
+					regulator-max-microvolt = <3300000>;
+				};
+
+				max77826_ldo9: LDO9 {
+					regulator-min-microvolt = <1800000>;
+					regulator-max-microvolt = <1800000>;
+				};
+
+				max77826_ldo10: LDO10 {
+					regulator-min-microvolt = <2800000>;
+					regulator-max-microvolt = <2950000>;
+				};
+
+				max77826_ldo11: LDO11 {
+					regulator-min-microvolt = <2700000>;
+					regulator-max-microvolt = <2950000>;
+				};
+
+				max77826_ldo12: LDO12 {
+					regulator-min-microvolt = <2500000>;
+					regulator-max-microvolt = <3300000>;
+				};
+
+				max77826_ldo13: LDO13 {
+					regulator-min-microvolt = <3300000>;
+					regulator-max-microvolt = <3300000>;
+				};
+
+				max77826_ldo14: LDO14 {
+					regulator-min-microvolt = <3300000>;
+					regulator-max-microvolt = <3300000>;
+				};
+
+				max77826_ldo15: LDO15 {
+					regulator-min-microvolt = <1800000>;
+					regulator-max-microvolt = <1800000>;
+				};
+
+				max77826_buck: BUCK {
+					regulator-min-microvolt = <1225000>;
+					regulator-max-microvolt = <1225000>;
+				};
+
+				max77826_buckboost: BUCKBOOST {
+					regulator-min-microvolt = <3400000>;
+					regulator-max-microvolt = <3400000>;
+				};
+			};
+		};
+	};
 };
arch/arm/boot/dts/qcom-msm8974.dtsi +11 -0
index 2ea2308d91b3..51f5f904f9eb 100644
@@ -974,6 +974,17 @@ blsp_i2c3: i2c@f9925000 {
 			#size-cells = <0>;
 		};
 
+		blsp_i2c6: i2c@f9928000 {
+			status = "disabled";
+			compatible = "qcom,i2c-qup-v2.1.1";
+			reg = <0xf9928000 0x1000>;
+			interrupts = <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&gcc GCC_BLSP1_QUP6_I2C_APPS_CLK>, <&gcc GCC_BLSP1_AHB_CLK>;
+			clock-names = "core", "iface";
+			#address-cells = <1>;
+			#size-cells = <0>;
+		};
+
 		blsp_i2c8: i2c@f9964000 {
 			status = "disabled";
 			compatible = "qcom,i2c-qup-v2.1.1";
Signature · 1 line
2.26.0
maintainer
#2 lore raw

Re: [PATCH 1/3] regulator: max77826: Add max77826 regulator driver

In reply to Iskren Chernev

drivers/regulator/max77826-regulator.c line 278

Quoted 2 lines · Iskren Chernev
drivers/regulator/max77826-regulator.c new file +2 -0
+static const struct of_device_id max77826_of_match[] = {
+	{ .compatible = "maxim,max77826-regulator" },

This should just be maxim,max77826 - there's no need to disambiguate or describe the device in the compatible string.

maintainer
#8 lore raw
In reply to Iskren Chernev
Quoted 7 lines · Iskren Chernev

The MAX77826 is a PMIC found on the Samsung Galaxy S5 (klte) and possibly other devices. It is produced by Maxim Integrated and contains 15 LDOs a buck and a buck boost regulator.

Iskren Chernev (3):
regulator: max77826: Add max77826 regulator driver
dt-bindings: regulator: Add document bindings for max77826

Aside from the compatible string and the subject prefix on the DT binding patch this looks good to me.

#9 lore raw
Quoted 11 lines · Mark Brown
Quoted 7 lines · Iskren Chernev

The MAX77826 is a PMIC found on the Samsung Galaxy S5 (klte) and possibly other devices. It is produced by Maxim Integrated and contains 15 LDOs a buck and a buck boost regulator.

Iskren Chernev (3):
   regulator: max77826: Add max77826 regulator driver
   dt-bindings: regulator: Add document bindings for max77826

Aside from the compatible string and the subject prefix on the DT binding patch this looks good to me.

About the subject -- I guess you mean the suffix is wrong, it should be:

  dt-bindings: regulator: Document bindings for max77826

I'll also change the compatible string.

maintainer
#10 lore raw
Quoted 6 lines · Iskren Chernev
Quoted 2 lines

Aside from the compatible string and the subject prefix on the DT binding patch this looks good to me.

About the subject -- I guess you mean the suffix is wrong, it should be:

  dt-bindings: regulator: Document bindings for max77826

No, it should just be regulator:.

maintainer
#4 lore raw

Re: [PATCH 2/3] dt-bindings: regulator: Add document bindings for max77826

In reply to Iskren Chernev
Quoted 46 lines · Iskren Chernev

Add device tree binding information for max77826 regulator driver. Example bindings for max77826 are added.

---
 .../bindings/regulator/maxim,max77826.yaml    | 70 +++++++++++++++++++
 1 file changed, 70 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/maxim,max77826.yaml
Documentation/devicetree/bindings/regulator/maxim,max77826.yaml new file +31 -0
new file mode 100644
index 000000000000..3cd449a746b0
@@ -0,0 +1,70 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/maxim,max77826.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Maxim Integrated MAX77826 PMIC
+
+maintainers:
+  - Iskren Chernev <[email protected]>
+
+properties:
+  $nodename:
+    pattern: "pmic@[0-9a-f]{1,2}"
+  compatible:
+    enum:
+      - maxim,max77826-regulator
+
+  reg:
+    maxItems: 1
+
+  regulators:
+    type: object
+    allOf:
+      - $ref: regulator.yaml#
+    description: |
+      list of regulators provided by this controller, must be named
+      after their hardware counterparts LDO[1-15], BUCK and BUCKBOOST
+
+    patternProperties:
+      "^LDO([1-9]|1[0-5])$":

Documentation/devicetree/bindings/regulator/maxim,max77826.yaml line 41

Quoted 10 lines
Documentation/devicetree/bindings/regulator/maxim,max77826.yaml new file +10 -0
+        type: object
+        allOf:
+          - $ref: regulator.yaml#
+
+      "^BUCK|BUCKBOOST$":
+        type: object
+        allOf:
+          - $ref: regulator.yaml#
+
+      additionalProperties: false

You are defining a property called 'additionalProperties'. This one should be dropped because additionalProperties doesn't work with a $ref.

Quoted 32 lines
Documentation/devicetree/bindings/regulator/maxim,max77826.yaml new file +29 -0
+    additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - regulators
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        pmic@69 {
+            compatible = "maxim,max77826-regulator";
+            reg = <0x69>;
+
+            regulators {
+                LDO2 {
+                    regulator-name = "ldo2";
+                    regulator-min-microvolt = <650000>;
+                    regulator-max-microvolt = <3587500>;
+                };
+            };
+       };
+     };
+...
Signature · 1 line
2.26.0
#5 lore raw

Re: [PATCH 2/3] dt-bindings: regulator: Add document bindings for max77826

Quoted 17 lines · Rob Herring

Documentation/devicetree/bindings/regulator/maxim,max77826.yaml line 41

Quoted 12 lines · Iskren Chernev

+    patternProperties:
+      "^LDO([1-9]|1[0-5])$":
+        type: object
+        allOf:
+          - $ref: regulator.yaml#

Documentation/devicetree/bindings/regulator/maxim,max77826.yaml new file +7 -0
+
+      "^BUCK|BUCKBOOST$":
+        type: object
+        allOf:
+          - $ref: regulator.yaml#
+
+      additionalProperties: false

You are defining a property called 'additionalProperties'. This one should be dropped because additionalProperties doesn't work with a $ref.

I got the idea from mps,mpq7920.yaml. It has additionalProperties in the exact same places that I do. Also bd718(28|37|47).yaml seem to use additionalProperties inside patternProperties. Shall I modify it as well?

I couldn't find the core schema for this yaml:
http://devicetree.org/meta-schemas/core.yaml (gives 404).  Is there a way to verify the validity of the yaml?

Also, this patch is already merged in linux-next. I guess I shall submit a new patch with the fixes standalone?

maintainer
#6 lore raw

Re: [PATCH 2/3] dt-bindings: regulator: Add document bindings for max77826

Quoted 21 lines · Iskren Chernev
Quoted 17 lines · Rob Herring

Documentation/devicetree/bindings/regulator/maxim,max77826.yaml line 41

Quoted 12 lines · Iskren Chernev
Documentation/devicetree/bindings/regulator/maxim,max77826.yaml new file +12 -0
+    patternProperties:
+      "^LDO([1-9]|1[0-5])$":
+        type: object
+        allOf:
+          - $ref: regulator.yaml#
+
+      "^BUCK|BUCKBOOST$":
+        type: object
+        allOf:
+          - $ref: regulator.yaml#
+
+      additionalProperties: false

You are defining a property called 'additionalProperties'. This one should be dropped because additionalProperties doesn't work with a $ref.

Quoted 3 lines

I got the idea from mps,mpq7920.yaml. It has additionalProperties in the exact same places that I do. Also bd718(28|37|47).yaml seem to use additionalProperties inside patternProperties. Shall I modify it as well?

Indeed. mps,mp5416.yaml too. I'll fix all of these and few non-regulator ones so I can get them into rc3.

Quoted 3 lines

I couldn't find the core schema for this yaml:
http://devicetree.org/meta-schemas/core.yaml (gives 404). Is there a way to verify the validity of the yaml?

Running 'make dt_binding_check'. The url is just convention and while files could be there they aren't. They are all contained in the dtschema module[1].

However, in this case the meta-schema fails to check for this. It is technically valid as it is saying you can't have a DT property called 'additionalProperties'. I've written a check now which should disallow listing any DT property names which are json-schema vocabulary. Once the failures get fixed I'll add it to the meta-schema.

Quoted 2 lines

Also, this patch is already merged in linux-next. I guess I shall submit a new patch with the fixes standalone?

Yes, should be on top of this one.

Thanks,
Rob

[1] https://github.com/devicetree-org/dt-schema