blob: 45a75d9381eb1caf30e4c75b59a43fda0ba3c6e6 [file] [log] [blame]
Thomas Gleixnerd2912cb2019-06-04 10:11:33 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Nicolas Pitre1c33be52012-04-12 02:56:10 -04002/*
3 * arch/arm/include/asm/bL_switcher.h
4 *
5 * Created by: Nicolas Pitre, April 2012
6 * Copyright: (C) 2012-2013 Linaro Limited
Nicolas Pitre1c33be52012-04-12 02:56:10 -04007 */
8
9#ifndef ASM_BL_SWITCHER_H
10#define ASM_BL_SWITCHER_H
11
Dave Martin491990e2012-12-10 17:19:58 +000012#include <linux/compiler.h>
13#include <linux/types.h>
14
Dave Martin0577fee2013-05-22 19:08:16 +010015typedef void (*bL_switch_completion_handler)(void *cookie);
16
17int bL_switch_request_cb(unsigned int cpu, unsigned int new_cluster_id,
18 bL_switch_completion_handler completer,
19 void *completer_cookie);
20static inline int bL_switch_request(unsigned int cpu, unsigned int new_cluster_id)
21{
22 return bL_switch_request_cb(cpu, new_cluster_id, NULL, NULL);
23}
Nicolas Pitre1c33be52012-04-12 02:56:10 -040024
Dave Martin491990e2012-12-10 17:19:58 +000025/*
26 * Register here to be notified about runtime enabling/disabling of
27 * the switcher.
28 *
29 * The notifier chain is called with the switcher activation lock held:
30 * the switcher will not be enabled or disabled during callbacks.
31 * Callbacks must not call bL_switcher_{get,put}_enabled().
32 */
33#define BL_NOTIFY_PRE_ENABLE 0
34#define BL_NOTIFY_POST_ENABLE 1
35#define BL_NOTIFY_PRE_DISABLE 2
36#define BL_NOTIFY_POST_DISABLE 3
37
38#ifdef CONFIG_BL_SWITCHER
39
40int bL_switcher_register_notifier(struct notifier_block *nb);
41int bL_switcher_unregister_notifier(struct notifier_block *nb);
42
43/*
44 * Use these functions to temporarily prevent enabling/disabling of
45 * the switcher.
46 * bL_switcher_get_enabled() returns true if the switcher is currently
47 * enabled. Each call to bL_switcher_get_enabled() must be followed
48 * by a call to bL_switcher_put_enabled(). These functions are not
49 * recursive.
50 */
Dave Martinc0f43752012-12-10 17:19:57 +000051bool bL_switcher_get_enabled(void);
52void bL_switcher_put_enabled(void);
53
Dave Martin29064b82013-02-11 14:39:19 +000054int bL_switcher_trace_trigger(void);
Dave Martind08e2e02013-02-13 16:20:44 +000055int bL_switcher_get_logical_index(u32 mpidr);
Dave Martin29064b82013-02-11 14:39:19 +000056
Dave Martin491990e2012-12-10 17:19:58 +000057#else
58static inline int bL_switcher_register_notifier(struct notifier_block *nb)
59{
60 return 0;
61}
62
63static inline int bL_switcher_unregister_notifier(struct notifier_block *nb)
64{
65 return 0;
66}
67
68static inline bool bL_switcher_get_enabled(void) { return false; }
69static inline void bL_switcher_put_enabled(void) { }
Dave Martin29064b82013-02-11 14:39:19 +000070static inline int bL_switcher_trace_trigger(void) { return 0; }
Dave Martind08e2e02013-02-13 16:20:44 +000071static inline int bL_switcher_get_logical_index(u32 mpidr) { return -EUNATCH; }
Dave Martin491990e2012-12-10 17:19:58 +000072#endif /* CONFIG_BL_SWITCHER */
73
Nicolas Pitre1c33be52012-04-12 02:56:10 -040074#endif