diff options
Diffstat (limited to 'arch/arm/mach-tegra/cpuidle.h')
-rw-r--r-- | arch/arm/mach-tegra/cpuidle.h | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/cpuidle.h b/arch/arm/mach-tegra/cpuidle.h new file mode 100644 index 00000000000..ce6eab940fd --- /dev/null +++ b/arch/arm/mach-tegra/cpuidle.h | |||
@@ -0,0 +1,130 @@ | |||
1 | /* | ||
2 | * arch/arm/mach-tegra/cpuidle.h | ||
3 | * | ||
4 | * Declarations for power state transition code | ||
5 | * | ||
6 | * Copyright (c) 2011, NVIDIA Corporation. | ||
7 | * | ||
8 | * This software is licensed under the terms of the GNU General Public | ||
9 | * License version 2, as published by the Free Software Foundation, and | ||
10 | * may be copied, distributed, and modified under those terms. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | */ | ||
18 | |||
19 | #ifndef __MACH_TEGRA_CPUIDLE_H | ||
20 | #define __MACH_TEGRA_CPUIDLE_H | ||
21 | |||
22 | #include <linux/cpuidle.h> | ||
23 | |||
24 | #ifdef CONFIG_PM_SLEEP | ||
25 | |||
26 | extern int tegra_lp2_exit_latency; | ||
27 | |||
28 | #ifdef CONFIG_ARCH_TEGRA_2x_SOC | ||
29 | void tegra2_idle_lp2(struct cpuidle_device *dev, struct cpuidle_state *state); | ||
30 | void tegra2_cpu_idle_stats_lp2_ready(unsigned int cpu); | ||
31 | void tegra2_cpu_idle_stats_lp2_time(unsigned int cpu, s64 us); | ||
32 | bool tegra2_lp2_is_allowed(struct cpuidle_device *dev, | ||
33 | struct cpuidle_state *state); | ||
34 | #ifdef CONFIG_DEBUG_FS | ||
35 | int tegra2_lp2_debug_show(struct seq_file *s, void *data); | ||
36 | #endif | ||
37 | #endif | ||
38 | #ifdef CONFIG_ARCH_TEGRA_3x_SOC | ||
39 | void tegra3_idle_lp2(struct cpuidle_device *dev, struct cpuidle_state *state); | ||
40 | void tegra3_cpu_idle_stats_lp2_ready(unsigned int cpu); | ||
41 | void tegra3_cpu_idle_stats_lp2_time(unsigned int cpu, s64 us); | ||
42 | bool tegra3_lp2_is_allowed(struct cpuidle_device *dev, | ||
43 | struct cpuidle_state *state); | ||
44 | int tegra3_cpudile_init_soc(void); | ||
45 | #ifdef CONFIG_DEBUG_FS | ||
46 | int tegra3_lp2_debug_show(struct seq_file *s, void *data); | ||
47 | #endif | ||
48 | #endif | ||
49 | |||
50 | static inline int tegra_cpudile_init_soc(void) | ||
51 | { | ||
52 | #ifdef CONFIG_ARCH_TEGRA_2x_SOC | ||
53 | return 0; | ||
54 | #else | ||
55 | return tegra3_cpudile_init_soc(); | ||
56 | #endif | ||
57 | } | ||
58 | |||
59 | static inline void tegra_cpu_idle_stats_lp2_ready(unsigned int cpu) | ||
60 | { | ||
61 | #ifdef CONFIG_ARCH_TEGRA_2x_SOC | ||
62 | tegra2_cpu_idle_stats_lp2_ready(cpu); | ||
63 | #endif | ||
64 | #ifdef CONFIG_ARCH_TEGRA_3x_SOC | ||
65 | tegra3_cpu_idle_stats_lp2_ready(cpu); | ||
66 | #endif | ||
67 | } | ||
68 | |||
69 | static inline void tegra_cpu_idle_stats_lp2_time(unsigned int cpu, s64 us) | ||
70 | { | ||
71 | #ifdef CONFIG_ARCH_TEGRA_2x_SOC | ||
72 | tegra2_cpu_idle_stats_lp2_time(cpu, us); | ||
73 | #endif | ||
74 | #ifdef CONFIG_ARCH_TEGRA_3x_SOC | ||
75 | tegra3_cpu_idle_stats_lp2_time(cpu, us); | ||
76 | #endif | ||
77 | } | ||
78 | |||
79 | static inline void tegra_idle_lp2(struct cpuidle_device *dev, | ||
80 | struct cpuidle_state *state) | ||
81 | { | ||
82 | #ifdef CONFIG_ARCH_TEGRA_2x_SOC | ||
83 | tegra2_idle_lp2(dev, state); | ||
84 | #endif | ||
85 | #ifdef CONFIG_ARCH_TEGRA_3x_SOC | ||
86 | tegra3_idle_lp2(dev, state); | ||
87 | #endif | ||
88 | } | ||
89 | |||
90 | static inline bool tegra_lp2_is_allowed(struct cpuidle_device *dev, | ||
91 | struct cpuidle_state *state) | ||
92 | { | ||
93 | #ifdef CONFIG_ARCH_TEGRA_2x_SOC | ||
94 | return tegra2_lp2_is_allowed(dev, state); | ||
95 | #endif | ||
96 | #ifdef CONFIG_ARCH_TEGRA_3x_SOC | ||
97 | return tegra3_lp2_is_allowed(dev, state); | ||
98 | #endif | ||
99 | } | ||
100 | |||
101 | static inline void tegra_lp2_set_global_latency(struct cpuidle_state *state) | ||
102 | { | ||
103 | #ifdef CONFIG_ARCH_TEGRA_2x_SOC | ||
104 | state->exit_latency = tegra_lp2_exit_latency; | ||
105 | #endif | ||
106 | /* Tegra3 does not use global exit latency */ | ||
107 | } | ||
108 | |||
109 | void tegra_lp2_update_target_residency(struct cpuidle_state *state); | ||
110 | |||
111 | #ifdef CONFIG_DEBUG_FS | ||
112 | static inline int tegra_lp2_debug_show(struct seq_file *s, void *data) | ||
113 | { | ||
114 | #ifdef CONFIG_ARCH_TEGRA_2x_SOC | ||
115 | return tegra2_lp2_debug_show(s, data); | ||
116 | #endif | ||
117 | #ifdef CONFIG_ARCH_TEGRA_3x_SOC | ||
118 | return tegra3_lp2_debug_show(s, data); | ||
119 | #endif | ||
120 | } | ||
121 | #endif | ||
122 | #endif /* CONFIG_PM_SLEEP */ | ||
123 | |||
124 | #if defined(CONFIG_CPU_IDLE) && defined(CONFIG_PM_SLEEP) | ||
125 | void tegra_lp2_in_idle(bool enable); | ||
126 | #else | ||
127 | static inline void tegra_lp2_in_idle(bool enable) {} | ||
128 | #endif | ||
129 | |||
130 | #endif | ||