Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 1 | /* arch/arm/mach-msm/pm.h |
| 2 | * |
| 3 | * Copyright (C) 2007 Google, Inc. |
| 4 | * Copyright (c) 2009-2011, Code Aurora Forum. All rights reserved. |
| 5 | * Author: San Mehat <san@android.com> |
| 6 | * |
| 7 | * This software is licensed under the terms of the GNU General Public |
| 8 | * License version 2, as published by the Free Software Foundation, and |
| 9 | * may be copied, distributed, and modified under those terms. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | */ |
| 17 | |
| 18 | #ifndef __ARCH_ARM_MACH_MSM_PM_H |
| 19 | #define __ARCH_ARM_MACH_MSM_PM_H |
| 20 | |
| 21 | #include <linux/types.h> |
| 22 | #include <linux/cpuidle.h> |
| 23 | |
| 24 | #ifdef CONFIG_SMP |
| 25 | extern int pen_release; |
| 26 | extern void msm_secondary_startup(void); |
| 27 | #else |
| 28 | #define msm_secondary_startup NULL |
| 29 | #endif |
| 30 | |
| 31 | enum msm_pm_sleep_mode { |
| 32 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE_SUSPEND, |
| 33 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 34 | MSM_PM_SLEEP_MODE_APPS_SLEEP, |
| 35 | MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT, |
| 36 | MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT, |
| 37 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN, |
| 38 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE, |
| 39 | MSM_PM_SLEEP_MODE_NR |
| 40 | }; |
| 41 | |
| 42 | #define MSM_PM_MODE(cpu, mode_nr) ((cpu) * MSM_PM_SLEEP_MODE_NR + (mode_nr)) |
| 43 | |
| 44 | struct msm_pm_platform_data { |
| 45 | u8 idle_supported; /* Allow device to enter mode during idle */ |
| 46 | u8 suspend_supported; /* Allow device to enter mode during suspend */ |
| 47 | u8 suspend_enabled; /* enabled for suspend */ |
| 48 | u8 idle_enabled; /* enabled for idle low power */ |
| 49 | u32 latency; /* interrupt latency in microseconds when entering |
| 50 | and exiting the low power mode */ |
| 51 | u32 residency; /* time threshold in microseconds beyond which |
| 52 | staying in the low power mode saves power */ |
| 53 | }; |
| 54 | |
| 55 | void msm_pm_set_platform_data(struct msm_pm_platform_data *data, int count); |
| 56 | int msm_pm_idle_prepare(struct cpuidle_device *dev); |
| 57 | int msm_pm_idle_enter(enum msm_pm_sleep_mode sleep_mode); |
| 58 | |
| 59 | #ifdef CONFIG_PM |
| 60 | void msm_pm_set_rpm_wakeup_irq(unsigned int irq); |
| 61 | int msm_pm_platform_secondary_init(unsigned int cpu); |
| 62 | #else |
| 63 | static inline void msm_pm_set_rpm_wakeup_irq(unsigned int irq) {} |
| 64 | static inline int msm_pm_platform_secondary_init(unsigned int cpu) |
| 65 | { return -ENOSYS; } |
| 66 | #endif |
| 67 | #endif /* __ARCH_ARM_MACH_MSM_PM_H */ |