Skip to contentSkip to conversation

Add regulator support for mpq7920

PATCH Superseded Saravanan Sekar 2 participants 6 messages Dec 21, 2019 – Dec 22, 2019

Subsystems (3)

v2 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Saravanan Sekar

author maintainer
#0 lore raw

v2 cover Add regulator support for mpq7920

Changes in V2:
- fixed all the review comments in the driver, avoid ternery operator, inline & constant
- fixed/modifed review comments in Documentation

This patch series add support for PMIC regulator driver for Monolithic Power System's MPQ7920 chipset. MPQ7920 provides support for 4-BUCK converter, one fixed voltage RTCLDO and 4-LDO regualtor, accessed over I2C.

Saravanan Sekar (4):
dt-bindings: Add an entry for Monolithic Power System, MPS
dt-bindings: regulator: add document bindings for mpq7920
regulator: mpq7920: add mpq7920 regulator driver
MAINTAINERS: Add entry for mpq7920 PMIC driver

 .../bindings/regulator/mpq7920.yaml           | 135 ++++++
 .../devicetree/bindings/vendor-prefixes.yaml  |   2 +
 MAINTAINERS                                   |   7 +
 drivers/regulator/Kconfig                     |  10 +
 drivers/regulator/Makefile                    |   1 +
 drivers/regulator/mpq7920.c                   | 396 ++++++++++++++++++
 drivers/regulator/mpq7920.h                   |  72 ++++
 7 files changed, 623 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/mpq7920.yaml
 create mode 100644 drivers/regulator/mpq7920.c
 create mode 100644 drivers/regulator/mpq7920.h
Signature · 1 line
2.17.1
author maintainer
#1 lore raw

PATCH v2 1/4 dt-bindings: Add an entry for Monolithic Power System, MPS

Add an entry for Monolithic Power System, MPS

---
 Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
index 6046f4555852..5eac9d08bfa8 100644
@@ -605,6 +605,8 @@ patternProperties:
     description: MiraMEMS Sensing Technology Co., Ltd.
   "^mitsubishi,.*":
     description: Mitsubishi Electric Corporation
+  "^mps,.*":
+    description: Monolithic Power Systems, Inc.
   "^mosaixtech,.*":
     description: Mosaix Technologies, Inc.
   "^motorola,.*":
Signature · 1 line
2.17.1
author maintainer
#2 lore raw

PATCH v2 2/4 dt-bindings: regulator: add document bindings for mpq7920

In reply to Saravanan Sekar

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

---
 .../bindings/regulator/mpq7920.yaml           | 135 ++++++++++++++++++
 1 file changed, 135 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/mpq7920.yaml
Documentation/devicetree/bindings/regulator/mpq7920.yaml new file +135 -0
new file mode 100644
index 000000000000..a60d3ef04c05
@@ -0,0 +1,135 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/mpq7920.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Monolithic Power System MPQ7920 PMIC
+
+maintainers:
+  - Saravanan Sekar <[email protected]>
+
+properties:
+  $nodename:
+    pattern: "mpq@[0-9a-f]{1,2}"
+  compatible:
+    enum:
+	- mps,mpq7920
+
+  reg:
+    maxItems: 1
+
+  regulators:
+    type: object
+    description: |
+      list of regulators provided by this controller, must be named
+      after their hardware counterparts BUCK[1-4], one LDORTC, and LDO[2-5]
+      The valid names for regulators are
+      buck1, buck2, buck3, buck4, ldortc, ldo2, ldo3, ldo4, ldo5
+
+  properties:
+       mps,time-slot:
+         - $ref: "/schemas/types.yaml#/definitions/uint8"
+         - enum: [ 0, 1, 2, 3 ]
+         - default: 0
+       description: |
+         each regulator output shall be delayed during power on/off sequence which
+         based on configurable time slot value, must be one of following corresponding
+         value 0.5ms, 2ms, 8ms, 16ms
+
+       mps,fixed-on-time:
+          - $ref: "/schemas/types.yaml#/definitions/boolean"
+       description: |
+         select power on sequence with fixed time output delay mentioned in
+         time-slot reg for all the regulators.
+
+       mps,fixed-off-time:
+          - $ref: "/schemas/types.yaml#/definitions/boolean"
+       description: |
+          select power off sequence with fixed time output delay mentioned in
+          time-slot reg for all the regulators.
+
+       mps,inc-off-time:
+          - $ref: "/schemas/types.yaml#/definitions/uint8-array"
+          - minimum: 0
+            maximum: 15
+       description: |
+          mutually exclusive to mps,fixed-off-time an array of 8, linearly increase
+          output delay during power off sequence based on factor of time slot/interval
+          for each regulator.
+
+       mps,inc-on-time:
+          - $ref: "/schemas/types.yaml#/definitions/uint8-array"
+          - minimum: 0
+            maximum: 15
+          - default: [ 0, 6, 0, 6, 7, 7, 7, 9 ]
+       description: |
+          mutually exclusive to mps,fixed-on-time an array of 8, linearly increase
+          output delay during power on sequence based on factor of time slot/interval
+          for each regulator.
+
+       mps,switch-freq:
+         - $ref: "/schemas/types.yaml#/definitions/uint8"
+         - enum: [ 0, 1, 2, 3 ]
+         - default: 2
+       description: |
+          switching frequency must be one of following corresponding value
+          1.1MHz, 1.65MHz, 2.2MHz, 2.75MHz
+
+       mps,buck-softstart:
+         - $ref: "/schemas/types.yaml#/definitions/uint8-array"
+         - enum: [ 0, 1, 2, 3 ]
+         - default: [ 1, 1, 1, 1 ]
+       description: |
+          An array of 4 contains soft start time of each buck, must be one of
+          following corresponding values 150us, 300us, 610us, 920us
+
+       mps,buck-ovp:
+         - $ref: "/schemas/types.yaml#/definitions/uint8-array"
+         - enum: [ 0, 1 ]
+         - default: [ 1, 1, 1, 1 ]
+       description: |
+          An array of 4 contains over voltage protection of each buck, must be
+          one of above values
+
+       mps,buck-phase-delay:
+         - $ref: "/schemas/types.yaml#/definitions/uint8-array"
+         - enum: [ 0, 1, 2, 3 ]
+         - default: [ 0, 0, 1, 1 ]
+       description: |
+          An array of 4 contains phase delay of each buck must be one of above values
+          corresponding to 0deg, 90deg, 180deg, 270deg,
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        mpq7920@69 {
+	  compatible = "mps,mpq7920";
+          reg = <0x69>;
+
+          mps,switch-freq = <1>;
+          mps,buck-softstart = /bits/ 8 <1 2 1 3>;
+          mps,buck-ovp = /bits/ 8 <1 0 1 1>;
+
+          regulators {
+            buck1 {
+             regulator-name = "buck1";
+             regulator-min-microvolt = <400000>;
+             regulator-max-microvolt = <3587500>;
+             regulator-min-microamp  = <460000>;
+             regulator-max-microamp  = <7600000>;
+             regulator-boot-on;
+           };
+
+           ldo2 {
+             regulator-name = "ldo2";
+             regulator-min-microvolt = <650000>;
+             regulator-max-microvolt = <3587500>;
+           };
+         };
+       };
+     };
+...
Signature · 1 line
2.17.1
#3 lore raw

Re: [PATCH v2 2/4] dt-bindings: regulator: add document bindings for mpq7920

Quoted 19 lines · Saravanan Sekar

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

---
 .../bindings/regulator/mpq7920.yaml           | 135 ++++++++++++++++++
 1 file changed, 135 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/mpq7920.yaml
Documentation/devicetree/bindings/regulator/mpq7920.yaml new file +4 -0
new file mode 100644
index 000000000000..a60d3ef04c05
@@ -0,0 +1,135 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/mpq7920.yaml#

Documentation/devicetree/bindings/regulator/mpq7920.yaml line 14

Quoted 10 lines
Documentation/devicetree/bindings/regulator/mpq7920.yaml new file +10 -0
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Monolithic Power System MPQ7920 PMIC
+
+maintainers:
+  - Saravanan Sekar <[email protected]>
+
+properties:
+  $nodename:
+    pattern: "mpq@[0-9a-f]{1,2}"

This is still not a valid node name

Quoted 4 lines
Documentation/devicetree/bindings/regulator/mpq7920.yaml new file +4 -0
+  compatible:
+    enum:
+	- mps,mpq7920
+

Documentation/devicetree/bindings/regulator/mpq7920.yaml line 28

Quoted 10 lines
Documentation/devicetree/bindings/regulator/mpq7920.yaml new file +10 -0
+  reg:
+    maxItems: 1
+
+  regulators:
+    type: object
+    description: |
+      list of regulators provided by this controller, must be named
+      after their hardware counterparts BUCK[1-4], one LDORTC, and LDO[2-5]
+      The valid names for regulators are
+      buck1, buck2, buck3, buck4, ldortc, ldo2, ldo3, ldo4, ldo5

These should be validated.

Documentation/devicetree/bindings/regulator/mpq7920.yaml line 29

Quoted 1 line
Documentation/devicetree/bindings/regulator/mpq7920.yaml new file +1 -0
+  properties:

If it's properties under the regulators node, it should be at one more indentation level.

Documentation/devicetree/bindings/regulator/mpq7920.yaml line 31

Quoted 1 line
Documentation/devicetree/bindings/regulator/mpq7920.yaml new file +1 -0
+       mps,time-slot:

This should have an allOf here

Documentation/devicetree/bindings/regulator/mpq7920.yaml line 38

Quoted 7 lines
Documentation/devicetree/bindings/regulator/mpq7920.yaml new file +7 -0
+         - $ref: "/schemas/types.yaml#/definitions/uint8"
+         - enum: [ 0, 1, 2, 3 ]
+         - default: 0
+       description: |
+         each regulator output shall be delayed during power on/off sequence which
+         based on configurable time slot value, must be one of following corresponding
+         value 0.5ms, 2ms, 8ms, 16ms

And this should be under the property, not at the same level.

Did you run dt_bindings_check?

Maxime

author maintainer
#4 lore raw

PATCH v2 3/4 regulator: mpq7920: add mpq7920 regulator driver

In reply to Saravanan Sekar

Adding regulator driver for the device mpq7920.
The MPQ7920 PMIC device contains four DC-DC buck converters and five regulators, is designed for automotive and accessed over I2C.

---
 drivers/regulator/Kconfig   |  10 +
 drivers/regulator/Makefile  |   1 +
 drivers/regulator/mpq7920.c | 396 ++++++++++++++++++++++++++++++++++++
 drivers/regulator/mpq7920.h |  72 +++++++
 4 files changed, 479 insertions(+)
 create mode 100644 drivers/regulator/mpq7920.c
 create mode 100644 drivers/regulator/mpq7920.h
drivers/regulator/Kconfig +10 -0
index 74eb5af7295f..e10adc2e57da 100644
@@ -600,6 +600,16 @@ config REGULATOR_MCP16502
 	  through the regulator interface. In addition it enables
 	  suspend-to-ram/standby transition.
 
+config REGULATOR_MPQ7920
+	tristate "Monolithic MPQ7920 PMIC"
+	depends on I2C && OF
+	select REGMAP_I2C
+	help
+	  Say y here to support the MPQ7920 PMIC. This will enable supports
+	  the software controllable 4 buck and 5 LDO regulators.
+	  This driver supports the control of different power rails of device
+	  through regulator interface.
+
 config REGULATOR_MT6311
 	tristate "MediaTek MT6311 PMIC"
 	depends on I2C
drivers/regulator/Makefile +1 -0
index 2210ba56f9bd..fd11002507e4 100644
@@ -77,6 +77,7 @@ obj-$(CONFIG_REGULATOR_MC13783) += mc13783-regulator.o
 obj-$(CONFIG_REGULATOR_MC13892) += mc13892-regulator.o
 obj-$(CONFIG_REGULATOR_MC13XXX_CORE) +=  mc13xxx-regulator-core.o
 obj-$(CONFIG_REGULATOR_MCP16502) += mcp16502.o
+obj-$(CONFIG_REGULATOR_MPQ7920) += mpq7920.o
 obj-$(CONFIG_REGULATOR_MT6311) += mt6311-regulator.o
 obj-$(CONFIG_REGULATOR_MT6323)	+= mt6323-regulator.o
 obj-$(CONFIG_REGULATOR_MT6358)	+= mt6358-regulator.o
drivers/regulator/mpq7920.c new file +396 -0

396 lines not on this page · raw message

drivers/regulator/mpq7920.h new file +72 -0

72 lines not on this page · raw message

Signature · 1 line
2.17.1
author maintainer
#5 lore raw

PATCH v2 4/4 MAINTAINERS: Add entry for mpq7920 PMIC driver

In reply to Saravanan Sekar

Add MAINTAINERS entry for Monolithic Power Systems mpq7920 PMIC driver.

---
 MAINTAINERS | 7 +++++++
 1 file changed, 7 insertions(+)
MAINTAINERS +7 -0
index 0fd82e674cf4..8a31285b59c6 100644
@@ -11128,6 +11128,13 @@ S:	Maintained
 F:	Documentation/driver-api/serial/moxa-smartio.rst
 F:	drivers/tty/mxser.*
 
+MONOLITHIC POWER SYSTEM PMIC DRIVER
+M:	Saravanan Sekar <[email protected]>
+S:	Maintained
+F:	Documentation/devicetree/bindings/regulator/mpq7920.yaml
+F:	drivers/regulator/mpq7920.c
+F:	drivers/regulator/mpq7920.h
+
 MR800 AVERMEDIA USB FM RADIO DRIVER
 M:	Alexey Klimov <[email protected]>
 L:	[email protected]
Signature · 1 line
2.17.1