]> nv-tegra.nvidia Code Review - linux-3.10.git/blob - arch/arm/mach-tegra/pm.h
e77127ffd5de7179b01739309809990c0a140144
[linux-3.10.git] / arch / arm / mach-tegra / pm.h
1 /*
2  * arch/arm/mach-tegra/include/mach/suspend.h
3  *
4  * Copyright (C) 2010 Google, Inc.
5  *
6  * Author:
7  *      Colin Cross <ccross@google.com>
8  *
9  * This software is licensed under the terms of the GNU General Public
10  * License version 2, as published by the Free Software Foundation, and
11  * may be copied, distributed, and modified under those terms.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  */
19
20
21 #ifndef _MACH_TEGRA_SUSPEND_H_
22 #define _MACH_TEGRA_SUSPEND_H_
23
24 enum tegra_suspend_mode {
25         TEGRA_SUSPEND_NONE = 0,
26         TEGRA_SUSPEND_LP2,      /* CPU voltage off */
27         TEGRA_SUSPEND_LP1,      /* CPU voltage off, DRAM self-refresh */
28         TEGRA_SUSPEND_LP0,      /* CPU + core voltage off, DRAM self-refresh */
29         TEGRA_MAX_SUSPEND_MODE,
30 };
31
32 struct tegra_suspend_platform_data {
33         unsigned long cpu_timer;   /* CPU power good time in us,  LP2/LP1 */
34         unsigned long cpu_off_timer;    /* CPU power off time us, LP2/LP1 */
35         unsigned long core_timer;  /* core power good time in ticks,  LP0 */
36         unsigned long core_off_timer;   /* core power off time ticks, LP0 */
37         bool corereq_high;         /* Core power request active-high */
38         bool sysclkreq_high;       /* System clock request is active-high */
39         enum tegra_suspend_mode suspend_mode;
40 };
41
42 unsigned long tegra_cpu_power_good_time(void);
43 unsigned long tegra_cpu_power_off_time(void);
44
45 #define TEGRA_POWER_SDRAM_SELFREFRESH   0x400   /* SDRAM is in self-refresh */
46
47 #define TEGRA_POWER_CLUSTER_G           0x1000  /* G CPU */
48 #define TEGRA_POWER_CLUSTER_LP          0x2000  /* LP CPU */
49 #define TEGRA_POWER_CLUSTER_MASK        0x3000
50 #define TEGRA_POWER_CLUSTER_IMMEDIATE   0x4000  /* Immediate wake */
51 #define TEGRA_POWER_CLUSTER_FORCE       0x8000  /* Force switch */
52
53 #ifdef CONFIG_ARCH_TEGRA_2x_SOC
54 void tegra2_lp0_suspend_init(void);
55 #else
56 static inline void tegra2_lp0_suspend_init(void)
57 {
58 }
59 #endif
60 void __init tegra_init_suspend(struct tegra_suspend_platform_data *plat);
61
62 void tegra_idle_lp2(void);
63
64 u64 tegra_rtc_read_ms(void);
65
66 /*
67  * Callbacks for platform drivers to implement.
68  */
69 extern void (*tegra_deep_sleep)(int);
70
71 void tegra_idle_lp2_last(unsigned int flags);
72 #ifdef CONFIG_ARCH_TEGRA_2x_SOC
73 #define INSTRUMENT_CLUSTER_SWITCH 0 /* Must be zero for ARCH_TEGRA_2x_SOC */
74 static inline int tegra_cluster_control(unsigned int us, unsigned int flags)
75 { return -EPERM; }
76 #define tegra_cluster_switch_prolog(flags) do {} while(0)
77 #define tegra_cluster_switch_epilog(flags) do {} while(0)
78 static inline unsigned int is_lp_cluster(void)
79 { return 0; }
80 static inline unsigned long tegra_get_lpcpu_max_rate(void)
81 { return 0; }
82 #else
83 #define INSTRUMENT_CLUSTER_SWITCH 1 /* Should be zero for shipping code */
84 int tegra_cluster_control(unsigned int us, unsigned int flags);
85 void tegra_cluster_switch_prolog(unsigned int flags);
86 void tegra_cluster_switch_epilog(unsigned int flags);
87 unsigned int is_lp_cluster(void);
88 unsigned long tegra_get_lpcpu_max_rate(void);
89 #endif
90
91 #endif /* _MACH_TEGRA_SUSPEND_H_ */