Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 343195
b: refs/heads/master
c: 985884d
h: refs/heads/master
i:
  343193: 71e2aeb
  343191: 0d0c2c2
v: v3
  • Loading branch information
Axel Lin authored and Mark Brown committed Dec 10, 2012
1 parent 6b2e8b8 commit 58c3ffe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 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: 5d6e6ffc400dbc3ea0cc58b8b6f9d9ac748d6572
refs/heads/master: 985884db501d7026257d122c3cc32a7005a9a864
15 changes: 7 additions & 8 deletions trunk/drivers/regulator/anatop-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,16 @@ static int anatop_regmap_set_voltage_sel(struct regulator_dev *reg,
unsigned selector)
{
struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg);
u32 val, mask;
u32 mask;

if (!anatop_reg->control_reg)
return -ENOTSUPP;

val = anatop_reg->min_bit_val + selector;
dev_dbg(&reg->dev, "%s: calculated val %d\n", __func__, val);
mask = ((1 << anatop_reg->vol_bit_width) - 1) <<
anatop_reg->vol_bit_shift;
val <<= anatop_reg->vol_bit_shift;
selector <<= anatop_reg->vol_bit_shift;
regmap_update_bits(anatop_reg->anatop, anatop_reg->control_reg,
mask, val);
mask, selector);

return 0;
}
Expand All @@ -77,7 +75,7 @@ static int anatop_regmap_get_voltage_sel(struct regulator_dev *reg)
anatop_reg->vol_bit_shift;
val = (val & mask) >> anatop_reg->vol_bit_shift;

return val - anatop_reg->min_bit_val;
return val;
}

static struct regulator_ops anatop_rops = {
Expand Down Expand Up @@ -158,10 +156,11 @@ static int __devinit anatop_regulator_probe(struct platform_device *pdev)
goto anatop_probe_end;
}

rdesc->n_voltages = (sreg->max_voltage - sreg->min_voltage)
/ 25000 + 1;
rdesc->n_voltages = (sreg->max_voltage - sreg->min_voltage) / 25000 + 1
+ sreg->min_bit_val;
rdesc->min_uV = sreg->min_voltage;
rdesc->uV_step = 25000;
rdesc->linear_min_sel = sreg->min_bit_val;

config.dev = &pdev->dev;
config.init_data = initdata;
Expand Down

0 comments on commit 58c3ffe

Please sign in to comment.