Esempio n. 1
0
static int diag_smd_probe(struct platform_device *pdev)
{
	int r = 0;

	if (pdev->id == SMD_APPS_MODEM) {
		r = smd_open(SMDDIAG_NAME, &driver->ch, driver, diag_smd_notify);
		wmb();
		ch_temp = driver->ch;
		DIAGFWD_INFO("%s: smd_open(%s):%d, ch_temp:%p, driver->ch:%p, &driver->ch:%p\n",
			__func__, SMDDIAG_NAME, r, ch_temp, driver->ch, &driver->ch);
	}
#if defined(CONFIG_MSM_N_WAY_SMD)
	if (pdev->id == SMD_APPS_QDSP) {
#if defined(CONFIG_MACH_MECHA) || defined(CONFIG_ARCH_MSM8X60_LTE)	\
	|| defined(CONFIG_ARCH_MSM8X60) || defined(CONFIG_ARCH_MSM8960)
		r = smd_named_open_on_edge("DIAG", SMD_APPS_QDSP
			, &driver->chqdsp, driver, diag_smd_qdsp_notify);
#else
		r = smd_open("DSP_DIAG", &driver->chqdsp, driver, diag_smd_qdsp_notify);
#endif
	}
#endif
	if (pdev->id == SMD_APPS_WCNSS)
		r = smd_named_open_on_edge("APPS_RIVA_DATA", SMD_APPS_WCNSS
			, &driver->ch_wcnss, driver, diag_smd_wcnss_notify);
	pm_runtime_set_active(&pdev->dev);
	pm_runtime_enable(&pdev->dev);
	pr_debug("diag: open SMD port, Id = %d, r = %d\n", pdev->id, r);
	smd_diag_initialized = 1;

	return 0;
}
Esempio n. 2
0
static int diag_smd_probe(struct platform_device *pdev)
{
	int r = 0;

	if (pdev->id == 0) {
		r = smd_open(SMDDIAG_NAME, &driver->ch, driver, diag_smd_notify);
		if (!r) {
			diag_smd_function_mode = SMD_FUNC_OPEN_DIAG;
		}
	}
#if defined(CONFIG_MSM_N_WAY_SMD)
	if (pdev->id == 1)
#if defined(CONFIG_MACH_MECHA) || defined(CONFIG_ARCH_MSM8X60_LTE) || defined(CONFIG_ARCH_MSM8X60)
				r = smd_named_open_on_edge("DIAG", SMD_APPS_QDSP
			, &driver->chqdsp, driver, diag_smd_qdsp_notify);
#else
				r = smd_open("DSP_DIAG", &driver->chqdsp, driver, diag_smd_qdsp_notify);
#endif
#endif
/*	pm_runtime_set_active(&pdev->dev);
	pm_runtime_enable(&pdev->dev);*/
//err:
	printk(KERN_INFO "diag opened SMD port pdev->id=%d; r = %d ch=%x\n", pdev->id, r, (unsigned int)driver->ch);

	return 0;
}
static void grmnet_ctrl_smd_connect_w(struct work_struct *w)
{
	struct rmnet_ctrl_port *port =
			container_of(w, struct rmnet_ctrl_port, connect_w.work);
	struct smd_ch_info *c = &port->ctrl_ch;
	unsigned long flags;
	int ret;

	pr_debug("%s:\n", __func__);

	if (!test_bit(CH_READY, &c->flags))
		return;

	ret = smd_open(c->name, &c->ch, port, grmnet_ctrl_smd_notify);
	if (ret) {
		if (ret == -EAGAIN) {
			/* port not ready  - retry */
			pr_debug("%s: SMD port not ready - rescheduling:%s err:%d\n",
					__func__, c->name, ret);
			queue_delayed_work(grmnet_ctrl_wq, &port->connect_w,
				msecs_to_jiffies(250));
		} else {
			pr_err("%s: unable to open smd port:%s err:%d\n",
					__func__, c->name, ret);
		}
		return;
	}

	spin_lock_irqsave(&port->port_lock, flags);
	if (port->port_usb)
		smd_tiocmset(c->ch, c->cbits_tomodem, ~c->cbits_tomodem);
	spin_unlock_irqrestore(&port->port_lock, flags);
}
static int __rmnet_open(struct net_device *dev)
{
	int r;
	void *pil;
	struct rmnet_private *p = netdev_priv(dev);

	mutex_lock(&p->pil_lock);
	if (!p->pil) {
		pil = msm_rmnet_load_modem(dev);
		if (IS_ERR(pil)) {
			mutex_unlock(&p->pil_lock);
			return PTR_ERR(pil);
		}
		p->pil = pil;
	}
	mutex_unlock(&p->pil_lock);

	if (!p->ch) {
		r = smd_open(p->chname, &p->ch, dev, smd_net_notify);

		if (r < 0)
			return -ENODEV;
	}

	smd_disable_read_intr(p->ch);
	return 0;
}
Esempio n. 5
0
static int smd_vt_open(struct inode *ip, struct file *fp)
{
    int r = 0;
    int try_count =0;
    
    printk(KERN_INFO "smd_vt_open\n");

    mutex_lock(&smd_vt_ch_lock);
    if ((smd_vt_devp->ch == 0) || (smd_vt_devp->open_count == 0)) {
        r = smd_open("DATA11", &smd_vt_devp->ch,0, smd_vt_notify);
        while((r == 0) && (smd_vt_devp->open_flag ==0)){
            if(100 < try_count++){
                r = -ENODEV;
                break;
            }
            msleep(10);
        }
    }

    if( r ==  0){    // opened success or already opened.
        smd_vt_devp->open_count++;
    }
    mutex_unlock(&smd_vt_ch_lock);
    return r;
}
static int __rmnet_open(struct net_device *dev)
{
	int r;
	void *pil;
	struct rmnet_private *p = netdev_priv(dev);

	/* printk("%s() ++\n", __func__); */

	mutex_lock(&p->pil_lock);
	if (!p->pil) {
		pil = msm_rmnet_load_modem(dev);
		if (IS_ERR(pil)) {
			mutex_unlock(&p->pil_lock);
			return PTR_ERR(pil);
		}
		p->pil = pil;
	}
	mutex_unlock(&p->pil_lock);

	if (!p->ch) {
		r = smd_open(p->chname, &p->ch, dev, smd_net_notify);

		if (r < 0)
			return -ENODEV;
	}

	/* printk("%s() --\n", __func__); */
	return 0;
}
Esempio n. 7
0
static int diag_smd_probe(struct platform_device *pdev)
{
	int r = 0;

	if (pdev->id == SMD_APPS_MODEM) {
		r = smd_open("DIAG", &driver->ch, driver, diag_smd_notify);
		ch_temp = driver->ch;
	}
#if defined(CONFIG_MSM_N_WAY_SMD)
	if (pdev->id == SMD_APPS_QDSP)
		r = smd_named_open_on_edge("DIAG", SMD_APPS_QDSP
			, &driver->chqdsp, driver, diag_smd_qdsp_notify);
#endif
	if (pdev->id == SMD_APPS_WCNSS)
		r = smd_named_open_on_edge("APPS_RIVA_DATA", SMD_APPS_WCNSS
			, &driver->ch_wcnss, driver, diag_smd_wcnss_notify);
	pm_runtime_set_active(&pdev->dev);
	pm_runtime_enable(&pdev->dev);
	pr_debug("diag: open SMD port, Id = %d, r = %d\n", pdev->id, r);

	#ifdef CONFIG_HUAWEI_FEATURE_PHUDIAG
	phudriver->ch = driver->ch;
	#endif
	return 0;
}
Esempio n. 8
0
static void grmnet_ctrl_smd_connect_w(struct work_struct *w)
{
	struct rmnet_ctrl_port *port =
			container_of(w, struct rmnet_ctrl_port, connect_w);
	struct smd_ch_info *c = &port->ctrl_ch;
	unsigned long flags;
	int ret;

	pr_debug("%s:\n", __func__);

	if (!test_bit(CH_READY, &c->flags))
		return;

	ret = smd_open(c->name, &c->ch, port, grmnet_ctrl_smd_notify);
	if (ret) {
		pr_err("%s: Unable to open smd ch:%s err:%d\n",
				__func__, c->name, ret);
		return;
	}

	spin_lock_irqsave(&port->port_lock, flags);
	if (port->port_usb)
		smd_tiocmset(c->ch, c->cbits_tomodem, ~c->cbits_tomodem);
	spin_unlock_irqrestore(&port->port_lock, flags);
}
static int diag_smd_probe(struct platform_device *pdev)
{
	int r = 0;

	if (pdev->id == 0) {
		if (driver->usb_buf_in == NULL &&
			(driver->usb_buf_in =
			kzalloc(USB_MAX_IN_BUF, GFP_KERNEL)) == NULL)

			goto err;
		else

		r = smd_open("DIAG", &driver->ch, driver, diag_smd_notify);
	}
#if defined(CONFIG_MSM_N_WAY_SMD)
	if (pdev->id == 1) {
		if (driver->usb_buf_in_qdsp == NULL &&
			(driver->usb_buf_in_qdsp =
			kzalloc(USB_MAX_IN_BUF, GFP_KERNEL)) == NULL)

			goto err;
		else

		r = smd_named_open_on_edge("DIAG", SMD_APPS_QDSP,
			&driver->chqdsp, driver, diag_smd_qdsp_notify);

	}
#endif
	printk(KERN_INFO "diag opened SMD port ; r = %d\n", r);

err:
	return 0;
}
static int rpcrouter_smd_remote_probe(struct platform_device *pdev)
{
    int rc;

    smd_remote_xprt.xprt.name = "rpcrotuer_smd_xprt";
    smd_remote_xprt.xprt.read_avail = rpcrouter_smd_remote_read_avail;
    smd_remote_xprt.xprt.read = rpcrouter_smd_remote_read;
    smd_remote_xprt.xprt.write_avail = rpcrouter_smd_remote_write_avail;
    smd_remote_xprt.xprt.write = rpcrouter_smd_remote_write;
    smd_remote_xprt.xprt.close = rpcrouter_smd_remote_close;
    smd_remote_xprt.xprt.priv = NULL;

    /* Open up SMD channel */
    rc = smd_open("RPCCALL", &smd_remote_xprt.channel, NULL,
                  rpcrouter_smd_remote_notify);
    if (rc < 0)
        return rc;

    smd_disable_read_intr(smd_remote_xprt.channel);

    msm_rpcrouter_xprt_notify(&smd_remote_xprt.xprt,
                              RPCROUTER_XPRT_EVENT_OPEN);

    smsm_change_state(SMSM_APPS_STATE, 0, SMSM_RPCINIT);

    return 0;
}
Esempio n. 11
0
void diag_smd_enable(smd_channel_t *ch, char *src, int mode)
{
	int r = 0;
	static smd_channel_t *_ch = NULL;
	DIAGFWD_INFO("smd_try_open(%s): mode=%d\n", src, mode);

	mutex_lock(&driver->smd_lock);
	diag_smd_function_mode = mode;
	if (mode) {
		if (!driver->ch) {
			r = smd_open(SMDDIAG_NAME, &driver->ch, driver, diag_smd_notify);
			if (!r)
				_ch = driver->ch;
		} else
			_ch = driver->ch;
	} else {
		if (driver->ch) {
			r = smd_close(driver->ch);
			driver->ch = NULL;
			if (!r)
				_ch = driver->ch;
		}
	}
	ch = _ch;
	mutex_unlock(&driver->smd_lock);
	DIAGFWD_INFO("smd_try_open(%s): r=%d _ch=%x\n", src, r, (unsigned int)ch);
}
Esempio n. 12
0
static int
diag_ioctl(struct inode *inode, struct file *file,
	  unsigned int cmd, unsigned long arg)
{
	struct bt_diag_context *ctxt = &_context;
	void __user *argp = (void __user *)arg;
	int tmp_value;
	unsigned long flags;
	dbg("diag_ioctl\n");

	if (_IOC_TYPE(cmd) != USB_DIAG_IOC_MAGIC) {
		dbg("IOC_TYPE not USB_DIAG_IOC_MAGIC\n");
		return -ENOTTY;
	}

	switch (cmd) {
	case USB_DIAG_FUNC_IOC_ENABLE_SET:
		if (copy_from_user(&tmp_value, argp, sizeof(int))) {
			dbg("copy_from_user fail\n");
			return -EFAULT;
		}
		dbg("IOCTL USB_DIAG_FUNC_IOC_ENABLE_SET %d\n", tmp_value);
		if (tmp_value)	{
			/*TODO: enable BT interface*/
			dbg("smd_open: SMD_DIAG\n");
			smd_open("SMD_DIAG", &ctxt->ch, ctxt, smd_diag_notify);
			wake_lock(&btport_wake_lock);
		} else	{
			/*TODO: disable BT interface*/
			dbg("smd_close: SMD_DIAG\n");
			smd_close(ctxt->ch);
			wake_unlock(&btport_wake_lock);
		}
		break;
	case USB_DIAG_FUNC_IOC_ENABLE_GET:
		/*TODO: assign BT enable to tmp_value*/
		if (copy_to_user(argp, &tmp_value, sizeof(tmp_value)))
			return -EFAULT;
		break;
	case USB_DIAG_FUNC_IOC_REGISTER_SET:
		spin_lock_irqsave(&ctxt->lock_reg_num, flags);
		if (copy_from_user(ctxt->id_table, (unsigned char *)argp, sizeof(unsigned char)*TABLE_SIZE)) {
			spin_unlock_irqrestore(&ctxt->lock_reg_num, flags);
			return -EFAULT;
		}
		spin_unlock_irqrestore(&ctxt->lock_reg_num, flags);
		break;
	case USB_DIAG_FUNC_IOC_AMR_SET:
		if (copy_from_user(&ctxt->is2ARM11, argp, sizeof(int)))
			return -EFAULT;
		dbg("IOCTL USB_DIAG_FUNC_IOC_AMR_SET %d\n", ctxt->is2ARM11);
		break;
	default:
		return -ENOTTY;
	}

	return 0;
}
static int msm_diag_smd_open(void)
{
	struct diag_context *ctxt = &_context;
	int r = 0;

    if ( !ctxt->ch ) {
	    r = smd_open("SMD_DIAG", &ctxt->ch, ctxt, smd_diag_notify);
    }
	return r;
}
Esempio n. 14
0
static int nmea_open(struct inode *ip, struct file *fp)
{
	int r = 0;

	mutex_lock(&nmea_ch_lock);
	if (nmea_devp->ch == 0)
		r = smd_open("GPSNMEA", &nmea_devp->ch, nmea_devp, nmea_notify);
	mutex_unlock(&nmea_ch_lock);

	return r;
}
Esempio n. 15
0
static int nmea_open(struct inode *ip, struct file *fp)
{
	int r = 0;

	mutex_lock(&nmea_ch_lock);
	if (nmea_devp->ch == 0)
		r = smd_open("SMD_GPSNMEA", &nmea_devp->ch, nmea_devp, nmea_notify);	/* Modified by Andy for HTC SMD upper layer drivers */
	mutex_unlock(&nmea_ch_lock);

	return r;
}
Esempio n. 16
0
static int smd_tty_open(struct tty_struct *tty, struct file *f)
{
	int res = 0;
	int n = tty->index;
	struct smd_tty_info *info;
	const char *name;

	if (n == 0)
		name = "SMD_DS";
//	else if (n == 7)
//		name = "DATA1";
//	else if (n == 21)
//		name = "DATA21";
	else if (n == 27)
		name = "SMD_GPSNMEA";
//	else if (n == 36)
//		name = "LOOPBACK";
	else
		return -ENODEV;

	info = smd_tty + n;

	mutex_lock(&smd_tty_lock);
	tty->driver_data = info;

	if (info->open_count++ == 0) {
		info->tty = tty;
		tasklet_init(&info->tty_tsklt, smd_tty_read,
			     (unsigned long)info);
		wake_lock_init(&info->wake_lock, WAKE_LOCK_SUSPEND, name);
		if (!info->ch) {
#if 0
			if (n == 36) {
				/* set smsm state to SMSM_SMD_LOOPBACK state
				** and wait allowing enough time for Modem side
				** to open the loopback port (Currently, this is
				** this is effecient than polling).
				*/
				smsm_change_state(SMSM_APPS_STATE,
						  0, SMSM_SMD_LOOPBACK);
				msleep(100);
			}
#endif
			res = smd_open(name, &info->ch, info,
				       smd_tty_notify);
		}
	}
	mutex_unlock(&smd_tty_lock);

	return res;
}
Esempio n. 17
0
static int __rmnet_open(struct net_device *dev)
{
	int r;
	struct rmnet_private *p = netdev_priv(dev);

	if (!p->ch) {
		r = smd_open(p->chname, &p->ch, dev, smd_net_notify);

		if (r < 0)
			return -ENODEV;
	}

	return 0;
}
static int diag_dci_probe(struct platform_device *pdev)
{
	int err = 0;

	if (pdev->id == SMD_APPS_MODEM) {
		err = smd_open("DIAG_2", &driver->ch_dci, driver,
					    diag_smd_dci_notify);
		if (err)
			pr_err("diag: cannot open DCI port, Id = %d, err ="
				" %d\n", pdev->id, err);
		else
			diag_dci_notify_client(DIAG_CON_MPSS);
	}
	return err;
}
Esempio n. 19
0
static int rmnet_open(struct net_device *dev)
{
	int r;
	struct rmnet_private *p = netdev_priv(dev);

	pr_info("rmnet_open()\n");
	if (!p->ch) {
		r = smd_open(p->chname, &p->ch, dev, smd_net_notify);

		if (r < 0)
			return -ENODEV;
	}

	netif_start_queue(dev);
	return 0;
}
static int smd_lge_open(struct inode *ip, struct file *fp)
{

	int r = 0;

	SMD_LGE_INFO("%s \n", __func__);
	if (psmd_device->ch == 0)
		r = smd_open(psmd_device->ch_name, &psmd_device->ch,
			psmd_device, smd_lge_notify);

	psmd_device->tx_buff = kmalloc(SMD_LGE_MAX_SIZE, GFP_KERNEL);
	psmd_device->rx_buff = kmalloc(SMD_LGE_MAX_SIZE, GFP_KERNEL);


	return r;
}
Esempio n. 21
0
static int diag_smd_probe(struct platform_device *pdev)
{
	int r = 0;

	if (pdev->id == 0)
		r = smd_open("DIAG", &driver->ch, driver, diag_smd_notify);
#if defined(CONFIG_MSM_N_WAY_SMD)
	if (pdev->id == 1)
		r = smd_named_open_on_edge("DIAG", SMD_APPS_QDSP
			, &driver->chqdsp, driver, diag_smd_qdsp_notify);
#endif
	pm_runtime_set_active(&pdev->dev);
	pm_runtime_enable(&pdev->dev);
	printk(KERN_INFO "diag opened SMD port ; r = %d\n", r);

	return 0;
}
static int smm6260net_open(struct net_device *dev)
{
	int r;
	struct smm6260net_private *p = netdev_priv(dev);

	pr_info("smm6260net_open(),%d\n",p->ucount);
	if (!p->ch) {
		p->ucount = 0;
		r = smd_open(p->chname, &p->ch, dev, smm6260_net_notify);

		if (r < 0)
			return -ENODEV;
	}
	p->ucount++;
	netif_start_queue(dev);
	return 0;
}
Esempio n. 23
0
static int smd_tty_open(struct tty_struct *tty, struct file *f)
{
	int res = 0;
	int n = tty->index;
	struct smd_tty_info *info;
	const char *name;

	if (n == 0)
		name = "DS";
	else if (n == 7)
		name = "DATA1";
	else if (n == 21)
		name = "DATA21";
	else if (n == 27)
		name = "GPSNMEA";
	else if (n == 36)
		name = "LOOPBACK";
	else
		return -ENODEV;

	info = smd_tty + n;

	mutex_lock(&smd_tty_lock);
	tty->driver_data = info;

	if (info->open_count++ == 0) {
		info->tty = tty;
		tasklet_init(&info->tty_tsklt, smd_tty_read,
			     (unsigned long)info);
		wake_lock_init(&info->wake_lock, WAKE_LOCK_SUSPEND, name);
		if (!info->ch) {
			if (n == 36) {
				
				smsm_change_state(SMSM_APPS_STATE,
						  0, SMSM_SMD_LOOPBACK);
				msleep(100);
			}

			res = smd_open(name, &info->ch, info,
				       smd_tty_notify);
		}
	}
	mutex_unlock(&smd_tty_lock);

	return res;
}
static void grmnet_ctrl_smd_connect_w(struct work_struct *w)
{
	struct rmnet_ctrl_port *port =
			container_of(w, struct rmnet_ctrl_port, connect_w.work);
	struct rmnet_ctrl_ports *port_entry = &ctrl_smd_ports[port->port_num];
	struct smd_ch_info *c = &port->ctrl_ch;
	unsigned long flags;
	int	set_bits = 0;
	int	clear_bits = 0;
	int ret;

	pr_debug("%s:\n", __func__);

	if (!test_bit(CH_READY, &c->flags)) {
		if (!test_bit(CH_PREPARE_READY, &c->flags)) {
			set_bit(CH_PREPARE_READY, &c->flags);
			platform_driver_register(&(port_entry->pdrv));
		}
		return;
	}

	ret = smd_open(c->name, &c->ch, port, grmnet_ctrl_smd_notify);
	if (ret) {
		if (ret == -EAGAIN) {
			/* port not ready  - retry */
			pr_debug("%s: SMD port not ready - rescheduling:%s err:%d\n",
					__func__, c->name, ret);
			queue_delayed_work(grmnet_ctrl_wq, &port->connect_w,
				msecs_to_jiffies(250));
		} else {
			pr_err("%s: unable to open smd port:%s err:%d\n",
					__func__, c->name, ret);
		}
		return;
	}

	set_bits = c->cbits_tomodem;
	clear_bits = ~(c->cbits_tomodem | TIOCM_RTS);
	spin_lock_irqsave(&port->port_lock, flags);
	if (port->port_usb)
		smd_tiocmset(c->ch, set_bits, clear_bits);
	spin_unlock_irqrestore(&port->port_lock, flags);
}
Esempio n. 25
0
void diag_smd_enable(char *src, int enable)
{

	printk(KERN_INFO "smd_try_open(%s): %d\n", src, enable);
	if (!driver->init_done)
		return;

	mutex_lock(&driver->smd_lock);
	if (enable) {
		if (!driver->ch)
			smd_open("SMD_DIAG", &driver->ch, driver, diag_smd_notify);
	} else {
		if (driver->ch) {
			smd_close(driver->ch);
			driver->ch = NULL;
		}
	}
	mutex_unlock(&driver->smd_lock);
}
Esempio n. 26
0
static int diag_smd_probe(struct platform_device *pdev)
{
	int r = 0;
	int index = -1;

	if (pdev->id == SMD_APPS_MODEM) {
		index = MODEM_DATA;
		r = smd_open("DIAG", &driver->smd_data[index].ch,
					&driver->smd_data[index],
					diag_smd_notify);
		driver->smd_data[index].ch_save =
					driver->smd_data[index].ch;
	}
#if defined(CONFIG_MSM_N_WAY_SMD)
	if (pdev->id == SMD_APPS_QDSP) {
		index = LPASS_DATA;
		r = smd_named_open_on_edge("DIAG", SMD_APPS_QDSP,
					&driver->smd_data[index].ch,
					&driver->smd_data[index],
					diag_smd_notify);
		driver->smd_data[index].ch_save =
					driver->smd_data[index].ch;
	}
#endif
	if (pdev->id == SMD_APPS_WCNSS) {
		index = WCNSS_DATA;
		r = smd_named_open_on_edge("APPS_RIVA_DATA",
					SMD_APPS_WCNSS,
					&driver->smd_data[index].ch,
					&driver->smd_data[index],
					diag_smd_notify);
		driver->smd_data[index].ch_save =
					driver->smd_data[index].ch;
	}

	pm_runtime_set_active(&pdev->dev);
	pm_runtime_enable(&pdev->dev);
	pr_debug("diag: open SMD port, Id = %d, r = %d\n", pdev->id, r);

	return 0;
}
Esempio n. 27
0
static int smd_tty_open(struct tty_struct *tty, struct file *f)
{
	int res = 0;
	int n = tty->index;
	struct smd_tty_info *info;
	const char *name;

	if (n == 0) {
		name = "SMD_DS";
	} else if (n == 27) {
		name = "SMD_GPSNMEA";
#ifdef CONFIG_BUILD_CIQ
	} else if (n == 26) {
		name = "SMD_DATA20";		/* CIQ Master/Slaver Bridge */
#endif
#ifdef CONFIG_BUILD_OMA_DM
	} else if (n == 17) {
		name = "SMD_DATA1";		/* MASD DATA1 AT-channel test */
#endif
	} else {
		return -ENODEV;
	}

	info = smd_tty + n;

	mutex_lock(&smd_tty_lock);
        wake_lock_init(&info->wake_lock, WAKE_LOCK_SUSPEND, name);
	tty->driver_data = info;

	if (info->open_count++ == 0) {
		info->tty = tty;
		if (info->ch) {
			smd_kick(info->ch);
		} else {
			res = smd_open(name, &info->ch, info, smd_tty_notify);
		}
	}
	mutex_unlock(&smd_tty_lock);

	return res;
}
Esempio n. 28
0
static int diag_smd_cntl_probe(struct platform_device *pdev)
{
	int r = 0;

	/* open control ports only on 8960 & newer targets */
	if (chk_apps_only()) {
		if (pdev->id == SMD_APPS_MODEM)
			r = smd_open("DIAG_CNTL", &driver->ch_cntl, driver,
							diag_smd_cntl_notify);
		if (pdev->id == SMD_APPS_QDSP)
			r = smd_named_open_on_edge("DIAG_CNTL", SMD_APPS_QDSP
					, &driver->chlpass_cntl, driver,
					diag_smd_lpass_cntl_notify);
		if (pdev->id == SMD_APPS_WCNSS)
			r = smd_named_open_on_edge("APPS_RIVA_CTRL",
				SMD_APPS_WCNSS, &driver->ch_wcnss_cntl,
					driver, diag_smd_wcnss_cntl_notify);
		pr_debug("diag: open CNTL port, ID = %d,r = %d\n", pdev->id, r);
	}
	return 0;
}
Esempio n. 29
0
static int diag_smd_cntl_probe(struct platform_device *pdev)
{
	int r = 0;

	/* open control ports only on 8960 */
	if (chk_config_get_id() == AO8960_TOOLS_ID) {
		if (pdev->id == SMD_APPS_MODEM)
			r = smd_open("DIAG_CNTL", &driver->ch_cntl, driver,
							diag_smd_cntl_notify);
		if (pdev->id == SMD_APPS_QDSP)
			r = smd_named_open_on_edge("DIAG_CNTL", SMD_APPS_QDSP
				, &driver->chqdsp_cntl, driver,
					 diag_smd_qdsp_cntl_notify);
		if (pdev->id == SMD_APPS_WCNSS)
			r = smd_named_open_on_edge("APPS_RIVA_CTRL",
				SMD_APPS_WCNSS, &driver->ch_wcnss_cntl,
					driver, diag_smd_wcnss_cntl_notify);
		pr_debug("diag: open CNTL port, ID = %d,r = %d\n", pdev->id, r);
	}
	return 0;
}
Esempio n. 30
0
static int qmi_open(struct inode *ip, struct file *fp)
{
	struct qmi_ctxt *ctxt = qmi_minor_to_ctxt(MINOR(ip->i_rdev));
	int r = 0;

	if (!ctxt) {
		printk(KERN_ERR "unknown qmi misc %d\n", MINOR(ip->i_rdev));
		return -ENODEV;
	}

	fp->private_data = ctxt;

	mutex_lock(&ctxt->lock);
	if (ctxt->ch == 0)
		r = smd_open(ctxt->ch_name, &ctxt->ch, ctxt, qmi_notify);
	if (r == 0)
		wake_up(&qmi_wait_queue);
	mutex_unlock(&ctxt->lock);

	return r;
}