Merge remote-tracking branch 'origin/upstream/linux-linaro-lsk-v3.10-android+android...
[firefly-linux-kernel-4.4.55.git] / include / linux / bp-auto.h
1 #ifndef _BP_AUTO_H\r
2 #define _BP_AUTO_H\r
3 #include <linux/miscdevice.h>\r
4 #include <linux/wakelock.h>\r
5 \r
6 struct bp_private_data;\r
7 #define BP_DEV_NAME     "voice_modem"\r
8 #define BP_UNKNOW_DATA  -1\r
9 #define BP_OFF          0\r
10 #define BP_ON           1\r
11 #define BP_SUSPEND      2\r
12 #define BP_WAKE         3\r
13 \r
14 #define BP_IOCTL_BASE 0x1a\r
15 \r
16 #define BP_IOCTL_RESET          _IOW(BP_IOCTL_BASE, 0x01, int)\r
17 #define BP_IOCTL_POWOFF         _IOW(BP_IOCTL_BASE, 0x02, int)\r
18 #define BP_IOCTL_POWON          _IOW(BP_IOCTL_BASE, 0x03, int)\r
19 \r
20 #define BP_IOCTL_WRITE_STATUS   _IOW(BP_IOCTL_BASE, 0x04, int)\r
21 #define BP_IOCTL_GET_STATUS     _IOR(BP_IOCTL_BASE, 0x05, int)\r
22 #define BP_IOCTL_SET_PVID       _IOW(BP_IOCTL_BASE, 0x06, int)\r
23 #define BP_IOCTL_GET_BPID       _IOR(BP_IOCTL_BASE, 0x07, int)\r
24 #define BP_IOCTL_GET_IMEI       _IOR(BP_IOCTL_BASE, 0x08, int)\r
25 \r
26 enum bp_id{\r
27         BP_ID_INVALID = 0,//no bp\r
28                 \r
29         BP_ID_MT6229,   //1 USI MT6229 WCDMA\r
30         BP_ID_MU509,    //2 huawei MU509 WCDMA\r
31         BP_ID_MI700,    //3 thinkwill MI700 WCDMA\r
32         BP_ID_MW100,    //4 thinkwill MW100 WCDMA\r
33         BP_ID_TD8801,   //5 spreadtrum SC8803 TD-SCDMA\r
34         BP_ID_SC6610,   //6 spreadtrum SC6610 GSM\r
35         BP_ID_M51,      //7 RDA GSM\r
36         BP_ID_MT6250,   //8 ZINN M50  EDGE\r
37         BP_ID_C66A,     //9 ZHIGUAN C66A GSM\r
38         BP_ID_SEW290,   //10 SCV SEW290 WCDMA\r
39         BP_ID_U5501,    //11 LONGSUNG U5501 WCDMA\r
40         BP_ID_U7501,    //12 LONGSUNG U7501 WCDMA/HSPA+\r
41         BP_ID_AW706,    //13 ANICARE AW706 EDGE\r
42         BP_ID_A85XX,    //14 LONGSUNG A8520/A8530 GSM
43     BP_ID_E1230S,    //15 huawei E1230S\r
44
45         BP_ID_NUM,  \r
46 };\r
47 \r
48 \r
49 \r
50 enum bp_bus_type{\r
51         BP_BUS_TYPE_INVALID = 0,\r
52                 \r
53         BP_BUS_TYPE_UART,\r
54         BP_BUS_TYPE_SPI,\r
55         BP_BUS_TYPE_USB,\r
56         BP_BUS_TYPE_SDIO,\r
57         BP_BUS_TYPE_USB_UART,\r
58         BP_BUS_TYPE_SPI_UART,\r
59         BP_BUS_TYPE_SDIO_UART,\r
60         \r
61         BP_BUS_TYPE_NUM_ID,\r
62 };\r
63 \r
64 struct bp_platform_data {       \r
65         int board_id;\r
66         int bp_id;\r
67         int (*init_platform_hw)(void);          \r
68         int (*exit_platform_hw)(void);  \r
69         int (*get_bp_id)(void);\r
70         int bp_power;\r
71         int bp_en;\r
72         int bp_reset;\r
73         int ap_ready;\r
74         int bp_ready;\r
75         int ap_wakeup_bp;\r
76         int bp_wakeup_ap;\r
77         int bp_assert;\r
78         int bp_usb_en;\r
79         int bp_uart_en;\r
80         \r
81         int gpio_valid;\r
82 };\r
83 \r
84 \r
85 struct bp_operate {\r
86         char *name;     //bp name can be null\r
87         int bp_id;      //bp id the value must be one of enum bp_id\r
88         int bp_bus;     // bp bus the value must be one of enum bp_bus_type\r
89         \r
90         int bp_pid;     // the pid of usb device if used usb else the value is BP_UNKNOW_DATA\r
91         int bp_vid;     // the vid of usb device if used usb else the value is BP_UNKNOW_DATA\r
92         int bp_power;//bp power if used GPIO value else the  is BP_UNKNOW_DATA\r
93         int bp_en;//bp power key if used GPIO value else the  is BP_UNKNOW_DATA\r
94         int bp_reset;//bo reset if used GPIO value else the  is BP_UNKNOW_DATA\r
95         int ap_ready;//bp ready  if used GPIO value else the  is BP_UNKNOW_DATA\r
96         int bp_ready;// bp ready  if used GPIO value else the  is BP_UNKNOW_DATA\r
97         int ap_wakeup_bp; //ap wakeup bp  if used GPIO value else the  is BP_UNKNOW_DATA\r
98         int bp_wakeup_ap;// bp wakeup ap  if used GPIO value else the  is BP_UNKNOW_DATA\r
99         int bp_assert;\r
100         int bp_usb_en;//not used\r
101         int bp_uart_en;//not used\r
102         int trig;//if 1:used board gpio define else used bp driver\r
103         int irq;\r
104 \r
105         int (*active)(struct bp_private_data *bp, int enable);\r
106         int (*init)(struct bp_private_data *bp);\r
107         int (*reset)(struct bp_private_data *bp);\r
108         int (*ap_wake_bp)(struct bp_private_data *bp, int wake);\r
109         int (*bp_wake_ap)(struct bp_private_data *bp);\r
110         int (*shutdown)(struct bp_private_data *bp);\r
111         int (*read_status)(struct bp_private_data *bp);\r
112         int (*write_status)(struct bp_private_data *bp);\r
113         int (*suspend)(struct bp_private_data *bp);\r
114         int (*resume)(struct bp_private_data *bp);              \r
115         char *misc_name;\r
116         struct miscdevice *private_miscdev;\r
117         \r
118 };\r
119 \r
120 \r
121 struct bp_private_data {        \r
122         struct device *dev;\r
123         int status;\r
124         int suspend_status;\r
125         struct wake_lock bp_wakelock;\r
126         struct delayed_work wakeup_work;        /*report second event*/\r
127         struct bp_platform_data *pdata;\r
128         struct bp_operate *ops; \r
129         struct file_operations fops;\r
130         struct miscdevice miscdev;\r
131         struct file_operations id_fops;\r
132         struct miscdevice id_miscdev;\r
133 \r
134 };\r
135 \r
136 extern int bp_register_slave(struct bp_private_data *bp,\r
137                         struct bp_platform_data *slave_pdata,\r
138                         struct bp_operate *(*get_bp_ops)(void));\r
139 \r
140 \r
141 extern int bp_unregister_slave(struct bp_private_data *bp,\r
142                         struct bp_platform_data *slave_pdata,\r
143                         struct bp_operate *(*get_bp_ops)(void));\r
144 \r
145 \r
146 #endif\r
147 \r