Add regulator support for mpq7920
Subsystems (3)
Saravanan Sekar
maintainerv6 cover Add regulator support for mpq7920
Changes in V6:
- replaced dts parse loop with an of_parse_cb callback
Changes in V5:
- removed timeslot related changes, the timeslot register holds the value of time duration between each regulator of power on/off sequence. Although timeslot register is accessed over I2C the changes reflects on next powercycle of pmic, so cannot handled part of this driver.
- device tree bindings property are defined per regulator node
Changes in V4:
- fixed 0-DAY warnings
Changes in V3:
- fixed review comments in Documentation and dt_bindings_check passed
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
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
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/mps,mpq7920.yaml | 202 ++++++++++ .../devicetree/bindings/vendor-prefixes.yaml | 2 + MAINTAINERS | 7 + drivers/regulator/Kconfig | 10 + drivers/regulator/Makefile | 1 + drivers/regulator/mpq7920.c | 346 ++++++++++++++++++ drivers/regulator/mpq7920.h | 68 ++++ 7 files changed, 636 insertions(+) create mode 100644 Documentation/devicetree/bindings/regulator/mps,mpq7920.yaml create mode 100644 drivers/regulator/mpq7920.c create mode 100644 drivers/regulator/mpq7920.h
Signature · 1 line
2.17.1
Saravanan Sekar
maintainerPATCH v6 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
@@ -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
Re: [PATCH v6 1/4] dt-bindings: Add an entry for Monolithic Power System, MPS
Quoted 8 lines · Saravanan Sekar
Add an entry for Monolithic Power System, MPS
Signed-off-by Saravanan Sekar <[email protected]>Acked-by Rob Herring <[email protected]>--- Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++ 1 file changed, 2 insertions(+)
Mark, And revert this too. It's a duplicate of what I already have in my tree and this one is not alphabetized correctly.
Rob
Mark Brown
maintainerRe: [PATCH v6 1/4] dt-bindings: Add an entry for Monolithic Power System, MPS
Quoted 9 lines · Rob Herring
Quoted 5 lines · Saravanan Sekar
Add an entry for Monolithic Power System, MPS
Signed-off-by Saravanan Sekar <[email protected]>Acked-by Rob Herring <[email protected]>Mark, And revert this too. It's a duplicate of what I already have in my tree and this one is not alphabetized correctly.
OK... I'm very surprised that you're asking me to revert a patch that you've acked though.
Saravanan Sekar
maintainerPATCH v6 2/4 dt-bindings: regulator: add document bindings for mpq7920
In reply to Saravanan SekarAdd device tree binding information for mpq7920 regulator driver. Example bindings for mpq7920 are added.
--- .../bindings/regulator/mps,mpq7920.yaml | 202 ++++++++++++++++++ 1 file changed, 202 insertions(+) create mode 100644 Documentation/devicetree/bindings/regulator/mps,mpq7920.yaml
Documentation/devicetree/bindings/regulator/mps,mpq7920.yaml new file +202 -0
@@ -0,0 +1,202 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/regulator/mps,mpq7920.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Monolithic Power System MPQ7920 PMIC + +maintainers: + - Saravanan Sekar <[email protected]> + +properties: + $nodename: + pattern: "pmic@[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] + + mps,switch-freq: + description: | + switching frequency must be one of following corresponding value + 1.1MHz, 1.65MHz, 2.2MHz, 2.75MHz + $ref: "/schemas/types.yaml#/definitions/uint8" + enum: [ 0, 1, 2, 3 ] + default: 2 + + buck1: + type: object + $ref: "regulator.yaml#" + description: | + 4.5A DC-DC step down converter + + mps,buck-softstart: + $ref: "/schemas/types.yaml#/definitions/uint8" + enum: [ 0, 1, 2, 3 ] + default: 1 + description: | + defines the soft start time of this buck, must be one of the following + corresponding values 150us, 300us, 610us, 920us + + mps,buck-phase-delay: + $ref: "/schemas/types.yaml#/definitions/uint8" + enum: [ 0, 1, 2, 3 ] + default: 0 + description: | + defines the phase delay of this buck, must be one of the following + corresponding values 0deg, 90deg, 180deg, 270deg + + mps,buck-ovp-disable: + type: boolean + description: | + disables over voltage protection of this buck + + buck2: + type: object + $ref: "regulator.yaml#" + description: | + 2.5A DC-DC step down converter + + mps,buck-softstart: + description: | + defines the soft start time of this buck, must be one of the following + corresponding values 150us, 300us, 610us, 920us + $ref: "/schemas/types.yaml#/definitions/uint8" + enum: [ 0, 1, 2, 3 ] + default: 1 + + mps,buck-phase-delay: + description: | + defines the phase delay of this buck, must be one of the following + corresponding values 0deg, 90deg, 180deg, 270deg + $ref: "/schemas/types.yaml#/definitions/uint8" + enum: [ 0, 1, 2, 3 ] + default: 0 + + mps,buck-ovp-disable: + description: | + disables over voltage protection of this buck + type: boolean + + buck3: + type: object + $ref: "regulator.yaml#" + description: | + 4.5A DC-DC step down converter + + mps,buck-softstart: + description: | + defines the soft start time of this buck, must be one of the following + corresponding values 150us, 300us, 610us, 920us + $ref: "/schemas/types.yaml#/definitions/uint8" + enum: [ 0, 1, 2, 3 ] + default: 1 + + mps,buck-phase-delay: + description: | + defines the phase delay of this buck, must be one of the following + corresponding values 0deg, 90deg, 180deg, 270deg + $ref: "/schemas/types.yaml#/definitions/uint8" + enum: [ 0, 1, 2, 3 ] + default: 1 + + mps,buck-ovp-disable: + description: | + disables over voltage protection of this buck + type: boolean + + buck4: + type: object + $ref: "regulator.yaml#" + description: | + 2.5A DC-DC step down converter + + mps,buck-softstart: + description: | + defines the soft start time of this buck, must be one of the following + corresponding values 150us, 300us, 610us, 920us + $ref: "/schemas/types.yaml#/definitions/uint8" + enum: [ 0, 1, 2, 3 ] + default: 1 + + mps,buck-phase-delay: + description: | + defines the phase delay of this buck, must be one of the following + corresponding values 0deg, 90deg, 180deg, 270deg + $ref: "/schemas/types.yaml#/definitions/uint8" + enum: [ 0, 1, 2, 3 ] + default: 1 + + mps,buck-ovp-disable: + description: | + disables over voltage protection of this buck + type: boolean + + ldortc: + $ref: "regulator.yaml#" + description: | + regulator with 0.65V-3.5875V for RTC, always enabled + + ldo2: + $ref: "regulator.yaml#" + description: | + regulator with 0.65V-3.5875V + + ldo3: + $ref: "regulator.yaml#" + description: | + regulator with 0.65V-3.5875V + + ldo4: + $ref: "regulator.yaml#" + description: | + regulator with 0.65V-3.5875V + + ldo5: + $ref: "regulator.yaml#" + description: | + regulator with 0.65V-3.5875V + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + pmic@69 { + compatible = "mps,mpq7920"; + reg = <0x69>; + + regulators { + mps,switch-freq = <1>; + + buck1 { + regulator-name = "buck1"; + regulator-min-microvolt = <400000>; + regulator-max-microvolt = <3587500>; + regulator-min-microamp = <460000>; + regulator-max-microamp = <7600000>; + regulator-boot-on; + mps,buck-ovp-disable; + mps,buck-phase-delay = <2>; + mps,buck-softstart = <1>; + }; + + ldo2 { + regulator-name = "ldo2"; + regulator-min-microvolt = <650000>; + regulator-max-microvolt = <3587500>; + }; + }; + }; + }; +...
Signature · 1 line
2.17.1
Re: [PATCH v6 2/4] dt-bindings: regulator: add document bindings for mpq7920
Quoted 3 lines · Saravanan Sekar
Add device tree binding information for mpq7920 regulator driver. Example bindings for mpq7920 are added.
Mark, Please revert this. Not even close to valid schema and my questions on v4 are unanswered.
Quoted 31 lines
Signed-off-by Saravanan Sekar <[email protected]>--- .../bindings/regulator/mps,mpq7920.yaml | 202 ++++++++++++++++++ 1 file changed, 202 insertions(+) create mode 100644 Documentation/devicetree/bindings/regulator/mps,mpq7920.yamlDocumentation/devicetree/bindings/regulator/mps,mpq7920.yaml new file +18
-0@@ -0,0 +1,202 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/regulator/mps,mpq7920.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Monolithic Power System MPQ7920 PMIC + +maintainers: + - Saravanan Sekar <[email protected]> + +properties: + $nodename: + pattern: "pmic@[0-9a-f]{1,2}" + compatible: + enum: + - mps,mpq7920 +
Documentation/devicetree/bindings/regulator/mps,mpq7920.yaml line 28
Quoted 10 lines
Documentation/devicetree/bindings/regulator/mps,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] + + mps,switch-freq:
This needs to be under 'properties'. Otherwise, everything below here is just part of 'description'.
As I asked on v4, shouldn't this be a common property? Switching frequency is a common property for switching regulators, right?
Documentation/devicetree/bindings/regulator/mps,mpq7920.yaml line 36
Quoted 8 lines
Documentation/devicetree/bindings/regulator/mps,mpq7920.yaml new file +8
-0+ description: | + switching frequency must be one of following corresponding value + 1.1MHz, 1.65MHz, 2.2MHz, 2.75MHz + $ref: "/schemas/types.yaml#/definitions/uint8" + enum: [ 0, 1, 2, 3 ] + default: 2 + + buck1:
This should be under 'patternProperties' as '^buck[1-4]$'. Then you aren't duplicating a bunch of property schemas.
Documentation/devicetree/bindings/regulator/mps,mpq7920.yaml line 38
Quoted 2 lines
Documentation/devicetree/bindings/regulator/mps,mpq7920.yaml new file +2
-0+ type: object + $ref: "regulator.yaml#"
Should be:
allOf:
- $ref: regulator.yaml#
Documentation/devicetree/bindings/regulator/mps,mpq7920.yaml line 42
Quoted 4 lines
Documentation/devicetree/bindings/regulator/mps,mpq7920.yaml new file +4
-0+ description: | + 4.5A DC-DC step down converter + + mps,buck-softstart:
Needs to be under 'properties'
Quoted 9 lines
Documentation/devicetree/bindings/regulator/mps,mpq7920.yaml new file +9
-0+ $ref: "/schemas/types.yaml#/definitions/uint8" + enum: [ 0, 1, 2, 3 ] + default: 1 + description: | + defines the soft start time of this buck, must be one of the following + corresponding values 150us, 300us, 610us, 920us + + mps,buck-phase-delay: + $ref: "/schemas/types.yaml#/definitions/uint8"
Documentation/devicetree/bindings/regulator/mps,mpq7920.yaml line 61
Quoted 10 lines
Documentation/devicetree/bindings/regulator/mps,mpq7920.yaml new file +10
-0+ enum: [ 0, 1, 2, 3 ] + default: 0 + description: | + defines the phase delay of this buck, must be one of the following + corresponding values 0deg, 90deg, 180deg, 270deg + + mps,buck-ovp-disable: + type: boolean + description: | + disables over voltage protection of this buck
Seems like configurable over voltage protection would be a common regulator property?
Quoted 73 lines
Documentation/devicetree/bindings/regulator/mps,mpq7920.yaml new file +73
-0+ + buck2: + type: object + $ref: "regulator.yaml#" + description: | + 2.5A DC-DC step down converter + + mps,buck-softstart: + description: | + defines the soft start time of this buck, must be one of the following + corresponding values 150us, 300us, 610us, 920us + $ref: "/schemas/types.yaml#/definitions/uint8" + enum: [ 0, 1, 2, 3 ] + default: 1 + + mps,buck-phase-delay: + description: | + defines the phase delay of this buck, must be one of the following + corresponding values 0deg, 90deg, 180deg, 270deg + $ref: "/schemas/types.yaml#/definitions/uint8" + enum: [ 0, 1, 2, 3 ] + default: 0 + + mps,buck-ovp-disable: + description: | + disables over voltage protection of this buck + type: boolean + + buck3: + type: object + $ref: "regulator.yaml#" + description: | + 4.5A DC-DC step down converter + + mps,buck-softstart: + description: | + defines the soft start time of this buck, must be one of the following + corresponding values 150us, 300us, 610us, 920us + $ref: "/schemas/types.yaml#/definitions/uint8" + enum: [ 0, 1, 2, 3 ] + default: 1 + + mps,buck-phase-delay: + description: | + defines the phase delay of this buck, must be one of the following + corresponding values 0deg, 90deg, 180deg, 270deg + $ref: "/schemas/types.yaml#/definitions/uint8" + enum: [ 0, 1, 2, 3 ] + default: 1 + + mps,buck-ovp-disable: + description: | + disables over voltage protection of this buck + type: boolean + + buck4: + type: object + $ref: "regulator.yaml#" + description: | + 2.5A DC-DC step down converter + + mps,buck-softstart: + description: | + defines the soft start time of this buck, must be one of the following + corresponding values 150us, 300us, 610us, 920us + $ref: "/schemas/types.yaml#/definitions/uint8" + enum: [ 0, 1, 2, 3 ] + default: 1 + + mps,buck-phase-delay: + description: | + defines the phase delay of this buck, must be one of the following + corresponding values 0deg, 90deg, 180deg, 270deg
Documentation/devicetree/bindings/regulator/mps,mpq7920.yaml line 144
Quoted 10 lines
Documentation/devicetree/bindings/regulator/mps,mpq7920.yaml new file +10
-0+ $ref: "/schemas/types.yaml#/definitions/uint8" + enum: [ 0, 1, 2, 3 ] + default: 1 + + mps,buck-ovp-disable: + description: | + disables over voltage protection of this buck + type: boolean + + ldortc:
Again, make this a pattern.
Quoted 13 lines
Documentation/devicetree/bindings/regulator/mps,mpq7920.yaml new file +13
-0+ $ref: "regulator.yaml#" + description: | + regulator with 0.65V-3.5875V for RTC, always enabled + + ldo2: + $ref: "regulator.yaml#" + description: | + regulator with 0.65V-3.5875V + + ldo3: + $ref: "regulator.yaml#" + description: | + regulator with 0.65V-3.5875V
Documentation/devicetree/bindings/regulator/mps,mpq7920.yaml line 167
Quoted 10 lines
Documentation/devicetree/bindings/regulator/mps,mpq7920.yaml new file +10
-0+ + ldo4: + $ref: "regulator.yaml#" + description: | + regulator with 0.65V-3.5875V + + ldo5: + $ref: "regulator.yaml#" + description: | + regulator with 0.65V-3.5875V
You need 'required' here listing compatible, reg, and regulators.
And then 'additionalProperties: false'
Quoted 38 lines
Documentation/devicetree/bindings/regulator/mps,mpq7920.yaml new file +35
-1+ +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + pmic@69 { + compatible = "mps,mpq7920"; + reg = <0x69>; + + regulators { + mps,switch-freq = <1>; + + buck1 { + regulator-name = "buck1"; + regulator-min-microvolt = <400000>; + regulator-max-microvolt = <3587500>; + regulator-min-microamp = <460000>; + regulator-max-microamp = <7600000>; + regulator-boot-on; + mps,buck-ovp-disable; + mps,buck-phase-delay = <2>; + mps,buck-softstart = <1>; + }; + + ldo2 { + regulator-name = "ldo2"; + regulator-min-microvolt = <650000>; + regulator-max-microvolt = <3587500>; + }; + }; + }; + }; +... --2.17.1
Mark Brown
maintainerRe: [PATCH v6 2/4] dt-bindings: regulator: add document bindings for mpq7920
Quoted 7 lines · Rob Herring
Quoted 2 lines · Saravanan Sekar
Add device tree binding information for mpq7920 regulator driver. Example bindings for mpq7920 are added.
Mark, Please revert this. Not even close to valid schema and my questions on v4 are unanswered.
OK... I didn't see any comments on V5.
Quoted 4 lines
Quoted 1 line
+ mps,switch-freq:
As I asked on v4, shouldn't this be a common property? Switching frequency is a common property for switching regulators, right?
It's not very common and where it's offered the valid values are generally highly constrained so I'm not sure it makes sense to do that, any device that does have this feature will want to specify the valid values for that particular device.
Saravanan Sekar
maintainerPATCH v6 3/4 regulator: mpq7920: add mpq7920 regulator driver
In reply to Saravanan SekarAdding 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.
Fixed sparse warning reported on this patch
--- drivers/regulator/Kconfig | 10 ++ drivers/regulator/Makefile | 1 + drivers/regulator/mpq7920.c | 346 ++++++++++++++++++++++++++++++++++++ drivers/regulator/mpq7920.h | 68 +++++++ 4 files changed, 425 insertions(+) create mode 100644 drivers/regulator/mpq7920.c create mode 100644 drivers/regulator/mpq7920.h
drivers/regulator/Kconfig +10 -0
@@ -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
@@ -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 +346 -0
346 lines not on this page · raw message
drivers/regulator/mpq7920.h new file +68 -0
68 lines not on this page · raw message
Signature · 1 line
2.17.1
Mark Brown
maintainerRe: [PATCH v6 3/4] regulator: mpq7920: add mpq7920 regulator driver
Quoted 3 lines · 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.
This doesn't apply against current code, please check and resend.
saravanan sekar
maintainerRe: [PATCH v6 3/4] regulator: mpq7920: add mpq7920 regulator driver
Quoted 5 lines · Mark Brown
Quoted 3 lines · 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.This doesn't apply against current code, please check and resend.
Means should I rebase this v6 patch to linux-next and send, or of_parse_cb callback changes as separate patch on top of v5?
Mark Brown
maintainerRe: [PATCH v6 3/4] regulator: mpq7920: add mpq7920 regulator driver
Quoted 2 lines · saravanan sekar
Means should I rebase this v6 patch to linux-next and send, or
of_parse_cbcallback changes as separate patch on top of v5?
Send based on -next, no need to resend the other patches which were already applied.
Saravanan Sekar
maintainerPATCH v6 4/4 MAINTAINERS: Add entry for mpq7920 PMIC driver
In reply to Saravanan SekarAdd MAINTAINERS entry for Monolithic Power Systems mpq7920 PMIC driver.
--- MAINTAINERS | 7 +++++++ 1 file changed, 7 insertions(+)
MAINTAINERS +7 -0
@@ -11143,6 +11143,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