Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 343137
b: refs/heads/master
c: f509fd4
h: refs/heads/master
i:
  343135: 6aaa00e
v: v3
  • Loading branch information
Axel Lin authored and Mark Brown committed Nov 27, 2012
1 parent f1c9c13 commit 2869c2d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 369cf602f364a60c72b8258c21eca8793939328f
refs/heads/master: f509fd46c164524d06a33b01a64f9bd2033e4825
21 changes: 9 additions & 12 deletions trunk/drivers/regulator/da9055-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -187,21 +187,18 @@ static int da9055_buck_set_current_limit(struct regulator_dev *rdev, int min_uA,
{
struct da9055_regulator *regulator = rdev_get_drvdata(rdev);
struct da9055_regulator_info *info = regulator->info;
int i, val = 0;

if (min_uA > da9055_current_limits[DA9055_MAX_UA] ||
max_uA < da9055_current_limits[DA9055_MIN_UA])
return -EINVAL;
int i;

for (i = 0; i < ARRAY_SIZE(da9055_current_limits); i++) {
if (min_uA <= da9055_current_limits[i]) {
val = i;
break;
}
for (i = ARRAY_SIZE(da9055_current_limits) - 1; i >= 0; i--) {
if ((min_uA <= da9055_current_limits[i]) &&
(da9055_current_limits[i] <= max_uA))
return da9055_reg_update(regulator->da9055,
DA9055_REG_BUCK_LIM,
info->mode.mask,
i << info->mode.shift);
}

return da9055_reg_update(regulator->da9055, DA9055_REG_BUCK_LIM,
info->mode.mask, val << info->mode.shift);
return -EINVAL;
}

static int da9055_list_voltage(struct regulator_dev *rdev, unsigned selector)
Expand Down

0 comments on commit 2869c2d

Please sign in to comment.