Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 312642
b: refs/heads/master
c: 8a165df
h: refs/heads/master
v: v3
  • Loading branch information
Axel Lin authored and Mark Brown committed Jul 17, 2012
1 parent cfd4790 commit 75d54f4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 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: 5bae062830b57e75a00f1a643a6e031ad0f15129
refs/heads/master: 8a165df7a915cb212f41c1dec9abc5ac8f8ee6b6
17 changes: 14 additions & 3 deletions trunk/drivers/regulator/palmas-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,11 +373,22 @@ static int palmas_set_voltage_smps_sel(struct regulator_dev *dev,
static int palmas_map_voltage_smps(struct regulator_dev *rdev,
int min_uV, int max_uV)
{
struct palmas_pmic *pmic = rdev_get_drvdata(rdev);
int id = rdev_get_id(rdev);
int ret, voltage;

ret = ((min_uV - 500000) / 10000) + 1;
if (ret < 0)
return ret;
if (min_uV == 0)
return 0;

if (pmic->range[id]) { /* RANGE is x2 */
if (min_uV < 1000000)
min_uV = 1000000;
ret = DIV_ROUND_UP(min_uV - 1000000, 20000) + 1;
} else { /* RANGE is x1 */
if (min_uV < 500000)
min_uV = 500000;
ret = DIV_ROUND_UP(min_uV - 500000, 10000) + 1;
}

/* Map back into a voltage to verify we're still in bounds */
voltage = palmas_list_voltage_smps(rdev, ret);
Expand Down

0 comments on commit 75d54f4

Please sign in to comment.