soc: samsung: Called regulator_suspend_prepare/finish for suspend.
authorJonghwa Lee <jonghwa3.lee@samsung.com>
Tue, 10 Mar 2015 06:32:09 +0000 (15:32 +0900)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Wed, 14 Dec 2016 04:43:09 +0000 (13:43 +0900)
To enter system-wide suspend, it may requires to set suspend operation
mode for regulators. Thus it calls regulator_suspend_prepare()/_finish()
at the proper step of suspend.

Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
drivers/soc/samsung/exynos-pm.c

index e903be0..836bbce 100644 (file)
 #include <linux/syscore_ops.h>
 #include <linux/soc/samsung/exynos-pmu.h>
 #include <linux/soc/samsung/exynos-pm.h>
+#include <linux/regulator/machine.h>
 
 static struct exynos_pm_ops *pm_ops;
 
 static int exynos_suspend_prepare(void)
 {
+       int ret;
+
+       ret = regulator_suspend_prepare(PM_SUSPEND_MEM);
+       if (ret) {
+               pr_err("Failed to prepare regulators for suspend.\n");
+               return ret;
+       }
+
        if (pm_ops->prepare)
                return pm_ops->prepare();
 
@@ -36,10 +45,20 @@ static int exynos_suspend_enter(suspend_state_t state)
        return 0;
 }
 
+static void exynos_suspend_finish(void)
+{
+       int ret;
+
+       ret = regulator_suspend_finish();
+       if (ret)
+               pr_warn("Failed to resume regulators from suspend.\n");
+}
+
 static struct platform_suspend_ops exynos_suspend_ops = {
        .valid = suspend_valid_only_mem,
        .prepare = exynos_suspend_prepare,
        .enter  = exynos_suspend_enter,
+       .finish = exynos_suspend_finish,
 };
 
 static int exynos_pm_syscore_suspend(void)