提交 40e72149 编写于 作者: T Thiago Farina 提交者: Mark Brown

regulator: max77686: Reuse rdev_get_id() function.

Signed-off-by: NThiago Farina <tfarina@chromium.org>
Signed-off-by: NMark Brown <broonie@opensource.wolfsonmicro.com>
上级 836dc9e3
...@@ -75,13 +75,14 @@ static int max77686_buck_set_suspend_disable(struct regulator_dev *rdev) ...@@ -75,13 +75,14 @@ static int max77686_buck_set_suspend_disable(struct regulator_dev *rdev)
{ {
unsigned int val; unsigned int val;
struct max77686_data *max77686 = rdev_get_drvdata(rdev); struct max77686_data *max77686 = rdev_get_drvdata(rdev);
int id = rdev_get_id(rdev);
if (rdev->desc->id == MAX77686_BUCK1) if (id == MAX77686_BUCK1)
val = 0x1; val = 0x1;
else else
val = 0x1 << MAX77686_OPMODE_BUCK234_SHIFT; val = 0x1 << MAX77686_OPMODE_BUCK234_SHIFT;
max77686->opmode[rdev->desc->id] = val; max77686->opmode[id] = val;
return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg,
rdev->desc->enable_mask, rdev->desc->enable_mask,
val); val);
...@@ -93,9 +94,10 @@ static int max77686_set_suspend_mode(struct regulator_dev *rdev, ...@@ -93,9 +94,10 @@ static int max77686_set_suspend_mode(struct regulator_dev *rdev,
{ {
struct max77686_data *max77686 = rdev_get_drvdata(rdev); struct max77686_data *max77686 = rdev_get_drvdata(rdev);
unsigned int val; unsigned int val;
int id = rdev_get_id(rdev);
/* BUCK[5-9] doesn't support this feature */ /* BUCK[5-9] doesn't support this feature */
if (rdev->desc->id >= MAX77686_BUCK5) if (id >= MAX77686_BUCK5)
return 0; return 0;
switch (mode) { switch (mode) {
...@@ -111,7 +113,7 @@ static int max77686_set_suspend_mode(struct regulator_dev *rdev, ...@@ -111,7 +113,7 @@ static int max77686_set_suspend_mode(struct regulator_dev *rdev,
return -EINVAL; return -EINVAL;
} }
max77686->opmode[rdev->desc->id] = val; max77686->opmode[id] = val;
return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg,
rdev->desc->enable_mask, rdev->desc->enable_mask,
val); val);
...@@ -140,7 +142,7 @@ static int max77686_ldo_set_suspend_mode(struct regulator_dev *rdev, ...@@ -140,7 +142,7 @@ static int max77686_ldo_set_suspend_mode(struct regulator_dev *rdev,
return -EINVAL; return -EINVAL;
} }
max77686->opmode[rdev->desc->id] = val; max77686->opmode[rdev_get_id(rdev)] = val;
return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg,
rdev->desc->enable_mask, rdev->desc->enable_mask,
val); val);
...@@ -152,7 +154,7 @@ static int max77686_enable(struct regulator_dev *rdev) ...@@ -152,7 +154,7 @@ static int max77686_enable(struct regulator_dev *rdev)
return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg,
rdev->desc->enable_mask, rdev->desc->enable_mask,
max77686->opmode[rdev->desc->id]); max77686->opmode[rdev_get_id(rdev)]);
} }
static int max77686_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay) static int max77686_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册