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. |
Matt Wagantall | 8c327c5 | 2012-02-01 16:51:03 -0800 | [diff] [blame] | 4 | * Copyright (c) 2009-2012, Code Aurora Forum. All rights reserved. |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 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 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 25 | extern void msm_secondary_startup(void); |
| 26 | #else |
| 27 | #define msm_secondary_startup NULL |
| 28 | #endif |
| 29 | |
Taniya Das | e30a6b2 | 2012-03-20 11:37:45 +0530 | [diff] [blame^] | 30 | extern int power_collapsed; |
| 31 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 32 | enum msm_pm_sleep_mode { |
| 33 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE_SUSPEND, |
| 34 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE, |
| 35 | MSM_PM_SLEEP_MODE_APPS_SLEEP, |
| 36 | MSM_PM_SLEEP_MODE_RAMP_DOWN_AND_WAIT_FOR_INTERRUPT, |
| 37 | MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT, |
| 38 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE_NO_XO_SHUTDOWN, |
| 39 | MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE, |
| 40 | MSM_PM_SLEEP_MODE_NR |
| 41 | }; |
| 42 | |
| 43 | #define MSM_PM_MODE(cpu, mode_nr) ((cpu) * MSM_PM_SLEEP_MODE_NR + (mode_nr)) |
| 44 | |
| 45 | struct msm_pm_platform_data { |
| 46 | u8 idle_supported; /* Allow device to enter mode during idle */ |
| 47 | u8 suspend_supported; /* Allow device to enter mode during suspend */ |
| 48 | u8 suspend_enabled; /* enabled for suspend */ |
| 49 | u8 idle_enabled; /* enabled for idle low power */ |
| 50 | u32 latency; /* interrupt latency in microseconds when entering |
| 51 | and exiting the low power mode */ |
| 52 | u32 residency; /* time threshold in microseconds beyond which |
| 53 | staying in the low power mode saves power */ |
| 54 | }; |
| 55 | |
Maheshkumar Sivasubramanian | 6866b1c | 2011-06-07 14:20:33 -0600 | [diff] [blame] | 56 | struct msm_pm_sleep_status_data { |
| 57 | void *base_addr; |
| 58 | uint32_t cpu_offset; |
| 59 | uint32_t mask; |
| 60 | }; |
| 61 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 62 | void msm_pm_set_platform_data(struct msm_pm_platform_data *data, int count); |
| 63 | int msm_pm_idle_prepare(struct cpuidle_device *dev); |
| 64 | int msm_pm_idle_enter(enum msm_pm_sleep_mode sleep_mode); |
Mahesh Sivasubramanian | d23add1 | 2011-11-18 14:30:11 -0700 | [diff] [blame] | 65 | void msm_pm_cpu_enter_lowpower(unsigned int cpu); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 66 | |
Maheshkumar Sivasubramanian | 6866b1c | 2011-06-07 14:20:33 -0600 | [diff] [blame] | 67 | void __init msm_pm_init_sleep_status_data( |
| 68 | struct msm_pm_sleep_status_data *sleep_data); |
Matt Wagantall | 8c327c5 | 2012-02-01 16:51:03 -0800 | [diff] [blame] | 69 | #ifdef CONFIG_MSM_PM8X60 |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 70 | void msm_pm_set_rpm_wakeup_irq(unsigned int irq); |
Matt Wagantall | 8c327c5 | 2012-02-01 16:51:03 -0800 | [diff] [blame] | 71 | int msm_pm_wait_cpu_shutdown(unsigned int cpu); |
| 72 | bool msm_pm_verify_cpu_pc(unsigned int cpu); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 73 | #else |
| 74 | static inline void msm_pm_set_rpm_wakeup_irq(unsigned int irq) {} |
Matt Wagantall | 8c327c5 | 2012-02-01 16:51:03 -0800 | [diff] [blame] | 75 | static inline int msm_pm_wait_cpu_shutdown(unsigned int cpu) { return 0; } |
| 76 | static inline bool msm_pm_verify_cpu_pc(unsigned int cpu) { return true; } |
Mahesh Sivasubramanian | d23add1 | 2011-11-18 14:30:11 -0700 | [diff] [blame] | 77 | #endif |
| 78 | |
| 79 | #ifdef CONFIG_HOTPLUG_CPU |
| 80 | int msm_platform_secondary_init(unsigned int cpu); |
| 81 | #else |
| 82 | static inline int msm_platform_secondary_init(unsigned int cpu) { return 0; } |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 83 | #endif |
| 84 | #endif /* __ARCH_ARM_MACH_MSM_PM_H */ |