Skip to contentSkip to conversation

regulator: support the HiSilicon STB PMOC voltage rails

PATCH In review David Yang 4 participants 9 messages Oct 9 – Oct 19

Subsystems (2)
lore
Share & tools
lore

David Yang

author
#0 lore raw

v2 cover regulator: support the HiSilicon STB PMOC voltage rails

HiSilicon STB SoCs regulate their CPU and core supplies with PWM outputs of the PMOC block feeding an external converter on the board. This adds the binding for those registers and a driver for them.

v2:
- naming and doc changes
v1: https://lore.kernel.org/r/[email protected]

David Yang (2):
regulator: dt-bindings: add hi3798cv200 regulator
regulator: histb: add voltage regulator driver

 .../hisilicon,hi3798cv200-regulator.yaml      |  48 ++++++
 MAINTAINERS                                   |   7 +
 drivers/regulator/Kconfig                     |   7 +
 drivers/regulator/Makefile                    |   1 +
 drivers/regulator/histb-regulator.c           | 162 ++++++++++++++++++
 5 files changed, 225 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/hisilicon,hi3798cv200-regulator.yaml
 create mode 100644 drivers/regulator/histb-regulator.c
Signature · 1 line
2.53.0
author
#1 lore raw

PATCH v2 1/2 regulator: dt-bindings: add hi3798cv200 regulator

The PMOC block of the HiSilicon STB SoCs (Hi3798cv200/mv100/mv200) drives an external converter with a PWM signal. Add dt-binding doc.

---
 .../hisilicon,hi3798cv200-regulator.yaml      | 48 +++++++++++++++++++
 1 file changed, 48 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/hisilicon,hi3798cv200-regulator.yaml
Documentation/devicetree/bindings/regulator/hisilicon,hi3798cv200-regulator.yaml new file +48 -0
new file mode 100644
index 000000000000..812d94aca1f5
@@ -0,0 +1,48 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/hisilicon,hi3798cv200-regulator.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: HiSilicon STB voltage regulator
+
+maintainers:
+  - David Yang <[email protected]>
+
+description: |
+  HiSilicon STB SoCs (Hi3798cv200/mv100/mv200) provide PWM outputs in the PMOC
+  block which drive an external converter.
+
+  The voltage range depends on the board design: reference designs specify
+  0.65 V to 1.15 V for the Hi3798cv200, and 0.7 V to 1.25 V for the Hi3798mv200;
+  a customized board has to figure out its own. The regulator itself has no
+  other source of calibration.
+
+properties:
+  compatible:
+    const: hisilicon,hi3798cv200-regulator
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - regulator-min-microvolt
+  - regulator-max-microvolt
+
+allOf:
+  - $ref: regulator.yaml#
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    vddcpu: regulator@8a23018 {
+        compatible = "hisilicon,hi3798cv200-regulator";
+        reg = <0x8a23018 0x4>;
+        regulator-name = "vdd-cpu";
+        regulator-min-microvolt = <650000>;
+        regulator-max-microvolt = <1150000>;
+        regulator-always-on;
+    };
Signature · 1 line
2.53.0
#2 lore raw

Re: [PATCH v2 1/2] regulator: dt-bindings: add hi3798cv200 regulator

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [High] dt-bindings: regulator: missing hardware calibration properties causes overvoltage - [Medium]…

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] dt-bindings: regulator: missing hardware calibration properties causes overvoltage
- [Medium] dt-bindings: compatible restricts to single SoC despite supporting multiple variants --

commit e41927e1676c51346b08990a591c57b883a2a88d
Author: David Yang <[email protected]>

regulator: dt-bindings: add hi3798cv200 regulator

The PMOC block of the HiSilicon STB SoCs (Hi3798cv200/mv100/mv200) drives an external converter with a PWM signal. Add dt-binding doc.

Quoted 5 lines
Documentation/devicetree/bindings/regulator/hisilicon,hi3798cv200-regulator.yaml new file +0 -0
new file mode 100644
index 0000000000000..812d94aca1f59

[ ... ]

Documentation/devicetree/bindings/regulator/hisilicon,hi3798cv200-regulator.yaml line 23

Quoted 12 lines
Documentation/devicetree/bindings/regulator/hisilicon,hi3798cv200-regulator.yaml new file +12 -0
+description: |
+  HiSilicon STB SoCs (Hi3798cv200/mv100/mv200) provide PWM outputs in the PMOC
+  block which drive an external converter.
+
+  The voltage range depends on the board design: reference designs specify
+  0.65 V to 1.15 V for the Hi3798cv200, and 0.7 V to 1.25 V for the Hi3798mv200;
+  a customized board has to figure out its own. The regulator itself has no
+  other source of calibration.
+
+properties:
+  compatible:
+    const: hisilicon,hi3798cv200-regulator

[Severity: Medium]
Will this strict constraint reject device trees for the other supported SoCs?

The description explicitly mentions support for multiple HiSilicon STB SoCs (Hi3798cv200/mv100/mv200) which have different voltage reference designs. However, restricting the compatible property to a single exact value (hisilicon,hi3798cv200-regulator) rejects device trees that use SoC-specific compatible strings (e.g., hisilicon,hi3798mv200-regulator) or fallback lists.

This prevents the proper representation of the other supported hardware variants without failing schema validation (dt_binding_check).

Quoted 4 lines
Documentation/devicetree/bindings/regulator/hisilicon,hi3798cv200-regulator.yaml new file +4 -0
+
+  reg:
+    maxItems: 1
+

Documentation/devicetree/bindings/regulator/hisilicon,hi3798cv200-regulator.yaml line 37

Quoted 10 lines
Documentation/devicetree/bindings/regulator/hisilicon,hi3798cv200-regulator.yaml new file +10 -0
+required:
+  - compatible
+  - reg
+  - regulator-min-microvolt
+  - regulator-max-microvolt
+
+allOf:
+  - $ref: regulator.yaml#
+
+unevaluatedProperties: false

[Severity: High]
Does the lack of hardware calibration properties here cause overvoltage in the driver?

By not including properties to describe the physical hardware bounds (e.g., duty-cycle mappings or pwm-regulator integration), strict validation prevents defining these board-specific calibration values in the device tree.

As a result, the follow-up commit "regulator: histb: add voltage regulator driver" relies on the standard OS policy constraints (regulator-min-microvolt and regulator-max-microvolt) as physical 100% and 0% duty cycle calibration boundaries:

drivers/regulator/histb-regulator.c:histb_regulator_probe() {
    ...
	priv->min_uV = init_data->constraints.min_uV;
	priv->max_uV = init_data->constraints.max_uV;
    ...
}

If a device tree author specifies a tighter policy constraint to protect hardware (e.g., a maximum of 1.0V when the physical maximum is 1.15V), a legitimate request for 1.0V outputs a 0% duty cycle:

drivers/regulator/histb-regulator.c:histb_regulator_set_voltage() {
    ...
	if (min_uV >= priv->max_uV)
		duty = 0;
    ...
}

This configures the hardware to physically deliver the unconstrained maximum of 1.15V, completely bypassing the intended safety bounds and potentially damaging connected components.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
author
#3 lore raw

Re: [PATCH v2 1/2] regulator: dt-bindings: add hi3798cv200 regulator

Quoted 11 lines · On Sat, Oct 10, 2026 at 5:52 AM <[email protected]> wrote:

[Severity: Medium]
Will this strict constraint reject device trees for the other supported SoCs?

The description explicitly mentions support for multiple HiSilicon STB SoCs (Hi3798cv200/mv100/mv200) which have different voltage reference designs. However, restricting the compatible property to a single exact value (hisilicon,hi3798cv200-regulator) rejects device trees that use SoC-specific compatible strings (e.g., hisilicon,hi3798mv200-regulator) or fallback lists.

This prevents the proper representation of the other supported hardware variants without failing schema validation (dt_binding_check).

No intend to introduce more compatibles; follows
hisilicon,hi3798cv200-pcie conventions.

Quoted 31 lines

[Severity: High]
Does the lack of hardware calibration properties here cause overvoltage in the driver?

By not including properties to describe the physical hardware bounds (e.g., duty-cycle mappings or pwm-regulator integration), strict validation prevents defining these board-specific calibration values in the device tree.

As a result, the follow-up commit "regulator: histb: add voltage regulator driver" relies on the standard OS policy constraints (regulator-min-microvolt and regulator-max-microvolt) as physical 100% and 0% duty cycle calibration boundaries:

drivers/regulator/histb-regulator.c:histb_regulator_probe() {
    ...
        priv->min_uV = init_data->constraints.min_uV;
        priv->max_uV = init_data->constraints.max_uV;
    ...
}

If a device tree author specifies a tighter policy constraint to protect hardware (e.g., a maximum of 1.0V when the physical maximum is 1.15V), a legitimate request for 1.0V outputs a 0% duty cycle:

drivers/regulator/histb-regulator.c:histb_regulator_set_voltage() {
    ...
        if (min_uV >= priv->max_uV)
                duty = 0;
    ...
}
Quoted 3 lines

This configures the hardware to physically deliver the unconstrained maximum of 1.15V, completely bypassing the intended safety bounds and potentially damaging connected components.

pwm-regulator.yaml: This mode uses the regulator's maximum and minimum supplied voltages specified in the regulator-{min,max}-microvolt properties to calculate appropriate duty-cycle values.

#4 lore raw

Re: [PATCH v2 1/2] regulator: dt-bindings: add hi3798cv200 regulator

In reply to David Yang
Quoted 19 lines · David Yang

The PMOC block of the HiSilicon STB SoCs (Hi3798cv200/mv100/mv200) drives an external converter with a PWM signal. Add dt-binding doc.

---
 .../hisilicon,hi3798cv200-regulator.yaml      | 48 +++++++++++++++++++
 1 file changed, 48 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/hisilicon,hi3798cv200-regulator.yaml
Documentation/devicetree/bindings/regulator/hisilicon,hi3798cv200-regulator.yaml new file +4 -0
new file mode 100644
index 000000000000..812d94aca1f5
@@ -0,0 +1,48 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/hisilicon,hi3798cv200-regulator.yaml#

Documentation/devicetree/bindings/regulator/hisilicon,hi3798cv200-regulator.yaml line 14

Quoted 10 lines
Documentation/devicetree/bindings/regulator/hisilicon,hi3798cv200-regulator.yaml new file +10 -0
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: HiSilicon STB voltage regulator
+
+maintainers:
+  - David Yang <[email protected]>
+
+description: |
+  HiSilicon STB SoCs (Hi3798cv200/mv100/mv200) provide PWM outputs in the PMOC
+  block which drive an external converter.

SoCs rarely provide supplies for themselves (they are rather called power domains in such case) and above wording suggests this is actually something external. It also speaks about PWM but binding has no PWM.

Quoted 17 lines
Documentation/devicetree/bindings/regulator/hisilicon,hi3798cv200-regulator.yaml new file +17 -0
+
+  The voltage range depends on the board design: reference designs specify
+  0.65 V to 1.15 V for the Hi3798cv200, and 0.7 V to 1.25 V for the Hi3798mv200;
+  a customized board has to figure out its own. The regulator itself has no
+  other source of calibration.
+
+properties:
+  compatible:
+    const: hisilicon,hi3798cv200-regulator
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - regulator-min-microvolt

Documentation/devicetree/bindings/regulator/hisilicon,hi3798cv200-regulator.yaml line 41

Quoted 10 lines
Documentation/devicetree/bindings/regulator/hisilicon,hi3798cv200-regulator.yaml new file +10 -0
+  - regulator-max-microvolt
+
+allOf:
+  - $ref: regulator.yaml#
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    vddcpu: regulator@8a23018 {

Drop unused label

Documentation/devicetree/bindings/regulator/hisilicon,hi3798cv200-regulator.yaml line 43

Quoted 2 lines
Documentation/devicetree/bindings/regulator/hisilicon,hi3798cv200-regulator.yaml new file +2 -0
+        compatible = "hisilicon,hi3798cv200-regulator";
+        reg = <0x8a23018 0x4>;

And one word is rarely a device, which adds to the confusion.

Best regards,
Krzysztof

maintainer
#5 lore raw

Re: [PATCH v2 1/2] regulator: dt-bindings: add hi3798cv200 regulator

Quoted 9 lines · Krzysztof Kozlowski

Documentation/devicetree/bindings/regulator/hisilicon,hi3798cv200-regulator.yaml line 14

Quoted 3 lines · David Yang
Documentation/devicetree/bindings/regulator/hisilicon,hi3798cv200-regulator.yaml new file +3 -0
+description: |
+  HiSilicon STB SoCs (Hi3798cv200/mv100/mv200) provide PWM outputs in the PMOC
+  block which drive an external converter.

SoCs rarely provide supplies for themselves (they are rather called power domains in such case) and above wording suggests this is actually something external. It also speaks about PWM but binding has no PWM.

I think this is talking about something like pwm-regulator.c.

Quoted 4 lines

Documentation/devicetree/bindings/regulator/hisilicon,hi3798cv200-regulator.yaml line 43

Quoted 2 lines
Documentation/devicetree/bindings/regulator/hisilicon,hi3798cv200-regulator.yaml new file +2 -0
+        compatible = "hisilicon,hi3798cv200-regulator";
+        reg = <0x8a23018 0x4>;

And one word is rarely a device, which adds to the confusion.

It is possible for a simple analog block...

author
#6 lore raw

Re: [PATCH v2 1/2] regulator: dt-bindings: add hi3798cv200 regulator

Quoted 12 lines · Mark Brown
Quoted 9 lines · Krzysztof Kozlowski

Documentation/devicetree/bindings/regulator/hisilicon,hi3798cv200-regulator.yaml line 14

Quoted 3 lines · David Yang
Documentation/devicetree/bindings/regulator/hisilicon,hi3798cv200-regulator.yaml new file +3 -0
+description: |
+  HiSilicon STB SoCs (Hi3798cv200/mv100/mv200) provide PWM outputs in the PMOC
+  block which drive an external converter.

SoCs rarely provide supplies for themselves (they are rather called power domains in such case) and above wording suggests this is actually something external. It also speaks about PWM but binding has no PWM.

Quoted 8 lines

I think this is talking about something like pwm-regulator.c.

Quoted 4 lines

Documentation/devicetree/bindings/regulator/hisilicon,hi3798cv200-regulator.yaml line 43

Quoted 2 lines
Documentation/devicetree/bindings/regulator/hisilicon,hi3798cv200-regulator.yaml new file +2 -0
+        compatible = "hisilicon,hi3798cv200-regulator";
+        reg = <0x8a23018 0x4>;

And one word is rarely a device, which adds to the confusion.

It is possible for a simple analog block...

Hi, I'm planning to spin up with another version. What should I do with the binding next?

#7 lore raw

Re: [PATCH v2 1/2] regulator: dt-bindings: add hi3798cv200 regulator

Quoted 10 lines · David Yang
Quoted 7 lines
Quoted 5 lines

Documentation/devicetree/bindings/regulator/hisilicon,hi3798cv200-regulator.yaml line 43

Quoted 3 lines
Documentation/devicetree/bindings/regulator/hisilicon,hi3798cv200-regulator.yaml new file +2 -0
+        compatible = "hisilicon,hi3798cv200-regulator";
+        reg = <0x8a23018 0x4>;

And one word is rarely a device, which adds to the confusion.

It is possible for a simple analog block...

Hi, I'm planning to spin up with another version. What should I do with the binding next?

You received some comments, no? BTW, Did you do prior-art research to avoid duplicated code?

Best regards,
Krzysztof

author
#8 lore raw

PATCH v2 2/2 regulator: histb: add voltage regulator driver

In reply to David Yang

Add a driver for the voltage rails on HiSilicon STB SoCs which are controlled by the PMOC block through a PWM signal, as described by the hisilicon,hi3798cv200-regulator binding.

The name conventions follow those of pcie-histb.c.

---
 MAINTAINERS                         |   7 ++
 drivers/regulator/Kconfig           |   7 ++
 drivers/regulator/Makefile          |   1 +
 drivers/regulator/histb-regulator.c | 162 ++++++++++++++++++++++++++++
 4 files changed, 177 insertions(+)
 create mode 100644 drivers/regulator/histb-regulator.c
MAINTAINERS +7 -0
index 65e8a4b5c90b..18b86d69ad07 100644
@@ -11910,6 +11910,13 @@ S:	Maintained
 F:	Documentation/devicetree/bindings/mfd/hisilicon,hi6421-spmi-pmic.yaml
 F:	drivers/mfd/hi6421-spmi-pmic.c
 
+HISILICON STB VOLTAGE REGULATOR DRIVER
+M:	David Yang <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	Documentation/devicetree/bindings/regulator/hisilicon,hi3798cv200-regulator.yaml
+F:	drivers/regulator/histb-regulator.c
+
 HISILICON TRUE RANDOM NUMBER GENERATOR V2 SUPPORT
 M:	Weili Qian <[email protected]>
 S:	Maintained
drivers/regulator/Kconfig +7 -0
index 89789ac7a786..a059c5b2bafc 100644
@@ -487,6 +487,13 @@ config REGULATOR_HI6421V600
 	  HiSilicon Hi6421v600 PMU / Codec IC.
 	  This is used on Kirin 3670 boards, like HiKey 970.
 
+config REGULATOR_HISI_STB
+	tristate "HiSilicon STB voltage regulator support"
+	depends on ARCH_HISI || COMPILE_TEST
+	help
+	  This driver provides support for the voltage regulators of the
+	  HiSilicon STB SoCs, including Hi3798cv200, Hi3798mv100, Hi3798mv200.
+
 config REGULATOR_ISL9305
 	tristate "Intersil ISL9305 regulator"
 	depends on I2C
drivers/regulator/Makefile +1 -0
index 5a764cec8df8..a2efd2bc3e0d 100644
@@ -57,6 +57,7 @@ obj-$(CONFIG_REGULATOR_HI6421) += hi6421-regulator.o
 obj-$(CONFIG_REGULATOR_HI6421V530) += hi6421v530-regulator.o
 obj-$(CONFIG_REGULATOR_HI6421V600) += hi6421v600-regulator.o
 obj-$(CONFIG_REGULATOR_HI655X) += hi655x-regulator.o
+obj-$(CONFIG_REGULATOR_HISI_STB) += histb-regulator.o
 obj-$(CONFIG_REGULATOR_ISL6271A) += isl6271a-regulator.o
 obj-$(CONFIG_REGULATOR_ISL9305) += isl9305.o
 obj-$(CONFIG_REGULATOR_FP9931) += fp9931.o
drivers/regulator/histb-regulator.c new file +162 -0

162 lines not on this page · raw message

Signature · 1 line
2.53.0