Nicolas Pitre | 1c33be5 | 2012-04-12 02:56:10 -0400 | [diff] [blame] | 1 | /* |
| 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 Martin | 491990e | 2012-12-10 17:19:58 +0000 | [diff] [blame^] | 15 | #include <linux/compiler.h> |
| 16 | #include <linux/types.h> |
| 17 | |
Nicolas Pitre | 71ce1de | 2012-10-26 02:36:17 -0400 | [diff] [blame] | 18 | int bL_switch_request(unsigned int cpu, unsigned int new_cluster_id); |
Nicolas Pitre | 1c33be5 | 2012-04-12 02:56:10 -0400 | [diff] [blame] | 19 | |
Dave Martin | 491990e | 2012-12-10 17:19:58 +0000 | [diff] [blame^] | 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 | |
| 35 | int bL_switcher_register_notifier(struct notifier_block *nb); |
| 36 | int 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 Martin | c0f4375 | 2012-12-10 17:19:57 +0000 | [diff] [blame] | 46 | bool bL_switcher_get_enabled(void); |
| 47 | void bL_switcher_put_enabled(void); |
| 48 | |
Dave Martin | 491990e | 2012-12-10 17:19:58 +0000 | [diff] [blame^] | 49 | #else |
| 50 | static inline int bL_switcher_register_notifier(struct notifier_block *nb) |
| 51 | { |
| 52 | return 0; |
| 53 | } |
| 54 | |
| 55 | static inline int bL_switcher_unregister_notifier(struct notifier_block *nb) |
| 56 | { |
| 57 | return 0; |
| 58 | } |
| 59 | |
| 60 | static inline bool bL_switcher_get_enabled(void) { return false; } |
| 61 | static inline void bL_switcher_put_enabled(void) { } |
| 62 | #endif /* CONFIG_BL_SWITCHER */ |
| 63 | |
Nicolas Pitre | 1c33be5 | 2012-04-12 02:56:10 -0400 | [diff] [blame] | 64 | #endif |