Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 302142
b: refs/heads/master
c: 7f52ba7
h: refs/heads/master
v: v3
  • Loading branch information
Axel Lin authored and Mark Brown committed Apr 2, 2012
1 parent a0d9eac commit 7b43fe7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 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: 42ff943148f78d6d60d345a52c7cfc6ae3bdf1cf
refs/heads/master: 7f52ba7791a35a8e13a3be992fc98da66e68b77d
15 changes: 5 additions & 10 deletions trunk/drivers/regulator/max8925-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ struct max8925_regulator_info {
int max_uV;
int step_uV;
int vol_reg;
int vol_shift;
int vol_nbits;
int enable_reg;
};

Expand Down Expand Up @@ -75,8 +73,7 @@ static int max8925_set_voltage(struct regulator_dev *rdev,
}
data = DIV_ROUND_UP(min_uV - info->min_uV, info->step_uV);
*selector = data;
data <<= info->vol_shift;
mask = ((1 << info->vol_nbits) - 1) << info->vol_shift;
mask = rdev->desc->n_voltages - 1;

return max8925_set_bits(info->i2c, info->vol_reg, mask, data);
}
Expand All @@ -90,8 +87,8 @@ static int max8925_get_voltage(struct regulator_dev *rdev)
ret = max8925_reg_read(info->i2c, info->vol_reg);
if (ret < 0)
return ret;
mask = ((1 << info->vol_nbits) - 1) << info->vol_shift;
data = (ret & mask) >> info->vol_shift;
mask = rdev->desc->n_voltages - 1;
data = ret & mask;

return max8925_list_voltage(rdev, data);
}
Expand Down Expand Up @@ -191,13 +188,12 @@ static struct regulator_ops max8925_regulator_ldo_ops = {
.type = REGULATOR_VOLTAGE, \
.id = MAX8925_ID_SD##_id, \
.owner = THIS_MODULE, \
.n_voltages = 64, \
}, \
.min_uV = min * 1000, \
.max_uV = max * 1000, \
.step_uV = step * 1000, \
.vol_reg = MAX8925_SDV##_id, \
.vol_shift = 0, \
.vol_nbits = 6, \
.enable_reg = MAX8925_SDCTL##_id, \
}

Expand All @@ -209,13 +205,12 @@ static struct regulator_ops max8925_regulator_ldo_ops = {
.type = REGULATOR_VOLTAGE, \
.id = MAX8925_ID_LDO##_id, \
.owner = THIS_MODULE, \
.n_voltages = 64, \
}, \
.min_uV = min * 1000, \
.max_uV = max * 1000, \
.step_uV = step * 1000, \
.vol_reg = MAX8925_LDOVOUT##_id, \
.vol_shift = 0, \
.vol_nbits = 6, \
.enable_reg = MAX8925_LDOCTL##_id, \
}

Expand Down

0 comments on commit 7b43fe7

Please sign in to comment.