blob: 606953d6387cc2cd2ad1c56219faab4899870837 [file] [log] [blame]
Shalabh Jainb0037c02013-01-18 12:47:40 -08001/* Copyright (c) 2008-2013, The Linux Foundation. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
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#ifndef DIAGCHAR_H
14#define DIAGCHAR_H
15
16#include <linux/init.h>
17#include <linux/module.h>
18#include <linux/mempool.h>
19#include <linux/mutex.h>
Dixon Peterson5db2e3c2012-09-06 19:13:14 -070020#include <linux/spinlock.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070021#include <linux/workqueue.h>
Shalabh Jain5e9a92b2012-06-07 21:53:49 -070022#include <linux/sched.h>
Dixon Petersonf2d449c2013-02-01 18:02:20 -080023#include <linux/wakelock.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070024#include <mach/msm_smd.h>
25#include <asm/atomic.h>
26#include <asm/mach-types.h>
Dixon Peterson66fb11b2012-12-04 20:30:54 -080027
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070028/* Size of the USB buffers used for read and write*/
29#define USB_MAX_OUT_BUF 4096
Ravi Aravamudhancc9946862013-07-15 13:31:11 -070030#define APPS_BUF_SIZE 4096
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070031#define IN_BUF_SIZE 16384
32#define MAX_IN_BUF_SIZE 32768
33#define MAX_SYNC_OBJ_NAME_SIZE 32
34/* Size of the buffer used for deframing a packet
35 reveived from the PC tool*/
36#define HDLC_MAX 4096
37#define HDLC_OUT_BUF_SIZE 8192
38#define POOL_TYPE_COPY 1
39#define POOL_TYPE_HDLC 2
Dixon Peterson6dba7572013-04-12 18:45:16 -070040#define POOL_TYPE_USER 3
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070041#define POOL_TYPE_WRITE_STRUCT 4
Shalabh Jainb0037c02013-01-18 12:47:40 -080042#define POOL_TYPE_HSIC 5
43#define POOL_TYPE_HSIC_2 6
44#define POOL_TYPE_HSIC_WRITE 11
45#define POOL_TYPE_HSIC_2_WRITE 12
46#define POOL_TYPE_ALL 10
Ravi Aravamudhan46df7d22013-06-12 11:57:07 -070047
48#define POOL_COPY_IDX 0
49#define POOL_HDLC_IDX 1
50#define POOL_USER_IDX 2
51#define POOL_WRITE_STRUCT_IDX 3
52#define POOL_HSIC_IDX 4
53#define POOL_HSIC_2_IDX 5
54#define POOL_HSIC_3_IDX 6
55#define POOL_HSIC_4_IDX 7
56#define POOL_HSIC_WRITE_IDX 8
57#define POOL_HSIC_2_WRITE_IDX 9
58#define POOL_HSIC_3_WRITE_IDX 10
59#define POOL_HSIC_4_WRITE_IDX 11
60
61#ifdef CONFIG_DIAGFWD_BRIDGE_CODE
62#define NUM_MEMORY_POOLS 12
63#else
64#define NUM_MEMORY_POOLS 4
65#endif
66
Ravi Aravamudhane131ce12013-08-21 20:44:50 -070067#define MAX_SSID_PER_RANGE 200
68
Dixon Petersoneecbadb2012-12-10 21:59:28 -080069#define MODEM_DATA 0
70#define LPASS_DATA 1
71#define WCNSS_DATA 2
Ashay Jaiswal8be3ce82012-09-13 16:01:54 -070072#define APPS_DATA 3
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070073#define SDIO_DATA 4
Dixon Petersoneecbadb2012-12-10 21:59:28 -080074#define HSIC_DATA 5
Shalabh Jainb0037c02013-01-18 12:47:40 -080075#define HSIC_2_DATA 6
76#define SMUX_DATA 10
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070077#define APPS_PROC 1
Ravi Aravamudhane131ce12013-08-21 20:44:50 -070078/*
79 * Each row contains First (uint32_t), Last (uint32_t), Actual
80 * last (uint32_t) values along with the range of SSIDs
81 * (MAX_SSID_PER_RANGE*uint32_t).
82 * And there are MSG_MASK_TBL_CNT rows.
83 */
84#define MSG_MASK_SIZE ((MAX_SSID_PER_RANGE+3) * 4 * MSG_MASK_TBL_CNT)
Ravi Aravamudhanbbcb99f2013-11-06 19:43:03 -080085#define MAX_EQUIP_ID 16
86#define MAX_ITEMS_PER_EQUIP_ID 512
87#define LOG_MASK_ITEM_SIZE (5 + MAX_ITEMS_PER_EQUIP_ID)
88#define LOG_MASK_SIZE (MAX_EQUIP_ID * LOG_MASK_ITEM_SIZE)
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070089#define EVENT_MASK_SIZE 1000
Dixon Peterson6dba7572013-04-12 18:45:16 -070090#define USER_SPACE_DATA 8192
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070091#define PKT_SIZE 4096
Ravi Aravamudhanbbcb99f2013-11-06 19:43:03 -080092
Shalabh Jain321c8b52012-02-22 12:37:06 -080093#define DIAG_CTRL_MSG_LOG_MASK 9
94#define DIAG_CTRL_MSG_EVENT_MASK 10
95#define DIAG_CTRL_MSG_F3_MASK 11
Shalabh Jain1c99e4c2012-03-26 18:47:59 -070096#define CONTROL_CHAR 0x7E
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070097
Shalabh Jain7b20eab2012-06-19 17:50:58 -070098#define DIAG_CON_APSS (0x0001) /* Bit mask for APSS */
99#define DIAG_CON_MPSS (0x0002) /* Bit mask for MPSS */
100#define DIAG_CON_LPASS (0x0004) /* Bit mask for LPASS */
101#define DIAG_CON_WCNSS (0x0008) /* Bit mask for WCNSS */
102
Dixon Peterson15a6ecb2013-06-25 12:36:33 -0700103#define NUM_STM_PROCESSORS 4
104
105#define DIAG_STM_MODEM 0x01
106#define DIAG_STM_LPASS 0x02
107#define DIAG_STM_WCNSS 0x04
108#define DIAG_STM_APPS 0x08
109
Dixon Peterson5a26a302012-11-15 17:26:17 -0800110/*
111 * The status bit masks when received in a signal handler are to be
112 * used in conjunction with the peripheral list bit mask to determine the
113 * status for a peripheral. For instance, 0x00010002 would denote an open
114 * status on the MPSS
115 */
116#define DIAG_STATUS_OPEN (0x00010000) /* DCI channel open status mask */
117#define DIAG_STATUS_CLOSED (0x00020000) /* DCI channel closed status mask */
118
Dixon Petersonf2d449c2013-02-01 18:02:20 -0800119#define MODE_REALTIME 1
120#define MODE_NONREALTIME 0
121
Dixon Peterson66fb11b2012-12-04 20:30:54 -0800122#define NUM_SMD_DATA_CHANNELS 3
Dixon Peterson3ff84ea2012-12-21 20:16:18 -0800123#define NUM_SMD_CONTROL_CHANNELS NUM_SMD_DATA_CHANNELS
Dixon Peterson66fb11b2012-12-04 20:30:54 -0800124#define NUM_SMD_DCI_CHANNELS 1
Dixon Peterson3ff84ea2012-12-21 20:16:18 -0800125#define NUM_SMD_CMD_CHANNELS 1
126#define NUM_SMD_DCI_CMD_CHANNELS 1
Dixon Peterson66fb11b2012-12-04 20:30:54 -0800127
128#define SMD_DATA_TYPE 0
129#define SMD_CNTL_TYPE 1
130#define SMD_DCI_TYPE 2
Dixon Peterson3ff84ea2012-12-21 20:16:18 -0800131#define SMD_CMD_TYPE 3
132#define SMD_DCI_CMD_TYPE 4
Dixon Peterson66fb11b2012-12-04 20:30:54 -0800133
Ravi Aravamudhan6a2da562013-06-17 16:01:34 -0700134#define DIAG_PROC_DCI 1
135#define DIAG_PROC_MEMORY_DEVICE 2
136
137/* Flags to vote the DCI or Memory device process up or down
138 when it becomes active or inactive */
139#define VOTE_DOWN 0
140#define VOTE_UP 1
141
Ravi Aravamudhan3dc66352013-06-14 10:46:19 -0700142#define DIAG_TS_SIZE 50
143
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700144/* Maximum number of pkt reg supported at initialization*/
Mohit Aggarwal3aa45862013-03-05 18:37:58 +0530145extern int diag_max_reg;
146extern int diag_threshold_reg;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700147
148#define APPEND_DEBUG(ch) \
149do { \
150 diag_debug_buf[diag_debug_buf_idx] = ch; \
151 (diag_debug_buf_idx < 1023) ? \
152 (diag_debug_buf_idx++) : (diag_debug_buf_idx = 0); \
153} while (0)
154
Ashay Jaiswala372f8c2012-12-12 14:02:38 +0530155/* List of remote processor supported */
156enum remote_procs {
157 MDM = 1,
Dixon Petersonf90f3582013-01-26 18:14:17 -0800158 MDM2 = 2,
159 MDM3 = 3,
160 MDM4 = 4,
161 QSC = 5,
Ashay Jaiswala372f8c2012-12-12 14:02:38 +0530162};
163
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700164struct diag_master_table {
165 uint16_t cmd_code;
166 uint16_t subsys_id;
167 uint32_t client_id;
168 uint16_t cmd_code_lo;
169 uint16_t cmd_code_hi;
170 int process_id;
171};
172
173struct bindpkt_params_per_process {
174 /* Name of the synchronization object associated with this proc */
175 char sync_obj_name[MAX_SYNC_OBJ_NAME_SIZE];
176 uint32_t count; /* Number of entries in this bind */
177 struct bindpkt_params *params; /* first bind params */
178};
179
180struct bindpkt_params {
181 uint16_t cmd_code;
182 uint16_t subsys_id;
183 uint16_t cmd_code_lo;
184 uint16_t cmd_code_hi;
185 /* For Central Routing, used to store Processor number */
186 uint16_t proc_id;
187 uint32_t event_id;
188 uint32_t log_code;
189 /* For Central Routing, used to store SMD channel pointer */
190 uint32_t client_id;
191};
192
193struct diag_write_device {
194 void *buf;
195 int length;
196};
197
198struct diag_client_map {
199 char name[20];
200 int pid;
201};
202
Dixon Petersonf2d449c2013-02-01 18:02:20 -0800203struct diag_nrt_wake_lock {
204 int enabled;
205 int ref_count;
206 int copy_count;
207 struct wake_lock read_lock;
208 spinlock_t read_spinlock;
209};
210
Ravi Aravamudhan6a2da562013-06-17 16:01:34 -0700211struct real_time_vote_t {
212 uint16_t proc;
213 uint8_t real_time_vote;
214};
215
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700216/* This structure is defined in USB header file */
217#ifndef CONFIG_DIAG_OVER_USB
218struct diag_request {
219 char *buf;
220 int length;
221 int actual;
222 int status;
223 void *context;
224};
225#endif
226
Dixon Peterson66fb11b2012-12-04 20:30:54 -0800227struct diag_smd_info {
228 int peripheral; /* The peripheral this smd channel communicates with */
229 int type; /* The type of smd channel (data, control, dci) */
230 uint16_t peripheral_mask;
Dixon Peterson9ce39c62013-02-21 13:00:52 -0800231 int encode_hdlc; /* Whether data is raw and needs to be hdlc encoded */
Dixon Peterson66fb11b2012-12-04 20:30:54 -0800232
233 smd_channel_t *ch;
234 smd_channel_t *ch_save;
235
Dixon Peterson25f042b2013-02-27 13:00:08 -0800236 struct mutex smd_ch_mutex;
237
Dixon Peterson66fb11b2012-12-04 20:30:54 -0800238 int in_busy_1;
239 int in_busy_2;
240
241 unsigned char *buf_in_1;
242 unsigned char *buf_in_2;
243
Dixon Peterson9ce39c62013-02-21 13:00:52 -0800244 unsigned char *buf_in_1_raw;
245 unsigned char *buf_in_2_raw;
246
Dixon Petersond2309b42013-08-28 21:00:05 -0700247 unsigned int buf_in_1_size;
248 unsigned int buf_in_2_size;
249
250 unsigned int buf_in_1_raw_size;
251 unsigned int buf_in_2_raw_size;
252
Dixon Peterson66fb11b2012-12-04 20:30:54 -0800253 struct diag_request *write_ptr_1;
254 struct diag_request *write_ptr_2;
255
Dixon Petersonf2d449c2013-02-01 18:02:20 -0800256 struct diag_nrt_wake_lock nrt_lock;
257
Dixon Petersonbba99ca2013-07-10 17:25:20 -0700258 struct workqueue_struct *wq;
259
Dixon Peterson66fb11b2012-12-04 20:30:54 -0800260 struct work_struct diag_read_smd_work;
261 struct work_struct diag_notify_update_smd_work;
262 int notify_context;
Dixon Peterson15a6ecb2013-06-25 12:36:33 -0700263 struct work_struct diag_general_smd_work;
264 int general_context;
Dixon Peterson66fb11b2012-12-04 20:30:54 -0800265
266 /*
267 * Function ptr for function to call to process the data that
268 * was just read from the smd channel
269 */
270 int (*process_smd_read_data)(struct diag_smd_info *smd_info,
271 void *buf, int num_bytes);
272};
273
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700274struct diagchar_dev {
275
276 /* State for the char driver */
277 unsigned int major;
278 unsigned int minor_start;
279 int num;
280 struct cdev *cdev;
281 char *name;
282 int dropped_count;
283 struct class *diagchar_class;
284 int ref_count;
285 struct mutex diagchar_mutex;
286 wait_queue_head_t wait_q;
Shalabh Jainc70b3b62012-08-31 19:11:20 -0700287 wait_queue_head_t smd_wait_q;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700288 struct diag_client_map *client_map;
289 int *data_ready;
290 int num_clients;
Shalabh Jain3d29fc32012-02-09 17:15:59 -0800291 int polling_reg_flag;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700292 struct diag_write_device *buf_tbl;
Dixon Petersona6d98092013-05-16 12:26:26 -0700293 unsigned int buf_tbl_size;
Dixon Petersonb4618a42012-02-29 18:56:31 -0800294 int use_device_tree;
Dixon Peterson3ff84ea2012-12-21 20:16:18 -0800295 int supports_separate_cmdrsp;
Dixon Peterson9ce39c62013-02-21 13:00:52 -0800296 int supports_apps_hdlc_encoding;
Dixon Peterson15a6ecb2013-06-25 12:36:33 -0700297 /* The state requested in the STM command */
298 int stm_state_requested[NUM_STM_PROCESSORS];
299 /* The current STM state */
300 int stm_state[NUM_STM_PROCESSORS];
301 /* Whether or not the peripheral supports STM */
302 int peripheral_supports_stm[NUM_SMD_CONTROL_CHANNELS];
Shalabh Jain1c99e4c2012-03-26 18:47:59 -0700303 /* DCI related variables */
Ravi Aravamudhanc94a4732013-12-10 10:26:10 -0800304 struct list_head dci_req_list;
Shalabh Jain16794902012-09-14 10:56:49 -0700305 struct diag_dci_client_tbl *dci_client_tbl;
Shalabh Jain1c99e4c2012-03-26 18:47:59 -0700306 int dci_tag;
307 int dci_client_id;
308 struct mutex dci_mutex;
309 int num_dci_client;
310 unsigned char *apps_dci_buf;
311 int dci_state;
Shalabh Jain16794902012-09-14 10:56:49 -0700312 struct workqueue_struct *diag_dci_wq;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700313 /* Memory pool parameters */
314 unsigned int itemsize;
315 unsigned int poolsize;
316 unsigned int itemsize_hdlc;
317 unsigned int poolsize_hdlc;
Dixon Peterson6dba7572013-04-12 18:45:16 -0700318 unsigned int itemsize_user;
319 unsigned int poolsize_user;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700320 unsigned int itemsize_write_struct;
321 unsigned int poolsize_write_struct;
322 unsigned int debug_flag;
323 /* State for the mempool for the char driver */
324 mempool_t *diagpool;
325 mempool_t *diag_hdlc_pool;
Dixon Peterson6dba7572013-04-12 18:45:16 -0700326 mempool_t *diag_user_pool;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700327 mempool_t *diag_write_struct_pool;
Ravi Aravamudhan850b4c92013-07-03 17:57:52 -0700328 spinlock_t diag_mem_lock;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700329 int count;
330 int count_hdlc_pool;
Dixon Peterson6dba7572013-04-12 18:45:16 -0700331 int count_user_pool;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700332 int count_write_struct_pool;
333 int used;
Shalabh Jain321c8b52012-02-22 12:37:06 -0800334 /* Buffers for masks */
Shalabh Jaina06c6d72012-04-30 13:40:35 -0700335 struct mutex diag_cntl_mutex;
Shalabh Jain321c8b52012-02-22 12:37:06 -0800336 struct diag_ctrl_event_mask *event_mask;
337 struct diag_ctrl_log_mask *log_mask;
338 struct diag_ctrl_msg_mask *msg_mask;
Ravi Aravamudhand09f8772012-12-20 14:48:30 -0800339 struct diag_ctrl_feature_mask *feature_mask;
Ravi Aravamudhanbbcb99f2013-11-06 19:43:03 -0800340 struct mutex log_mask_mutex;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700341 /* State for diag forwarding */
Dixon Peterson66fb11b2012-12-04 20:30:54 -0800342 struct diag_smd_info smd_data[NUM_SMD_DATA_CHANNELS];
343 struct diag_smd_info smd_cntl[NUM_SMD_CONTROL_CHANNELS];
344 struct diag_smd_info smd_dci[NUM_SMD_DCI_CHANNELS];
Dixon Peterson3ff84ea2012-12-21 20:16:18 -0800345 struct diag_smd_info smd_cmd[NUM_SMD_CMD_CHANNELS];
346 struct diag_smd_info smd_dci_cmd[NUM_SMD_DCI_CMD_CHANNELS];
Ravi Aravamudhan91391ce2013-10-01 17:09:50 -0700347 int rcvd_feature_mask[NUM_SMD_CONTROL_CHANNELS];
Dixon Peterson3ff84ea2012-12-21 20:16:18 -0800348 int separate_cmdrsp[NUM_SMD_CONTROL_CHANNELS];
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700349 unsigned char *usb_buf_out;
350 unsigned char *apps_rsp_buf;
Mohit Aggarwala0118b12013-12-05 17:14:35 +0530351 unsigned char *user_space_data_buf;
Shalabh Jain321c8b52012-02-22 12:37:06 -0800352 /* buffer for updating mask to peripherals */
353 unsigned char *buf_msg_mask_update;
354 unsigned char *buf_log_mask_update;
355 unsigned char *buf_event_mask_update;
Ravi Aravamudhand09f8772012-12-20 14:48:30 -0800356 unsigned char *buf_feature_mask_update;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700357 int read_len_legacy;
Dixon Peterson25f042b2013-02-27 13:00:08 -0800358 struct mutex diag_hdlc_mutex;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700359 unsigned char *hdlc_buf;
360 unsigned hdlc_count;
361 unsigned hdlc_escape;
Ravi Aravamudhan72c55282013-03-20 19:29:01 -0700362 int in_busy_pktdata;
Ravi Aravamudhan37903fe2013-06-03 12:35:05 -0700363 struct device *dci_device;
364 struct device *dci_cmd_device;
Ravi Aravamudhan6a2da562013-06-17 16:01:34 -0700365 /* Variables for non real time mode */
366 int real_time_mode;
367 int real_time_update_busy;
368 uint16_t proc_active_mask;
369 uint16_t proc_rt_vote_mask;
370 struct mutex real_time_mutex;
371 struct work_struct diag_real_time_work;
372 struct workqueue_struct *diag_real_time_wq;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700373#ifdef CONFIG_DIAG_OVER_USB
374 int usb_connected;
375 struct usb_diag_ch *legacy_ch;
376 struct work_struct diag_proc_hdlc_work;
377 struct work_struct diag_read_work;
Mohit Aggarwalb4465772013-04-18 13:08:07 +0530378 struct work_struct diag_usb_connect_work;
379 struct work_struct diag_usb_disconnect_work;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700380#endif
381 struct workqueue_struct *diag_wq;
382 struct work_struct diag_drain_work;
Shalabh Jain321c8b52012-02-22 12:37:06 -0800383 struct workqueue_struct *diag_cntl_wq;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700384 uint8_t *msg_masks;
Ravi Aravamudhan987be232013-08-08 15:46:50 -0700385 uint8_t msg_status;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700386 uint8_t *log_masks;
Ravi Aravamudhan987be232013-08-08 15:46:50 -0700387 uint8_t log_status;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700388 uint8_t *event_masks;
Ravi Aravamudhan987be232013-08-08 15:46:50 -0700389 uint8_t event_status;
Ravi Aravamudhand09f8772012-12-20 14:48:30 -0800390 uint8_t log_on_demand_support;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700391 struct diag_master_table *table;
392 uint8_t *pkt_buf;
393 int pkt_length;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700394 struct diag_request *usb_read_ptr;
395 struct diag_request *write_ptr_svc;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700396 int logging_mode;
Shalabh Jainc236f982011-12-15 22:55:20 -0800397 int mask_check;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700398 int logging_process_id;
Dixon Peterson625ee652012-06-21 22:03:49 -0700399 struct task_struct *socket_process;
Shalabh Jain84e30342012-10-16 16:16:08 -0700400 struct task_struct *callback_process;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700401#ifdef CONFIG_DIAG_SDIO_PIPE
402 unsigned char *buf_in_sdio;
403 unsigned char *usb_buf_mdm_out;
404 struct sdio_channel *sdio_ch;
405 int read_len_mdm;
406 int in_busy_sdio;
407 struct usb_diag_ch *mdm_ch;
408 struct work_struct diag_read_mdm_work;
409 struct workqueue_struct *diag_sdio_wq;
410 struct work_struct diag_read_sdio_work;
Shalabh Jain5d9ba342011-08-10 13:51:54 -0700411 struct work_struct diag_close_sdio_work;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700412 struct diag_request *usb_read_mdm_ptr;
413 struct diag_request *write_ptr_mdm;
414#endif
Shalabh Jain737fca72012-11-14 21:53:43 -0800415#ifdef CONFIG_DIAGFWD_BRIDGE_CODE
416 /* common for all bridges */
Mohit Aggarwalb4465772013-04-18 13:08:07 +0530417 struct work_struct diag_connect_work;
Shalabh Jain737fca72012-11-14 21:53:43 -0800418 struct work_struct diag_disconnect_work;
Shalabh Jainf7228dc2012-05-23 17:32:05 -0700419 /* SGLTE variables */
420 int lcid;
421 unsigned char *buf_in_smux;
422 int in_busy_smux;
423 int diag_smux_enabled;
Ashay Jaiswal2d8daae2012-07-17 17:29:33 +0530424 int smux_connected;
Dixon Peterson938f8602012-08-17 20:02:57 -0700425 struct diag_request *write_ptr_mdm;
Dixon Peterson32e70bb2011-12-16 13:26:45 -0800426#endif
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700427};
428
Shalabh Jain737fca72012-11-14 21:53:43 -0800429extern struct diag_bridge_dev *diag_bridge;
Shalabh Jainb0037c02013-01-18 12:47:40 -0800430extern struct diag_hsic_dev *diag_hsic;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700431extern struct diagchar_dev *driver;
Ravi Aravamudhanf55dc1d2012-12-27 11:51:42 -0800432
433extern int wrap_enabled;
434extern uint16_t wrap_count;
435
Ravi Aravamudhan3dc66352013-06-14 10:46:19 -0700436void diag_get_timestamp(char *time_str);
Ravi Aravamudhan8081a132013-08-02 12:19:28 -0700437int diag_find_polling_reg(int i);
Ravi Aravamudhan3dc66352013-06-14 10:46:19 -0700438
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700439#endif