aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAxel Lin <[email protected]>2021-06-16 09:18:16 +0800
committerMark Brown <[email protected]>2021-06-16 15:41:16 +0100
commit512d895664a318d57de0ca3655d2bf1c280767a0 (patch)
tree421a133adf4582848d989f3dafee6ccb9ecf6155
parent70d654ea3de937d7754c107bb8eeb20e30262c89 (diff)
regulator: rt6160: Fix setting suspend voltage
The vsel active level is for the normal voltage, the opposite level is the suspend voltage. Signed-off-by: Axel Lin <[email protected]> Reviewed-by: ChiYuan Huang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
-rw-r--r--drivers/regulator/rt6160-regulator.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/regulator/rt6160-regulator.c b/drivers/regulator/rt6160-regulator.c
index ccd023da4318..5d7b0e7ad69a 100644
--- a/drivers/regulator/rt6160-regulator.c
+++ b/drivers/regulator/rt6160-regulator.c
@@ -128,13 +128,19 @@ static unsigned int rt6160_get_mode(struct regulator_dev *rdev)
static int rt6160_set_suspend_voltage(struct regulator_dev *rdev, int uV)
{
struct regmap *regmap = rdev_get_regmap(rdev);
+ unsigned int suspend_vsel_reg;
int vsel;
vsel = regulator_map_voltage_linear(rdev, uV, uV);
if (vsel < 0)
return vsel;
- return regmap_update_bits(regmap, rdev->desc->vsel_reg,
+ if (rdev->desc->vsel_reg == RT6160_REG_VSELL)
+ suspend_vsel_reg = RT6160_REG_VSELH;
+ else
+ suspend_vsel_reg = RT6160_REG_VSELL;
+
+ return regmap_update_bits(regmap, suspend_vsel_reg,
RT6160_VSEL_MASK, vsel);
}