Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 312551
b: refs/heads/master
c: d580cb5
h: refs/heads/master
i:
  312549: 531ffc8
  312547: 1591d69
  312543: 1152ba3
v: v3
  • Loading branch information
Axel Lin authored and Mark Brown committed Jun 17, 2012
1 parent 4046f84 commit a29b09b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 36 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: 0a4796896bda399a63090dad267896ea93d44fa7
refs/heads/master: d580cb5e78763eb3d8149e0d60a0a73d355d27c5
44 changes: 9 additions & 35 deletions trunk/drivers/regulator/wm831x-dcdc.c
Original file line number Diff line number Diff line change
Expand Up @@ -599,51 +599,25 @@ static struct platform_driver wm831x_buckv_driver = {
* BUCKP specifics
*/

static int wm831x_buckp_set_voltage_int(struct regulator_dev *rdev, int reg,
int min_uV, int max_uV, int *selector)
static int wm831x_buckp_set_suspend_voltage(struct regulator_dev *rdev, int uV)
{
struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
struct wm831x *wm831x = dcdc->wm831x;
u16 vsel;

if (min_uV <= 34000000)
vsel = (min_uV - 850000) / 25000;
else
return -EINVAL;

if (regulator_list_voltage_linear(rdev, vsel) > max_uV)
return -EINVAL;

*selector = vsel;

return wm831x_set_bits(wm831x, reg, WM831X_DC3_ON_VSEL_MASK, vsel);
}

static int wm831x_buckp_set_voltage(struct regulator_dev *rdev,
int min_uV, int max_uV,
unsigned *selector)
{
struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
u16 reg = dcdc->base + WM831X_DCDC_ON_CONFIG;

return wm831x_buckp_set_voltage_int(rdev, reg, min_uV, max_uV,
selector);
}

static int wm831x_buckp_set_suspend_voltage(struct regulator_dev *rdev,
int uV)
{
struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
u16 reg = dcdc->base + WM831X_DCDC_SLEEP_CONTROL;
unsigned selector;
int sel;

sel = regulator_map_voltage_linear(rdev, uV, uV);
if (sel < 0)
return sel;

return wm831x_buckp_set_voltage_int(rdev, reg, uV, uV, &selector);
return wm831x_set_bits(wm831x, reg, WM831X_DC3_ON_VSEL_MASK, sel);
}

static struct regulator_ops wm831x_buckp_ops = {
.set_voltage = wm831x_buckp_set_voltage,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.list_voltage = regulator_list_voltage_linear,
.map_voltage = regulator_map_voltage_linear,
.set_suspend_voltage = wm831x_buckp_set_suspend_voltage,

.is_enabled = regulator_is_enabled_regmap,
Expand Down

0 comments on commit a29b09b

Please sign in to comment.