blob: b243ca93e8e941c1f1e7553ca5609fea1a1b38cf [file] [log] [blame]
Nicolas Pitre1c33be52012-04-12 02:56:10 -04001/*
2 * arch/arm/include/asm/bL_switcher.h
3 *
4 * Created by: Nicolas Pitre, April 2012
5 * Copyright: (C) 2012-2013 Linaro Limited
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef ASM_BL_SWITCHER_H
13#define ASM_BL_SWITCHER_H
14
Dave Martin491990e2012-12-10 17:19:58 +000015#include <linux/compiler.h>
16#include <linux/types.h>
17
Nicolas Pitre71ce1de2012-10-26 02:36:17 -040018int bL_switch_request(unsigned int cpu, unsigned int new_cluster_id);
Nicolas Pitre1c33be52012-04-12 02:56:10 -040019
Dave Martin491990e2012-12-10 17:19:58 +000020/*
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 */
Dave Martinc0f43752012-12-10 17:19:57 +000046bool bL_switcher_get_enabled(void);
47void bL_switcher_put_enabled(void);
48
Dave Martin491990e2012-12-10 17:19:58 +000049#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
Nicolas Pitre1c33be52012-04-12 02:56:10 -040064#endif