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.

Linux/AM5726: Fixed regulator in device tree

Part Number: AM5726

Tool/software: Linux

I need a little help with regulators in my device tree.  After adding smps9_reg to my tps659038_pmic regulator

smps9_reg: smps9 {
    /* VDD_1V0 */
    regulator-name = "smps9";
    regulator-min-microvolt = <1000000>;
    regulator-max-microvolt = <1000000>;
};

I also added vdd_1v0 to my device tree

vdd_1v0: fixedregulator-vdd_1v0 {
    compatible = "regulator-fixed";
    regulator-name = "vdd_1v0";
    vin-supply = <&smps9_reg>;
    regulator-min-microvolt = <1000000>;
    regulator-max-microvolt = <1000000>;
};

And I added a platform device as a consumer

my_device1 {
    compatible = "asdf,my_device";
    vcc-supply = <&vdd_1v0>;
};

I'd like the 1.0v rail's power to be controllable from user space via a platform device driver, but I've noticed that the rail is powered up during the kernel boot.

I'm certain I'm doing something wrong in my device tree but I'm not sure what to fix.

Thanks in advance for any assistance!

  • Hi Kent,

    I'm taking a look at this.

    Curious, if you add a status property to your consumer, and set as disabled, does the regulator still come up? Can you set the regulator state from sysfs?

    Regards,
    Mike
  • with 'status = "disabled";' added to the consumer, smps9 still comes up.
    I have removed vdd_1v0 from my device tree and can control smps9 directly from my device driver via regulator_get() and regulator_enable()/regulator_disable(). This works fine since I only have 1 device using the 1 volt rail.

    I have very little experience working with regulators, can you point me to the node in the sysfs that I should write to for setting the regulator state?
  • Hi Kent,

    Apologies for the delay!

    To be honest, I have not manually controlled consumer device regulators myself, however I found this information that might help:

    Userspace consumer regulator support is necessary in the Kernel (CONFIG_REGULATOR_USERSPACE_CONSUMER): cateee.net/.../REGULATOR_USERSPACE_CONSUMER.html

    Regulator sysfs state entry: (/sys/class/regulator/.../state): www.kernel.org/.../sysfs-class-regulator

    Regards,
    Mike
  • Thanks Mike,
    Since my main requirement is that I do not delay very long in the power-up sequence between smps9 and my consumer component and I have still been unable to prevent a regulator definition in the device tree from automatically powering up smps9, I'm so far forced to control smps9 directly via a kernel module.
    If I can figure out how to prevent the automatic power-up of smps9, I will very likely switch over to using the userspace consumer so I can avoid kernel taint. It will likely be a refactoring effort in the future. Thanks for the links.