Commit 512d8956 authored by Axel Lin's avatar Axel Lin Committed by Mark Brown

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: default avatarAxel Lin <axel.lin@ingics.com>
Reviewed-by: default avatarChiYuan Huang <cy_huang@richtek.com>
Link: https://lore.kernel.org/r/20210616011816.3479406-1-axel.lin@ingics.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 70d654ea
......@@ -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);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment