Exemple #1
0
static void diag_read_mdm_work_fn(struct work_struct *work)
{
	int ret;
	if (driver->diag_smux_enabled) {
		if (driver->lcid && driver->usb_buf_mdm_out &&
					 (driver->read_len_mdm > 0)) {
			ret = msm_smux_write(driver->lcid,  NULL,
		 driver->usb_buf_mdm_out, driver->read_len_mdm);
			if (ret)
				pr_err("diag: writing to SMUX ch, r = %d,"
					"lcid = %d\n", ret, driver->lcid);
		}
		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);
		return;
	}

	/* if SMUX not enabled, check for HSIC */
	if (!driver->hsic_ch) {
		pr_err("DIAG in %s: driver->hsic_ch == 0\n", __func__);
		return;
	}

	/*
	 * If there is no data being read from the usb mdm channel
	 * and there is no mdm channel data currently being written
	 * to the hsic
	 */
	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_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);
		APPEND_DEBUG('y');
	}

	/*
	 * 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_device)
		queue_work(driver->diag_bridge_wq,
			 &driver->diag_read_mdm_work);
}
Exemple #2
0
static void diag_read_mdm_work_fn(struct work_struct *work)
{
	if (!driver->hsic_ch) {
		pr_err("DIAG in %s: driver->hsic_ch == 0\n", __func__);
		return;
	}

	/*
	 * If there is no data being read from the usb mdm channel
	 * 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) {
		APPEND_DEBUG('x');

		/* Setup the next read from usb mdm channel */
		driver->in_busy_hsic_read_on_mdm = 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);
		APPEND_DEBUG('y');
	}

	/*
	 * 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)
		queue_work(driver->diag_hsic_wq, &driver->diag_read_mdm_work);
}
Exemple #3
0
static void usb_read_work_fn(struct work_struct *work)
{
	unsigned long flags;
	struct diag_request *req = NULL;
	struct diag_usb_info *ch = container_of(work, struct diag_usb_info,
						read_work);
	if (!ch)
		return;

	if (!ch->connected || !ch->enabled || ch->read_pending) {
		pr_debug_ratelimited("diag: Discarding USB read, ch: %s connected: %d, enabled: %d, pending: %d\n",
				     ch->name, ch->connected, ch->enabled,
				     ch->read_pending);
		return;
	}

	spin_lock_irqsave(&ch->lock, flags);
	req = ch->read_ptr;
	if (req) {
		ch->read_pending = 1;
		req->buf = ch->read_buf;
		req->length = USB_MAX_OUT_BUF;
		usb_diag_read(ch->hdl, req);
	} else {
		pr_err_ratelimited("diag: In %s invalid read req\n", __func__);
	}
	spin_unlock_irqrestore(&ch->lock, flags);
}
Exemple #4
0
void diag_read_usb_hsic_work_fn(struct work_struct *work)
{
	if (!driver->hsic_ch) {
		pr_err("diag: in %s: driver->hsic_ch == 0\n", __func__);
		return;
	}
	/*
	 * If there is no data being read from the usb mdm channel
	 * and there is no mdm channel data currently being written
	 * to the HSIC
	 */
	if (!driver->in_busy_hsic_read_on_device &&
	     !driver->in_busy_hsic_write) {
		APPEND_DEBUG('x');
		
		driver->in_busy_hsic_read_on_device = 1;
		diag_bridge[HSIC].usb_read_ptr->buf =
				 diag_bridge[HSIC].usb_buf_out;
		diag_bridge[HSIC].usb_read_ptr->length = USB_MAX_OUT_BUF;
		diag_bridge[HSIC].usb_read_ptr->context = (void *)HSIC;
		usb_diag_read(diag_bridge[HSIC].ch,
				 diag_bridge[HSIC].usb_read_ptr);
		APPEND_DEBUG('y');
	}

	if (!driver->in_busy_hsic_read_on_device &&
		(driver->logging_mode == USB_MODE))
		queue_work(diag_bridge[HSIC].wq,
			 &(diag_bridge[HSIC].diag_read_work));
}
Exemple #5
0
static void usb_read_done_work_fn(struct work_struct *work)
{
	struct diag_request *req = NULL;
	struct diag_usb_info *ch = container_of(work, struct diag_usb_info,
						read_done_work);
	if (!ch)
		return;

	if (!ch->connected || !ch->enabled)
		return;

	req = ch->read_ptr;
	ch->read_cnt++;

#if DIAG_XPST && !defined(CONFIG_DIAGFWD_BRIDGE_CODE)
       if (driver->nohdlc) {
               req->buf = ch->read_buf;
               req->length = USB_MAX_OUT_BUF;
               usb_diag_read(ch->hdl, req);
               return;
       }
#endif

	if (ch->ops && ch->ops->read_done && req->status >= 0)
		ch->ops->read_done(req->buf, req->actual, ch->ctxt);
}
Exemple #6
0
int diagfwd_connect(void)
{
	int err;

	printk(KERN_DEBUG "diag: USB connected\n");
	err = usb_diag_alloc_req(driver->legacy_ch, N_LEGACY_WRITE,
			N_LEGACY_READ);
	if (err)
		printk(KERN_ERR "diag: unable to allocate USB requests");
	driver->usb_connected = 1;
	driver->in_busy_1 = 0;
	driver->in_busy_2 = 0;
	driver->in_busy_qdsp_1 = 0;
	driver->in_busy_qdsp_2 = 0;

	/* Poll SMD channels to check for data*/
	queue_work(driver->diag_wq, &(driver->diag_read_smd_work));
	queue_work(driver->diag_wq, &(driver->diag_read_smd_qdsp_work));

	driver->usb_read_ptr->buf = driver->usb_buf_out;
	driver->usb_read_ptr->length = USB_MAX_OUT_BUF;
	APPEND_DEBUG('a');
	usb_diag_read(driver->legacy_ch, driver->usb_read_ptr);
	APPEND_DEBUG('b');
	return 0;
}
Exemple #7
0
void diag_read_mdm_work_fn(struct work_struct *work)
{
#ifdef CONFIG_LGE_USB_MDM_DIAG_DISABLE
	if(mdm_diag_enable == 1) 
		return;
#endif
	if (driver->sdio_ch) {
		wait_event_interruptible(driver->wait_q, ((sdio_write_avail
			(driver->sdio_ch) >= driver->read_len_mdm) ||
				 !(driver->sdio_ch)));
		if (!(driver->sdio_ch)) {
			pr_alert("diag: sdio channel not valid");
			return;
		}
		if (driver->sdio_ch && driver->usb_buf_mdm_out &&
						 (driver->read_len_mdm > 0))
			sdio_write(driver->sdio_ch, driver->usb_buf_mdm_out,
							 driver->read_len_mdm);
		APPEND_DEBUG('x');
		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);
		APPEND_DEBUG('y');
	}
}
static void usb_read_done_work_fn(struct work_struct *work)
{
    struct diag_request *req = NULL;
    struct diag_usb_info *ch = container_of(work, struct diag_usb_info,
                                            read_done_work);
    if (!ch)
        return;

    /*
     * USB is disconnected/Disabled before the previous read completed.
     * Discard the packet and don't do any further processing.
     */
    if (!ch->connected || !ch->enabled)
        return;

    req = ch->read_ptr;
    ch->read_cnt++;

#if DIAG_XPST && !defined(CONFIG_DIAGFWD_BRIDGE_CODE)
    if (driver->nohdlc) {
        req->buf = ch->read_buf;
        req->length = USB_MAX_OUT_BUF;
        usb_diag_read(ch->hdl, req);
        return;
    }
#endif

    if (ch->ops && ch->ops->read_done && req->status >= 0)
        ch->ops->read_done(req->buf, req->actual, ch->ctxt);
}
Exemple #9
0
void diag_read_usb_hsic_work_fn(struct work_struct *work)
{
	struct diag_bridge_dev *bridge_struct = container_of(work,
							     struct diag_bridge_dev, diag_read_work);
	int index = bridge_struct->id;

	if (!diag_hsic[index].hsic_ch) {
		pr_err("diag: in %s: hsic_ch == 0\n", __func__);
		return;
	}
	/*
	 * If there is no data being read from the usb mdm channel
	 * and there is no mdm channel data currently being written
	 * to the HSIC
	 */
	if (!diag_hsic[index].in_busy_hsic_read_on_device && !diag_hsic[index].in_busy_hsic_write) {
		APPEND_DEBUG('x');
		/* Setup the next read from usb mdm channel */
		diag_hsic[index].in_busy_hsic_read_on_device = 1;
		diag_bridge[index].usb_read_ptr->buf = diag_bridge[index].usb_buf_out;
		diag_bridge[index].usb_read_ptr->length = USB_MAX_OUT_BUF;
		diag_bridge[index].usb_read_ptr->context = (void *)index;
		usb_diag_read(diag_bridge[index].ch, diag_bridge[index].usb_read_ptr);
		APPEND_DEBUG('y');
	}
	/* If for some reason there was no mdm channel read initiated,
	 * queue up the reading of data from the mdm channel
	 */

	if (!diag_hsic[index].in_busy_hsic_read_on_device && (driver->logging_mode == USB_MODE))
		queue_work(diag_bridge[index].wq, &(diag_bridge[index].diag_read_work));
}
void diag_read_work_fn(struct work_struct *work)
{
	APPEND_DEBUG('d');
	driver->usb_read_ptr->buf = driver->usb_buf_out;
	driver->usb_read_ptr->length = USB_MAX_OUT_BUF;
	usb_diag_read(driver->legacy_ch, driver->usb_read_ptr);
	APPEND_DEBUG('e');
}
Exemple #11
0
void diag_read_work_fn(struct work_struct *work)
{
	APPEND_DEBUG('d');
	driver->usb_read_ptr->buf = driver->usb_buf_out;
	driver->usb_read_ptr->length = USB_MAX_OUT_BUF;
#ifdef CONFIG_SH_USB_CUST
	diag_read(driver->usb_read_ptr);
#else /* CONFIG_SH_USB_CUST */
	usb_diag_read(driver->legacy_ch, driver->usb_read_ptr);
#endif /* CONFIG_SH_USB_CUST */
	APPEND_DEBUG('e');
}
Exemple #12
0
int diagfwd_read_complete(struct diag_request *diag_read_ptr)
{
	int status = diag_read_ptr->status;
	unsigned char *buf = diag_read_ptr->buf;

	/* Determine if the read complete is for data on legacy/mdm ch */
	if (buf == (void *)driver->usb_buf_out) {
		driver->read_len_legacy = diag_read_ptr->actual;
		APPEND_DEBUG('s');
#ifdef DIAG_DEBUG
	printk(KERN_INFO "read data from USB, pkt length %d \n",
		    diag_read_ptr->actual);
	print_hex_dump(KERN_DEBUG, "Read Packet Data from USB: ", DUMP_PREFIX_ADDRESS, 16, 1,
		       diag_read_ptr->buf,
		       diag_read_ptr->actual, 1);
#endif /* DIAG DEBUG */
	if (driver->nohdlc) {
		driver->usb_read_ptr->buf = driver->usb_buf_out;
		driver->usb_read_ptr->length = USB_MAX_OUT_BUF;
		usb_diag_read(driver->legacy_ch, driver->usb_read_ptr);
		return 0;
	}
	if (driver->logging_mode == USB_MODE) {
#ifdef CONFIG_ARCH_MSM8X60_LTE
		if (diag_ch_sdio) {
			driver->read_len_mdm = diag_read_ptr->actual;
			diagfwd_read_complete_sdio();
		} else
#endif
			{
			if (status != -ECONNRESET && status != -ESHUTDOWN)
				queue_work(driver->diag_wq,
					&(driver->diag_proc_hdlc_work));
			else
					queue_work(driver->diag_wq,
						 &(driver->diag_read_work));
			}
		}
	}
#if defined(CONFIG_ARCH_MSM8X60_LTE)
	else if (buf == (void *)driver->usb_buf_mdm_out) {
		driver->read_len_mdm = diag_read_ptr->actual;
		diagfwd_read_complete_sdio();
	}
#endif
	else
		DIAGFWD_ERR("diag: Unknown buffer ptr from USB");

	return 0;
}
Exemple #13
0
void diag_read_mdm_work_fn(struct work_struct *work)
{
	if (driver->sdio_ch) {
		wait_event_interruptible(driver->wait_q, (sdio_write_avail
				(driver->sdio_ch) >= driver->read_len_mdm));
		if (driver->sdio_ch && driver->usb_buf_mdm_out &&
						 (driver->read_len_mdm > 0))
			sdio_write(driver->sdio_ch, driver->usb_buf_mdm_out,
							 driver->read_len_mdm);
		APPEND_DEBUG('x');
		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);
		APPEND_DEBUG('y');
	}
}
int diagfwd_read_complete(struct diag_request *diag_read_ptr)
{
	int status = diag_read_ptr->status;
	unsigned char *buf = diag_read_ptr->buf;

	/* Determine if the read complete is for data on legacy/mdm ch */
	if (buf == (void *)driver->usb_buf_out) {
		driver->read_len_legacy = diag_read_ptr->actual;
		APPEND_DEBUG('s');
#ifdef DIAG_DEBUG
		printk(KERN_INFO "read data from USB, pkt length %d",
		    diag_read_ptr->actual);
		print_hex_dump(KERN_DEBUG, "Read Packet Data from USB: ", 16, 1,
		       DUMP_PREFIX_ADDRESS, diag_read_ptr->buf,
		       diag_read_ptr->actual, 1);
#endif /* DIAG DEBUG */
#if DIAG_XPST
		if (driver->nohdlc) {
			driver->usb_read_ptr->buf = driver->usb_buf_out;
			driver->usb_read_ptr->length = USB_MAX_OUT_BUF;
			usb_diag_read(driver->legacy_ch, driver->usb_read_ptr);
			return 0;
		}
#endif
		if (driver->logging_mode == USB_MODE) {
			if (status != -ECONNRESET && status != -ESHUTDOWN)
				queue_work(driver->diag_wq,
					&(driver->diag_proc_hdlc_work));
			else
				queue_work(driver->diag_wq,
						 &(driver->diag_read_work));
		}
	}
#ifdef CONFIG_DIAG_SDIO_PIPE
	else if (buf == (void *)driver->usb_buf_mdm_out) {
		if (diag_support_mdm9k) {
			driver->read_len_mdm = diag_read_ptr->actual;
			diagfwd_read_complete_sdio();
		} else
			pr_err("diag: Incorrect buffer pointer while READ");
	}
#endif
	else
		printk(KERN_ERR "diag: Unknown buffer ptr from USB");

	return 0;
}
void diag_read_usb_smux_work_fn(struct work_struct *work)
{
	int ret;

	if (driver->diag_smux_enabled) {
		if (driver->lcid && diag_bridge[SMUX].usb_buf_out &&
			(diag_bridge[SMUX].read_len > 0) &&
				driver->smux_connected) {
			ret = msm_smux_write(driver->lcid, NULL,
			      diag_bridge[SMUX].usb_buf_out,
				 diag_bridge[SMUX].read_len);
			if (ret)
				pr_err("diag: writing to SMUX ch, r = %d, lcid = %d\n",
						 ret, driver->lcid);
		}
		diag_bridge[SMUX].usb_read_ptr->buf =
					 diag_bridge[SMUX].usb_buf_out;
		diag_bridge[SMUX].usb_read_ptr->length = USB_MAX_OUT_BUF;
		diag_bridge[SMUX].usb_read_ptr->context = (void *)SMUX;
		usb_diag_read(diag_bridge[SMUX].ch,
					 diag_bridge[SMUX].usb_read_ptr);
		return;
	}
}