This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

How do you setup the regulators in the device tree?

Other Parts Discussed in Thread: TPS65910, TPS65911

I’m working on integrating a node into my custom hardware device tree to support the use of a TPS659114, I’ve been looking at a couple of other device trees as examples but still had some questions on what everything means.

My reference files are:
arch/arm/boot/dts/tegra30-cardhu.dtsi
arch/arm/boot/dts/tegra30-beaver.dts

1) My first question is with respect to the supplies:

     vcc1-supply = <&vdd_ac_bat_reg>;
     vcc2-supply = <&vdd_ac_bat_reg>;
     …

The bindings documentation for the tps65910.txt state these are: “required if regulators are enabled”, which implies to me that I only need the xxxx-supply if I want the particular input to be enabled. However later in the same document it states: “Missing of these properties can cause the regulator registration fails”.  So I’m not sure how to read that.. is it saying that if I’m missing one of the xxx-supply entries that my registration will fail? That seems contrary to how I read it the first time.

 

2) My second question is in reference to the xxx-supply parameters. They are being pointed to nodes in the device tree further down (outside the scope of the PMIC), example from the referenced device trees:

               regulators {
                   compatible = "simple-bus";
                   #address-cells = <1>;
                   #size-cells = <0>;

                   vdd_5v_in_reg: regulator@0 {
                          compatible = "regulator-fixed";
                          reg = <0>;
                          regulator-name = "vdd_5v_in";
                          regulator-min-microvolt = <5000000>;
                          regulator-max-microvolt = <5000000>;
                          regulator-always-on;
                   };

Now what is this “regulators” node vs the “regulators” sub-node within the PMIC node? Is this one the “input” regulators or power supplies on the board and the regulators listed within the PMIC are the “outputs” from the PMIC itself?

3) Tied to these first two questions… in my specific design I’m inclined to think that I want a “5v always on” generic “input” regulator in my regulators node which is my supply to most of the VCCXs, but since my VCCIO is actually tied to ground I think I need to just remove the vccio-supply from the PMIC node all together:

Is this the correct way to handle such a design?

 

4) Looking at the tps65911 spec, as far as I can tell, the “vcc1” input then powers the “vdd1” output. “vcc3” input powers the “LDO6, LDO7, and LDO8” outputs.
If I have that correct, when what powers the VDDCtrl output?

  • Mike,

    Have you looked at this page:

    http://www.ti.com/tool/tps65910sw-linux

    There's a ton of good info there.  For example, have you confirmed that in your kernel config you have enabled the appropriate options?

    Also, you have not specified what you're using for your "compatible" field in the device tree.  Are you using compatible = "ti,tps65911"?  It would be better if you posted ALL lines from your dts pertaining to TPS65911.

    Mike Worster said:
    Now what is this “regulators” node vs the “regulators” sub-node within the PMIC node? Is this one the “input” regulators or power supplies on the board and the regulators listed within the PMIC are the “outputs” from the PMIC itself?

    The PMIC regulators sub-node is where you program the output voltages of the PMIC.  The "regulators" node you mentioned looks to be just a grouping of (discrete) regulators for that particular Tegra board.

    Mike Worster said:
    The bindings documentation for the tps65910.txt state these are: “required if regulators are enabled”, which implies to me that I only need the xxxx-supply if I want the particular input to be enabled. However later in the same document it states: “Missing of these properties can cause the regulator registration fails”.  So I’m not sure how to read that.. is it saying that if I’m missing one of the xxx-supply entries that my registration will fail? That seems contrary to how I read it the first time.

    So if you have enabled one of the output voltages (i.e. specified an output voltage in the PMIC regulators sub-node), then you must define the corresponding input power supply.  So if you enable LDO5 then you must specify vcc4-supply.

    Mike Worster said:
    3) Tied to these first two questions… in my specific design I’m inclined to think that I want a “5v always on” generic “input” regulator in my regulators node which is my supply to most of the VCCXs

    Sounds reasonable.  Here's a snippet from the AM335x EVM dts:

            vbat: fixedregulator@0 {
                    compatible = "regulator-fixed";
                    regulator-name = "vbat";
                    regulator-min-microvolt = <5000000>;
                    regulator-max-microvolt = <5000000>;
                    regulator-boot-on;
            };

    &tps {
            vcc1-supply = <&vbat>;
            vcc2-supply = <&vbat>;
            vcc3-supply = <&vbat>;
            vcc4-supply = <&vbat>;
            vcc5-supply = <&vbat>;
            vcc6-supply = <&vbat>;
            vcc7-supply = <&vbat>;
            vccio-supply = <&vbat>;
    }

    Mike Worster said:
    but since my VCCIO is actually tied to ground I think I need to just remove the vccio-supply from the PMIC node all together:

    Are you sure an unused rail should be grounded?  Perhaps someone from the PMIC team can comment on that one...

    With respect to dts, you can remove vccio-supply as long as you correspondingly remove vio_reg from the regulators subnode.

    Mike Worster said:
    what powers the VDDCtrl output?

    Looks like V5IN, though perhaps someone from the PMIC team can confirm.

  • Thanks for the input Brad!

    Brad Griffis said:

    Have you looked at this page:

    http://www.ti.com/tool/tps65910sw-linux

    There's a ton of good info there.  For example, have you confirmed that in your kernel config you have enabled the appropriate options?

    Yes, I did take a look at that page, and no I haven't enabled the PMIC in the kernel config yet. Before I started enabling drivers or writing code I was working to understand the concepts behind the device tree to make sure what I was writing was correct.


    Brad Griffis said:

    Also, you have not specified what you're using for your "compatible" field in the device tree.  Are you using compatible = "ti,tps65911"?  It would be better if you posted ALL lines from your dts pertaining to TPS65911.

    The only reason I didn't include any of the code from my device tree is it wasn't written yet. I'm still trying to figure out what to write. Here's the extent of it right now:

    pmic: tps65911@2d {
        compatible = "ti,tps65911";
        reg = <0x2d>;
    
        interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
        #interrupt-cells = <2>;
        interrupt-controller;
    
        ti,system-power-controller;
    
    };

    Effectively, I know the address, compatibility, and interrupt number so I only wrote that much. Thanks to your answers so far I'm pretty close to the rest.

    Brad Griffis said:
    Mike Worster
    Now what is this “regulators” node vs the “regulators” sub-node within the PMIC node? Is this one the “input” regulators or power supplies on the board and the regulators listed within the PMIC are the “outputs” from the PMIC itself?

    The PMIC regulators sub-node is where you program the output voltages of the PMIC.  The "regulators" node you mentioned looks to be just a grouping of (discrete) regulators for that particular Tegra board.

    So on my board I have a buck regulator (Hardware, no software control/setup) which takes a 24VAC signal and converts it to the +5V needed for the PMIC input. In this particular instance, would I make/use a regulator node such as:

    regulators {
        compatible = "simple-bus";
        #address-cells = <1>;
        #size-cells = <0>;
    
        vinput: regulator@0 {
            compatible = "regulator-fixed";
            reg = <0>;
            regulator-name = "5v_input_fixed";
            regulator-alway-on;
            regulator-min-microvolt = <5000000>;
            regulator-max-microvolt = <5000000>;
        };
    };
    
    pmic: tps65911@2d {
        compatible = "ti,tps65911";
        ...
        vcc1-supply = <&vinput>;

    Or, because this is pure hardware with no software control/setup, do I handle this differently? (ie no need for a "regulator" node)

    Brad Griffis said:

    Are you sure an unused rail should be grounded?  Perhaps someone from the PMIC team can comment on that one...

    We checked the documentation and it stated if VCCIO wasn't going to be used, it should be connected to VCC7 or ground.

  • Mike Worster said:
    regulator-alway-on;

    Minor typo there.  Should be regulator-always-on.

    Mike Worster said:
    Or, because this is pure hardware with no software control/setup, do I handle this differently? (ie no need for a "regulator" node)

    You must define the input voltage if you're going to enable the corresponding output.  So even though you can't do anything to control that 5V regulator, you still need to define it just to make things "complete".  That was the same deal for the AM335x EVM example I listed.

    Mike Worster said:
    We checked the documentation and it stated if VCCIO wasn't going to be used, it should be connected to VCC7 or ground.

    Sounds good.  Thanks.  I think you're headed in the right direction now.

  • Regarding VDDCtrl supply, the PWM controller for this rail is powered from V5IN; however, the input feed to the power stage for this supply is external to the PMIC on the drain of the high side external power FET.

  • Thanks for the support on this topic. I think the device looks pretty good right now, here's what I have:

    imxpmic: tps65911@2d {
        compatible = "ti,tps65911";
        reg = <0x2d>;
    
        interrupts = <GIC_SPI 4 IRQ_TYPE_LEVEL_HIGH>;
        #interrupt-cells = <2>;
        interrupt-controller;
    
        ti,system-power-controller;
    
        vcc1-supply = <&vbat>;
        vcc2-supply = <&vbat>;
        vcc4-supply = <&vbat>;
        vcc7-supply = <&vbat>;
    
        regulators {
    	#address-cells = <1>;
    	#size-cells = <0>;
    
    	vdd1_reg: vdd1 {
    	    regulator-name = "vdd1_ddr_1v5";
    	    regulator-min-microvolt = <1500000>;
    	    regulator-max-microvolt = <1500000>;
    	    regulator-always-on;
    	};
    
    	vdd2_reg: vdd2 {
    	    regulator-name = "vdd2_3v3_nvcc";
    	    regulator-min-microvolt = <3300000>;
    	    regulator-max-microvolt = <3300000>;
    	    regulator-always-on;
    	};
    
    	vddctrl_reg: vddctrl {
    	    regulator-name = "vdd_cpu,vdd_sys";
    	    regulator-min-microvolt = <1375000>;
    	    regulator-max-microvolt = <1375000>;
    	    regulator-always-on;
    	};
    
    	ldo5_reg: ldo5 {
    	    regulator-name = "vddhigh_in,vdd_snvs_in";
    	    regulator-min-microvolt = <3000000>;
    	    regulator-max-microvolt = <3000000>;
    	    regulator-always-on;
    	};
        };
    };
    

    One of my final questions with respect to setup is do I need to include ldo5_reg? The way our board works, the bootloader will setup LDO5 to be 3.0V, then it's never touched after that. It is also never used as a "supply" to any other node in the device tree. So if I simply remove the ldo5 node and vcc7-supply, will everything still work as is, or is there a good reason to keep that node in the tree?

  • Mike Worster said:
    So if I simply remove the ldo5 node and vcc7-supply, will everything still work as is, or is there a good reason to keep that node in the tree?

    Here's a snippet from the device tree documentation:

      tps65911:
    	vcc1-supply: VDD1 input.
    	vcc2-supply: VDD2 input.
    	vcc3-supply: LDO6, LDO7 and LDO8 input.
    	vcc4-supply: LDO5 input.
    	vcc5-supply: LDO3 and LDO4 input.
    	vcc6-supply: LDO1 and LDO2 input.
    	vcc7-supply: VRTC input.
    	vccio-supply: VIO input.
    

    It looks like it's vcc4-supply that you should correspondingly be removing.  If you want to keep that rail entirely outside the purview of Linux, then I think that should be fine to remove.