diff options
author | Thiago Farina <tfransosi@gmail.com> | 2013-02-13 14:52:26 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-02-14 07:11:04 -0500 |
commit | 40e72149a25b69cf0717b55b19b4ff76c7cf35e5 (patch) | |
tree | a9876a2269db14f188dc9133a26b98ba73cd4637 /drivers/regulator/max77686.c | |
parent | 836dc9e3fbbab0c30aa6e664417225f5c1fb1c39 (diff) |
regulator: max77686: Reuse rdev_get_id() function.
Signed-off-by: Thiago Farina <tfarina@chromium.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/max77686.c')
-rw-r--r-- | drivers/regulator/max77686.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/regulator/max77686.c b/drivers/regulator/max77686.c index cca18a3c0294..e4586ee8858d 100644 --- a/drivers/regulator/max77686.c +++ b/drivers/regulator/max77686.c | |||
@@ -75,13 +75,14 @@ static int max77686_buck_set_suspend_disable(struct regulator_dev *rdev) | |||
75 | { | 75 | { |
76 | unsigned int val; | 76 | unsigned int val; |
77 | struct max77686_data *max77686 = rdev_get_drvdata(rdev); | 77 | struct max77686_data *max77686 = rdev_get_drvdata(rdev); |
78 | int id = rdev_get_id(rdev); | ||
78 | 79 | ||
79 | if (rdev->desc->id == MAX77686_BUCK1) | 80 | if (id == MAX77686_BUCK1) |
80 | val = 0x1; | 81 | val = 0x1; |
81 | else | 82 | else |
82 | val = 0x1 << MAX77686_OPMODE_BUCK234_SHIFT; | 83 | val = 0x1 << MAX77686_OPMODE_BUCK234_SHIFT; |
83 | 84 | ||
84 | max77686->opmode[rdev->desc->id] = val; | 85 | max77686->opmode[id] = val; |
85 | return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, | 86 | return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, |
86 | rdev->desc->enable_mask, | 87 | rdev->desc->enable_mask, |
87 | val); | 88 | val); |
@@ -93,9 +94,10 @@ static int max77686_set_suspend_mode(struct regulator_dev *rdev, | |||
93 | { | 94 | { |
94 | struct max77686_data *max77686 = rdev_get_drvdata(rdev); | 95 | struct max77686_data *max77686 = rdev_get_drvdata(rdev); |
95 | unsigned int val; | 96 | unsigned int val; |
97 | int id = rdev_get_id(rdev); | ||
96 | 98 | ||
97 | /* BUCK[5-9] doesn't support this feature */ | 99 | /* BUCK[5-9] doesn't support this feature */ |
98 | if (rdev->desc->id >= MAX77686_BUCK5) | 100 | if (id >= MAX77686_BUCK5) |
99 | return 0; | 101 | return 0; |
100 | 102 | ||
101 | switch (mode) { | 103 | switch (mode) { |
@@ -111,7 +113,7 @@ static int max77686_set_suspend_mode(struct regulator_dev *rdev, | |||
111 | return -EINVAL; | 113 | return -EINVAL; |
112 | } | 114 | } |
113 | 115 | ||
114 | max77686->opmode[rdev->desc->id] = val; | 116 | max77686->opmode[id] = val; |
115 | return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, | 117 | return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, |
116 | rdev->desc->enable_mask, | 118 | rdev->desc->enable_mask, |
117 | val); | 119 | val); |
@@ -140,7 +142,7 @@ static int max77686_ldo_set_suspend_mode(struct regulator_dev *rdev, | |||
140 | return -EINVAL; | 142 | return -EINVAL; |
141 | } | 143 | } |
142 | 144 | ||
143 | max77686->opmode[rdev->desc->id] = val; | 145 | max77686->opmode[rdev_get_id(rdev)] = val; |
144 | return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, | 146 | return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, |
145 | rdev->desc->enable_mask, | 147 | rdev->desc->enable_mask, |
146 | val); | 148 | val); |
@@ -152,7 +154,7 @@ static int max77686_enable(struct regulator_dev *rdev) | |||
152 | 154 | ||
153 | return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, | 155 | return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, |
154 | rdev->desc->enable_mask, | 156 | rdev->desc->enable_mask, |
155 | max77686->opmode[rdev->desc->id]); | 157 | max77686->opmode[rdev_get_id(rdev)]); |
156 | } | 158 | } |
157 | 159 | ||
158 | static int max77686_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay) | 160 | static int max77686_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay) |