1
0
Fork 0

MLK-23562: regulator: core: adjust supply voltage in bypass

Take account of bypass case where min_dropout_uV is 0 to adjust external
supply voltage correctly, otherwise, external pmic voltage will never be
in ldo bypass mode.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Anson Huang <Anson.Huang@nxp.com>
5.4-rM2-2.2.x-imx-squashed
Robin Gong 2020-03-10 04:45:45 +08:00
parent e169cf3592
commit ed6597132c
1 changed files with 13 additions and 2 deletions

View File

@ -3334,6 +3334,16 @@ static int _regulator_do_set_suspend_voltage(struct regulator_dev *rdev,
return 0;
}
static bool _regulator_is_bypass(struct regulator_dev *rdev)
{
bool bypassed = false;
if (rdev->desc->ops->get_bypass)
rdev->desc->ops->get_bypass(rdev, &bypassed);
return bypassed;
}
static int regulator_set_voltage_unlocked(struct regulator *regulator,
int min_uV, int max_uV,
suspend_state_t state)
@ -3403,8 +3413,9 @@ int regulator_set_voltage_rdev(struct regulator_dev *rdev, int min_uV,
if (rdev->supply &&
regulator_ops_is_valid(rdev->supply->rdev,
REGULATOR_CHANGE_VOLTAGE) &&
(rdev->desc->min_dropout_uV || !(rdev->desc->ops->get_voltage ||
rdev->desc->ops->get_voltage_sel))) {
(_regulator_is_bypass(rdev) || rdev->desc->min_dropout_uV ||
!(rdev->desc->ops->get_voltage ||
rdev->desc->ops->get_voltage_sel))) {
int current_supply_uV;
int selector;