Skip to main content
Visitor II
January 18, 2023
Question

How to enable/disable pwr_sw1 and pwr_sw1 via sysfs?

  • January 18, 2023
  • 1 reply
  • 1188 views

We need to enable/disable pwr_sw1 and pwr_sw1 preferably via sysfs:

vdd_usb_sw: pwr_sw1 {
 regulator-name = "vdd_usb_sw";
};
 
vdd_sd_sw: pwr_sw2 {
 regulator-name = "vdd_sd_sw";
 regulator-always-on;
 regulator-boot-on;
 regulator-active-discharge = <1>;
};

How can we achieve this?

    This topic has been closed for replies.

    1 reply

    Technical Moderator
    January 25, 2023

    Hi @johnnyc​ 

    Please refer to Regulator overview - stm32mpu

    It's clearly state :

    "The regulator framework offers a sysfs interface that can be used for monitoring. It is not possible to control a regulator via the sysfs."

    Best practice is to use "consumers" mechanism of the regulator.

    As soon as regulator is not used it's turn-off. ( as soon as you remove regulator-always-on policy )

    I guess this could be achieve by using some dedicated kernel drivers.

    If you detail further to what pwr_sw1 and pwr_sw2 are connected in your design and what you want to do. I can come back with further guidelines.

    Olivier