Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 177720
b: refs/heads/master
c: 638f85c
h: refs/heads/master
v: v3
  • Loading branch information
Mark Brown authored and Liam Girdwood committed Dec 17, 2009
1 parent 51169d0 commit ce85b70
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 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: 1083c39346d482b9001944d05c09191027892226
refs/heads/master: 638f85c54f4fed0f8f1fbc23745a8f334112e892
25 changes: 22 additions & 3 deletions trunk/drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,10 +581,29 @@ static int suspend_set_state(struct regulator_dev *rdev,
struct regulator_state *rstate)
{
int ret = 0;
bool can_set_state;

/* enable & disable are mandatory for suspend control */
if (!rdev->desc->ops->set_suspend_enable ||
!rdev->desc->ops->set_suspend_disable) {
can_set_state = rdev->desc->ops->set_suspend_enable &&
rdev->desc->ops->set_suspend_disable;

/* If we have no suspend mode configration don't set anything;
* only warn if the driver actually makes the suspend mode
* configurable.
*/
if (!rstate->enabled && !rstate->disabled) {
if (can_set_state)
printk(KERN_WARNING "%s: No configuration for %s\n",
__func__, rdev_get_name(rdev));
return 0;
}

if (rstate->enabled && rstate->disabled) {
printk(KERN_ERR "%s: invalid configuration for %s\n",
__func__, rdev_get_name(rdev));
return -EINVAL;
}

if (!can_set_state) {
printk(KERN_ERR "%s: no way to set suspend state\n",
__func__);
return -EINVAL;
Expand Down
6 changes: 5 additions & 1 deletion trunk/include/linux/regulator/machine.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,20 @@ struct regulator;
/**
* struct regulator_state - regulator state during low power system states
*
* This describes a regulators state during a system wide low power state.
* This describes a regulators state during a system wide low power
* state. One of enabled or disabled must be set for the
* configuration to be applied.
*
* @uV: Operating voltage during suspend.
* @mode: Operating mode during suspend.
* @enabled: Enabled during suspend.
* @disabled: Disabled during suspend.
*/
struct regulator_state {
int uV; /* suspend voltage */
unsigned int mode; /* suspend regulator operating mode */
int enabled; /* is regulator enabled in this suspend state */
int disabled; /* is the regulator disbled in this suspend state */
};

/**
Expand Down

0 comments on commit ce85b70

Please sign in to comment.