summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorTomasz Figa <t.figa@samsung.com>2013-04-24 18:58:06 +0200
committerChanho Park <chanho61.park@samsung.com>2014-11-18 11:43:23 +0900
commit2134a0e00bc6c20202bb252777e6f52556eb4f38 (patch)
tree7708c84696d981785658c5e5247c8f3832e22cf2 /drivers
parentdc935ee812ce8f153184adc9a2e4c1ace2778c29 (diff)
downloadlinux-3.10-2134a0e00bc6c20202bb252777e6f52556eb4f38.tar.gz
linux-3.10-2134a0e00bc6c20202bb252777e6f52556eb4f38.tar.bz2
linux-3.10-2134a0e00bc6c20202bb252777e6f52556eb4f38.zip
regulator: Handle suspend and resume of regulators
Signed-off-by: Tomasz Figa <t.figa@samsung.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/regulator/core.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index a86d1232613..66877efc55f 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -3938,6 +3938,32 @@ static const struct file_operations supply_map_fops = {
#endif
};
+static int regulator_pm_notify(struct notifier_block *nb,
+ unsigned long event, void *ptr)
+{
+ int ret;
+
+ switch (event) {
+ case PM_SUSPEND_PREPARE:
+ ret = regulator_suspend_prepare(PM_SUSPEND_MEM);
+ break;
+ case PM_HIBERNATION_PREPARE:
+ ret = regulator_suspend_prepare(PM_SUSPEND_MAX);
+ break;
+ case PM_POST_SUSPEND:
+ case PM_POST_HIBERNATION:
+ ret = regulator_suspend_finish();
+ break;
+ default:
+ return NOTIFY_DONE;
+ }
+
+ if (ret)
+ return NOTIFY_BAD;
+
+ return NOTIFY_OK;
+}
+
static int __init regulator_init(void)
{
int ret;
@@ -3953,6 +3979,8 @@ static int __init regulator_init(void)
regulator_dummy_init();
+ pm_notifier(regulator_pm_notify, 0);
+
return ret;
}