Merge branch 'develop-3.0' of ssh://10.10.10.29/rk/kernel into develop-3.0
[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,   //USI MT6229 WCDMA\r
30         BP_ID_MU509,    //huawei MU509 WCDMA\r
31         BP_ID_MI700,    //thinkwill MI700 WCDMA\r
32         BP_ID_MW100,    //thinkwill MW100 WCDMA\r
33         BP_ID_TD8801,   //spreadtrum SC8803 TD-SCDMA\r
34         BP_ID_SC6610,   //spreadtrum SC6610 GSM\r
35         BP_ID_M50,              //spreadtrum RDA GSM\r
36         BP_ID_MT6250,  //ZINN M50  EDGE\r
37         BP_ID_C66A,    //zhongben\r
38         BP_ID_NUM,  \r
39 };\r
40 \r
41 \r
42 \r
43 enum bp_bus_type{\r
44         BP_BUS_TYPE_INVALID = 0,\r
45                 \r
46         BP_BUS_TYPE_UART,\r
47         BP_BUS_TYPE_SPI,\r
48         BP_BUS_TYPE_USB,\r
49         BP_BUS_TYPE_SDIO,\r
50         BP_BUS_TYPE_USB_UART,\r
51         BP_BUS_TYPE_SPI_UART,\r
52         BP_BUS_TYPE_SDIO_UART,\r
53         \r
54         BP_BUS_TYPE_NUM_ID,\r
55 };\r
56 \r
57 struct bp_platform_data {       \r
58         int board_id;\r
59         int bp_id;\r
60         int (*init_platform_hw)(void);          \r
61         int (*exit_platform_hw)(void);  \r
62         int (*get_bp_id)(void);\r
63         int bp_power;\r
64         int bp_en;\r
65         int bp_reset;\r
66         int ap_ready;\r
67         int bp_ready;\r
68         int ap_wakeup_bp;\r
69         int bp_wakeup_ap;\r
70         int bp_assert;\r
71         int bp_usb_en;\r
72         int bp_uart_en;\r
73         \r
74         int gpio_valid;\r
75 };\r
76 \r
77 \r
78 struct bp_operate {\r
79         char *name;     //bp name can be null\r
80         int bp_id;      //bp id the value must be one of enum bp_id\r
81         int bp_bus;     // bp bus the value must be one of enum bp_bus_type\r
82         \r
83         int bp_pid;     // the pid of usb device if used usb else the value is BP_UNKNOW_DATA\r
84         int bp_vid;     // the vid of usb device if used usb else the value is BP_UNKNOW_DATA\r
85         int bp_power;//bp power if used GPIO value else the  is BP_UNKNOW_DATA\r
86         int bp_en;//bp power key if used GPIO value else the  is BP_UNKNOW_DATA\r
87         int bp_reset;//bo reset if used GPIO value else the  is BP_UNKNOW_DATA\r
88         int ap_ready;//bp ready  if used GPIO value else the  is BP_UNKNOW_DATA\r
89         int bp_ready;// bp ready  if used GPIO value else the  is BP_UNKNOW_DATA\r
90         int ap_wakeup_bp; //ap wakeup bp  if used GPIO value else the  is BP_UNKNOW_DATA\r
91         int bp_wakeup_ap;// bp wakeup ap  if used GPIO value else the  is BP_UNKNOW_DATA\r
92         int bp_assert;\r
93         int bp_usb_en;//not used\r
94         int bp_uart_en;//not used\r
95         int trig;//if 1:used board gpio define else used bp driver\r
96         int irq;\r
97 \r
98         int (*active)(struct bp_private_data *bp, int enable);\r
99         int (*init)(struct bp_private_data *bp);\r
100         int (*reset)(struct bp_private_data *bp);\r
101         int (*ap_wake_bp)(struct bp_private_data *bp, int wake);\r
102         int (*bp_wake_ap)(struct bp_private_data *bp);\r
103         int (*shutdown)(struct bp_private_data *bp);\r
104         int (*read_status)(struct bp_private_data *bp);\r
105         int (*write_status)(struct bp_private_data *bp);\r
106         int (*suspend)(struct bp_private_data *bp);\r
107         int (*resume)(struct bp_private_data *bp);              \r
108         char *misc_name;\r
109         struct miscdevice *private_miscdev;\r
110         \r
111 };\r
112 \r
113 \r
114 struct bp_private_data {        \r
115         struct device *dev;\r
116         int status;\r
117         int suspend_status;\r
118         struct wake_lock bp_wakelock;\r
119         struct delayed_work wakeup_work;        /*report second event*/\r
120         struct bp_platform_data *pdata;\r
121         struct bp_operate *ops; \r
122         struct file_operations fops;\r
123         struct miscdevice miscdev;\r
124         struct file_operations id_fops;\r
125         struct miscdevice id_miscdev;\r
126 \r
127 };\r
128 \r
129 extern int bp_register_slave(struct bp_private_data *bp,\r
130                         struct bp_platform_data *slave_pdata,\r
131                         struct bp_operate *(*get_bp_ops)(void));\r
132 \r
133 \r
134 extern int bp_unregister_slave(struct bp_private_data *bp,\r
135                         struct bp_platform_data *slave_pdata,\r
136                         struct bp_operate *(*get_bp_ops)(void));\r
137 \r
138 \r
139 #endif\r
140 \r