regulator:add bypass logic when registering

do not control regulators when set bypass flag

Signed-off-by: zhangshengchao <zhangshengchao@xiaomi.com>
This commit is contained in:
zhangshengchao 2023-11-16 22:53:25 +08:00 committed by Xiang Xiao
parent 18497e5bc6
commit e26a01d9a6
2 changed files with 10 additions and 1 deletions

View file

@ -1043,6 +1043,11 @@ regulator_register(FAR const struct regulator_desc_s *regulator_desc,
list_initialize(&rdev->consumer_list);
list_initialize(&rdev->list);
if (rdev->desc->bypass_on)
{
goto bypass;
}
if (rdev->desc->boot_on || rdev->desc->always_on)
{
ret = _regulator_do_enable(rdev);
@ -1060,6 +1065,7 @@ regulator_register(FAR const struct regulator_desc_s *regulator_desc,
_regulator_do_disable(rdev);
}
bypass:
if (rdev->desc->apply_uv)
{
_regulator_do_set_voltage(rdev, rdev->desc->min_uv,

View file

@ -123,7 +123,10 @@ struct regulator_desc_s
unsigned int boot_on; /* true if this regulator is to be enabled
* at power up/reset
*/
unsigned int always_on;
unsigned int always_on; /* true if this regulator is always on */
unsigned int bypass_on; /* true if this regulator should be ignored
* during initialization
*/
FAR const char *supply_name;
#ifdef CONFIG_PM
unsigned int auto_lp;