Add regulator support for mpq7920
Subsystems (3)
Saravanan Sekar
maintainerv3 cover Add regulator support for mpq7920
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
.../bindings/regulator/mpq7920.yaml | 143 +++++++ .../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, 631 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
Saravanan Sekar
maintainerPATCH v3 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
Saravanan Sekar
maintainerPATCH v3 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/mpq7920.yaml | 143 ++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 Documentation/devicetree/bindings/regulator/mpq7920.yaml
Documentation/devicetree/bindings/regulator/mpq7920.yaml new file +143 -0
@@ -0,0 +1,143 @@ +# 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: "pmic@[0-9a-f]{1,2}" + compatible: + enum: + - mps,mpq7920 + + reg: + maxItems: 1 + + mps,time-slot: + 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 + allOf: + - $ref: "/schemas/types.yaml#/definitions/uint8" + - enum: [ 0, 1, 2, 3 ] + - default: 0 + + mps,fixed-on-time: + description: + select power on sequence with fixed time output delay mentioned in + time-slot reg for all the regulators. + type: boolean + + mps,fixed-off-time: + description: + select power off sequence with fixed time output delay mentioned in + time-slot reg for all the regulators. + type: boolean + + mps,inc-off-time: + 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. + allOf: + - $ref: "/schemas/types.yaml#/definitions/uint8-array" + - minimum: 0 + - maximum: 15 + - default: [ 0, 6, 0, 6, 7, 7, 7, 9 ] + + mps,inc-on-time: + 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. + allOf: + - $ref: "/schemas/types.yaml#/definitions/uint8-array" + - minimum: 0 + - maximum: 15 + - default: [ 0, 6, 0, 6, 7, 7, 7, 9 ] + + mps,switch-freq: + description: | + switching frequency must be one of following corresponding value + 1.1MHz, 1.65MHz, 2.2MHz, 2.75MHz + allOf: + - $ref: "/schemas/types.yaml#/definitions/uint8" + - enum: [ 0, 1, 2, 3 ] + - default: 2 + + mps,buck-softstart: + description: | + An array of 4 contains soft start time of each buck, must be one of + following corresponding values 150us, 300us, 610us, 920us + allOf: + - $ref: "/schemas/types.yaml#/definitions/uint8-array" + - enum: [ 0, 1, 2, 3 ] + - default: [ 1, 1, 1, 1 ] + + mps,buck-ovp: + description: | + An array of 4 contains over voltage protection of each buck, must be + one of above values + allOf: + - $ref: "/schemas/types.yaml#/definitions/uint8-array" + - enum: [ 0, 1 ] + - default: [ 1, 1, 1, 1 ] + + mps,buck-phase-delay: + description: | + An array of 4 contains phase delay of each buck must be one of above values + corresponding to 0deg, 90deg, 180deg, 270deg + allOf: + - $ref: "/schemas/types.yaml#/definitions/uint8-array" + - enum: [ 0, 1, 2, 3 ] + - default: [ 0, 0, 1, 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 + + +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
Re: [PATCH v3 2/4] dt-bindings: regulator: add document bindings for mpq7920
Quoted 47 lines · Saravanan Sekar
Add device tree binding information for mpq7920 regulator driver. Example bindings for mpq7920 are added.
Signed-off-by Saravanan Sekar <[email protected]>--- .../bindings/regulator/mpq7920.yaml | 143 ++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 Documentation/devicetree/bindings/regulator/mpq7920.yamlDocumentation/devicetree/bindings/regulator/mpq7920.yaml new file +32
-0@@ -0,0 +1,143 @@ +# 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: "pmic@[0-9a-f]{1,2}" + compatible: + enum: + - mps,mpq7920 + + reg: + maxItems: 1 + + mps,time-slot: + 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 + allOf: + - $ref: "/schemas/types.yaml#/definitions/uint8" + - enum: [ 0, 1, 2, 3 ] + - default: 0 + + mps,fixed-on-time:
Documentation/devicetree/bindings/regulator/mpq7920.yaml line 42
Quoted 10 lines
Documentation/devicetree/bindings/regulator/mpq7920.yaml new file +10
-0+ description: + select power on sequence with fixed time output delay mentioned in + time-slot reg for all the regulators. + type: boolean + + mps,fixed-off-time: + description: + select power off sequence with fixed time output delay mentioned in + time-slot reg for all the regulators. + type: boolean
I'm not sure what this fixed-on-time and fixed-off-time property is supposed to be doing. Why not just get rid of the time slot property, and set the power on / power off time in fixed-on-time / fixed-off-time property?
Documentation/devicetree/bindings/regulator/mpq7920.yaml line 53
Quoted 10 lines
Documentation/devicetree/bindings/regulator/mpq7920.yaml new file +10
-0+ mps,inc-off-time: + 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. + allOf: + - $ref: "/schemas/types.yaml#/definitions/uint8-array" + - minimum: 0 + - maximum: 15 + - default: [ 0, 6, 0, 6, 7, 7, 7, 9 ]
You should check the size of the array too, but if it's a property of the regulators, why not have it in the regulators node?
Quoted 44 lines
Documentation/devicetree/bindings/regulator/mpq7920.yaml new file +44
-0+ mps,inc-on-time: + 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. + allOf: + - $ref: "/schemas/types.yaml#/definitions/uint8-array" + - minimum: 0 + - maximum: 15 + - default: [ 0, 6, 0, 6, 7, 7, 7, 9 ] + + mps,switch-freq: + description: | + switching frequency must be one of following corresponding value + 1.1MHz, 1.65MHz, 2.2MHz, 2.75MHz + allOf: + - $ref: "/schemas/types.yaml#/definitions/uint8" + - enum: [ 0, 1, 2, 3 ] + - default: 2 + + mps,buck-softstart: + description: | + An array of 4 contains soft start time of each buck, must be one of + following corresponding values 150us, 300us, 610us, 920us + allOf: + - $ref: "/schemas/types.yaml#/definitions/uint8-array" + - enum: [ 0, 1, 2, 3 ] + - default: [ 1, 1, 1, 1 ] + + mps,buck-ovp: + description: | + An array of 4 contains over voltage protection of each buck, must be + one of above values + allOf: + - $ref: "/schemas/types.yaml#/definitions/uint8-array" + - enum: [ 0, 1 ] + - default: [ 1, 1, 1, 1 ] + + mps,buck-phase-delay: + description: | + An array of 4 contains phase delay of each buck must be one of above values + corresponding to 0deg, 90deg, 180deg, 270deg + allOf: + - $ref: "/schemas/types.yaml#/definitions/uint8-array"
Documentation/devicetree/bindings/regulator/mpq7920.yaml line 108
Quoted 10 lines
Documentation/devicetree/bindings/regulator/mpq7920.yaml new file +10
-0+ - enum: [ 0, 1, 2, 3 ] + - default: [ 0, 0, 1, 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
For the third times now, the names should be validated using propertyNames.
Maxime
Quoted 1 line
saravanan sekar
maintainerRe: [PATCH v3 2/4] dt-bindings: regulator: add document bindings for mpq7920
Quoted 51 lines · Maxime Ripard
Quoted 50 lines · Saravanan Sekar
Add device tree binding information for mpq7920 regulator driver. Example bindings for mpq7920 are added.
Signed-off-by Saravanan Sekar <[email protected]>--- .../bindings/regulator/mpq7920.yaml | 143 ++++++++++++++++++ 1 file changed, 143 insertions(+)create mode 100644
Documentation/devicetree/bindings/regulator/mpq7920.yamlDocumentation/devicetree/bindings/regulator/mpq7920.yaml new file +35
-0@@ -0,0 +1,143 @@ +# 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: "pmic@[0-9a-f]{1,2}" + compatible: + enum: + - mps,mpq7920 + + reg: + maxItems: 1 + + mps,time-slot: + 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 + allOf: + - $ref: "/schemas/types.yaml#/definitions/uint8" + - enum: [ 0, 1, 2, 3 ] + - default: 0 + + mps,fixed-on-time: + description: + select power on sequence with fixed time output delay mentioned in + time-slot reg for all the regulators.
Quoted 8 lines
Documentation/devicetree/bindings/regulator/mpq7920.yaml line 42
Quoted 7 lines
Documentation/devicetree/bindings/regulator/mpq7920.yaml new file +7
-0+ type: boolean + + mps,fixed-off-time: + description: + select power off sequence with fixed time output delay mentioned in + time-slot reg for all the regulators. + type: booleanI'm not sure what this fixed-on-time and fixed-off-time property is
the time slot register holds the time interval of Vout when enable the each regulator.
fixed-on-time property is to specify each regulator shares same time interval mention in time slot register.
variable on-time defines the factor or multiples of value in time slot register.
Quoted 3 lines
supposed to be doing. Why not just get rid of the time slot property, and set the power on / power off time in fixed-on-time / fixed-off-time property?
1. if fixed-on-time is needed with default time slot register settings, then time slot property is not needed
2. if variable time is needed with modified time slot, then both variable time factor & time slot property is needed,
Hope above explanations answers the necessary of all the above property
Quoted 11 lines
Documentation/devicetree/bindings/regulator/mpq7920.yaml line 53
Quoted 11 lines
Documentation/devicetree/bindings/regulator/mpq7920.yaml new file +10
-0+ mps,inc-off-time: + 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. + allOf: + - $ref: "/schemas/types.yaml#/definitions/uint8-array" + - minimum: 0 + - maximum: 15 + - default: [ 0, 6, 0, 6, 7, 7, 7, 9 ]
Quoted 2 lines
You should check the size of the array too, but if it's a property of the regulators, why not have it in the regulators node?
the node regulators & sub-node of regulators are parsed (initdata) by regulator framework during regulator registration,
so it would be redundant parsing all the node if mentioned under each regulator node and this is optional. If you still not convinced I will change.
Quoted 48 lines
Quoted 48 lines
Documentation/devicetree/bindings/regulator/mpq7920.yaml new file +48
-0+ mps,inc-on-time: + 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. + allOf: + - $ref: "/schemas/types.yaml#/definitions/uint8-array" + - minimum: 0 + - maximum: 15 + - default: [ 0, 6, 0, 6, 7, 7, 7, 9 ] + + mps,switch-freq: + description: | + switching frequency must be one of following corresponding value + 1.1MHz, 1.65MHz, 2.2MHz, 2.75MHz + allOf: + - $ref: "/schemas/types.yaml#/definitions/uint8" + - enum: [ 0, 1, 2, 3 ] + - default: 2 + + mps,buck-softstart: + description: | + An array of 4 contains soft start time of each buck, must be one of + following corresponding values 150us, 300us, 610us, 920us + allOf: + - $ref: "/schemas/types.yaml#/definitions/uint8-array" + - enum: [ 0, 1, 2, 3 ] + - default: [ 1, 1, 1, 1 ] + + mps,buck-ovp: + description: | + An array of 4 contains over voltage protection of each buck, must be + one of above values + allOf: + - $ref: "/schemas/types.yaml#/definitions/uint8-array" + - enum: [ 0, 1 ] + - default: [ 1, 1, 1, 1 ] + + mps,buck-phase-delay: + description: | + An array of 4 contains phase delay of each buck must be one of above values + corresponding to 0deg, 90deg, 180deg, 270deg + allOf: + - $ref: "/schemas/types.yaml#/definitions/uint8-array" + - enum: [ 0, 1, 2, 3 ] + - default: [ 0, 0, 1, 1 ] + + regulators:
Quoted 8 lines
Documentation/devicetree/bindings/regulator/mpq7920.yaml line 108
Quoted 6 lines
Documentation/devicetree/bindings/regulator/mpq7920.yaml new file +6
-0+ 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, ldo5For the third times now, the names should be validated using propertyNames.
Not sure did I understand your question correctly. all the node name under regulators node are parsed by regulator framework & validated against
name in regulator descriptors.
Quoted 2 lines
Maxime
Thanks,
Saravanan
Quoted 134 lines · Maxime Ripard
Quoted 47 lines · Saravanan Sekar
Add device tree binding information for mpq7920 regulator driver. Example bindings for mpq7920 are added.
Signed-off-by Saravanan Sekar <[email protected]>--- .../bindings/regulator/mpq7920.yaml | 143 ++++++++++++++++++ 1 file changed, 143 insertions(+)create mode 100644
Documentation/devicetree/bindings/regulator/mpq7920.yamlDocumentation/devicetree/bindings/regulator/mpq7920.yaml new file +32
-0@@ -0,0 +1,143 @@ +# 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: "pmic@[0-9a-f]{1,2}" + compatible: + enum: + - mps,mpq7920 + + reg: + maxItems: 1 + + mps,time-slot: + 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 + allOf: + - $ref: "/schemas/types.yaml#/definitions/uint8" + - enum: [ 0, 1, 2, 3 ] + - default: 0 + + mps,fixed-on-time:Documentation/devicetree/bindings/regulator/mpq7920.yaml line 42
Quoted 10 lines
Documentation/devicetree/bindings/regulator/mpq7920.yaml new file +10
-0+ description: + select power on sequence with fixed time output delay mentioned in + time-slot reg for all the regulators. + type: boolean + + mps,fixed-off-time: + description: + select power off sequence with fixed time output delay mentioned in + time-slot reg for all the regulators. + type: booleanI'm not sure what this fixed-on-time and fixed-off-time property is supposed to be doing. Why not just get rid of the time slot property, and set the power on / power off time in fixed-on-time / fixed-off-time property?
Documentation/devicetree/bindings/regulator/mpq7920.yaml line 53
Quoted 10 lines
Documentation/devicetree/bindings/regulator/mpq7920.yaml new file +10
-0+ mps,inc-off-time: + 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. + allOf: + - $ref: "/schemas/types.yaml#/definitions/uint8-array" + - minimum: 0 + - maximum: 15 + - default: [ 0, 6, 0, 6, 7, 7, 7, 9 ]You should check the size of the array too, but if it's a property of the regulators, why not have it in the regulators node?
Quoted 44 lines
Documentation/devicetree/bindings/regulator/mpq7920.yaml new file +44
-0+ mps,inc-on-time: + 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. + allOf: + - $ref: "/schemas/types.yaml#/definitions/uint8-array" + - minimum: 0 + - maximum: 15 + - default: [ 0, 6, 0, 6, 7, 7, 7, 9 ] + + mps,switch-freq: + description: | + switching frequency must be one of following corresponding value + 1.1MHz, 1.65MHz, 2.2MHz, 2.75MHz + allOf: + - $ref: "/schemas/types.yaml#/definitions/uint8" + - enum: [ 0, 1, 2, 3 ] + - default: 2 + + mps,buck-softstart: + description: | + An array of 4 contains soft start time of each buck, must be one of + following corresponding values 150us, 300us, 610us, 920us + allOf: + - $ref: "/schemas/types.yaml#/definitions/uint8-array" + - enum: [ 0, 1, 2, 3 ] + - default: [ 1, 1, 1, 1 ] + + mps,buck-ovp: + description: | + An array of 4 contains over voltage protection of each buck, must be + one of above values + allOf: + - $ref: "/schemas/types.yaml#/definitions/uint8-array" + - enum: [ 0, 1 ] + - default: [ 1, 1, 1, 1 ] + + mps,buck-phase-delay: + description: | + An array of 4 contains phase delay of each buck must be one of above values + corresponding to 0deg, 90deg, 180deg, 270deg + allOf: + - $ref: "/schemas/types.yaml#/definitions/uint8-array"Documentation/devicetree/bindings/regulator/mpq7920.yaml line 108
Quoted 10 lines
Documentation/devicetree/bindings/regulator/mpq7920.yaml new file +10
-0+ - enum: [ 0, 1, 2, 3 ] + - default: [ 0, 0, 1, 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, ldo5For the third times now, the names should be validated using propertyNames.
Maxime
Mark Brown
maintainerRe: [PATCH v3 2/4] dt-bindings: regulator: add document bindings for mpq7920
Quoted 9 lines · saravanan sekar
Quoted 7 lines · Maxime Ripard
Quoted 5 lines · Saravanan Sekar
Documentation/devicetree/bindings/regulator/mpq7920.yaml new file +5
-0+ mps,fixed-off-time: + description: + select power off sequence with fixed time output delay mentioned in + time-slot reg for all the regulators. + type: boolean
Quoted 8 lines
Quoted 1 line
I'm not sure what this fixed-on-time and fixed-off-time property is
the time slot register holds the time interval of Vout when enable the each regulator.
fixed-on-time property is to specify each regulator shares same time interval mention in time slot register.
variable on-time defines the factor or multiples of value in time slot register.
This really isn't very clear from the bindings document. You need an explanation like the above in there.
Quoted 9 lines
Quoted 3 lines
supposed to be doing. Why not just get rid of the time slot property, and set the power on / power off time in fixed-on-time / fixed-off-time property?
1. if fixed-on-time is needed with default time slot register settings, then time slot property is not needed
2. if variable time is needed with modified time slot, then both variable time factor & time slot property is needed,
Hope above explanations answers the necessary of all the above property
Same here, though I'm still a bit unclear about what "needed with modified time slot" means.
Quoted 8 lines
Quoted 7 lines
Quoted 7 lines
Documentation/devicetree/bindings/regulator/mpq7920.yaml new file +7
-0+ 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
Quoted 7 lines
Quoted 2 lines
For the third times now, the names should be validated using propertyNames.
Not sure did I understand your question correctly. all the node name under regulators node are parsed by regulator framework & validated against
name in regulator descriptors.
That validates at kernel runtime but doesn't let bindings validation at the time the DTS is built verify things, Maxime is asking you to spell things out in the DT binding document so the DT can be validated independently of the kernel.
Re: [PATCH v3 2/4] dt-bindings: regulator: add document bindings for mpq7920
In reply to saravanan sekarQuoted 10 lines · saravanan sekar
Quoted 10 lines
Quoted 10 lines
Documentation/devicetree/bindings/regulator/mpq7920.yaml new file +10
-0+ mps,inc-off-time: + 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. + allOf: + - $ref: "/schemas/types.yaml#/definitions/uint8-array" + - minimum: 0 + - maximum: 15 + - default: [ 0, 6, 0, 6, 7, 7, 7, 9 ]
Quoted 8 lines
Quoted 2 lines
You should check the size of the array too, but if it's a property of the regulators, why not have it in the regulators node?
the node regulators & sub-node of regulators are parsed (initdata) by regulator framework during regulator registration,
so it would be redundant parsing all the node if mentioned under each regulator node and this is optional. If you still not convinced I will change.
It's not really redundant, since the regulator framework will ignore whatever custom property you would put there, and your driver would ignore any generic property in those nodes.
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Documentation/devicetree/bindings/regulator/mpq7920.yaml new file +7
-0+ 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
Quoted 7 lines
Quoted 2 lines
For the third times now, the names should be validated using propertyNames.
Not sure did I understand your question correctly. all the node name under regulators node are parsed by regulator framework & validated against
name in regulator descriptors.
Yes, and the point of the bindings in YAML is to make sure all the constraints we might have can be catched at compilation / validation time.
The names of the nodes are a constraint, and propertyNames allows you to express it.
Maxime
Saravanan Sekar
maintainerPATCH v3 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.
--- 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
@@ -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 +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
kbuild test robot
build botRe: [PATCH v3 3/4] regulator: mpq7920: add mpq7920 regulator driver
Thank you for the patch! Perhaps something to improve:
Hi Saravanan,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on regulator/for-next]
[also build test WARNING on robh/for-next linus/master v5.5-rc3 next-20191220] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Saravanan-Sekar/Add-regulator-support-for-mpq7920/20191225-005026 base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator.git for-next reproduce: # apt-get install sparse # sparse version: v0.6.1-129-g341daf20-dirty make ARCH=x86_64 allmodconfig make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
If you fix the issue, kindly add following tag
sparse warnings: (new ones prefixed by >>)
>> drivers/regulator/mpq7920.c:339:44: sparse: sparse: Using plain integer as NULL pointer >> drivers/regulator/mpq7920.c:317:21: sparse: sparse: incorrect type in assignment (different modifiers) >> drivers/regulator/mpq7920.c:317:21: sparse: expected struct regulator_ops *ops >> drivers/regulator/mpq7920.c:317:21: sparse: got struct regulator_ops const *ops
vim +339 drivers/regulator/mpq7920.c
306
307 static inline int mpq7920_regulator_register(
308 struct mpq7920_regulator_info *info,
309 struct regulator_config *config)
310 {
311 int i;
312 struct regulator_desc *rdesc;
313 struct regulator_ops *ops;
314
315 for (i = 0; i < MPQ7920_MAX_REGULATORS; i++) {
316 rdesc = &info->rdesc[i];
> 317 ops = rdesc->ops;
318 if (rdesc->curr_table) {
319 ops->get_current_limit =
320 regulator_get_current_limit_regmap;
321 ops->set_current_limit =
322 regulator_set_current_limit_regmap;
323 }
324
325 info->rdev[i] = devm_regulator_register(info->dev, rdesc,
326 config);
327 if (IS_ERR(info->rdev))
328 return PTR_ERR(info->rdev);
329 }
330
331 return 0;
332 }
333
334 static int mpq7920_i2c_probe(struct i2c_client *client,
335 const struct i2c_device_id *id)
336 {
337 struct device *dev = &client->dev;
338 struct mpq7920_regulator_info *info;
> 339 struct regulator_config config = { 0 }; 340 struct regmap *regmap;
341 int ret;
342
343 info = devm_kzalloc(dev, sizeof(struct mpq7920_regulator_info),
344 GFP_KERNEL);
345 if (!info)
346 return -ENOMEM;
347
348 info->dev = dev;
349 info->rdesc = mpq7920_regulators_desc;
350 regmap = devm_regmap_init_i2c(client, &mpq7920_regmap_config);
351 if (IS_ERR(regmap)) {
352 dev_err(dev, "Failed to allocate regmap!\n");
353 return PTR_ERR(regmap);
354 }
355
356 i2c_set_clientdata(client, info);
357 info->regmap = regmap;
358 if (client->dev.of_node)
359 mpq7920_parse_dt(&client->dev, info);
360
361 config.dev = info->dev;
362 config.regmap = regmap;
363 config.driver_data = info;
364
365 ret = mpq7920_regulator_register(info, &config);
366 if (ret < 0)
367 dev_err(dev, "Failed to register regulator!\n");
368
369 return ret;
370 }
371
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/[email protected] Intel Corporation
Saravanan Sekar
maintainerPATCH v3 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
@@ -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