Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 1 | /* Copyright (c) 2010-2012, Code Aurora Forum. All rights reserved. |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | * |
| 12 | */ |
| 13 | |
| 14 | #ifndef __ARCH_ARM_MACH_MSM_MPM_H |
| 15 | #define __ARCH_ARM_MACH_MSM_MPM_H |
| 16 | |
| 17 | #include <linux/types.h> |
| 18 | #include <linux/list.h> |
| 19 | |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 20 | #define MSM_MPM_NR_MPM_IRQS 64 |
| 21 | |
| 22 | struct msm_mpm_device_data { |
| 23 | uint16_t *irqs_m2a; |
| 24 | unsigned int irqs_m2a_size; |
| 25 | uint16_t *bypassed_apps_irqs; |
| 26 | unsigned int bypassed_apps_irqs_size; |
| 27 | void __iomem *mpm_request_reg_base; |
| 28 | void __iomem *mpm_status_reg_base; |
| 29 | void __iomem *mpm_apps_ipc_reg; |
| 30 | unsigned int mpm_apps_ipc_val; |
| 31 | unsigned int mpm_ipc_irq; |
| 32 | }; |
| 33 | |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 34 | extern struct msm_mpm_device_data msm8660_mpm_dev_data; |
| 35 | extern struct msm_mpm_device_data msm8960_mpm_dev_data; |
| 36 | extern struct msm_mpm_device_data msm9615_mpm_dev_data; |
| 37 | extern struct msm_mpm_device_data apq8064_mpm_dev_data; |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 38 | |
Praveen Chidambaram | 7849901 | 2011-11-01 17:15:17 -0600 | [diff] [blame] | 39 | void msm_mpm_irq_extn_init(struct msm_mpm_device_data *mpm_data); |
| 40 | |
| 41 | #ifdef CONFIG_MSM_MPM |
Subhash Jadavani | fe608a2 | 2012-04-13 10:45:53 +0530 | [diff] [blame] | 42 | int msm_mpm_enable_pin(unsigned int pin, unsigned int enable); |
| 43 | int msm_mpm_set_pin_wake(unsigned int pin, unsigned int on); |
| 44 | int msm_mpm_set_pin_type(unsigned int pin, unsigned int flow_type); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 45 | bool msm_mpm_irqs_detectable(bool from_idle); |
| 46 | bool msm_mpm_gpio_irqs_detectable(bool from_idle); |
| 47 | void msm_mpm_enter_sleep(bool from_idle); |
| 48 | void msm_mpm_exit_sleep(bool from_idle); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 49 | #else |
Subhash Jadavani | 350290f | 2012-04-12 10:57:56 +0530 | [diff] [blame] | 50 | static inline int msm_mpm_enable_irq(unsigned int irq, unsigned int enable) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 51 | { return -ENODEV; } |
Subhash Jadavani | 350290f | 2012-04-12 10:57:56 +0530 | [diff] [blame] | 52 | static inline int msm_mpm_set_irq_wake(unsigned int irq, unsigned int on) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 53 | { return -ENODEV; } |
Subhash Jadavani | 350290f | 2012-04-12 10:57:56 +0530 | [diff] [blame] | 54 | static inline int msm_mpm_set_irq_type(unsigned int irq, unsigned int flow_type) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 55 | { return -ENODEV; } |
Subhash Jadavani | fe608a2 | 2012-04-13 10:45:53 +0530 | [diff] [blame] | 56 | static inline int msm_mpm_enable_pin(unsigned int pin, unsigned int enable) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 57 | { return -ENODEV; } |
Subhash Jadavani | fe608a2 | 2012-04-13 10:45:53 +0530 | [diff] [blame] | 58 | static inline int msm_mpm_set_pin_wake(unsigned int pin, unsigned int on) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 59 | { return -ENODEV; } |
Subhash Jadavani | fe608a2 | 2012-04-13 10:45:53 +0530 | [diff] [blame] | 60 | static inline int msm_mpm_set_pin_type(unsigned int pin, |
Subhash Jadavani | 350290f | 2012-04-12 10:57:56 +0530 | [diff] [blame] | 61 | unsigned int flow_type) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 62 | { return -ENODEV; } |
Subhash Jadavani | 350290f | 2012-04-12 10:57:56 +0530 | [diff] [blame] | 63 | static inline bool msm_mpm_irqs_detectable(bool from_idle) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 64 | { return false; } |
Subhash Jadavani | 350290f | 2012-04-12 10:57:56 +0530 | [diff] [blame] | 65 | static inline bool msm_mpm_gpio_irqs_detectable(bool from_idle) |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 66 | { return false; } |
Subhash Jadavani | 350290f | 2012-04-12 10:57:56 +0530 | [diff] [blame] | 67 | static inline void msm_mpm_enter_sleep(bool from_idle) {} |
| 68 | static inline void msm_mpm_exit_sleep(bool from_idle) {} |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 69 | #endif |
| 70 | |
| 71 | |
| 72 | |
| 73 | #endif /* __ARCH_ARM_MACH_MSM_MPM_H */ |