aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/include
diff options
context:
space:
mode:
authorDave Martin <dave.martin@linaro.org>2012-12-10 12:19:58 -0500
committerNicolas Pitre <nicolas.pitre@linaro.org>2013-09-23 18:39:06 -0400
commit491990e29f5d285a1b75e74785e3160716b79040 (patch)
tree72229acfce9b46c63f86ad383ff5f97ed0f8908b /arch/arm/include
parentc0f4375146a738bae23e48fa8b5383abf02177cb (diff)
ARM: bL_switcher: Add runtime control notifier
Some subsystems will need to respond synchronously to runtime enabling and disabling of the switcher. This patch adds a dedicated notifier interface to support such subsystems. Pre- and post- enable/disable notifications are sent to registered callbacks, allowing safe transition of non-b.L- transparent subsystems across these control transitions. Notifier callbacks may veto switcher (de)activation on pre notifications only. Post notifications won't revert the action. If enabling or disabling of the switcher fails after the pre-change notification has been sent, subsystems which have registered notifiers can be left in an inappropriate state. This patch sends a suitable post-change notification on failure, indicating that the old state has been reestablished. For example, a failed initialisation will result in the following sequence: BL_NOTIFY_PRE_ENABLE /* switcher initialisation fails */ BL_NOTIFY_POST_DISABLE It is the responsibility of notified subsystems to respond in an appropriate way. Signed-off-by: Dave Martin <dave.martin@linaro.org> Signed-off-by: Nicolas Pitre <nico@linaro.org>
Diffstat (limited to 'arch/arm/include')
-rw-r--r--arch/arm/include/asm/bL_switcher.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/arch/arm/include/asm/bL_switcher.h b/arch/arm/include/asm/bL_switcher.h
index 05d7c4cb9473..b243ca93e8e9 100644
--- a/arch/arm/include/asm/bL_switcher.h
+++ b/arch/arm/include/asm/bL_switcher.h
@@ -12,9 +12,53 @@
12#ifndef ASM_BL_SWITCHER_H 12#ifndef ASM_BL_SWITCHER_H
13#define ASM_BL_SWITCHER_H 13#define ASM_BL_SWITCHER_H
14 14
15#include <linux/compiler.h>
16#include <linux/types.h>
17
15int bL_switch_request(unsigned int cpu, unsigned int new_cluster_id); 18int bL_switch_request(unsigned int cpu, unsigned int new_cluster_id);
16 19
20/*
21 * Register here to be notified about runtime enabling/disabling of
22 * the switcher.
23 *
24 * The notifier chain is called with the switcher activation lock held:
25 * the switcher will not be enabled or disabled during callbacks.
26 * Callbacks must not call bL_switcher_{get,put}_enabled().
27 */
28#define BL_NOTIFY_PRE_ENABLE 0
29#define BL_NOTIFY_POST_ENABLE 1
30#define BL_NOTIFY_PRE_DISABLE 2
31#define BL_NOTIFY_POST_DISABLE 3
32
33#ifdef CONFIG_BL_SWITCHER
34
35int bL_switcher_register_notifier(struct notifier_block *nb);
36int bL_switcher_unregister_notifier(struct notifier_block *nb);
37
38/*
39 * Use these functions to temporarily prevent enabling/disabling of
40 * the switcher.
41 * bL_switcher_get_enabled() returns true if the switcher is currently
42 * enabled. Each call to bL_switcher_get_enabled() must be followed
43 * by a call to bL_switcher_put_enabled(). These functions are not
44 * recursive.
45 */
17bool bL_switcher_get_enabled(void); 46bool bL_switcher_get_enabled(void);
18void bL_switcher_put_enabled(void); 47void bL_switcher_put_enabled(void);
19 48
49#else
50static inline int bL_switcher_register_notifier(struct notifier_block *nb)
51{
52 return 0;
53}
54
55static inline int bL_switcher_unregister_notifier(struct notifier_block *nb)
56{
57 return 0;
58}
59
60static inline bool bL_switcher_get_enabled(void) { return false; }
61static inline void bL_switcher_put_enabled(void) { }
62#endif /* CONFIG_BL_SWITCHER */
63
20#endif 64#endif