577d037f1650b477292f93807c20631c1738c389
[GitHub/moto-9609/android_kernel_motorola_exynos9610.git] / include / linux / psci.h
1 /*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License version 2 as
4 * published by the Free Software Foundation.
5 *
6 * This program is distributed in the hope that it will be useful,
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 * GNU General Public License for more details.
10 *
11 * Copyright (C) 2015 ARM Limited
12 */
13
14 #ifndef __LINUX_PSCI_H
15 #define __LINUX_PSCI_H
16
17 #include <linux/init.h>
18 #include <linux/types.h>
19
20 #define PSCI_CUSTOMIZED_INDEX (1 << 7)
21 #define PSCI_CLUSTER_SLEEP (PSCI_CUSTOMIZED_INDEX)
22 #define PSCI_SYSTEM_IDLE (1 << 8)
23 #define PSCI_CP_CALL (1 << 9)
24 #define PSCI_SYSTEM_SLEEP (1 << 10)
25
26 #define PSCI_POWER_STATE_TYPE_STANDBY 0
27 #define PSCI_POWER_STATE_TYPE_POWER_DOWN 1
28
29 bool psci_tos_resident_on(int cpu);
30
31 int psci_cpu_init_idle(unsigned int cpu);
32 int psci_cpu_suspend_enter(unsigned long index);
33
34 enum psci_conduit {
35 PSCI_CONDUIT_NONE,
36 PSCI_CONDUIT_SMC,
37 PSCI_CONDUIT_HVC,
38 };
39
40 enum smccc_version {
41 SMCCC_VERSION_1_0,
42 SMCCC_VERSION_1_1,
43 };
44
45 struct psci_operations {
46 u32 (*get_version)(void);
47 int (*cpu_suspend)(u32 state, unsigned long entry_point);
48 int (*cpu_off)(u32 state);
49 int (*cpu_on)(unsigned long cpuid, unsigned long entry_point);
50 int (*migrate)(unsigned long cpuid);
51 int (*affinity_info)(unsigned long target_affinity,
52 unsigned long lowest_affinity_level);
53 int (*migrate_info_type)(void);
54 enum psci_conduit conduit;
55 enum smccc_version smccc_version;
56 };
57
58 extern struct psci_operations psci_ops;
59
60 #if defined(CONFIG_ARM_PSCI_FW)
61 int __init psci_dt_init(void);
62 #else
63 static inline int psci_dt_init(void) { return 0; }
64 #endif
65
66 #if defined(CONFIG_ARM_PSCI_FW) && defined(CONFIG_ACPI)
67 int __init psci_acpi_init(void);
68 bool __init acpi_psci_present(void);
69 bool __init acpi_psci_use_hvc(void);
70 #else
71 static inline int psci_acpi_init(void) { return 0; }
72 static inline bool acpi_psci_present(void) { return false; }
73 #endif
74
75 #endif /* __LINUX_PSCI_H */