From 84c243bed615f4a76e3f4f34e87e419e98f7a444 Mon Sep 17 00:00:00 2001 From: Heiko Stuebner Date: Wed, 16 Mar 2016 12:18:43 +0100 Subject: [PATCH] drivers: firmware: psci: notify regulators on system-suspend On some systems regulators need to do special actions on suspend/resume. These get set from the generic regulator_suspend_prepare and regulator_suspend_finish functions so these should be called from the psci suspend ops as well. Change-Id: I6fbf7b39ceae936ed5bd9df6719ccd3cd360840f Signed-off-by: Heiko Stuebner Signed-off-by: Shengfei xu --- drivers/firmware/psci.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c index d24f35d74b27..a33bfddd5f67 100644 --- a/drivers/firmware/psci.c +++ b/drivers/firmware/psci.c @@ -21,6 +21,7 @@ #include #include #include +#include #include @@ -236,9 +237,25 @@ static int psci_system_suspend_enter(suspend_state_t state) return cpu_suspend(0, psci_system_suspend); } +static int psci_system_suspend_prepare(void) +{ + return regulator_suspend_prepare(PM_SUSPEND_MEM); +} + +static void psci_system_suspend_finish(void) +{ + int ret; + + ret = regulator_suspend_finish(); + if (ret < 0) + pr_warn("regulator_suspend_finish failed (%d)\n", ret); +} + static const struct platform_suspend_ops psci_suspend_ops = { .valid = suspend_valid_only_mem, .enter = psci_system_suspend_enter, + .prepare = psci_system_suspend_prepare, + .finish = psci_system_suspend_finish, }; static void __init psci_init_system_suspend(void) -- 2.34.1