diff options
author | Wang Dongsheng <dongsheng.wang@freescale.com> | 2014-04-25 05:28:18 (GMT) |
---|---|---|
committer | Jose Rivera <German.Rivera@freescale.com> | 2014-04-29 14:11:25 (GMT) |
commit | acf2570649581aa9b12a1afcb73215c439ab33c8 (patch) | |
tree | 538b6977aa5b63d5d9046d3e90929f3f08eefe9f /arch/powerpc/sysdev/fsl_pmc.c | |
parent | 22642f20535811b5bf40a3f3323fd4e5719a162d (diff) | |
download | linux-fsl-qoriq-acf2570649581aa9b12a1afcb73215c439ab33c8.tar.xz |
fsl/pm: add api to get suspend state which is STANDBY or MEM
Add set_pm_suspend_state & pm_suspend_state functions to set/get
suspend state. When system going to sleep or deep sleep, devices
can get the system suspend state(STANDBY/MEM) through pm_suspend_state
function and to handle different situations.
Signed-off-by: Wang Dongsheng <dongsheng.wang@freescale.com>
Change-Id: Ibd369079f6f0777854d88d7e1af21f455eaf909e
Reviewed-on: http://git.am.freescale.net:8181/11530
Tested-by: Review Code-CDREVIEW <CDREVIEW@freescale.com>
Reviewed-by: Yang Li <LeoLi@freescale.com>
Reviewed-by: Jose Rivera <German.Rivera@freescale.com>
Diffstat (limited to 'arch/powerpc/sysdev/fsl_pmc.c')
-rw-r--r-- | arch/powerpc/sysdev/fsl_pmc.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/arch/powerpc/sysdev/fsl_pmc.c b/arch/powerpc/sysdev/fsl_pmc.c index 61dba33..e56edfa 100644 --- a/arch/powerpc/sysdev/fsl_pmc.c +++ b/arch/powerpc/sysdev/fsl_pmc.c @@ -21,6 +21,7 @@ #include <linux/device.h> #include <linux/of_platform.h> #include <linux/pm.h> +#include <asm/fsl_pm.h> #include <asm/switch_to.h> #include <asm/cacheflush.h> @@ -163,16 +164,25 @@ static int pmc_suspend_enter(suspend_state_t state) static int pmc_suspend_valid(suspend_state_t state) { + set_pm_suspend_state(state); + if (((pmc_flag & PMC_SLEEP) && (state == PM_SUSPEND_STANDBY)) || ((pmc_flag & PMC_DEEP_SLEEP) && (state == PM_SUSPEND_MEM))) return 1; - else - return 0; + + set_pm_suspend_state(PM_SUSPEND_ON); + return 0; +} + +static void pmc_suspend_end(void) +{ + set_pm_suspend_state(PM_SUSPEND_ON); } static const struct platform_suspend_ops pmc_suspend_ops = { .valid = pmc_suspend_valid, .enter = pmc_suspend_enter, + .end = pmc_suspend_end, }; static int pmc_probe(struct platform_device *pdev) @@ -191,6 +201,7 @@ static int pmc_probe(struct platform_device *pdev) pmc_flag |= PMC_DEEP_SLEEP | PMC_LOSSLESS; suspend_set_ops(&pmc_suspend_ops); + set_pm_suspend_state(PM_SUSPEND_ON); pr_info("Freescale PMC driver\n"); return 0; |