diag: Add On-Device logging support for Fusion3

Diag traffic can be written to an SD card.  For Fusion3, add
support for logging diag traffic from the MDM over the HSIC
to the SD card.

Change-Id: I1f532557452ba8ec1c55e6b17114bf4c000d5769
Signed-off-by: Dixon Peterson <dixonp@codeaurora.org>
diff --git a/drivers/char/diag/diagchar.h b/drivers/char/diag/diagchar.h
index d547121..656223b 100644
--- a/drivers/char/diag/diagchar.h
+++ b/drivers/char/diag/diagchar.h
@@ -262,8 +262,8 @@
 	int hsic_device_opened;
 	int hsic_suspend;
 	int read_len_mdm;
-	int in_busy_hsic_read_on_mdm;
-	int in_busy_hsic_write_on_mdm;
+	int in_busy_hsic_read_on_device;
+	int in_busy_hsic_write_on_device;
 	int in_busy_hsic_write;
 	int in_busy_hsic_read;
 	int usb_mdm_connected;
diff --git a/drivers/char/diag/diagchar_core.c b/drivers/char/diag/diagchar_core.c
index 0a156de..f1ab127 100644
--- a/drivers/char/diag/diagchar_core.c
+++ b/drivers/char/diag/diagchar_core.c
@@ -233,6 +233,10 @@
 	if (driver->logging_process_id == current->tgid) {
 		driver->logging_mode = USB_MODE;
 		diagfwd_connect();
+#ifdef CONFIG_DIAG_HSIC_PIPE
+		diagfwd_cancel_hsic();
+		diagfwd_connect_hsic(0);
+#endif
 	}
 #endif /* DIAG over USB */
 	/* Delete the pkt response table entry for the exiting process */
@@ -476,6 +480,9 @@
 #ifdef CONFIG_DIAG_SDIO_PIPE
 			driver->in_busy_sdio = 1;
 #endif
+#ifdef CONFIG_DIAG_HSIC_PIPE
+			diagfwd_disconnect_hsic(0);
+#endif
 		} else if (temp == NO_LOGGING_MODE && driver->logging_mode
 							== MEMORY_DEVICE_MODE) {
 			driver->in_busy_1 = 0;
@@ -501,15 +508,24 @@
 				queue_work(driver->diag_sdio_wq,
 					&(driver->diag_read_sdio_work));
 #endif
+#ifdef CONFIG_DIAG_HSIC_PIPE
+			diagfwd_connect_hsic(0);
+#endif
 		}
 #ifdef CONFIG_DIAG_OVER_USB
 		else if (temp == USB_MODE && driver->logging_mode
-							 == NO_LOGGING_MODE)
+							 == NO_LOGGING_MODE) {
 			diagfwd_disconnect();
-		else if (temp == NO_LOGGING_MODE && driver->logging_mode
-								== USB_MODE)
+#ifdef CONFIG_DIAG_HSIC_PIPE
+			diagfwd_disconnect_hsic(0);
+#endif
+		} else if (temp == NO_LOGGING_MODE && driver->logging_mode
+								== USB_MODE) {
 			diagfwd_connect();
-		else if (temp == USB_MODE && driver->logging_mode
+#ifdef CONFIG_DIAG_HSIC_PIPE
+			diagfwd_connect_hsic(0);
+#endif
+		} else if (temp == USB_MODE && driver->logging_mode
 							== MEMORY_DEVICE_MODE) {
 			diagfwd_disconnect();
 			driver->in_busy_1 = 0;
@@ -535,9 +551,18 @@
 				queue_work(driver->diag_sdio_wq,
 					&(driver->diag_read_sdio_work));
 #endif
-			} else if (temp == MEMORY_DEVICE_MODE &&
-					 driver->logging_mode == USB_MODE)
-				diagfwd_connect();
+#ifdef CONFIG_DIAG_HSIC_PIPE
+			diagfwd_cancel_hsic();
+			diagfwd_connect_hsic(0);
+#endif
+		} else if (temp == MEMORY_DEVICE_MODE &&
+				 driver->logging_mode == USB_MODE) {
+			diagfwd_connect();
+#ifdef CONFIG_DIAG_HSIC_PIPE
+			diagfwd_cancel_hsic();
+			diagfwd_connect_hsic(0);
+#endif
+		}
 #endif /* DIAG over USB */
 		success = 1;
 	}
@@ -565,6 +590,7 @@
 
 	if ((driver->data_ready[index] & USER_SPACE_LOG_TYPE) && (driver->
 					logging_mode == MEMORY_DEVICE_MODE)) {
+		pr_debug("diag: process woken up\n");
 		/*Copy the type of data being passed*/
 		data_type = driver->data_ready[index] & USER_SPACE_LOG_TYPE;
 		COPY_USER_SPACE_OR_EXIT(buf, data_type, 4);
@@ -693,6 +719,23 @@
 			driver->in_busy_sdio = 0;
 		}
 #endif
+#ifdef CONFIG_DIAG_HSIC_PIPE
+		pr_debug("diag: Copy data to user space %d\n",
+			 driver->in_busy_hsic_write_on_device);
+		if (driver->in_busy_hsic_write_on_device == 1) {
+			num_data++;
+			/*Copy the length of data being passed*/
+			COPY_USER_SPACE_OR_EXIT(buf+ret,
+				 (driver->write_ptr_mdm->length), 4);
+			/*Copy the actual data being passed*/
+			COPY_USER_SPACE_OR_EXIT(buf+ret,
+					*(driver->buf_in_hsic),
+					 driver->write_ptr_mdm->length);
+			pr_debug("diag: data copied\n");
+			/* call the write complete function */
+			diagfwd_write_complete_hsic();
+		}
+#endif
 		/* copy number of data fields */
 		COPY_USER_SPACE_OR_EXIT(buf+4, num_data, 4);
 		ret -= 4;
@@ -854,7 +897,32 @@
 			}
 		}
 #endif
-		/* send masks to modem now */
+#ifdef CONFIG_DIAG_HSIC_PIPE
+		/* send masks to 9k too */
+		if (driver->hsic_ch && (payload_size > 0)) {
+			/* wait sending mask updates if HSIC ch not ready */
+			if (driver->in_busy_hsic_write)
+				wait_event_interruptible(driver->wait_q,
+					(driver->in_busy_hsic_write != 1));
+			driver->in_busy_hsic_write = 1;
+			driver->in_busy_hsic_read_on_device = 0;
+			err = diag_bridge_write(driver->user_space_data,
+							 payload_size);
+			if (err) {
+				pr_err("diag: err sending mask to MDM: %d\n",
+									 err);
+				/*
+				* If the error is recoverable, then clear
+				* the write flag, so we will resubmit a
+				* write on the next frame.  Otherwise, don't
+				* resubmit a write on the next frame.
+				*/
+				if ((-ESHUTDOWN) != err)
+					driver->in_busy_hsic_write = 0;
+			}
+		}
+#endif
+		/* send masks to 8k now */
 		diag_process_hdlc((void *)(driver->user_space_data),
 							 payload_size);
 		return 0;
diff --git a/drivers/char/diag/diagfwd.c b/drivers/char/diag/diagfwd.c
index 7066141..340524b 100644
--- a/drivers/char/diag/diagfwd.c
+++ b/drivers/char/diag/diagfwd.c
@@ -273,6 +273,7 @@
 				break;
 		if (i < driver->num_clients) {
 			driver->data_ready[i] |= USER_SPACE_LOG_TYPE;
+			pr_debug("diag: wake up logging process\n");
 			wake_up_interruptible(&driver->wait_q);
 		} else
 			return -EINVAL;
@@ -300,6 +301,15 @@
 				&(driver->diag_read_sdio_work));
 		}
 #endif
+#ifdef CONFIG_DIAG_HSIC_PIPE
+		else if (proc_num == HSIC_DATA) {
+			driver->in_busy_hsic_read = 0;
+			driver->in_busy_hsic_write_on_device = 0;
+			if (driver->hsic_ch)
+				queue_work(driver->diag_hsic_wq,
+					&(driver->diag_read_hsic_work));
+		}
+#endif
 		err = -1;
 	}
 #ifdef CONFIG_DIAG_OVER_USB
diff --git a/drivers/char/diag/diagfwd_hsic.c b/drivers/char/diag/diagfwd_hsic.c
index 4ecf000..a3c6f26 100644
--- a/drivers/char/diag/diagfwd_hsic.c
+++ b/drivers/char/diag/diagfwd_hsic.c
@@ -36,11 +36,11 @@
 		return;
 	}
 
-	/*
-	 * If there is no hsic data being read from the hsic and there
-	 * is no hsic data being written to the usb mdm channel
+	/* If there is no hsic data being read from the hsic and there
+	 * is no hsic data being written to the device
 	 */
-	if (!driver->in_busy_hsic_read && !driver->in_busy_hsic_write_on_mdm) {
+	if (!driver->in_busy_hsic_read &&
+			 !driver->in_busy_hsic_write_on_device) {
 		/*
 		 * Initiate the read from the hsic.  The hsic read is
 		 * asynchronous.  Once the read is complete the read
@@ -49,6 +49,7 @@
 		int err;
 		driver->in_busy_hsic_read = 1;
 		APPEND_DEBUG('i');
+		pr_debug("diag: read from HSIC\n");
 		err = diag_bridge_read((char *)driver->buf_in_hsic,
 					IN_BUF_SIZE);
 		if (err) {
@@ -97,7 +98,8 @@
 			 * diag_bridge_read(), so buf here should be
 			 * driver->buf_in_hsic
 			 */
-			driver->in_busy_hsic_write_on_mdm = 1;
+			driver->in_busy_hsic_write_on_device = 1;
+			pr_debug("diag: write to device\n");
 			diag_device_write((void *)buf, HSIC_DATA,
 						driver->write_ptr_mdm);
 		}
@@ -109,9 +111,9 @@
 	 * If for some reason there was no hsic data to write to the
 	 * mdm channel, set up another read
 	 */
-	if (!driver->in_busy_hsic_write_on_mdm &&
-			driver->usb_mdm_connected &&
-			!driver->hsic_suspend)
+	if (!driver->in_busy_hsic_write_on_device && ((driver->logging_mode
+			== MEMORY_DEVICE_MODE) || (driver->usb_mdm_connected &&
+						    !driver->hsic_suspend)))
 		queue_work(driver->diag_hsic_wq, &driver->diag_read_hsic_work);
 }
 
@@ -135,9 +137,14 @@
 
 static int diag_hsic_suspend(void *ctxt)
 {
+	pr_debug("diag: hsic_suspend\n");
 	if (driver->in_busy_hsic_write)
 		return -EBUSY;
 
+	/* Don't allow suspend if in MEMORY_DEVICE_MODE */
+	if (driver->logging_mode == MEMORY_DEVICE_MODE)
+		return -EBUSY;
+
 	driver->hsic_suspend = 1;
 
 	return 0;
@@ -145,9 +152,11 @@
 
 static void diag_hsic_resume(void *ctxt)
 {
+	pr_debug("diag: hsic_resume\n");
 	driver->hsic_suspend = 0;
 
-	if (!driver->in_busy_hsic_write_on_mdm && driver->usb_mdm_connected)
+	if (!driver->in_busy_hsic_write_on_device && (driver->logging_mode
+			== MEMORY_DEVICE_MODE || driver->usb_mdm_connected))
 		queue_work(driver->diag_hsic_wq, &driver->diag_read_hsic_work);
 }
 
@@ -167,28 +176,59 @@
 			driver->hsic_device_opened = 0;
 			diag_bridge_close();
 		}
-		pr_debug("DIAG in %s: closed successfully\n", __func__);
+		pr_debug("diag: in %s: closed successfully\n", __func__);
 	} else {
-		pr_debug("DIAG in %s: already closed\n", __func__);
+		pr_debug("diag: in %s: already closed\n", __func__);
+	}
+
+	return 0;
+}
+
+/* diagfwd_cancel_hsic is called to cancel outstanding read/writes */
+int diagfwd_cancel_hsic(void)
+{
+	int err;
+
+	if (driver->hsic_device_enabled) {
+		if (driver->hsic_device_opened) {
+			driver->hsic_ch = 0;
+			driver->hsic_device_opened = 0;
+			diag_bridge_close();
+			err = diag_bridge_open(&hsic_diag_bridge_ops);
+			if (err) {
+				pr_err("DIAG: HSIC channel open error: %d\n",
+					err);
+			} else {
+				pr_debug("DIAG: opened HSIC channel\n");
+				driver->hsic_device_opened = 1;
+				driver->hsic_ch = 1;
+			}
+		}
 	}
 
 	return 0;
 }
 
 /* diagfwd_connect_hsic is called when the USB mdm channel is connected */
-static int diagfwd_connect_hsic(void)
+int diagfwd_connect_hsic(int process_cable)
 {
 	int err;
 
 	pr_debug("DIAG in %s\n", __func__);
 
-	err = usb_diag_alloc_req(driver->mdm_ch, N_MDM_WRITE, N_MDM_READ);
-	if (err)
-		pr_err("DIAG: unable to alloc USB req on mdm ch err:%d\n", err);
+	/* If the usb cable is being connected */
+	if (process_cable) {
+		err = usb_diag_alloc_req(driver->mdm_ch, N_MDM_WRITE,
+			N_MDM_READ);
+		if (err)
+			pr_err("DIAG: unable to alloc USB req on mdm"
+				" ch err:%d\n", err);
 
-	driver->usb_mdm_connected = 1;
-	driver->in_busy_hsic_write_on_mdm = 0;
-	driver->in_busy_hsic_read_on_mdm = 0;
+		driver->usb_mdm_connected = 1;
+	}
+
+	driver->in_busy_hsic_write_on_device = 0;
+	driver->in_busy_hsic_read_on_device = 0;
 	driver->in_busy_hsic_write = 0;
 	driver->in_busy_hsic_read = 0;
 
@@ -215,7 +255,9 @@
 			driver->hsic_ch = 1;
 
 		/* Poll USB mdm channel to check for data */
-		queue_work(driver->diag_hsic_wq, &driver->diag_read_mdm_work);
+		if (driver->logging_mode == USB_MODE)
+			queue_work(driver->diag_hsic_wq,
+					&driver->diag_read_mdm_work);
 
 		/* Poll HSIC channel to check for data */
 		queue_work(driver->diag_hsic_wq, &driver->diag_read_hsic_work);
@@ -231,33 +273,38 @@
  * diagfwd_disconnect_hsic is called when the USB mdm channel
  * is disconnected
  */
-static int diagfwd_disconnect_hsic(void)
+int diagfwd_disconnect_hsic(int process_cable)
 {
 	pr_debug("DIAG in %s\n", __func__);
 
-	driver->usb_mdm_connected = 0;
-	usb_diag_free_req(driver->mdm_ch);
-	driver->in_busy_hsic_write_on_mdm = 1;
-	driver->in_busy_hsic_read_on_mdm = 1;
-	driver->in_busy_hsic_write = 1;
-	driver->in_busy_hsic_read = 1;
+	/* If the usb cable is being disconnected */
+	if (process_cable) {
+		driver->usb_mdm_connected = 0;
+		usb_diag_free_req(driver->mdm_ch);
+	}
 
-	/* Turn off communication over usb mdm and hsic */
-	return diag_hsic_close();
+	if (driver->logging_mode != MEMORY_DEVICE_MODE) {
+		driver->in_busy_hsic_write_on_device = 1;
+		driver->in_busy_hsic_read_on_device = 1;
+		driver->in_busy_hsic_write = 1;
+		driver->in_busy_hsic_read = 1;
+		/* Turn off communication over usb mdm and hsic */
+		return diag_hsic_close();
+	}
+	return 0;
 }
 
 /*
  * diagfwd_write_complete_hsic is called after the asynchronous
  * usb_diag_write() on mdm channel is complete
  */
-static int diagfwd_write_complete_hsic(void)
+int diagfwd_write_complete_hsic(void)
 {
 	/*
 	 * Clear flag to denote that the write of the hsic data on the
 	 * usb mdm channel is complete
 	 */
-	driver->in_busy_hsic_write_on_mdm = 0;
-
+	driver->in_busy_hsic_write_on_device = 0;
 	if (!driver->hsic_ch) {
 		pr_err("DIAG in %s: driver->hsic_ch == 0\n", __func__);
 		return 0;
@@ -275,7 +322,7 @@
 static int diagfwd_read_complete_hsic(struct diag_request *diag_read_ptr)
 {
 	/* The read of the usb driver on the mdm (not hsic) has completed */
-	driver->in_busy_hsic_read_on_mdm = 0;
+	driver->in_busy_hsic_read_on_device = 0;
 	driver->read_len_mdm = diag_read_ptr->actual;
 
 	if (!driver->hsic_ch) {
@@ -329,7 +376,7 @@
 {
 	switch (event) {
 	case USB_DIAG_CONNECT:
-		diagfwd_connect_hsic();
+		diagfwd_connect_hsic(1);
 		break;
 	case USB_DIAG_DISCONNECT:
 		queue_work(driver->diag_hsic_wq, &driver->diag_disconnect_work);
@@ -355,7 +402,7 @@
 
 static void diag_disconnect_work_fn(struct work_struct *w)
 {
-	diagfwd_disconnect_hsic();
+	diagfwd_disconnect_hsic(1);
 }
 
 static void diag_read_mdm_work_fn(struct work_struct *work)
@@ -370,11 +417,12 @@
 	 * and there is no mdm channel data currently being written
 	 * to the hsic
 	 */
-	if (!driver->in_busy_hsic_read_on_mdm && !driver->in_busy_hsic_write) {
+	if (!driver->in_busy_hsic_read_on_device &&
+				 !driver->in_busy_hsic_write) {
 		APPEND_DEBUG('x');
 
 		/* Setup the next read from usb mdm channel */
-		driver->in_busy_hsic_read_on_mdm = 1;
+		driver->in_busy_hsic_read_on_device = 1;
 		driver->usb_read_mdm_ptr->buf = driver->usb_buf_mdm_out;
 		driver->usb_read_mdm_ptr->length = USB_MAX_OUT_BUF;
 		usb_diag_read(driver->mdm_ch, driver->usb_read_mdm_ptr);
@@ -385,41 +433,77 @@
 	 * If for some reason there was no mdm channel read initiated,
 	 * queue up the reading of data from the mdm channel
 	 */
-	if (!driver->in_busy_hsic_read_on_mdm)
+	if (!driver->in_busy_hsic_read_on_device)
 		queue_work(driver->diag_hsic_wq, &driver->diag_read_mdm_work);
 }
 
-int diag_hsic_enable(void)
+static int diag_hsic_probe(struct platform_device *pdev)
 {
-	pr_debug("DIAG in %s\n", __func__);
-
-	driver->read_len_mdm = 0;
-	if (driver->buf_in_hsic == NULL)
-		driver->buf_in_hsic = kzalloc(IN_BUF_SIZE, GFP_KERNEL);
-	if (driver->buf_in_hsic == NULL)
-		goto err;
-	if (driver->usb_buf_mdm_out  == NULL)
-		driver->usb_buf_mdm_out = kzalloc(USB_MAX_OUT_BUF, GFP_KERNEL);
-	if (driver->usb_buf_mdm_out == NULL)
-		goto err;
-	if (driver->write_ptr_mdm == NULL)
-		driver->write_ptr_mdm = kzalloc(
-		sizeof(struct diag_request), GFP_KERNEL);
-	if (driver->write_ptr_mdm == NULL)
-		goto err;
-	if (driver->usb_read_mdm_ptr == NULL)
-		driver->usb_read_mdm_ptr = kzalloc(
-		sizeof(struct diag_request), GFP_KERNEL);
-	if (driver->usb_read_mdm_ptr == NULL)
-		goto err;
+	int err = 0;
+	pr_debug("diag: in %s\n", __func__);
+	if (!driver->hsic_device_enabled) {
+		driver->read_len_mdm = 0;
+		if (driver->buf_in_hsic == NULL)
+			driver->buf_in_hsic = kzalloc(IN_BUF_SIZE, GFP_KERNEL);
+		if (driver->buf_in_hsic == NULL)
+			goto err;
+		if (driver->usb_buf_mdm_out  == NULL)
+			driver->usb_buf_mdm_out = kzalloc(USB_MAX_OUT_BUF,
+								 GFP_KERNEL);
+		if (driver->usb_buf_mdm_out == NULL)
+			goto err;
+		if (driver->write_ptr_mdm == NULL)
+			driver->write_ptr_mdm = kzalloc(
+			sizeof(struct diag_request), GFP_KERNEL);
+		if (driver->write_ptr_mdm == NULL)
+			goto err;
+		if (driver->usb_read_mdm_ptr == NULL)
+			driver->usb_read_mdm_ptr = kzalloc(
+			sizeof(struct diag_request), GFP_KERNEL);
+		if (driver->usb_read_mdm_ptr == NULL)
+			goto err;
 #ifdef CONFIG_DIAG_OVER_USB
-	INIT_WORK(&(driver->diag_read_mdm_work), diag_read_mdm_work_fn);
+		INIT_WORK(&(driver->diag_read_mdm_work), diag_read_mdm_work_fn);
 #endif
-	INIT_WORK(&(driver->diag_read_hsic_work), diag_read_hsic_work_fn);
+		INIT_WORK(&(driver->diag_read_hsic_work),
+						 diag_read_hsic_work_fn);
+		driver->hsic_device_enabled = 1;
+	}
 
-	driver->hsic_device_enabled = 1;
+	/*
+	 * The probe function was called after the usb was connected
+	 * on the legacy channel OR ODL is turned on. Communication over usb
+	 * mdm and hsic needs to be turned on.
+	 */
+	if (driver->usb_mdm_connected || (driver->logging_mode ==
+							 MEMORY_DEVICE_MODE)) {
+		/* The hsic (diag_bridge) platform device driver is enabled */
+		err = diag_bridge_open(&hsic_diag_bridge_ops);
+		if (err) {
+			pr_err("diag: could not open HSIC, err: %d\n", err);
+			driver->hsic_device_opened = 0;
+			return err;
+		}
 
-	return 0;
+		pr_info("diag: opened HSIC channel\n");
+		driver->hsic_device_opened = 1;
+		driver->hsic_ch = 1;
+		driver->in_busy_hsic_write_on_device = 0;
+		driver->in_busy_hsic_read_on_device = 0;
+		driver->in_busy_hsic_write = 0;
+		driver->in_busy_hsic_read = 0;
+
+		if (driver->usb_mdm_connected) {
+			/* Poll USB mdm channel to check for data */
+			queue_work(driver->diag_hsic_wq,
+					 &driver->diag_read_mdm_work);
+		}
+
+		/* Poll HSIC channel to check for data */
+		queue_work(driver->diag_hsic_wq, &driver->diag_read_hsic_work);
+	}
+
+	return err;
 err:
 	pr_err("DIAG could not initialize buf for HSIC\n");
 	kfree(driver->buf_in_hsic);
@@ -432,50 +516,6 @@
 	return -ENOMEM;
 }
 
-static int diag_hsic_probe(struct platform_device *pdev)
-{
-	int err;
-
-	if (!driver->hsic_device_enabled) {
-		err = diag_hsic_enable();
-		if (err) {
-			pr_err("DIAG could not enable HSIC, err: %d\n", err);
-			return err;
-		}
-	}
-
-	/*
-	 * The probe function was called after the usb was connected
-	 * on the legacy channel. Communication over usb mdm and hsic
-	 * needs to be turned on.
-	 */
-	if (driver->usb_mdm_connected) {
-		/* The hsic (diag_bridge) platform device driver is enabled */
-		err = diag_bridge_open(&hsic_diag_bridge_ops);
-		if (err) {
-			pr_err("DIAG could not open HSIC, err: %d\n", err);
-			driver->hsic_device_opened = 0;
-			return err;
-		}
-
-		pr_debug("DIAG opened HSIC channel\n");
-		driver->hsic_device_opened = 1;
-		driver->hsic_ch = 1;
-		driver->in_busy_hsic_write_on_mdm = 0;
-		driver->in_busy_hsic_read_on_mdm = 0;
-		driver->in_busy_hsic_write = 0;
-		driver->in_busy_hsic_read = 0;
-
-		/* Poll USB mdm channel to check for data */
-		queue_work(driver->diag_hsic_wq, &driver->diag_read_mdm_work);
-
-		/* Poll HSIC channel to check for data */
-		queue_work(driver->diag_hsic_wq, &driver->diag_read_hsic_work);
-	}
-
-	return err;
-}
-
 static int diag_hsic_remove(struct platform_device *pdev)
 {
 	pr_debug("DIAG: %s called\n", __func__);
@@ -510,7 +550,6 @@
 		   },
 };
 
-
 void diagfwd_hsic_init(void)
 {
 	int ret;
diff --git a/drivers/char/diag/diagfwd_hsic.h b/drivers/char/diag/diagfwd_hsic.h
index 3cfb260..8785d9f 100644
--- a/drivers/char/diag/diagfwd_hsic.h
+++ b/drivers/char/diag/diagfwd_hsic.h
@@ -17,6 +17,10 @@
 #define N_MDM_WRITE	1 /* Upgrade to 2 with ping pong buffer */
 #define N_MDM_READ	1
 
+int diagfwd_connect_hsic(int);
+int diagfwd_disconnect_hsic(int);
+int diagfwd_write_complete_hsic(void);
+int diagfwd_cancel_hsic(void);
 void diagfwd_hsic_init(void);
 void diagfwd_hsic_exit(void);