Skip to contentSkip to conversation

Voltage and current regulator: usage of 'regulators' parent node in device tree

DISCUSSION embedded (VIVAVIS AG) 2 participants 4 messages Aug 23, 2021 – Sep 8, 2021 2 messages not in the archive

lore
Share & tools
lore
#0 lore raw

Dear maintainer,

I see a lot of Device trees wrapping the regulator nodes within a parent node like this

regulators {
    compatible = "simple-bus";
    #address-cells = <1>;
    #size-cells = <0>;
    reg_p3v3: regulator@0 {
        compatible = "regulator-fixed";
        [...]
        regulator-always-on;
    };
    [...]

Contrary to that, patches exist removing the 'regulators' node, because the 'simple-bus' doesn't really exist in hardware. Unfortunately, the documentation is unclear about wrapping regulator nodes like shown above.

Should I avoid the parent 'regulators' node and why?

Is the given naming schema in fixed-regulator.yaml best practice to follow?

    reg_xyz: regulator-xyz {
      compatible = "regulator-fixed";
      regulator-name = "xyz";

Thank you for clarification.

Carsten Stelling

A message that is not in the archive (sent off-list or not yet received): 809518e1649a469cb4fc6fffd9bf427c-dQ8pE230Wp9BDgjK7y7TUQ@public.gmane.org

#2 lore raw

I'd really appreciate it, if you can give me feedback on my question. Thank you.

Quoted 31 lines

Dear maintainer,

I see a lot of Device trees wrapping the regulator nodes within a parent node like this

regulators {
   compatible = "simple-bus";
   #address-cells = <1>;
   #size-cells = <0>;
   reg_p3v3: regulator@0 {
       compatible = "regulator-fixed";
       [...]
       regulator-always-on;
   };
   [...]

Contrary to that, patches exist removing the 'regulators' node, because the 'simple-bus' doesn't really exist in hardware. Unfortunately, the documentation is unclear about wrapping regulator nodes like shown above.

Should I avoid the parent 'regulators' node and why?

Is the given naming schema in fixed-regulator.yaml best practice to follow?

   reg_xyz: regulator-xyz {
     compatible = "regulator-fixed";
     regulator-name = "xyz";

Thank you for clarification.

Carsten Stelling

#3 lore raw
In reply to a message not in the archive
Quoted 17 lines · embedded (VIVAVIS AG)

Dear maintainer,

I see a lot of Device trees wrapping the regulator nodes within a parent node like this

regulators {
    compatible = "simple-bus";
    #address-cells = <1>;
    #size-cells = <0>;
    reg_p3v3: regulator@0 {
        compatible = "regulator-fixed";
        [...]
        regulator-always-on;
    };
    [...]
Quoted 5 lines

Contrary to that, patches exist removing the 'regulators' node, because the 'simple-bus' doesn't really exist in hardware. Unfortunately, the documentation is unclear about wrapping regulator nodes like shown above.

Should I avoid the parent 'regulators' node and why?

Yes and no. Yes, in the above case as there is no bus nor grouping of fixed regulators. For a MFD that includes regulators, then a child 'regulators' node is appropriate. To put it another way, if you have a schema defining a 'regulators' node, then it probably is appropriate.

Quoted 5 lines

Is the given naming schema in fixed-regulator.yaml best practice to follow?

    reg_xyz: regulator-xyz {
      compatible = "regulator-fixed";
      regulator-name = "xyz";

Yes, pretty much.

Rob

A message that is not in the archive (sent off-list or not yet received): CAL_JsqLBiq0+MnYQ0=vMEDe_n+gHAT8PP6VO=Quj-A4yOCu_6w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#5 lore raw

Hi Rob,

Quoted 32 lines
Quoted 17 lines · embedded (VIVAVIS AG)

Dear maintainer,

I see a lot of Device trees wrapping the regulator nodes within a parent node like this

regulators {
    compatible = "simple-bus";
    #address-cells = <1>;
    #size-cells = <0>;
    reg_p3v3: regulator@0 {
        compatible = "regulator-fixed";
        [...]
        regulator-always-on;
    };
    [...]
Quoted 5 lines

Contrary to that, patches exist removing the 'regulators' node, because the 'simple-bus' doesn't really exist in hardware. Unfortunately, the documentation is unclear about wrapping regulator nodes like shown above.

Should I avoid the parent 'regulators' node and why?

Yes and no. Yes, in the above case as there is no bus nor grouping of fixed regulators. For a MFD that includes regulators, then a child 'regulators' node is appropriate. To put it another way, if you have a schema defining a 'regulators' node, then it probably is appropriate.

Quoted 2 lines

Is the given naming schema in fixed-regulator.yaml best practice to follow?

Quoted 7 lines
Quoted 3 lines
    reg_xyz: regulator-xyz {
      compatible = "regulator-fixed";
      regulator-name = "xyz";

Yes, pretty much.

Rob

Think I understand.
MFD might be an integrated power management controller connected to an I2C bus or kind of GPIO. In this case the regulators node is used as child node under the node describing the PMIC. Found this binding example for MAX8997 /devicetree/bindings/regulator/max8997-regulator.txt.

max8997_pmic@66 {
    compatible = "maxim,max8997-pmic";
    <snip>
    regulators: {  // child node here
        regulators {
            ldo1_reg: LDO1 { 
            regulator-name = "VDD_ABB_3.3V";
            regulator-min-microvolt = <3300000>;
            regulator-max-microvolt = <3300000>;
        };
        ldo2_reg: LDO2 {
            regulator-name = "VDD_ALIVE_1.1V";
            regulator-min-microvolt = <1100000>;
            regulator-max-microvolt = <1100000>;
            regulator-always-on;
        };
        buck1_reg: BUCK1 {
            regulator-name = "VDD_ARM_1.2V";
            regulator-min-microvolt = <950000>;
            regulator-max-microvolt = <1350000>;
            regulator-always-on;
            regulator-boot-on;
        };
    };
};

To describe my simple 3.3V and 5.0V voltage regulators on the board (not integrated in a PMIC nor connected to a bus), I should not use the regulators node and put their descriptions to the root node.

reg_3v3: regulator-3v3 {
    compatible = "regulator-fixed";
    regulator-name = "3v3";
    regulator-min-microvolt = <3300000>;
    regulator-max-microvolt = <3300000>;
    regulator-always-on;
};
reg_5v0: regulator-5v0 {
    compatible = "regulator-fixed";
    regulator-name = "5v0";
    regulator-min-microvolt = <5000000>;
    regulator-max-microvolt = <5000000>;
    regulator-always-on;
};

Thank you very much.

Carsten