Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 312528
b: refs/heads/master
c: d01c3a1
h: refs/heads/master
v: v3
  • Loading branch information
Axel Lin authored and Mark Brown committed Jun 11, 2012
1 parent 42202f9 commit 74d159d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 24 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: ea7e33045458ffd6d13175031527b6527807633c
refs/heads/master: d01c3a1e1b1e4e417202adf1e9dec0730eb00e2b
29 changes: 6 additions & 23 deletions trunk/drivers/regulator/anatop-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,33 +43,15 @@ struct anatop_regulator {
struct regulator_init_data *initdata;
};

static int anatop_set_voltage(struct regulator_dev *reg, int min_uV,
int max_uV, unsigned *selector)
static int anatop_set_voltage_sel(struct regulator_dev *reg, unsigned selector)
{
struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg);
u32 val, sel, mask;
int uv;

uv = min_uV;
dev_dbg(&reg->dev, "%s: uv %d, min %d, max %d\n", __func__,
uv, anatop_reg->min_voltage,
anatop_reg->max_voltage);

if (uv < anatop_reg->min_voltage) {
if (max_uV > anatop_reg->min_voltage)
uv = anatop_reg->min_voltage;
else
return -EINVAL;
}
u32 val, mask;

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

sel = DIV_ROUND_UP(uv - anatop_reg->min_voltage, 25000);
if (sel * 25000 + anatop_reg->min_voltage > anatop_reg->max_voltage)
return -EINVAL;
val = anatop_reg->min_bit_val + sel;
*selector = sel;
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;
Expand All @@ -95,9 +77,10 @@ static int anatop_get_voltage_sel(struct regulator_dev *reg)
}

static struct regulator_ops anatop_rops = {
.set_voltage = anatop_set_voltage,
.set_voltage_sel = anatop_set_voltage_sel,
.get_voltage_sel = anatop_get_voltage_sel,
.list_voltage = regulator_list_voltage_linear,
.list_voltage = regulator_list_voltage_linear,
.map_voltage = regulator_map_voltage_linear,
};

static int __devinit anatop_regulator_probe(struct platform_device *pdev)
Expand Down

0 comments on commit 74d159d

Please sign in to comment.