diff options
Diffstat (limited to 'drivers/regulator/da903x.c')
-rw-r--r-- | drivers/regulator/da903x.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/regulator/da903x.c b/drivers/regulator/da903x.c index f8c4661a7a81..362e08221085 100644 --- a/drivers/regulator/da903x.c +++ b/drivers/regulator/da903x.c | |||
@@ -107,7 +107,7 @@ static inline int check_range(struct da903x_regulator_info *info, | |||
107 | 107 | ||
108 | /* DA9030/DA9034 common operations */ | 108 | /* DA9030/DA9034 common operations */ |
109 | static int da903x_set_ldo_voltage(struct regulator_dev *rdev, | 109 | static int da903x_set_ldo_voltage(struct regulator_dev *rdev, |
110 | int min_uV, int max_uV) | 110 | int min_uV, int max_uV, unsigned *selector) |
111 | { | 111 | { |
112 | struct da903x_regulator_info *info = rdev_get_drvdata(rdev); | 112 | struct da903x_regulator_info *info = rdev_get_drvdata(rdev); |
113 | struct device *da9034_dev = to_da903x_dev(rdev); | 113 | struct device *da9034_dev = to_da903x_dev(rdev); |
@@ -119,6 +119,7 @@ static int da903x_set_ldo_voltage(struct regulator_dev *rdev, | |||
119 | } | 119 | } |
120 | 120 | ||
121 | val = (min_uV - info->min_uV + info->step_uV - 1) / info->step_uV; | 121 | val = (min_uV - info->min_uV + info->step_uV - 1) / info->step_uV; |
122 | *selector = val; | ||
122 | val <<= info->vol_shift; | 123 | val <<= info->vol_shift; |
123 | mask = ((1 << info->vol_nbits) - 1) << info->vol_shift; | 124 | mask = ((1 << info->vol_nbits) - 1) << info->vol_shift; |
124 | 125 | ||
@@ -187,7 +188,8 @@ static int da903x_list_voltage(struct regulator_dev *rdev, unsigned selector) | |||
187 | 188 | ||
188 | /* DA9030 specific operations */ | 189 | /* DA9030 specific operations */ |
189 | static int da9030_set_ldo1_15_voltage(struct regulator_dev *rdev, | 190 | static int da9030_set_ldo1_15_voltage(struct regulator_dev *rdev, |
190 | int min_uV, int max_uV) | 191 | int min_uV, int max_uV, |
192 | unsigned *selector) | ||
191 | { | 193 | { |
192 | struct da903x_regulator_info *info = rdev_get_drvdata(rdev); | 194 | struct da903x_regulator_info *info = rdev_get_drvdata(rdev); |
193 | struct device *da903x_dev = to_da903x_dev(rdev); | 195 | struct device *da903x_dev = to_da903x_dev(rdev); |
@@ -200,6 +202,7 @@ static int da9030_set_ldo1_15_voltage(struct regulator_dev *rdev, | |||
200 | } | 202 | } |
201 | 203 | ||
202 | val = (min_uV - info->min_uV + info->step_uV - 1) / info->step_uV; | 204 | val = (min_uV - info->min_uV + info->step_uV - 1) / info->step_uV; |
205 | *selector = val; | ||
203 | val <<= info->vol_shift; | 206 | val <<= info->vol_shift; |
204 | mask = ((1 << info->vol_nbits) - 1) << info->vol_shift; | 207 | mask = ((1 << info->vol_nbits) - 1) << info->vol_shift; |
205 | val |= DA9030_LDO_UNLOCK; /* have to set UNLOCK bits */ | 208 | val |= DA9030_LDO_UNLOCK; /* have to set UNLOCK bits */ |
@@ -214,7 +217,8 @@ static int da9030_set_ldo1_15_voltage(struct regulator_dev *rdev, | |||
214 | } | 217 | } |
215 | 218 | ||
216 | static int da9030_set_ldo14_voltage(struct regulator_dev *rdev, | 219 | static int da9030_set_ldo14_voltage(struct regulator_dev *rdev, |
217 | int min_uV, int max_uV) | 220 | int min_uV, int max_uV, |
221 | unsigned *selector) | ||
218 | { | 222 | { |
219 | struct da903x_regulator_info *info = rdev_get_drvdata(rdev); | 223 | struct da903x_regulator_info *info = rdev_get_drvdata(rdev); |
220 | struct device *da903x_dev = to_da903x_dev(rdev); | 224 | struct device *da903x_dev = to_da903x_dev(rdev); |
@@ -234,6 +238,7 @@ static int da9030_set_ldo14_voltage(struct regulator_dev *rdev, | |||
234 | val = (min_uV - thresh + info->step_uV - 1) / info->step_uV; | 238 | val = (min_uV - thresh + info->step_uV - 1) / info->step_uV; |
235 | } | 239 | } |
236 | 240 | ||
241 | *selector = val; | ||
237 | val <<= info->vol_shift; | 242 | val <<= info->vol_shift; |
238 | mask = ((1 << info->vol_nbits) - 1) << info->vol_shift; | 243 | mask = ((1 << info->vol_nbits) - 1) << info->vol_shift; |
239 | 244 | ||
@@ -263,7 +268,7 @@ static int da9030_get_ldo14_voltage(struct regulator_dev *rdev) | |||
263 | 268 | ||
264 | /* DA9034 specific operations */ | 269 | /* DA9034 specific operations */ |
265 | static int da9034_set_dvc_voltage(struct regulator_dev *rdev, | 270 | static int da9034_set_dvc_voltage(struct regulator_dev *rdev, |
266 | int min_uV, int max_uV) | 271 | int min_uV, int max_uV, unsigned *selector) |
267 | { | 272 | { |
268 | struct da903x_regulator_info *info = rdev_get_drvdata(rdev); | 273 | struct da903x_regulator_info *info = rdev_get_drvdata(rdev); |
269 | struct device *da9034_dev = to_da903x_dev(rdev); | 274 | struct device *da9034_dev = to_da903x_dev(rdev); |
@@ -276,6 +281,7 @@ static int da9034_set_dvc_voltage(struct regulator_dev *rdev, | |||
276 | } | 281 | } |
277 | 282 | ||
278 | val = (min_uV - info->min_uV + info->step_uV - 1) / info->step_uV; | 283 | val = (min_uV - info->min_uV + info->step_uV - 1) / info->step_uV; |
284 | *selector = val; | ||
279 | val <<= info->vol_shift; | 285 | val <<= info->vol_shift; |
280 | mask = ((1 << info->vol_nbits) - 1) << info->vol_shift; | 286 | mask = ((1 << info->vol_nbits) - 1) << info->vol_shift; |
281 | 287 | ||
@@ -289,7 +295,7 @@ static int da9034_set_dvc_voltage(struct regulator_dev *rdev, | |||
289 | } | 295 | } |
290 | 296 | ||
291 | static int da9034_set_ldo12_voltage(struct regulator_dev *rdev, | 297 | static int da9034_set_ldo12_voltage(struct regulator_dev *rdev, |
292 | int min_uV, int max_uV) | 298 | int min_uV, int max_uV, unsigned *selector) |
293 | { | 299 | { |
294 | struct da903x_regulator_info *info = rdev_get_drvdata(rdev); | 300 | struct da903x_regulator_info *info = rdev_get_drvdata(rdev); |
295 | struct device *da9034_dev = to_da903x_dev(rdev); | 301 | struct device *da9034_dev = to_da903x_dev(rdev); |
@@ -302,6 +308,7 @@ static int da9034_set_ldo12_voltage(struct regulator_dev *rdev, | |||
302 | 308 | ||
303 | val = (min_uV - info->min_uV + info->step_uV - 1) / info->step_uV; | 309 | val = (min_uV - info->min_uV + info->step_uV - 1) / info->step_uV; |
304 | val = (val >= 20) ? val - 12 : ((val > 7) ? 8 : val); | 310 | val = (val >= 20) ? val - 12 : ((val > 7) ? 8 : val); |
311 | *selector = val; | ||
305 | val <<= info->vol_shift; | 312 | val <<= info->vol_shift; |
306 | mask = ((1 << info->vol_nbits) - 1) << info->vol_shift; | 313 | mask = ((1 << info->vol_nbits) - 1) << info->vol_shift; |
307 | 314 | ||