Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 242971
b: refs/heads/master
c: 7a32b58
h: refs/heads/master
i:
  242969: 7c4f613
  242967: bbf0d99
v: v3
  • Loading branch information
MyungJoo Ham authored and Liam Girdwood committed Mar 26, 2011
1 parent 7c5fd5c commit 08c6f82
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fb7c18cac8608983168a7f4f55193cea190c83c8
refs/heads/master: 7a32b589a9c856493bccb02db55047edc04eee7b
41 changes: 41 additions & 0 deletions trunk/drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2655,6 +2655,47 @@ int regulator_suspend_prepare(suspend_state_t state)
}
EXPORT_SYMBOL_GPL(regulator_suspend_prepare);

/**
* regulator_suspend_finish - resume regulators from system wide suspend
*
* Turn on regulators that might be turned off by regulator_suspend_prepare
* and that should be turned on according to the regulators properties.
*/
int regulator_suspend_finish(void)
{
struct regulator_dev *rdev;
int ret = 0, error;

mutex_lock(&regulator_list_mutex);
list_for_each_entry(rdev, &regulator_list, list) {
struct regulator_ops *ops = rdev->desc->ops;

mutex_lock(&rdev->mutex);
if ((rdev->use_count > 0 || rdev->constraints->always_on) &&
ops->enable) {
error = ops->enable(rdev);
if (error)
ret = error;
} else {
if (!has_full_constraints)
goto unlock;
if (!ops->disable)
goto unlock;
if (ops->is_enabled && !ops->is_enabled(rdev))
goto unlock;

error = ops->disable(rdev);
if (error)
ret = error;
}
unlock:
mutex_unlock(&rdev->mutex);
}
mutex_unlock(&regulator_list_mutex);
return ret;
}
EXPORT_SYMBOL_GPL(regulator_suspend_finish);

/**
* regulator_has_full_constraints - the system has fully specified constraints
*
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/regulator/machine.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ struct regulator_init_data {
};

int regulator_suspend_prepare(suspend_state_t state);
int regulator_suspend_finish(void);

#ifdef CONFIG_REGULATOR
void regulator_has_full_constraints(void);
Expand Down

0 comments on commit 08c6f82

Please sign in to comment.