static int fimg2d_suspend(struct device *dev)
{
	fimg2d_debug("suspend... start\n");
	atomic_set(&info->suspended, 1);
	while (1) {
		if (fimg2d_queue_is_empty(&info->cmd_q))
			break;

		mdelay(2);
	}
	fimg2d_debug("suspend... done\n");
	return 0;
}
Esempio n. 2
0
static int fimg2d_suspend(struct device *dev)
{
	unsigned long flags;
	int retry = POLL_RETRY;

	g2d_lock(&ctrl->drvlock);
	g2d_spin_lock(&ctrl->bltlock, flags);
	atomic_set(&ctrl->suspended, 1);
	g2d_spin_unlock(&ctrl->bltlock, flags);
	while (retry--) {
		if (fimg2d_queue_is_empty(&ctrl->cmd_q))
			break;
		mdelay(POLL_TIMEOUT);
	}
	g2d_unlock(&ctrl->drvlock);
	fimg2d_info("suspend... done\n");
	return 0;
}
Esempio n. 3
0
static int fimg2d_suspend(struct device *dev)
{
	unsigned long flags;
	int retry = POLL_RETRY;

	g2d_spin_lock(&ctrl->bltlock, flags);
	atomic_set(&ctrl->suspended, 1);
	g2d_spin_unlock(&ctrl->bltlock, flags);
	while (retry--) {
		if (fimg2d_queue_is_empty(&ctrl->cmd_q))
			break;
		mdelay(POLL_TIMEOUT);
	}
	if (ip_is_g2d_5h() || ip_is_g2d_5hp())
		exynos5433_fimg2d_clk_set_osc(ctrl);
	fimg2d_info("suspend... done\n");
	return 0;
}
Esempio n. 4
0
static long fimg2d_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
	int ret = 0;
	struct fimg2d_context *ctx;
	struct fimg2d_platdata *pdata;
	struct fimg2d_blit blit;
	struct fimg2d_version ver;
	struct fimg2d_image dst;

	ctx = file->private_data;
	if (!ctx) {
		printk(KERN_ERR "[%s] missing ctx\n", __func__);
		return -EFAULT;
	}

	switch (cmd) {
	case FIMG2D_BITBLT_BLIT:
		if (info->secure)
			return -EFAULT;
		if (copy_from_user(&blit, (void *)arg, sizeof(blit)))
			return -EFAULT;
		if (blit.dst)
			if (copy_from_user(&dst, (void *)blit.dst, sizeof(dst)))
				return -EFAULT;

#ifdef CONFIG_BUSFREQ_OPP
#if defined(CONFIG_CPU_EXYNOS4212) || defined(CONFIG_CPU_EXYNOS4412)
			dev_lock(info->bus_dev, info->dev, 160160);
#endif
#endif
		if ((blit.dst) && (dst.addr.type == ADDR_USER))
			if (!down_write_trylock(&page_alloc_slow_rwsem))
				ret = -EAGAIN;

		if (ret != -EAGAIN)
			ret = fimg2d_add_command(info, ctx, &blit, dst.addr.type);

		if (!ret) {
			fimg2d_request_bitblt(ctx);
		}

#ifdef PERF_PROFILE
		perf_print(ctx, blit.seq_no);
		perf_clear(ctx);
#endif
		if ((blit.dst) && (dst.addr.type == ADDR_USER) && ret != -EAGAIN)
			up_write(&page_alloc_slow_rwsem);

#ifdef CONFIG_BUSFREQ_OPP
#if defined(CONFIG_CPU_EXYNOS4212) || defined(CONFIG_CPU_EXYNOS4412)
			dev_unlock(info->bus_dev, info->dev);
#endif
#endif
		break;

	case FIMG2D_BITBLT_SYNC:
		fimg2d_debug("FIMG2D_BITBLT_SYNC ctx: %p\n", ctx);
		/* FIXME: */
		break;

	case FIMG2D_BITBLT_VERSION:
		pdata = to_fimg2d_plat(info->dev);
		ver.hw = pdata->hw_ver;
		ver.sw = 0;
		fimg2d_debug("fimg2d version, hw: 0x%x sw: 0x%x\n",
				ver.hw, ver.sw);
		if (copy_to_user((void *)arg, &ver, sizeof(ver)))
			return -EFAULT;
		break;

	case FIMG2D_BITBLT_SECURE:
		if (copy_from_user(&info->secure,
				   (unsigned int *)arg,
				   sizeof(unsigned int))) {
			printk(KERN_ERR
				"[%s] failed to FIMG2D_BITBLT_SECURE: copy_from_user error\n\n",
				__func__);
			return -EFAULT;
		}

		while (1) {
			if (fimg2d_queue_is_empty(&info->cmd_q))
				break;
			mdelay(2);
		}

		break;

	default:
		printk(KERN_ERR "[%s] unknown ioctl\n", __func__);
		ret = -EFAULT;
		break;
	}

	return ret;
}