Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 252151
b: refs/heads/master
c: 1a39962
h: refs/heads/master
i:
  252149: fae4bbe
  252147: 48ee57c
  252143: 03c7eeb
v: v3
  • Loading branch information
Saquib Herman authored and Liam Girdwood committed May 27, 2011
1 parent 6facf0a commit c38776b
Show file tree
Hide file tree
Showing 2 changed files with 35 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: 9a0244ad719258b0ae6064ad7da937cddcb109e0
refs/heads/master: 1a39962fc4d1fccdf45fef2656b37acbae5fa793
42 changes: 34 additions & 8 deletions trunk/drivers/regulator/twl-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,15 +262,12 @@ static int twl6030reg_get_status(struct regulator_dev *rdev)
return REGULATOR_STATUS_OFF;
}

static int twlreg_set_mode(struct regulator_dev *rdev, unsigned mode)
static int twl4030reg_set_mode(struct regulator_dev *rdev, unsigned mode)
{
struct twlreg_info *info = rdev_get_drvdata(rdev);
unsigned message;
int status;

if (twl_class_is_6030())
return 0; /* FIXME return for 6030 regulator */

/* We can only set the mode through state machine commands... */
switch (mode) {
case REGULATOR_MODE_NORMAL:
Expand Down Expand Up @@ -299,6 +296,35 @@ static int twlreg_set_mode(struct regulator_dev *rdev, unsigned mode)
message & 0xff, TWL4030_PM_MASTER_PB_WORD_LSB);
}

static int twl6030reg_set_mode(struct regulator_dev *rdev, unsigned mode)
{
struct twlreg_info *info = rdev_get_drvdata(rdev);
int grp;
int val;

grp = twlreg_read(info, TWL_MODULE_PM_RECEIVER, VREG_GRP);

if (grp < 0)
return grp;

/* Compose the state register settings */
val = grp << TWL6030_CFG_STATE_GRP_SHIFT;
/* We can only set the mode through state machine commands... */
switch (mode) {
case REGULATOR_MODE_NORMAL:
val |= TWL6030_CFG_STATE_ON;
break;
case REGULATOR_MODE_STANDBY:
val |= TWL6030_CFG_STATE_SLEEP;
break;

default:
return -EINVAL;
}

return twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_STATE, val);
}

/*----------------------------------------------------------------------*/

/*
Expand Down Expand Up @@ -451,7 +477,7 @@ static struct regulator_ops twl4030ldo_ops = {
.disable = twlreg_disable,
.is_enabled = twl4030reg_is_enabled,

.set_mode = twlreg_set_mode,
.set_mode = twl4030reg_set_mode,

.get_status = twl4030reg_get_status,
};
Expand Down Expand Up @@ -509,7 +535,7 @@ static struct regulator_ops twl6030ldo_ops = {
.disable = twlreg_disable,
.is_enabled = twl6030reg_is_enabled,

.set_mode = twlreg_set_mode,
.set_mode = twl6030reg_set_mode,

.get_status = twl6030reg_get_status,
};
Expand Down Expand Up @@ -542,7 +568,7 @@ static struct regulator_ops twl4030fixed_ops = {
.disable = twlreg_disable,
.is_enabled = twl4030reg_is_enabled,

.set_mode = twlreg_set_mode,
.set_mode = twl4030reg_set_mode,

.get_status = twl4030reg_get_status,
};
Expand All @@ -556,7 +582,7 @@ static struct regulator_ops twl6030fixed_ops = {
.disable = twlreg_disable,
.is_enabled = twl6030reg_is_enabled,

.set_mode = twlreg_set_mode,
.set_mode = twl6030reg_set_mode,

.get_status = twl6030reg_get_status,
};
Expand Down

0 comments on commit c38776b

Please sign in to comment.