regulator: pf530x: NXP PF530x regulator driver
Subsystems (3)
Woodrow Douglass
maintainercover regulator: pf530x: NXP PF530x regulator driver
I wrote this driver to read settings and state from the nxp pf530x regulator. Please consider it for inclusion, any criticism is welcome.
Thank you,
Woodrow Douglass
Woodrow Douglass (2):
regulator: pf530x: Add a driver for the NXP PF5300 Regulator
regulator: pf530x: dt-bindings: nxp,pf530x-regulator
.../regulator/nxp,pf530x-regulator.yaml | 74 ++++ MAINTAINERS | 6 + drivers/regulator/Kconfig | 12 + drivers/regulator/Makefile | 1 + drivers/regulator/pf530x-regulator.c | 328 ++++++++++++++++++ 5 files changed, 421 insertions(+) create mode 100644 Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml create mode 100644 drivers/regulator/pf530x-regulator.c
Signature · 1 line
2.39.5
Woodrow Douglass
maintainerPATCH 1/2 regulator: pf530x: Add a driver for the NXP PF5300 Regulator
This driver allows reading some regulator settings and adjusting output voltage. It is based on information from the datasheet at https://www.nxp.com/docs/en/data-sheet/PF5300.pdf
--- MAINTAINERS | 6 + drivers/regulator/Kconfig | 12 + drivers/regulator/Makefile | 1 + drivers/regulator/pf530x-regulator.c | 328 +++++++++++++++++++++++++++ 4 files changed, 347 insertions(+) create mode 100644 drivers/regulator/pf530x-regulator.c
MAINTAINERS +6 -0
@@ -18291,6 +18291,12 @@ F: Documentation/devicetree/bindings/clock/*imx* F: drivers/clk/imx/ F: include/dt-bindings/clock/*imx* +NXP PF5300/PF5301/PF5302 PMIC REGULATOR DEVICE DRIVER +M: Woodrow Douglass <[email protected]> +S: Maintained +F: Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml +F: drivers/regulator/pf530x-regulator.c + NXP PF8100/PF8121A/PF8200 PMIC REGULATOR DEVICE DRIVER M: Jagan Teki <[email protected]> S: Maintained
drivers/regulator/Kconfig +12 -0
@@ -1006,6 +1006,18 @@ config REGULATOR_PCAP This driver provides support for the voltage regulators of the PCAP2 PMIC. +config REGULATOR_PF530X + tristate "NXP PF5300/PF5301/PF5302 regulator driver" + depends on I2C && OF + select REGMAP_I2C + help + Say y here to support the regulators found on the NXP + PF5300/PF5301/PF5302 PMIC. + + Say M here if you want to support for the regulators found + on the NXP PF5300/PF5301/PF5302 PMIC. The module will be named + "pf530x-regulator". + config REGULATOR_PF8X00 tristate "NXP PF8100/PF8121A/PF8200 regulator driver" depends on I2C && OF
drivers/regulator/Makefile +1 -0
@@ -125,6 +125,7 @@ obj-$(CONFIG_REGULATOR_QCOM_USB_VBUS) += qcom_usb_vbus-regulator.o obj-$(CONFIG_REGULATOR_PALMAS) += palmas-regulator.o obj-$(CONFIG_REGULATOR_PCA9450) += pca9450-regulator.o obj-$(CONFIG_REGULATOR_PF9453) += pf9453-regulator.o +obj-$(CONFIG_REGULATOR_PF530X) += pf530x-regulator.o obj-$(CONFIG_REGULATOR_PF8X00) += pf8x00-regulator.o obj-$(CONFIG_REGULATOR_PFUZE100) += pfuze100-regulator.o obj-$(CONFIG_REGULATOR_PV88060) += pv88060-regulator.o
drivers/regulator/pf530x-regulator.c new file +328 -0
328 lines not on this page · raw message
Signature · 1 line
2.39.5
Woodrow Douglass
maintainerPATCH 2/2 regulator: pf530x: dt-bindings: nxp,pf530x-regulator
In reply to Woodrow DouglassBindings for the pf530x series of voltage regulators
--- .../regulator/nxp,pf530x-regulator.yaml | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml
Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml new file +74 -0
@@ -0,0 +1,74 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/regulator/nxp,pf530x-regulator.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NXP PF5300/PF5301/PF5302 PMIC regulators + +maintainers: + - Woodrow Douglass <[email protected]> + +description: | + The PF5300, PF5301, and PF5302 integrate high-performance buck converters, 12 A, 8 A, + and 15 A, respectively, to power high-end automotive and industrial processors. With adaptive + voltage positioning and a high-bandwidth loop, they offer transient regulation to minimize capacitor + requirements. + +properties: + compatible: + enum: + - nxp,pf5300 + - nxp,pf5301 + - nxp,pf5302 + + reg: + maxItems: 1 + + regulators: + type: object + description: | + list of regulators provided by this controller + + properties: + SW1: + type: object + $ref: regulator.yaml# + description: + Properties for the regulator. + + properties: + regulator-name: + pattern: "^SW1$" + description: + Name of the single regulator + + additionalProperties: false + +required: + - compatible + - reg + - regulators + +additionalProperties: false + +examples: + - | + i2c1 { + #address-cells = <1>; + #size-cells = <0>; + + vddi_0_75@28 { + compatible = "nxp,pf5302"; + reg = <0x28>; + + regulators { + SW1: SW1 { + regulator-always-on; + regulator-boot-on; + regulator-max-microvolt = <1200000>; + regulator-min-microvolt = <500000>; + }; + }; + }; + };
Signature · 1 line
2.39.5
Mark Brown
maintainerRe: [PATCH 1/2] regulator: pf530x: Add a driver for the NXP PF5300 Regulator
In reply to Woodrow DouglassQuoted 7 lines · Woodrow Douglass
obj-$(CONFIG_REGULATOR_PALMAS) += palmas-regulator.o obj-$(CONFIG_REGULATOR_PCA9450) += pca9450-regulator.o obj-$(CONFIG_REGULATOR_PF9453) += pf9453-regulator.o
+obj-$(CONFIG_REGULATOR_PF530X) += pf530x-regulator.o
obj-$(CONFIG_REGULATOR_PF8X00) += pf8x00-regulator.o obj-$(CONFIG_REGULATOR_PFUZE100) += pfuze100-regulator.o obj-$(CONFIG_REGULATOR_PV88060) += pv88060-regulator.o
I'd say please keep this sorted but there's some cleanup needed here already so whatever, let's deal with that separately.
drivers/regulator/pf530x-regulator.c line 96
Quoted 6 lines
drivers/regulator/pf530x-regulator.c new file +6
-0+static const struct regmap_config pf530x_regmap_config = { + .reg_bits =8 , + .val_bits =8 , + .max_register =PF530X_OTP_MODE , + .cache_type =REGCACHE_RBTREE , +};
In general it's better to use _MAPLE register caches unless you've got a good reason not to, the data structure is more modern.
drivers/regulator/pf530x-regulator.c line 100
Quoted 3 lines
drivers/regulator/pf530x-regulator.c new file +3
-0+static int pf530x_is_enabled (struct regulator_dev *rdev) +{ +//first get mode
Usual comment style would have a space after the //.
Review
Quoted 2 lines
(quoted diff) +2
-0+static int pf530x_get_status(struct regulator_dev *rdev) +{
I would have expected this function to check INT_SENSE1/2 for current error statuses and report those.
Quoted 1 line
+static int
pf530x_get_error_flags(struct regulator_dev *rdev, unsigned int *flags)
I see INT_STATUS2 has thermal warning/error interrupts in it as well. Not essential but it'd be nice to also check those. These statuses are also clear on write so I'd expect a write to clear them, even though the device lacks an actual interrupt line so it's all somewhat ornamantal ATM :/ I suppse we ought to implement some core thing to do polling for non-interrupting regulators, but that's definitely out of scope for this driver.
drivers/regulator/pf530x-regulator.c line 185
Quoted 4 lines
drivers/regulator/pf530x-regulator.c new file +4
-0+static const struct regulator_ops pf530x_regulator_ops = { + .enable = regulator_enable_regmap, + .disable = regulator_disable_regmap, + .is_enabled = pf530x_is_enabled,
The custom is_enabled() operation doesn't seem to line up with the generic regmap enable/disable operations, and we don't seem to have enable_val or disable_val in the regulator_desc which the generic ops expect. The whole connection with the modes seems a bit odd, the standby voltages look like they'd more naturally map to the regulator API's suspend mode but perhaps these devices are not usually integrated in that way and this would be controlled separately to system suspend.
drivers/regulator/pf530x-regulator.c line 255
Quoted 4 lines
drivers/regulator/pf530x-regulator.c new file +3
-0+static int pf530x_identify (struct pf530x_chip *chip) +{ +dev_info (chip->dev,"%s Regulator found.\n" , name);
It wouldn't hurt to read and log the data in REV, EMREV and PROG_ID too (it can be helpful when debugging).
Re: [PATCH 2/2] regulator: pf530x: dt-bindings: nxp,pf530x-regulator
In reply to Woodrow DouglassQuoted 5 lines · Woodrow Douglass
Bindings for the pf530x series of voltage regulators
Signed-off-by Woodrow Douglass <[email protected]>--- .../regulator/nxp,pf530x-regulator.yaml | 74 +++++++++++++++++++
<form letter>
Please use scripts/get_maintainers.pl to get a list of necessary people and lists to CC. It might happen, that command when run on an older kernel, gives you outdated entries. Therefore please be sure you base your patches on recent Linux kernel.
Tools like b4 or scripts/get_maintainer.pl provide you proper list of people, so fix your workflow. Tools might also fail if you work on some ancient tree (don't, instead use mainline) or work on fork of kernel (don't, instead use mainline). Just use b4 and everything should be fine, although remember about b4 prep --auto-to-cc if you added new patches to the patchset.
You missed at least devicetree list (maybe more), so this won't be tested by automated tooling. Performing review on untested code might be a waste of time.
Please kindly resend and include all necessary To/Cc entries. </form letter>
Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml
Quoted 8 lines
1 file changed, 74 insertions(+) create mode 100644 Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yamlDocumentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml new file +0
-0
Filename should match compatible, so nxp,pf5300.yaml.
Quoted 7 lines
Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml new file +6
-0@@ -0,0 +1,74 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/regulator/nxp,pf530x-regulator.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# +
Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml line 16
Quoted 10 lines
Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml new file +10
-0+title: NXP PF5300/PF5301/PF5302 PMIC regulators + +maintainers: + - Woodrow Douglass <[email protected]> + +description: | + The PF5300, PF5301, and PF5302 integrate high-performance buck converters, 12 A, 8 A, + and 15 A, respectively, to power high-end automotive and industrial processors. With adaptive + voltage positioning and a high-bandwidth loop, they offer transient regulation to minimize capacitor + requirements.
Wrap according to Linux coding style.
Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml line 23
Quoted 7 lines
Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml new file +7
-0+ +properties: + compatible: + enum: + - nxp,pf5300 + - nxp,pf5301 + - nxp,pf5302
Your driver clearly suggests these are compatible, so express it (see example schema).
Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml line 28
Quoted 5 lines
Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml new file +5
-0+ + reg: + maxItems: 1 + + regulators:
No need for this node.
Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml line 34
Quoted 6 lines
Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml new file +6
-0+ type: object + description: | + list of regulators provided by this controller + + properties: + SW1:
No need, drop the node.
Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml line 42
Quoted 8 lines
Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml new file +8
-0+ type: object + $ref: regulator.yaml# + description: + Properties for the regulator. + + properties: + regulator-name: + pattern: "^SW1$"
No, drop entirely regulator-name. Just embed the properties in parent node.
Quoted 5 lines
Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml new file +5
-0+ description: + Name of the single regulator + + additionalProperties: false +
Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml line 57
Quoted 10 lines
Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml new file +10
-0+required: + - compatible + - reg + - regulators + +additionalProperties: false + +examples: + - | + i2c1 {
i2c
Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml line 61
Quoted 4 lines
Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml new file +4
-0+ #address-cells = <1>; + #size-cells = <0>; + + vddi_0_75@28 {
Node names should be generic. See also an explanation and list of examples (not exhaustive) in DT specification:
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation
If you cannot find a name matching your device, please check in kernel sources for similar cases or you can grow the spec (via pull request to DT spec repo).
See also DTS coding style.
Best regards,
Krzysztof
Woodrow Douglass
maintainerv2 cover regulator: pf530x: NXP PF530x regulator driver
In reply to Woodrow DouglassI wrote this driver to read settings and state from the nxp pf530x regulator. Please consider it for inclusion, any criticism is welcome.
I am resubmitting this patchset with an expanded email list at the suggestion of Krzysztof Kozlowski. I will be incorporating suggestions by Krzysztof and Mark Brown in a new revision tomorrow. Thank you very much for your comments.
Thanks again,
Woodrow Douglass
Woodrow Douglass (2):
regulator: pf530x: Add a driver for the NXP PF5300 Regulator
regulator: pf530x: dt-bindings: nxp,pf530x-regulator
.../regulator/nxp,pf530x-regulator.yaml | 74 ++++ MAINTAINERS | 6 + drivers/regulator/Kconfig | 12 + drivers/regulator/Makefile | 1 + drivers/regulator/pf530x-regulator.c | 328 ++++++++++++++++++ 5 files changed, 421 insertions(+) create mode 100644 Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml create mode 100644 drivers/regulator/pf530x-regulator.c
--
2.39.5
---
Woodrow Douglass (2):
regulator: pf530x: Add a driver for the NXP PF5300 Regulator
regulator: pf530x: dt-bindings: nxp,pf530x-regulator.../bindings/regulator/nxp,pf530x-regulator.yaml | 74 +++++ MAINTAINERS | 6 + drivers/regulator/Kconfig | 12 + drivers/regulator/Makefile | 1 + drivers/regulator/pf530x-regulator.c | 328 +++++++++++++++++++++ 5 files changed, 421 insertions(+)
---
base-commit: b320789d6883cc00ac78ce83bccbfe7ed58afcf0
change-id: 20250902-pf530x-6db7b921120c
Best regards,
Signature · 1 line
Woodrow Douglass <[email protected]>
Woodrow Douglass
maintainerPATCH v2 2/2 regulator: pf530x: dt-bindings: nxp,pf530x-regulator
Bindings for the pf530x series of voltage regulators
--- .../bindings/regulator/nxp,pf530x-regulator.yaml | 74 ++++++++++++++++++++++ 1 file changed, 74 insertions(+)
Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml new file +74 -0
@@ -0,0 +1,74 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/regulator/nxp,pf530x-regulator.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NXP PF5300/PF5301/PF5302 PMIC regulators + +maintainers: + - Woodrow Douglass <[email protected]> + +description: | + The PF5300, PF5301, and PF5302 integrate high-performance buck converters, 12 A, 8 A, + and 15 A, respectively, to power high-end automotive and industrial processors. With adaptive + voltage positioning and a high-bandwidth loop, they offer transient regulation to minimize capacitor + requirements. + +properties: + compatible: + enum: + - nxp,pf5300 + - nxp,pf5301 + - nxp,pf5302 + + reg: + maxItems: 1 + + regulators: + type: object + description: | + list of regulators provided by this controller + + properties: + SW1: + type: object + $ref: regulator.yaml# + description: + Properties for the regulator. + + properties: + regulator-name: + pattern: "^SW1$" + description: + Name of the single regulator + + additionalProperties: false + +required: + - compatible + - reg + - regulators + +additionalProperties: false + +examples: + - | + i2c1 { + #address-cells = <1>; + #size-cells = <0>; + + vddi_0_75@28 { + compatible = "nxp,pf5302"; + reg = <0x28>; + + regulators { + SW1: SW1 { + regulator-always-on; + regulator-boot-on; + regulator-max-microvolt = <1200000>; + regulator-min-microvolt = <500000>; + }; + }; + }; + };
Signature · 1 line
2.39.5
Woodrow Douglass
maintainerPATCH v2 1/2 regulator: pf530x: Add a driver for the NXP PF5300 Regulator
In reply to Woodrow DouglassThis driver allows reading some regulator settings and adjusting output voltage. It is based on information from the datasheet at https://www.nxp.com/docs/en/data-sheet/PF5300.pdf
--- MAINTAINERS | 6 + drivers/regulator/Kconfig | 12 ++ drivers/regulator/Makefile | 1 + drivers/regulator/pf530x-regulator.c | 328 +++++++++++++++++++++++++++++++++++ 4 files changed, 347 insertions(+)
MAINTAINERS +6 -0
@@ -18291,6 +18291,12 @@ F: Documentation/devicetree/bindings/clock/*imx* F: drivers/clk/imx/ F: include/dt-bindings/clock/*imx* +NXP PF5300/PF5301/PF5302 PMIC REGULATOR DEVICE DRIVER +M: Woodrow Douglass <[email protected]> +S: Maintained +F: Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml +F: drivers/regulator/pf530x-regulator.c + NXP PF8100/PF8121A/PF8200 PMIC REGULATOR DEVICE DRIVER M: Jagan Teki <[email protected]> S: Maintained
drivers/regulator/Kconfig +12 -0
@@ -1006,6 +1006,18 @@ config REGULATOR_PCAP This driver provides support for the voltage regulators of the PCAP2 PMIC. +config REGULATOR_PF530X + tristate "NXP PF5300/PF5301/PF5302 regulator driver" + depends on I2C && OF + select REGMAP_I2C + help + Say y here to support the regulators found on the NXP + PF5300/PF5301/PF5302 PMIC. + + Say M here if you want to support for the regulators found + on the NXP PF5300/PF5301/PF5302 PMIC. The module will be named + "pf530x-regulator". + config REGULATOR_PF8X00 tristate "NXP PF8100/PF8121A/PF8200 regulator driver" depends on I2C && OF
drivers/regulator/Makefile +1 -0
@@ -125,6 +125,7 @@ obj-$(CONFIG_REGULATOR_QCOM_USB_VBUS) += qcom_usb_vbus-regulator.o obj-$(CONFIG_REGULATOR_PALMAS) += palmas-regulator.o obj-$(CONFIG_REGULATOR_PCA9450) += pca9450-regulator.o obj-$(CONFIG_REGULATOR_PF9453) += pf9453-regulator.o +obj-$(CONFIG_REGULATOR_PF530X) += pf530x-regulator.o obj-$(CONFIG_REGULATOR_PF8X00) += pf8x00-regulator.o obj-$(CONFIG_REGULATOR_PFUZE100) += pfuze100-regulator.o obj-$(CONFIG_REGULATOR_PV88060) += pv88060-regulator.o
drivers/regulator/pf530x-regulator.c new file +328 -0
328 lines not on this page · raw message
Signature · 1 line
2.39.5
Re: [PATCH v2 2/2] regulator: pf530x: dt-bindings: nxp,pf530x-regulator
In reply to Woodrow DouglassQuoted 7 lines · Woodrow Douglass
Bindings for the pf530x series of voltage regulators
Signed-off-by Woodrow Douglass <[email protected]>--- .../bindings/regulator/nxp,pf530x-regulator.yaml | 74 ++++++++++++++++++++++ 1 file changed, 74 insertions(+)
Nothing improved and you sent it AFTER you received my feedback.
Don't ignore the comments.
Do not attach (thread) your patchsets to some other threads (unrelated or older versions). This buries them deep in the mailbox and might interfere with applying entire sets.
<form letter>
This is a friendly reminder during the review process.
It seems my or other reviewer's previous comments were not fully addressed. Maybe the feedback got lost between the quotes, maybe you just forgot to apply it. Please go back to the previous discussion and either implement all requested changes or keep discussing them.
Thank you.
</form letter>
Best regards,
Krzysztof
Mark Brown
maintainerRe: [PATCH v2 2/2] regulator: pf530x: dt-bindings: nxp,pf530x-regulator
Quoted 5 lines · Krzysztof Kozlowski
Quoted 1 line · Woodrow Douglass
Bindings for the pf530x series of voltage regulators
Nothing improved and you sent it AFTER you received my feedback.
He said in the cover letter that he was resending copying in the lists as per your request and would follow up with another verision with the changes we both requested. Obviously it'd have been better to just send that version or at least tag this as a resend but I do understand the confusion.
Woodrow Douglass
maintainerPATCH v3 2/2 regulator: pf530x: dt-bindings: nxp,pf530x-regulator
In reply to Woodrow DouglassBindings for the pf530x series of voltage regulators
--- .../devicetree/bindings/regulator/nxp,pf5300.yaml | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+)
Documentation/devicetree/bindings/regulator/nxp,pf5300.yaml new file +52 -0
@@ -0,0 +1,52 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/regulator/nxp,pf530x-regulator.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: NXP PF5300/PF5301/PF5302 PMIC regulators + +maintainers: + - Woodrow Douglass <[email protected]> + +description: | + The PF5300, PF5301, and PF5302 integrate high-performance buck converters, + 12 A, 8 A, and 15 A, respectively, to power high-end automotive and industrial + processors. With adaptive voltage positioning and a high-bandwidth loop, they + offer transient regulation to minimize capacitor requirements. + +properties: + compatible: + enum: + - nxp,pf5300 + - nxp,pf5301 + - nxp,pf5302 + + reg: + maxItems: 1 + + additionalProperties: false + +required: + - compatible + - reg + - regulators + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + regulator@28 { + compatible = "nxp,pf5302"; + reg = <0x28>; + + regulator-always-on; + regulator-boot-on; + regulator-max-microvolt = <1200000>; + regulator-min-microvolt = <500000>; + }; + };
Signature · 1 line
2.39.5
Woodrow Douglass
maintainerv3 cover regulator: pf530x: NXP PF530x regulator driver
In reply to Woodrow DouglassAll,
Sorry for resubmitting the original patches, i thought that's what was wanted. I'm trying very hard not to break ettiquite here. Below are some responses to your earlier comments. Thank you.
Quoted 23 lines · Mark Brown
Quoted 7 lines · Woodrow Douglass
obj-$(CONFIG_REGULATOR_PALMAS) += palmas-regulator.o obj-$(CONFIG_REGULATOR_PCA9450) += pca9450-regulator.o obj-$(CONFIG_REGULATOR_PF9453) += pf9453-regulator.o
+obj-$(CONFIG_REGULATOR_PF530X) += pf530x-regulator.o
obj-$(CONFIG_REGULATOR_PF8X00) += pf8x00-regulator.o obj-$(CONFIG_REGULATOR_PFUZE100) += pfuze100-regulator.o obj-$(CONFIG_REGULATOR_PV88060) += pv88060-regulator.oI'd say please keep this sorted but there's some cleanup needed here already so whatever, let's deal with that separately.
Review
Quoted 6 lines
(quoted diff) +6
-0+static const struct regmap_config pf530x_regmap_config = { + .reg_bits = 8, + .val_bits = 8, + .max_register = PF530X_OTP_MODE, + .cache_type = REGCACHE_RBTREE, +};In general it's better to use
_MAPLEregister caches unless you've got a good reason not to, the data structure is more modern.
Quoted 6 lines
Review
Quoted 3 lines
(quoted diff) +3
-0+static int pf530x_is_enabled(struct regulator_dev *rdev) +{ + //first get modeUsual comment style would have a space after the //.
this exact comment got lost in the fallout of the regmap changes below, but i've fixed this issue elsewhere in the file, thanks.
Quoted 5 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+static int pf530x_get_status(struct regulator_dev *rdev) +{I would have expected this function to check INT_SENSE1/2 for current error statuses and report those.
I have added the INT_SENSE1 bits to the REGULATOR_STATUS_ERROR return value. I'm not sure how to properly represent the thermal bits in INT_SENSE2 here -- this part can safely run at high temperatures, some of those bits are just informational in some designs (including the board I'm working on now)
Quoted 11 lines
Quoted 2 lines
+static int
pf530x_get_error_flags(struct regulator_dev *rdev, unsigned int *flags)I see
INT_STATUS2has thermal warning/error interrupts in it as well. Not essential but it'd be nice to also check those. These statuses are also clear on write so I'd expect a write to clear them, even though the device lacks an actual interrupt line so it's all somewhat ornamantal ATM :/ I suppse we ought to implement some core thing to do polling for non-interrupting regulators, but that's definitely out of scope for this driver.
Quoted 12 lines
Review
Quoted 4 lines
(quoted diff) +4
-0+static const struct regulator_ops pf530x_regulator_ops = { + .enable = regulator_enable_regmap, + .disable = regulator_disable_regmap, + .is_enabled = pf530x_is_enabled,The custom
is_enabled()operation doesn't seem to line up with the generic regmap enable/disable operations, and we don't seem to haveenable_valordisable_valin theregulator_descwhich the generic ops expect. The whole connection with the modes seems a bit odd, the standby voltages look like they'd more naturally map to the regulator API's suspend mode but perhaps these devices are not usually integrated in that way and this would be controlled separately to system suspend.
I agree, I was misguided here. I've added enable_reg, enable_mask, enable_val, and disable_val to the regulator_desc initializer, and moved to the regmap function from helpers.c. I'm moving the "suspend mode" settings too here. The board i'm working with has the suspend pin grounded, so I can't really test suspend mode -- supporting that may have to wait for a future patchset.
Quoted 8 lines
Review
Quoted 5 lines
(quoted diff) +3
-0+static int pf530x_identify(struct pf530x_chip *chip) +{ + dev_info(chip->dev, "%s Regulator found.\n", name);It wouldn't hurt to read and log the data in REV, EMREV and
PROG_IDtoo (it can be helpful when debugging).
I've added REV and PROG_ID, EMREV is listed as "Reserved for NXP Internal Use" on page 95 of the datasheet, and -- I can include those bits here but i'm not sure they're very useful; if you'd like me to include those bits anyway i will
Quoted 60 lines · Krzysztof Kozlowski
Quoted 5 lines · Woodrow Douglass
Bindings for the pf530x series of voltage regulators
Signed-off-by Woodrow Douglass <[email protected]>--- .../regulator/nxp,pf530x-regulator.yaml | 74 +++++++++++++++++++<form letter>
Please usescripts/get_maintainers.plto get a list of necessary people and lists to CC. It might happen, that command when run on an older kernel, gives you outdated entries. Therefore please be sure you base your patches on recent Linux kernel.Tools like b4 or
scripts/get_maintainer.plprovide you proper list of people, so fix your workflow. Tools might also fail if you work on some ancient tree (don't, instead use mainline) or work on fork of kernel (don't, instead use mainline). Just use b4 and everything should be fine, although remember aboutb4 prep --auto-to-ccif you added new patches to the patchset.You missed at least devicetree list (maybe more), so this won't be tested by automated tooling. Performing review on untested code might be a waste of time.
Please kindly resend and include all necessary To/Cc entries. </form letter>
Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml
Quoted 8 lines
1 file changed, 74 insertions(+) create mode 100644 Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yamlDocumentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml new file +0
-0Filename should match compatible, so nxp,pf5300.yaml.
Quoted 7 lines
Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml new file +6
-0@@ -0,0 +1,74 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/regulator/nxp,pf530x-regulator.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# +Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml line 16
Quoted 10 lines
Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml new file +10
-0+title: NXP PF5300/PF5301/PF5302 PMIC regulators + +maintainers: + - Woodrow Douglass <[email protected]> + +description: | + The PF5300, PF5301, and PF5302 integrate high-performance buck converters, 12 A, 8 A, + and 15 A, respectively, to power high-end automotive and industrial processors. With adaptive + voltage positioning and a high-bandwidth loop, they offer transient regulation to minimize capacitor + requirements.Wrap according to Linux coding style.
Quoted 11 lines
Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml line 23
Quoted 7 lines
Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml new file +7
-0+ +properties: + compatible: + enum: + - nxp,pf5300 + - nxp,pf5301 + - nxp,pf5302Your driver clearly suggests these are compatible, so express it (see example schema).
I'm not sure I understand this comment. The difference in these parts is only the current limit, so the software interface is compatible -- should I only have a single "compatible" string (nxp,pf5300) and ignore the other two variants? Seems like it would limit searchability for future users of the driver, but maybe i'm not understanding what you're asking for here? I was following nxp,pf8x00-regulator.yaml as an example (I am also using that regulator in this design) and i guess it must be a bit dated.
Quoted 28 lines
Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml line 28
Quoted 5 lines
Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml new file +5
-0+ + reg: + maxItems: 1 + + regulators:No need for this node.
Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml line 34
Quoted 6 lines
Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml new file +6
-0+ type: object + description: | + list of regulators provided by this controller + + properties: + SW1:No need, drop the node.
Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml line 42
Quoted 8 lines
Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml new file +8
-0+ type: object + $ref: regulator.yaml# + description: + Properties for the regulator. + + properties: + regulator-name: + pattern: "^SW1$"No, drop entirely regulator-name. Just embed the properties in parent node.
Quoted 10 lines
Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml line 52
Quoted 10 lines
Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml new file +10
-0+ description: + Name of the single regulator + + additionalProperties: false + +required: + - compatible + - reg + - regulators +
I have removed the regulators node (and refactored the driver to not require it)
Quoted 13 lines
Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml line 57
Quoted 5 lines
Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml new file +5
-0+additionalProperties: false + +examples: + - | + i2c1 {i2c
Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml line 61
Quoted 4 lines
Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml new file +4
-0+ #address-cells = <1>; + #size-cells = <0>; + + vddi_0_75@28 {
Quoted 10 lines
Node names should be generic. See also an explanation and list of examples (not exhaustive) in DT specification:
https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation
If you cannot find a name matching your device, please check in kernel sources for similar cases or you can grow the spec (via pull request to DT spec repo).See also DTS coding style.
I have updated this example to be more generic.
Quoted 4 lines
Best regards,
Krzysztof
Thanks again,
Woodrow Douglass
--
2.39.5
---
Changes in v3:
- Replaced REGCACHE_RBTREE with REGCACHE_MAPLE
- Replaced pf530x_is_enabled function with regulator_is_enabled_regmap
- Added status bits from INT_SENSE1 to pf530x_get_status function
- Added extra context to info print upon chip identification
- Reworked devtree to not require nested "regulators" subnode
- Some minor reformatting of comment style and long lines
- Link to v2: https://lore.kernel.org/r/[email protected]
---
Woodrow Douglass (2):
regulator: pf530x: Add a driver for the NXP PF5300 Regulator
regulator: pf530x: dt-bindings: nxp,pf530x-regulator.../devicetree/bindings/regulator/nxp,pf5300.yaml | 52 +++ MAINTAINERS | 6 + drivers/regulator/Kconfig | 12 + drivers/regulator/Makefile | 1 + drivers/regulator/pf530x-regulator.c | 359 +++++++++++++++++++++ 5 files changed, 430 insertions(+)
---
base-commit: b320789d6883cc00ac78ce83bccbfe7ed58afcf0
change-id: 20250902-pf530x-6db7b921120c
Best regards,
Signature · 1 line
Woodrow Douglass <[email protected]>
Woodrow Douglass
maintainerPATCH v3 1/2 regulator: pf530x: Add a driver for the NXP PF5300 Regulator
This driver allows reading some regulator settings and adjusting output voltage. It is based on information from the datasheet at https://www.nxp.com/docs/en/data-sheet/PF5300.pdf
--- MAINTAINERS | 6 + drivers/regulator/Kconfig | 12 ++ drivers/regulator/Makefile | 1 + drivers/regulator/pf530x-regulator.c | 359 +++++++++++++++++++++++++++++++++++ 4 files changed, 378 insertions(+)
MAINTAINERS +6 -0
@@ -18291,6 +18291,12 @@ F: Documentation/devicetree/bindings/clock/*imx* F: drivers/clk/imx/ F: include/dt-bindings/clock/*imx* +NXP PF5300/PF5301/PF5302 PMIC REGULATOR DEVICE DRIVER +M: Woodrow Douglass <[email protected]> +S: Maintained +F: Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml +F: drivers/regulator/pf530x-regulator.c + NXP PF8100/PF8121A/PF8200 PMIC REGULATOR DEVICE DRIVER M: Jagan Teki <[email protected]> S: Maintained
drivers/regulator/Kconfig +12 -0
@@ -1006,6 +1006,18 @@ config REGULATOR_PCAP This driver provides support for the voltage regulators of the PCAP2 PMIC. +config REGULATOR_PF530X + tristate "NXP PF5300/PF5301/PF5302 regulator driver" + depends on I2C && OF + select REGMAP_I2C + help + Say y here to support the regulators found on the NXP + PF5300/PF5301/PF5302 PMIC. + + Say M here if you want to support for the regulators found + on the NXP PF5300/PF5301/PF5302 PMIC. The module will be named + "pf530x-regulator". + config REGULATOR_PF8X00 tristate "NXP PF8100/PF8121A/PF8200 regulator driver" depends on I2C && OF
drivers/regulator/Makefile +1 -0
@@ -125,6 +125,7 @@ obj-$(CONFIG_REGULATOR_QCOM_USB_VBUS) += qcom_usb_vbus-regulator.o obj-$(CONFIG_REGULATOR_PALMAS) += palmas-regulator.o obj-$(CONFIG_REGULATOR_PCA9450) += pca9450-regulator.o obj-$(CONFIG_REGULATOR_PF9453) += pf9453-regulator.o +obj-$(CONFIG_REGULATOR_PF530X) += pf530x-regulator.o obj-$(CONFIG_REGULATOR_PF8X00) += pf8x00-regulator.o obj-$(CONFIG_REGULATOR_PFUZE100) += pfuze100-regulator.o obj-$(CONFIG_REGULATOR_PV88060) += pv88060-regulator.o
drivers/regulator/pf530x-regulator.c new file +359 -0
359 lines not on this page · raw message
Signature · 1 line
2.39.5
Mark Brown
maintainerQuoted 9 lines · Woodrow Douglass
Quoted 7 lines · Mark Brown
Review
Quoted 2 lines · Woodrow Douglass
(quoted diff) +2
-0+static int pf530x_get_status(struct regulator_dev *rdev) +{I would have expected this function to check INT_SENSE1/2 for current error statuses and report those.
Quoted 4 lines
I have added the
INT_SENSE1bits to theREGULATOR_STATUS_ERRORreturn value. I'm not sure how to properly represent the thermal bits inINT_SENSE2here -- this part can safely run at high temperatures, some of those bits are just informational in some designs (including the board I'm working on now)
If the device can happily run at those levels then report as a warning.
Quoted 8 lines
Quoted 7 lines
The custom
is_enabled()operation doesn't seem to line up with the generic regmap enable/disable operations, and we don't seem to haveenable_valordisable_valin theregulator_descwhich the generic ops expect. The whole connection with the modes seems a bit odd, the standby voltages look like they'd more naturally map to the regulator API's suspend mode but perhaps these devices are not usually integrated in that way and this would be controlled separately to system suspend.
Quoted 5 lines
I agree, I was misguided here. I've added
enable_reg,enable_mask,enable_val, anddisable_valto theregulator_descinitializer, and moved to the regmap function fromhelpers.c. I'm moving the "suspend mode" settings too here. The board i'm working with has the suspend pin grounded, so I can't really test suspend mode -- supporting that may have to wait for a future patchset.
That's fine, someone can always extend the functionality later.
Quoted 11 lines
Quoted 7 lines
Review
Quoted 4 lines
(quoted diff) +3
-0+static int pf530x_identify(struct pf530x_chip *chip) +{ + dev_info(chip->dev, "%s Regulator found.\n", name);It wouldn't hurt to read and log the data in REV, EMREV and
PROG_IDtoo (it can be helpful when debugging).I've added REV and
PROG_ID, EMREV is listed as "Reserved for NXP Internal Use" on page 95 of the datasheet, and -- I can include those bits here but i'm not sure they're very useful; if you'd like me to include those bits anyway i will
IIRC something in there mentioned it was a metal revision which would make sense for the name. Given the name you may as well include them, worst case they just get ignored best case it helps someone debug some issue sometime.
Rob Herring (Arm)
maintainerRe: [PATCH v3 2/2] regulator: pf530x: dt-bindings: nxp,pf530x-regulator
In reply to Woodrow DouglassQuoted 7 lines · Woodrow Douglass
Bindings for the pf530x series of voltage regulators
Signed-off-by Woodrow Douglass <[email protected]>--- .../devicetree/bindings/regulator/nxp,pf5300.yaml | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+)
My bot found errors running 'make dt_binding_check' on your patch:
yamllint warnings/errors:
dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/regulator/nxp,pf5300.yaml: properties: 'additionalProperties' should not be valid under {'$ref': '#/definitions/json-schema-prop-names'}
hint: A json-schema keyword was found instead of a DT property name.
from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/regulator/nxp,pf5300.yaml: $id: Cannot determine base path from $id, relative path/filename doesn't match actual path or filename
$id: http://devicetree.org/schemas/regulator/nxp,pf530x-regulator.yaml
file: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/regulator/nxp,pf5300.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/regulator/nxp,pf5300.example.dtb: regulator@28 (nxp,pf5302): 'regulator-always-on', 'regulator-boot-on', 'regulator-max-microvolt', 'regulator-min-microvolt' do not match any of the regexes: '^pinctrl-[0-9]+$'
from schema $id: http://devicetree.org/schemas/regulator/nxp,pf530x-regulator.yaml# /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/regulator/nxp,pf5300.example.dtb: regulator@28 (nxp,pf5302): 'regulators' is a required property from schema $id: http://devicetree.org/schemas/regulator/nxp,pf530x-regulator.yaml#
doc reference errors (make refcheckdocs):
Warning: MAINTAINERS references a file that doesn't exist: Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yamlMAINTAINERS: Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yaml
See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]
The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.
Woody Douglass
maintainerRe: [PATCH v3 2/2] regulator: pf530x: dt-bindings: nxp,pf530x-regulator
Rob,
Thank you for pointing this out! I will rebase on the latest rc1 and run make dt_binding_check before submitting v5!
Thanks again,
Woodrow Douglass
Quoted 46 lines · Rob Herring (Arm)
Quoted 7 lines · Woodrow Douglass
Bindings for the pf530x series of voltage regulators
Signed-off-by Woodrow Douglass <[email protected]>--- .../devicetree/bindings/regulator/nxp,pf5300.yaml | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+)My bot found errors running 'make
dt_binding_check' on your patch:yamllint warnings/errors:
dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/regulator/nxp,pf5300.yaml: properties: 'additionalProperties' should not be valid under {'$ref': '#/definitions/json-schema-prop-names'}
hint: A json-schema keyword was found instead of a DT property name.
from schema $id: http://devicetree.org/meta-schemas/keywords.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/regulator/nxp,pf5300.yaml: $id: Cannot determine base path from $id, relative path/filename doesn't match actual path or filename(quoted diff) +0
-0$id: http://devicetree.org/schemas/regulator/nxp,pf530x-regulator.yaml file: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/regulator/nxp,pf5300.yaml/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/regulator/nxp,pf5300.example.dtb: regulator@28 (nxp,pf5302): 'regulator-always-on', 'regulator-boot-on', 'regulator-max-microvolt', 'regulator-min-microvolt' do not match any of the regexes: '^pinctrl-[0-9]+$'
from schema $id: http://devicetree.org/schemas/regulator/nxp,pf530x-regulator.yaml# /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/regulator/nxp,pf5300.example.dtb: regulator@28 (nxp,pf5302): 'regulators' is a required property from schema $id: http://devicetree.org/schemas/regulator/nxp,pf530x-regulator.yaml#doc reference errors (make refcheckdocs):
Warning:MAINTAINERSreferences a file that doesn't exist:Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yamlMAINTAINERS:Documentation/devicetree/bindings/regulator/nxp,pf530x-regulator.yamlSee https://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]
The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch.
If you already ran 'make
dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note that
DT_SCHEMA_FILEScan be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema.