Commit 12401a1c authored by Axel Lin's avatar Axel Lin Committed by Mark Brown

regulator: mt6397: Remove modeset_shift from struct mt6397_regulator_info

The shift setting can be calculated via the corresponding mask field,
so remove modeset_shift.
Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Link: https://lore.kernel.org/r/20210629130503.2183574-3-axel.lin@ingics.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent d6208ba8
...@@ -32,7 +32,6 @@ struct mt6397_regulator_info { ...@@ -32,7 +32,6 @@ struct mt6397_regulator_info {
u32 vselctrl_mask; u32 vselctrl_mask;
u32 modeset_reg; u32 modeset_reg;
u32 modeset_mask; u32 modeset_mask;
u32 modeset_shift;
}; };
#define MT6397_BUCK(match, vreg, min, max, step, volt_ranges, enreg, \ #define MT6397_BUCK(match, vreg, min, max, step, volt_ranges, enreg, \
...@@ -61,7 +60,6 @@ struct mt6397_regulator_info { ...@@ -61,7 +60,6 @@ struct mt6397_regulator_info {
.vselctrl_mask = BIT(1), \ .vselctrl_mask = BIT(1), \
.modeset_reg = _modeset_reg, \ .modeset_reg = _modeset_reg, \
.modeset_mask = BIT(_modeset_shift), \ .modeset_mask = BIT(_modeset_shift), \
.modeset_shift = _modeset_shift \
} }
#define MT6397_LDO(match, vreg, ldo_volt_table, enreg, enbit, vosel, \ #define MT6397_LDO(match, vreg, ldo_volt_table, enreg, enbit, vosel, \
...@@ -175,11 +173,11 @@ static int mt6397_regulator_set_mode(struct regulator_dev *rdev, ...@@ -175,11 +173,11 @@ static int mt6397_regulator_set_mode(struct regulator_dev *rdev,
goto err_mode; goto err_mode;
} }
dev_dbg(&rdev->dev, "mt6397 buck set_mode %#x, %#x, %#x, %#x\n", dev_dbg(&rdev->dev, "mt6397 buck set_mode %#x, %#x, %#x\n",
info->modeset_reg, info->modeset_mask, info->modeset_reg, info->modeset_mask, val);
info->modeset_shift, val);
val <<= ffs(info->modeset_mask) - 1;
val <<= info->modeset_shift;
ret = regmap_update_bits(rdev->regmap, info->modeset_reg, ret = regmap_update_bits(rdev->regmap, info->modeset_reg,
info->modeset_mask, val); info->modeset_mask, val);
err_mode: err_mode:
...@@ -204,7 +202,10 @@ static unsigned int mt6397_regulator_get_mode(struct regulator_dev *rdev) ...@@ -204,7 +202,10 @@ static unsigned int mt6397_regulator_get_mode(struct regulator_dev *rdev)
return ret; return ret;
} }
switch ((regval & info->modeset_mask) >> info->modeset_shift) { regval &= info->modeset_mask;
regval >>= ffs(info->modeset_mask) - 1;
switch (regval) {
case MT6397_BUCK_MODE_AUTO: case MT6397_BUCK_MODE_AUTO:
return REGULATOR_MODE_NORMAL; return REGULATOR_MODE_NORMAL;
case MT6397_BUCK_MODE_FORCE_PWM: case MT6397_BUCK_MODE_FORCE_PWM:
......
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