Exemple #1
0
static int isp_open(struct inode *inode, struct file *filp)
{
	int ret = 0;

	isp_t *dev = kmalloc(sizeof(isp_t), GFP_KERNEL);
	if (!dev)
		return -ENOMEM;

	filp->private_data = dev;
	dev->lock = __SPIN_LOCK_UNLOCKED();
	dev->isp_status.status = 0;

	sema_init(&dev->irq_sem, 0);

	enable_isp_clock();

	ret =
	    request_irq(IRQ_ISP, isp_isr, IRQF_DISABLED | IRQF_SHARED,
			ISP_DEV_NAME, dev);
	if (ret) {
		err_print("request_irq failed ret = %d\n", ret);
		goto err;
	}

	disable_irq(IRQ_ISP);
	return 0;

err:
	if (dev)
		kfree(dev);
	return ret;
}
static int isp_open(struct inode *inode, struct file *filp)
{
	int ret = 0;

	struct isp_t *dev = kmalloc(sizeof(struct isp_t), GFP_KERNEL);
	if (!dev)
		return -ENOMEM;

	filp->private_data = dev;
	spin_lock_init(&dev->lock);
	dev->isp_status.status = 0;

	init_completion(&dev->irq_sem);

	ret =
	    pi_mgr_dfs_add_request(&isp_dfs_node, "isp", PI_MGR_PI_ID_MM,
				   PI_MGR_DFS_MIN_VALUE);

	if (ret) {
		printk(KERN_ERR "%s: failed to register PI DFS request\n",
		       __func__);
		goto err;
	}

	ret = pi_mgr_qos_add_request(&isp_qos_node, "isp",
					PI_MGR_PI_ID_ARM_CORE,
					PI_MGR_QOS_DEFAULT_VALUE);
	if (ret) {
		printk(KERN_ERR "%s: failed to register PI QOS request\n",
				__func__);
		ret = -EIO;
		goto qos_request_fail;
	}

	enable_isp_clock();
	pi_mgr_qos_request_update(&isp_qos_node, 0);
	scu_standby(0);

	ret =
	    request_irq(IRQ_ISP, isp_isr, IRQF_DISABLED | IRQF_SHARED,
			ISP_DEV_NAME, dev);
	if (ret) {
		err_print("request_irq failed ret = %d\n", ret);
		goto err;
	}
	/* Ensure that only one CORE handles interrupt for the MM block. */
	irq_set_affinity(IRQ_ISP, cpumask_of(0));
	disable_irq(IRQ_ISP);
	return 0;


qos_request_fail:
	pi_mgr_dfs_request_remove(&isp_dfs_node);
err:
	kfree(dev);
	return ret;
}