aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh
diff options
context:
space:
mode:
authorMagnus Damm <damm@opensource.se>2009-10-29 06:51:48 -0400
committerPaul Mundt <lethal@linux-sh.org>2009-10-29 22:54:59 -0400
commit49f42644fd01bc7bd9b6b0a080fee1a89dc66665 (patch)
tree570a5cc04f260ecdb81eb4af5ab3000c8518aa7d /arch/sh
parenteb3118f652ea7751ecf6a7e467bb637895e3be3b (diff)
sh: Add notifiers chains for cpu/board code
This patch adds atomic notifier chains for pre/post sleep events. Useful for cpu code and boards that need to save and restore register state before and after entering a sleep mode. Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh')
-rw-r--r--arch/sh/include/asm/suspend.h11
-rw-r--r--arch/sh/kernel/cpu/shmobile/pm.c12
2 files changed, 23 insertions, 0 deletions
diff --git a/arch/sh/include/asm/suspend.h b/arch/sh/include/asm/suspend.h
index 5c8ea28ff7a4..d1cc5221645d 100644
--- a/arch/sh/include/asm/suspend.h
+++ b/arch/sh/include/asm/suspend.h
@@ -2,6 +2,7 @@
2#define _ASM_SH_SUSPEND_H 2#define _ASM_SH_SUSPEND_H
3 3
4#ifndef __ASSEMBLY__ 4#ifndef __ASSEMBLY__
5#include <linux/notifier.h>
5static inline int arch_prepare_suspend(void) { return 0; } 6static inline int arch_prepare_suspend(void) { return 0; }
6 7
7#include <asm/ptrace.h> 8#include <asm/ptrace.h>
@@ -19,6 +20,16 @@ void sh_mobile_setup_cpuidle(void);
19static inline void sh_mobile_setup_cpuidle(void) {} 20static inline void sh_mobile_setup_cpuidle(void) {}
20#endif 21#endif
21 22
23/* notifier chains for pre/post sleep hooks */
24extern struct atomic_notifier_head sh_mobile_pre_sleep_notifier_list;
25extern struct atomic_notifier_head sh_mobile_post_sleep_notifier_list;
26
27/* priority levels for notifiers */
28#define SH_MOBILE_SLEEP_BOARD 0
29#define SH_MOBILE_SLEEP_CPU 1
30#define SH_MOBILE_PRE(x) (x)
31#define SH_MOBILE_POST(x) (-(x))
32
22#endif 33#endif
23 34
24/* flags passed to assembly suspend code */ 35/* flags passed to assembly suspend code */
diff --git a/arch/sh/kernel/cpu/shmobile/pm.c b/arch/sh/kernel/cpu/shmobile/pm.c
index ee3c2aaf66fb..7ebf8cf89242 100644
--- a/arch/sh/kernel/cpu/shmobile/pm.c
+++ b/arch/sh/kernel/cpu/shmobile/pm.c
@@ -17,6 +17,12 @@
17#include <asm/uaccess.h> 17#include <asm/uaccess.h>
18 18
19/* 19/*
20 * Notifier lists for pre/post sleep notification
21 */
22ATOMIC_NOTIFIER_HEAD(sh_mobile_pre_sleep_notifier_list);
23ATOMIC_NOTIFIER_HEAD(sh_mobile_post_sleep_notifier_list);
24
25/*
20 * Sleep modes available on SuperH Mobile: 26 * Sleep modes available on SuperH Mobile:
21 * 27 *
22 * Sleep mode is just plain "sleep" instruction 28 * Sleep mode is just plain "sleep" instruction
@@ -44,8 +50,14 @@ void sh_mobile_call_standby(unsigned long mode)
44 void *onchip_mem = (void *)ILRAM_BASE; 50 void *onchip_mem = (void *)ILRAM_BASE;
45 void (*standby_onchip_mem)(unsigned long, unsigned long) = onchip_mem; 51 void (*standby_onchip_mem)(unsigned long, unsigned long) = onchip_mem;
46 52
53 atomic_notifier_call_chain(&sh_mobile_pre_sleep_notifier_list,
54 mode, NULL);
55
47 /* Let assembly snippet in on-chip memory handle the rest */ 56 /* Let assembly snippet in on-chip memory handle the rest */
48 standby_onchip_mem(mode, ILRAM_BASE); 57 standby_onchip_mem(mode, ILRAM_BASE);
58
59 atomic_notifier_call_chain(&sh_mobile_post_sleep_notifier_list,
60 mode, NULL);
49} 61}
50 62
51static int sh_pm_enter(suspend_state_t state) 63static int sh_pm_enter(suspend_state_t state)