예제 #1
0
static int msm_rmnet_sdio_probe(struct platform_device *pdev)
{
	int rc;
	static int sdio_mux_initialized;

	pr_info("[lte] msm_rmnet_sdio: %s\n",  __func__);
	if (sdio_mux_initialized)
		return 0;

	/* is one thread gud enough for read and write? */
	sdio_mux_workqueue = create_singlethread_workqueue("msm_rmnet_sdio");
	if (!sdio_mux_workqueue) {
		pr_err("[lte] Error - %s, ENOMEM\n", __func__);
		return -ENOMEM;
	}

	for (rc = 0; rc < 8; rc++)
		spin_lock_init(&sdio_ch[rc].lock);

	wake_lock_init(&sdio_mux_ch_wakelock, WAKE_LOCK_SUSPEND,
		       "rmnet_sdio_mux");
	rc = sdio_open("SDIO_RMNET_DATA", &sdio_mux_ch, NULL, sdio_mux_notify);
	if (rc < 0) {
		pr_err("[lte] Error - %s: sido open failed %d\n", __func__, rc);
		wake_lock_destroy(&sdio_mux_ch_wakelock);
		destroy_workqueue(sdio_mux_workqueue);
		return rc;
	}

	sdio_mux_initialized = 1;
	pr_info("[lte] msm_rmnet_sdio: %s\n",  __func__);
	return 0;
}
예제 #2
0
int sdio_smem_register_client(void)
{
	int err = 0;

	if (!client.buf || !client.size || !client.cb_func)
		return -EINVAL;

	pr_debug("buf = %p\n", client.buf);
	pr_debug("size = 0x%x\n", client.size);

	bytes_avail = client.size;
	workq = create_singlethread_workqueue("sdio_smem");
	if (!workq)
		return -ENOMEM;

	sdio_ch_opened = 1;
	err = sdio_open("SDIO_SMEM", &channel, NULL, sdio_smem_notify);
	if (err) {
		sdio_ch_opened = 0;
		pr_err("sdio_open error (%d)\n", err);
		destroy_workqueue(workq);
		return err;
	}
	pr_debug("SDIO SMEM channel opened\n");
	return err;
}
예제 #3
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;
}
예제 #4
0
static int sdio_dmux_probe(struct platform_device *pdev)
{
	int rc;

	DBG("%s probe called\n", __func__);

	if (!sdio_mux_initialized) {
		sdio_mux_workqueue = create_singlethread_workqueue("sdio_dmux");
		if (!sdio_mux_workqueue)
			return -ENOMEM;

		skb_queue_head_init(&sdio_mux_write_pool);
		spin_lock_init(&sdio_mux_write_lock);

		for (rc = 0; rc < SDIO_DMUX_NUM_CHANNELS; ++rc)
			spin_lock_init(&sdio_ch[rc].lock);


		wake_lock_init(&sdio_mux_ch_wakelock, WAKE_LOCK_SUSPEND,
				   "sdio_dmux");
	}

	rc = sdio_open("SDIO_RMNT", &sdio_mux_ch, NULL, sdio_mux_notify);
	if (rc < 0) {
		pr_err("%s: sido open failed %d\n", __func__, rc);
		wake_lock_destroy(&sdio_mux_ch_wakelock);
		destroy_workqueue(sdio_mux_workqueue);
		sdio_mux_initialized = 0;
		return rc;
	}

	sdio_mux_initialized = 1;
	return 0;
}
예제 #5
0
static void gsdio_open_work(struct work_struct *w)
{
	struct gsdio_port *port =
			container_of(w, struct gsdio_port, sdio_open_work.work);
	struct sdio_port_info *pi = port->sport_info;
	struct gserial *gser;
	int ret;
	int ctrl_bits;
	int startio;

	ret = sdio_open(pi->data_ch_name, &pi->ch, port, gsdio_ch_notify);
	if (ret) {
		pr_err("%s: port:%p port#%d unable to open sdio ch:%s\n",
				__func__, port, port->port_num,
				pi->data_ch_name);
		return;
	}

	ret = sdio_cmux_open(pi->ctrl_ch_id, 0, 0,
			gsdio_ctrl_modem_status, port);
	if (ret) {
		pr_err("%s: port:%p port#%d unable to open ctrl ch:%d\n",
				__func__, port, port->port_num, pi->ctrl_ch_id);
		port->ctrl_ch_err = 1;
	}

	/* check for latest status update from modem */
	if (!port->ctrl_ch_err) {
		ctrl_bits = sdio_cmux_tiocmget(pi->ctrl_ch_id);
		gsdio_ctrl_modem_status(ctrl_bits, port);
	}

	pr_debug("%s: SDIO data:%s ctrl:%d are open\n", __func__,
					pi->data_ch_name,
					pi->ctrl_ch_id);

	port->sdio_open = 1;

	/* start tx if usb is open already */
	spin_lock_irq(&port->port_lock);
	startio = port->port_usb ? 1 : 0;
	gser = port->port_usb;
	spin_unlock_irq(&port->port_lock);

	if (startio) {
		pr_debug("%s: USB is already open, start io\n", __func__);
		gsdio_start_io(port);
		 if (gser->send_modem_ctrl_bits)
			gser->send_modem_ctrl_bits(gser, port->cbits_to_laptop);
	}
}
예제 #6
0
static int diag_sdio_probe(struct platform_device *pdev)
{
	int err;

	err = sdio_open("SDIO_DIAG", &driver->sdio_ch, driver, diag_sdio_notify);
	if (err)
		printk(KERN_INFO "DIAG could not open SDIO channel");
	else {
		printk(KERN_INFO "DIAG opened SDIO channel");
		queue_work(driver->diag_sdio_wq, &(driver->diag_read_mdm_work));
	}

	return err;
}
static int diag_sdio_probe(struct platform_device *pdev)
{
	int err;
	if (diag9k_debug_mask)
		DIAG_INFO("%s\n", __func__);

	err = sdio_open("SDIO_DIAG", &driver->sdio_ch, driver,
							 diag_sdio_notify);
	if (err)
		DIAG_ERR("DIAG could not open SDIO channel");
	else {
		DIAG_INFO("DIAG opened SDIO channel");

		if (!strcmp(DIAG_LEGACY, usb_ch_name)) {
			driver->legacy_ch = usb_diag_open(DIAG_LEGACY, driver,
				diag_usb_legacy_notifier);
			if (IS_ERR(driver->legacy_ch)) {
				DIAG_ERR("Unable to open USB diag legacy channel\n");
				goto err;
			}
			DIAG_INFO("open USB diag legacy channel\n");
		} else if (!strcmp(DIAG_MDM, usb_ch_name)) {
			driver->legacy_ch = usb_diag_open(DIAG_LEGACY, driver,
				diag_usb_legacy_notifier);
			if (IS_ERR(driver->legacy_ch)) {
				DIAG_ERR("Unable to open USB diag legacy channel\n");
				goto err;
			}
			DIAG_INFO("open USB diag legacy channel\n");

			driver->mdm_ch = usb_diag_open(DIAG_MDM, driver,
				diag_usb_legacy_notifier);
			if (IS_ERR(driver->mdm_ch)) {
				DIAG_ERR("Unable to open USB diag MDM channel\n");
				goto err;
			}
			DIAG_INFO("open USB diag MDM channel\n");
		}
/*		queue_work(driver->diag_sdio_wq, &(driver->diag_read_mdm_work));*/
	}
	if (diag_configured)
		diagfwd_connect();
	driver->in_busy_sdio_1 = 0;
	driver->in_busy_sdio_2 = 0;
	driver->qxdm2sd_drop = 0;
	sdio_diag_initialized = 1;
err:
	return err;
}
예제 #8
0
/**
 * Test Main
 */
static int test_start(void)
{
	int ret = -ENOMEM;
	struct sdio_channel *ch = NULL;

	pr_debug(MODULE_NAME ":Starting Test ....\n");

	test_ctx->buf_size = MAX_XFER_SIZE;

	test_ctx->buf = kzalloc(test_ctx->buf_size, GFP_KERNEL);
	if (test_ctx->buf == NULL)
		goto err_alloc_buf;

	test_ctx->workqueue = create_singlethread_workqueue("sdio_al_test_wq");

	INIT_WORK(&test_ctx->work, worker);

	init_waitqueue_head(&test_ctx->wait_q);
	test_ctx->rx_bytes = 0;
	test_ctx->tx_bytes = 0;

	test_ctx->tx_notify_count = 0;
	test_ctx->rx_notify_count = 0;

	ret = sdio_open(test_ctx->name , &test_ctx->ch, test_ctx, notify);
	if (ret)
		goto err_sdio_open;
	ch = test_ctx->ch;

	memset(test_ctx->buf, 0x00, test_ctx->buf_size);

	queue_work(test_ctx->workqueue, &test_ctx->work);

	mutex_init(&test_ctx->lock);

	pr_debug(MODULE_NAME ":Test Start completed OK..\n");

	return 0;

err_sdio_open:
	kfree(test_ctx->buf);
err_alloc_buf:
	kfree(test_ctx);

	pr_debug(MODULE_NAME ":Test Start Failure..\n");

	return ret;
}
예제 #9
0
static int diag_sdio_probe(struct platform_device *pdev)
{
	int err;

#ifdef CONFIG_SH_USB_CUST
	err = -1;
#else /* CONFIG_SH_USB_CUST */
	err = sdio_open("SDIO_DIAG", &driver->sdio_ch, driver,
							 diag_sdio_notify);
#endif /* CONFIG_SH_USB_CUST */
	if (err)
		printk(KERN_INFO "DIAG could not open SDIO channel");
	else {
		printk(KERN_INFO "DIAG opened SDIO channel");
		queue_work(driver->diag_sdio_wq, &(driver->diag_read_mdm_work));
	}

	return err;
}
예제 #10
0
static int sdio_dmux_probe(struct platform_device *pdev)
{
	int rc;

	DBG("%s probe called\n", __func__);

	if (!sdio_mux_initialized) {
		//ALRAN
		//sdio_mux_workqueue = create_singlethread_workqueue("sdio_dmux"); QCT_PATCH 20120531 bluetooth.kang
		sdio_mux_workqueue = alloc_workqueue("sdio_dmux", /*WQ_UNBOUND*/WQ_MEM_RECLAIM, 1);
		//ALRANEND

		if (!sdio_mux_workqueue)
			return -ENOMEM;

		skb_queue_head_init(&sdio_mux_write_pool);
		spin_lock_init(&sdio_mux_write_lock);

		for (rc = 0; rc < SDIO_DMUX_NUM_CHANNELS; ++rc)
			spin_lock_init(&sdio_ch[rc].lock);


		wake_lock_init(&sdio_mux_ch_wakelock, WAKE_LOCK_SUSPEND,
				   "sdio_dmux");
	}

	rc = sdio_open("SDIO_RMNT", &sdio_mux_ch, NULL, sdio_mux_notify);
	if (rc < 0) {
		pr_err("%s: sido open failed %d\n", __func__, rc);
		wake_lock_destroy(&sdio_mux_ch_wakelock);
		destroy_workqueue(sdio_mux_workqueue);
		sdio_mux_initialized = 0;
		return rc;
	}

	fatal_error = 0;
	sdio_mux_initialized = 1;
	return 0;
}