sh: Keep track of allowed sleep modes
Subsystems (2)
PATCH 5/9 sh: Keep track of allowed sleep modes
From: Magnus Damm <[email protected]>
Add code to keep track of supported sleep modes. This to only export cpuidle modes that are backed by board support code. Also, do not allow suspend-to-ram if sdram board code is missing.
Signed-off-by Magnus Damm <[email protected]>
---
arch/sh/include/asm/suspend.h | 3 ++ arch/sh/kernel/cpu/shmobile/cpuidle.c | 42 ++++++++++++++++++--------------- arch/sh/kernel/cpu/shmobile/pm.c | 7 +++++ 3 files changed, 34 insertions(+), 18 deletions(-)
arch/sh/include/asm/suspend.h +3 -0
@@ -49,6 +49,9 @@ struct sh_sleep_data { unsigned long sr; }; +/* a bitmap of supported sleep modes (SUSP_SH..) */ +extern unsigned long sh_mobile_sleep_supported; +#endif /* flags passed to assembly suspend code */
arch/sh/kernel/cpu/shmobile/cpuidle.c +24 -18
49 lines not on this page · raw message
arch/sh/kernel/cpu/shmobile/pm.c +7 -0
@@ -70,6 +70,8 @@ extern const char sh_mobile_sleep_enter_extern const char sh_mobile_sleep_resume_start;extern const char sh_mobile_sleep_resume_end; +unsigned long sh_mobile_sleep_supported =SUSP_SH_SLEEP ; +void sh_mobile_register_self_refresh (unsigned long flags,void *pre_start,void *pre_end,void *post_start,void *post_end)
@@ -105,10 +107,15 @@ void sh_mobile_register_self_refresh(uns vp = onchip_mem +0x600 ;/* located at interrupt vector */ n = &sh_mobile_sleep_resume_end - &sh_mobile_sleep_resume_start;memcpy (vp, &sh_mobile_sleep_resume_start, n); + + sh_mobile_sleep_supported |= flags; }static int sh_pm_enter (suspend_state_t state) { +if (!(sh_mobile_sleep_supported &SUSP_MODE_STANDBY_SF )) +return -ENXIO ; +local_irq_disable ();set_bl_bit ();sh_mobile_call_standby (SUSP_MODE_STANDBY_SF );