69140891319d69bf41f57a35ac9f388f7146e99f
[linux-2.6.git] / arch / arm / mach-tegra / baseband-xmm-power.h
1 /*
2  * arch/arm/mach-tegra/baseband-xmm-power.h
3  *
4  * Copyright (C) 2011 NVIDIA Corporation
5  *
6  * This software is licensed under the terms of the GNU General Public
7  * License version 2, as published by the Free Software Foundation, and
8  * may be copied, distributed, and modified under those terms.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  */
16
17 #ifndef BASEBAND_XMM_POWER_H
18 #define BASREBAND_XMM_POWER_H
19
20 #include <linux/pm.h>
21 #include <linux/suspend.h>
22
23 #define VENDOR_ID         0x1519
24 #define PRODUCT_ID        0x0020
25 #define TEGRA_EHCI_DEVICE "/sys/devices/platform/tegra-ehci.1/ehci_power"
26
27 #define XMM_MODEM_VER_1121      0x1121
28 #define XMM_MODEM_VER_1130      0x1130
29
30 /* shared between baseband-xmm-* modules so they can agree on same
31  * modem configuration
32  */
33 extern unsigned long modem_ver;
34 extern unsigned long modem_flash;
35 extern unsigned long modem_pm;
36
37 enum baseband_type {
38         BASEBAND_XMM,
39 };
40
41 struct baseband_power_platform_data {
42         enum baseband_type baseband_type;
43         struct platform_device* (*hsic_register)(void);
44         void (*hsic_unregister)(struct platform_device *);
45         union {
46                 struct {
47                         int mdm_reset;
48                         int mdm_on;
49                         int ap2mdm_ack;
50                         int mdm2ap_ack;
51                         int ap2mdm_ack2;
52                         int mdm2ap_ack2;
53                         struct platform_device *device;
54                 } generic;
55                 struct {
56                         int bb_rst;
57                         int bb_on;
58                         int ipc_bb_wake;
59                         int ipc_ap_wake;
60                         int ipc_hsic_active;
61                         int ipc_hsic_sus_req;
62                         struct platform_device *hsic_device;
63                 } xmm;
64         } modem;
65 };
66
67 enum baseband_xmm_power_work_state_t {
68         BBXMM_WORK_UNINIT,
69         BBXMM_WORK_INIT,
70         /* initialize flash modem */
71         BBXMM_WORK_INIT_FLASH_STEP1,
72         /* initialize flash (with power management support) modem */
73         BBXMM_WORK_INIT_FLASH_PM_STEP1,
74         /* initialize flashless (with power management support) modem */
75         BBXMM_WORK_INIT_FLASHLESS_PM_STEP1,
76         BBXMM_WORK_INIT_FLASHLESS_PM_STEP2,
77         BBXMM_WORK_INIT_FLASHLESS_PM_STEP3,
78         BBXMM_WORK_INIT_FLASHLESS_PM_STEP4,
79 };
80
81 struct xmm_power_data {
82         /* xmm modem state */
83         enum baseband_xmm_power_work_state_t state;
84         struct baseband_power_platform_data *pdata;
85         struct work_struct work;
86         struct platform_device *hsic_device;
87         wait_queue_head_t bb_wait;
88         /* host wakeup gpio state*/
89         unsigned int hostwake;
90 };
91
92 enum baseband_xmm_powerstate_t {
93         BBXMM_PS_UNINIT = 0,
94         BBXMM_PS_INIT   = 1,
95         BBXMM_PS_L0     = 2,
96         BBXMM_PS_L0TOL2 = 3,
97         BBXMM_PS_L2     = 4,
98         BBXMM_PS_L2TOL0 = 5,
99         BBXMM_PS_L2TOL3 = 6,
100         BBXMM_PS_L3     = 7,
101         BBXMM_PS_L3TOL0 = 8,
102         BBXMM_PS_LAST   = -1,
103 };
104
105 irqreturn_t xmm_power_ipc_ap_wake_irq(int irq, void *dev_id);
106
107 void baseband_xmm_set_power_status(unsigned int status);
108 extern struct xmm_power_data xmm_power_drv_data;
109
110 #endif  /* BASREBAND_XMM_POWER_H */