int diagfwd_connect_bridge(int process_cable)
{
	int err;

	DIAGFWD_INFO("DIAG in %s\n", __func__);

	
	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->qxdmusb_drop = 0;
		driver->usb_mdm_connected = 1;
	}

	if (driver->hsic_device_enabled) {
		driver->in_busy_hsic_read_on_device = 0;
		driver->in_busy_hsic_write = 0;
	} else if (driver->diag_smux_enabled) {
		driver->in_busy_smux = 0;
		diagfwd_connect_smux();
		return 0;
	}

	
	if (driver->hsic_device_enabled) {
		if (!driver->hsic_device_opened) {
			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;
			}
		} else {
			pr_debug("diag: HSIC channel already open\n");
		}

		if (driver->hsic_device_opened)
			driver->hsic_ch = 1;

		
		if (driver->logging_mode == USB_MODE)
			queue_work(driver->diag_bridge_wq,
					&driver->diag_read_mdm_work);

		
		queue_work(driver->diag_bridge_wq,
				 &driver->diag_read_hsic_work);
	} else {
		
		pr_info("diag: HSIC channel not yet enabled\n");
	}

	return 0;
}
示例#2
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 alloc USB req on legacy ch");

	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));
	/* Poll USB channel to check for data*/
	queue_work(driver->diag_wq, &(driver->diag_read_work));
#ifdef CONFIG_DIAG_SDIO_PIPE
	if (machine_is_msm8x60_charm_surf() || machine_is_msm8x60_charm_ffa()) {
		if (driver->mdm_ch && !IS_ERR(driver->mdm_ch))
			diagfwd_connect_sdio();
		else
			printk(KERN_INFO "diag: No USB MDM ch");
	}
#endif
	return 0;
}
示例#3
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;
}
示例#4
0
int diagfwd_connect_sdio(void)
{
	int err;

	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\n");

	driver->in_busy_sdio = 0;
	if (!driver->sdio_ch) {
		err = sdio_open("SDIO_DIAG", &driver->sdio_ch, driver,
							 diag_sdio_notify);
		if (err)
			pr_info("diag: could not open SDIO channel\n");
		else
			pr_info("diag: opened SDIO channel\n");
	} else {
		pr_info("diag: SDIO channel already open\n");
	}

	/* Poll USB channel to check for data*/
	queue_work(driver->diag_sdio_wq, &(driver->diag_read_mdm_work));
	/* Poll SDIO channel to check for data*/
	queue_work(driver->diag_sdio_wq, &(driver->diag_read_sdio_work));
	return 0;
}
示例#5
0
int diagfwd_connect(void)
{
	int err;
	int i;

	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 alloc USB req on legacy ch");

	driver->usb_connected = 1;
	for (i = 0; i < NUM_SMD_DATA_CHANNELS; i++) {
		driver->smd_data[i].in_busy_1 = 0;
		driver->smd_data[i].in_busy_2 = 0;
		/* Poll SMD data channels to check for data */
		queue_work(driver->diag_wq,
			&(driver->smd_data[i].diag_read_smd_work));
		/* Poll SMD CNTL channels to check for data */
		diag_smd_notify(&(driver->smd_cntl[i]), SMD_EVENT_DATA);
	}

	/* Poll USB channel to check for data*/
	queue_work(driver->diag_wq, &(driver->diag_read_work));
#ifdef CONFIG_DIAG_SDIO_PIPE
	if (machine_is_msm8x60_fusion() || machine_is_msm8x60_fusn_ffa()) {
		if (driver->mdm_ch && !IS_ERR(driver->mdm_ch))
			diagfwd_connect_sdio();
		else
			printk(KERN_INFO "diag: No USB MDM ch");
	}
#endif
	return 0;
}
示例#6
0
void connect_bridge(int process_cable, uint8_t index)
{
	int err;

	mutex_lock(&diag_bridge[index].bridge_mutex);
	/* If the usb cable is being connected */
	if (process_cable) {
		err = usb_diag_alloc_req(diag_bridge[index].ch, N_MDM_WRITE, N_MDM_READ);
		if (err)
			pr_err("diag: unable to alloc USB req for ch %d err:%d\n", index, err);

		diag_bridge[index].usb_connected = 1;
	}

	if (index == SMUX) {
		if (driver->diag_smux_enabled) {
			driver->in_busy_smux = 0;
			diagfwd_connect_smux();
		}
	} else {
		if (index >= MAX_HSIC_CH) {
			pr_err("diag: Invalid hsic channel index %d in %s\n", index, __func__);
			mutex_unlock(&diag_bridge[index].bridge_mutex);
			return;
		}
		if (diag_hsic[index].hsic_device_enabled && (driver->logging_mode != MEMORY_DEVICE_MODE || diag_hsic[index].hsic_data_requested)) {
			diag_hsic[index].in_busy_hsic_read_on_device = 0;
			diag_hsic[index].in_busy_hsic_write = 0;
			/* If the HSIC (diag_bridge) platform
			 * device is not open */
			if (!diag_hsic[index].hsic_device_opened) {
				hsic_diag_bridge_ops[index].ctxt = (void *)(int)(index);
				err = diag_bridge_open(index, &hsic_diag_bridge_ops[index]);
				if (err) {
					pr_err("diag: HSIC channel open error: %d\n", err);
				} else {
					pr_debug("diag: opened HSIC channel\n");
					diag_hsic[index].hsic_device_opened = 1;
				}
			} else {
				pr_debug("diag: HSIC channel already open\n");
			}
			/*
			 * Turn on communication over usb mdm and HSIC,
			 * if the HSIC device driver is enabled
			 * and opened
			 */
			if (diag_hsic[index].hsic_device_opened) {
				diag_hsic[index].hsic_ch = 1;
				/* Poll USB mdm channel to check for data */
				if (driver->logging_mode == USB_MODE)
					queue_work(diag_bridge[index].wq, &diag_bridge[index].diag_read_work);
				/* Poll HSIC channel to check for data */
				queue_work(diag_bridge[index].wq, &diag_hsic[index].diag_read_hsic_work);
			}
		}
	}
	mutex_unlock(&diag_bridge[index].bridge_mutex);
}
/* diagfwd_connect_hsic is called when the USB mdm channel is connected */
int diagfwd_connect_hsic(int process_cable)
{
	int err;

	pr_debug("DIAG in %s\n", __func__);

	/* 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;
	}

	if (driver->hsic_device_enabled) {
		driver->in_busy_hsic_read_on_device = 0;
		driver->in_busy_hsic_write = 0;
	}

	/* If the hsic (diag_bridge) platform device is not open */
	if (driver->hsic_device_enabled) {
		if (!driver->hsic_device_opened) {
			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;
			}
		} else {
			pr_debug("DIAG: HSIC channel already open\n");
		}

		/*
		 * Turn on communication over usb mdm and hsic, if the hsic
		 * device driver is enabled and opened
		 */
		if (driver->hsic_device_opened)
			driver->hsic_ch = 1;

		/* Poll USB mdm channel to check for data */
		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);
	} else {
		/* The hsic device driver has not yet been enabled */
		pr_info("DIAG: HSIC channel not yet enabled\n");
	}

	return 0;
}
示例#8
0
int diagfwd_connect(void)
{
	int err;

	DIAGFWD_INFO("%s\n", __func__);
	if (!driver->usb_connected) {
		err = usb_diag_alloc_req(driver->legacy_ch, N_LEGACY_WRITE,
			N_LEGACY_READ);
		if (err)
			DIAGFWD_ERR("diag: unable to allocate USB requests");
	}

	driver->in_busy_1 = 0;
	driver->in_busy_2 = 0;
	driver->in_busy_qdsp_1 = 0;
	driver->in_busy_qdsp_2 = 0;
#if defined(CONFIG_MACH_MECHA)
	driver->in_busy_mdm_1 = 0;
	driver->in_busy_mdm_2 = 0;
#endif
	/* 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));

#if defined(CONFIG_ARCH_MSM8X60_LTE)
	driver->in_busy_sdio_1 = 0;
	driver->in_busy_sdio_2 = 0;
	if (diag_ch_sdio) {
		if (driver->legacy_ch && !IS_ERR(driver->legacy_ch))
			diagfwd_connect_sdio();
		else
			DIAGFWD_INFO("diag:No data from SDIO without  USB LEGACY ch");

	} else {
		if ((!driver->usb_connected) && driver->mdm_ch && !IS_ERR(driver->mdm_ch))
			diagfwd_connect_sdio();
		else
			DIAGFWD_INFO("diag:No data from SDIO without  USB MDM ch");

		queue_work(driver->diag_sdio_wq, &(driver->diag_read_mdm_work));
	}

#endif
	driver->usb_connected = 1;
	/* Poll USB channel to check for data*/
	queue_work(driver->diag_wq, &(driver->diag_read_work));

	return 0;
}
void connect_bridge(int process_cable, int index)
{
	int err;

	mutex_lock(&diag_bridge[index].bridge_mutex);
	
	if (process_cable) {
		err = usb_diag_alloc_req(diag_bridge[index].ch, N_MDM_WRITE,
			       N_MDM_READ);
		if (err)
			pr_err("diag: unable to alloc USB req on mdm ch err:%d\n",
							 err);

		diag_bridge[index].usb_connected = 1;
		driver->qxdmusb_drop = 0;
	}

	if (index == SMUX && driver->diag_smux_enabled) {
		driver->in_busy_smux = 0;
		diagfwd_connect_smux();
	} else if (index == HSIC && driver->hsic_device_enabled) {
		driver->in_busy_hsic_read_on_device = 0;
		driver->in_busy_hsic_write = 0;
		
		if (!driver->hsic_device_opened) {
			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;
			}
		} else {
			pr_debug("diag: HSIC channel already open\n");
		}
		if (driver->hsic_device_opened) {
			driver->hsic_ch = 1;
			
			if (driver->logging_mode == USB_MODE)
				queue_work(diag_bridge[HSIC].wq,
					  &diag_bridge[HSIC].diag_read_work);
			
			queue_work(diag_bridge[HSIC].wq,
				   &driver->diag_read_hsic_work);
		}
	}
	mutex_unlock(&diag_bridge[index].bridge_mutex);
}
示例#10
0
int diagfwd_connect_sdio(void)
{
    int err;

    err = usb_diag_alloc_req(driver->mdm_ch, N_MDM_WRITE,
                             N_MDM_READ);
    if (err)
        printk(KERN_ERR "diag: unable to alloc USB req on mdm ch");

    driver->in_busy_sdio = 0;

    /* Poll USB channel to check for data*/
    queue_work(driver->diag_sdio_wq, &(driver->diag_read_mdm_work));
    /* Poll SDIO channel to check for data*/
    queue_work(driver->diag_sdio_wq, &(driver->diag_read_sdio_work));
    return 0;
}
示例#11
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 alloc USB req on legacy ch");

	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;
	driver->in_busy_wcnss = 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));
	queue_work(driver->diag_wq, &(driver->diag_read_smd_wcnss_work));

	if (chk_config_get_id() == AO8960_TOOLS_ID) {
		/* Poll SMD CNTL channels to check for data */
		queue_work(driver->diag_wq, &(driver->diag_read_smd_cntl_work));
		queue_work(driver->diag_wq, &(driver->diag_read_smd_qdsp_cntl_work));
		queue_work(driver->diag_wq, &(driver->diag_read_smd_wcnss_cntl_work));
	}
	/* Poll USB channel to check for data*/
	queue_work(driver->diag_wq, &(driver->diag_read_work));
#ifdef CONFIG_DIAG_SDIO_PIPE
	if (diag_support_mdm9k) {
		if (driver->mdm_ch && !IS_ERR(driver->mdm_ch))
			diagfwd_connect_sdio();
		else
			printk(KERN_INFO "diag: No USB MDM ch");
	}
#endif
	return 0;
}
示例#12
0
/*
 * This function is called asynchronously when USB is connected and
 * synchronously when Diag wants to connect to USB explicitly.
 */
static void usb_connect(struct diag_usb_info *ch)
{
	int err = 0;
	int num_write = 0;
	int num_read = 1; /* Only one read buffer for any USB channel */

	if (!ch)
		return;

	num_write = diag_mempools[ch->mempool].poolsize;
	err = usb_diag_alloc_req(ch->hdl, num_write, num_read);
	if (err) {
		pr_err("diag: Unable to allocate usb requests for %s, write: %d read: %d, err: %d\n",
		       ch->name, num_write, num_read, err);
		return;
	}

	if (ch->ops && ch->ops->open)
		ch->ops->open(ch->ctxt, DIAG_USB_MODE);
	/* As soon as we open the channel, queue a read */
	queue_work(ch->usb_wq, &(ch->read_work));
}
int diagfwd_connect_sdio(void)
{

	int err;

	DIAG_INFO("%s\n", __func__);

	if (!strcmp(DIAG_MDM, usb_ch_name)) {
		err = usb_diag_alloc_req(driver->mdm_ch, N_MDM_WRITE,
							 N_MDM_READ);
		if (err) {
			DIAG_ERR("diag: unable to alloc USB req on mdm ch");
			return -ENOMEM;
		}
	}

	driver->in_busy_sdio_1 = 0;
	driver->in_busy_sdio_2 = 0;
	/* Poll SDIO channel to check for data*/
	queue_work(driver->diag_sdio_wq, &(driver->diag_read_sdio_work));
	return 0;
}
示例#14
0
static void usb_connect(struct diag_usb_info *ch)
{
	int err = 0;
	int num_write = 0;
	int num_read = 1; 

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

	num_write = diag_mempools[ch->mempool].poolsize;
	err = usb_diag_alloc_req(ch->hdl, num_write, num_read);
	if (err) {
		pr_err("diag: Unable to allocate usb requests for %s, write: %d read: %d, err: %d\n",
		       ch->name, num_write, num_read, err);
		return;
	}

	if (ch->ops && ch->ops->open)
		ch->ops->open(ch->ctxt, DIAG_USB_MODE);
	
	queue_work(ch->usb_wq, &(ch->read_work));
}
示例#15
0
/* diagfwd_connect_hsic is called when the USB mdm channel is connected */
int diagfwd_connect_hsic(unsigned int mode)
{
	int err;

	pr_info("DIAG in %s\n", __func__);

	if (mode == WRITE_TO_USB) {
		err = usb_diag_alloc_req(driver->mdm_ch, N_MDM_WRITE,
								N_MDM_READ);
		if (err)
			pr_err("DIAG: unable to alloc req on mdm ch err:%d\n",
									err);
		driver->usb_mdm_connected = 1;
	} else {
		pr_info("silent log %s\n", __func__);
		driver->usb_mdm_connected = 0;
	}
	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;

	// zero_pky.patch by jagadish
	/* zero cfg packet variables are set to 0 again here,
	   just in case to prevent any looping  */
	driver->zero_cfg_mode = 0;
	driver->zero_cfg_packet_lens_index = 0;
	driver->zero_cfg_index =0;

	/* If the hsic (diag_bridge) platform device is not open */
	if (driver->hsic_device_enabled) {
		if (!driver->hsic_device_opened) {
			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;
			}
		} else {
			pr_debug("DIAG: HSIC channel already open\n");
		}

		/*
		 * Turn on communication over usb mdm and hsic, if the hsic
		 * device driver is enabled and opened
		 */
		if (driver->hsic_device_opened)
			driver->hsic_ch = 1;

		if (mode == WRITE_TO_USB) {
			/* 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);
	} else {
		/* The hsic device driver has not yet been enabled */
		pr_info("DIAG: HSIC channel not yet enabled\n");
	}

	return 0;
}