Browse Source

feat(st-regulator): add support for regulator-always-on

Add support for regulator-always-on at BL2 level as it was supported
before using the regulator framework.

Signed-off-by: Pascal Paillet <p.paillet@st.com>
Change-Id: Idb2f4ddc2fdd4e0d31fb33da87c84618aa2e5135
pull/1983/merge
Pascal Paillet 3 years ago
committed by Yann Gautier
parent
commit
9b4ca70d97
  1. 26
      drivers/st/regulator/regulator_core.c

26
drivers/st/regulator/regulator_core.c

@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, STMicroelectronics - All Rights Reserved
* Copyright (c) 2021-2022, STMicroelectronics - All Rights Reserved
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@ -156,6 +156,10 @@ int regulator_disable(struct rdev *rdev)
assert(rdev != NULL);
if (rdev->flags & REGUL_ALWAYS_ON) {
return 0;
}
ret = __regulator_set_state(rdev, STATE_DISABLE);
udelay(rdev->enable_ramp_delay);
@ -412,6 +416,21 @@ int regulator_set_flag(struct rdev *rdev, uint16_t flag)
return 0;
}
static int parse_properties(const void *fdt, struct rdev *rdev, int node)
{
int ret;
if (fdt_getprop(fdt, node, "regulator-always-on", NULL) != NULL) {
VERBOSE("%s: set regulator-always-on\n", rdev->desc->node_name);
ret = regulator_set_flag(rdev, REGUL_ALWAYS_ON);
if (ret != 0) {
return ret;
}
}
return 0;
}
/*
* Parse the device-tree for a regulator
*
@ -476,6 +495,11 @@ static int parse_dt(struct rdev *rdev, int node)
return ret;
}
ret = parse_properties(fdt, rdev, node);
if (ret != 0) {
return ret;
}
return 0;
}

Loading…
Cancel
Save