static int fimc_is_ixc_video_open(struct file *file)
{
	int ret = 0;
	struct fimc_is_video *video;
	struct fimc_is_video_ctx *vctx;
	struct fimc_is_device_ischain *device;
	struct fimc_is_resourcemgr *resourcemgr;

	vctx = NULL;
	device = NULL;
	video = video_drvdata(file);
	resourcemgr = video->resourcemgr;
	if (!resourcemgr) {
		err("resourcemgr is NULL");
		ret = -EINVAL;
		goto p_err;
	}

	ret = fimc_is_resource_open(resourcemgr, RESOURCE_TYPE_ISCHAIN, (void **)&device);
	if (ret) {
		err("fimc_is_resource_open is fail(%d)", ret);
		goto p_err;
	}

	if (!device) {
		err("device is NULL");
		ret = -EINVAL;
		goto p_err;
	}

	minfo("[I%dC:V] %s\n", device, GET_IXC_ID(video), __func__);

	ret = open_vctx(file, video, &vctx, device->instance, FRAMEMGR_ID_IXC);
	if (ret) {
		merr("open_vctx is fail(%d)", device, ret);
		goto p_err;
	}

	ret = fimc_is_video_open(vctx,
		device,
		VIDEO_IXC_READY_BUFFERS,
		video,
		&fimc_is_ixc_qops,
		&fimc_is_ischain_subdev_ops);
	if (ret) {
		merr("fimc_is_video_open is fail(%d)", device, ret);
		close_vctx(file, video, vctx);
		goto p_err;
	}

	ret = fimc_is_ischain_subdev_open(device, vctx);
	if (ret) {
		merr("fimc_is_ischain_subdev_open is fail(%d)", device, ret);
		close_vctx(file, video, vctx);
		goto p_err;
	}

p_err:
	return ret;
}
static int fimc_is_vdo_video_open(struct file *file)
{
	int ret = 0;
	u32 refcount;
	struct fimc_is_core *core;
	struct fimc_is_video *video;
	struct fimc_is_video_ctx *vctx;
	struct fimc_is_device_ischain *device;

	vctx = NULL;
	video = video_drvdata(file);
	core = container_of(video, struct fimc_is_core, video_vdo);

	ret = open_vctx(file, video, &vctx, FRAMEMGR_ID_DIS_GRP, FRAMEMGR_ID_INVALID);
	if (ret) {
		err("open_vctx is fail(%d)", ret);
		goto p_err;
	}

	info("[VDO:V:%d] %s\n", vctx->instance, __func__);

	refcount = atomic_read(&core->video_isp.refcount);
	if (refcount > FIMC_IS_MAX_NODES) {
		err("invalid ischain refcount(%d)", refcount);
		close_vctx(file, video, vctx);
		ret = -EINVAL;
		goto p_err;
	}

	device = &core->ischain[refcount - 1];

	ret = fimc_is_video_open(vctx,
		device,
		VIDEO_VDISO_READY_BUFFERS,
		video,
		FIMC_IS_VIDEO_TYPE_OUTPUT,
		&fimc_is_vdo_qops,
		&fimc_is_ischain_vdo_ops,
		&fimc_is_ischain_sub_ops);
	if (ret) {
		err("fimc_is_video_open is fail");
		close_vctx(file, video, vctx);
		goto p_err;
	}

	ret = fimc_is_ischain_vdo_open(device, vctx);
	if (ret) {
		err("fimc_is_ischain_vdo_open is fail");
		close_vctx(file, video, vctx);
		goto p_err;
	}

p_err:
	return ret;
}
示例#3
0
static int fimc_is_scp_video_open(struct file *file)
{
	int ret = 0;
	u32 refcount;
	struct fimc_is_core *core;
	struct fimc_is_video *video;
	struct fimc_is_video_ctx *vctx;
	struct fimc_is_device_ischain *device;

	vctx = NULL;
	video = video_drvdata(file);
	core = container_of(video, struct fimc_is_core, video_scp);

	ret = open_vctx(file, video, &vctx, FRAMEMGR_ID_INVALID, FRAMEMGR_ID_SCP);
	if (ret) {
		err("open_vctx is fail(%d)", ret);
		goto p_err;
	}

	mdbgv_scp("[SCP:V:%d] %s\n",vctx, vctx->instance, __func__);

	refcount = atomic_read(&core->video_isp.refcount);
	if (refcount > FIMC_IS_MAX_NODES || refcount < 1) {
		err("invalid ischain refcount(%d)", refcount);
		close_vctx(file, video, vctx);
		ret = -EINVAL;
		goto p_err;
	}

	device = &core->ischain[refcount - 1];

	ret = fimc_is_video_open(vctx,
		device,
		VIDEO_SCP_READY_BUFFERS,
		video,
		FIMC_IS_VIDEO_TYPE_CAPTURE,
		&fimc_is_scp_qops,
		NULL,
		&fimc_is_ischain_sub_ops);
	if (ret) {
		err("fimc_is_video_open is fail");
		close_vctx(file, video, vctx);
		goto p_err;
	}

	ret = fimc_is_subdev_open(&device->scp, vctx, NULL);
	if (ret) {
		err("fimc_is_subdev_open is fail");
		close_vctx(file, video, vctx);
		goto p_err;
	}

p_err:
	return ret;
}
static int fimc_is_ssx_video_open(struct file *file)
{
	int ret = 0;
	struct fimc_is_video *video;
	struct fimc_is_video_ctx *vctx;
	struct fimc_is_device_sensor *device;
	struct fimc_is_resourcemgr *resourcemgr;

	vctx = NULL;
	video = video_drvdata(file);
	device = container_of(video, struct fimc_is_device_sensor, video);
	resourcemgr = video->resourcemgr;
	if (!resourcemgr) {
		err("resourcemgr is NULL");
		ret = -EINVAL;
		goto p_err;
	}

	ret = fimc_is_resource_open(resourcemgr, video->id - FIMC_IS_VIDEO_SS0_NUM, NULL);
	if (ret) {
		err("fimc_is_resource_open is fail(%d)", ret);
		goto p_err;
	}

	minfo("[SS%d:V] %s\n", device, video->id, __func__);

	ret = open_vctx(file, video, &vctx, device->instance, FRAMEMGR_ID_SSX);
	if (ret) {
		merr("open_vctx is fail(%d)", device, ret);
		goto p_err;
	}

	ret = fimc_is_video_open(vctx,
		device,
		VIDEO_SSX_READY_BUFFERS,
		video,
		&fimc_is_ssx_qops,
		&fimc_is_sensor_ops);
	if (ret) {
		merr("fimc_is_video_open is fail(%d)", device, ret);
		close_vctx(file, video, vctx);
		goto p_err;
	}

	ret = fimc_is_sensor_open(device, vctx);
	if (ret) {
		merr("fimc_is_ssx_open is fail(%d)", device, ret);
		close_vctx(file, video, vctx);
		goto p_err;
	}

p_err:
	return ret;
}
示例#5
0
static int fimc_is_3a1_video_open(struct file *file)
{
	int ret = 0;
	u32 refcount;
	struct fimc_is_core *core = video_drvdata(file);
	struct fimc_is_video *video = &core->video_3a1;
	struct fimc_is_video_ctx *vctx = NULL;
	struct fimc_is_device_ischain *device = NULL;

	BUG_ON(!core);

	ret = open_vctx(file, video, &vctx, FRAMEMGR_ID_3A1_GRP, FRAMEMGR_ID_3A1);
	if (ret) {
		err("open_vctx is fail(%d)", ret);
		goto p_err;
	}

	pr_info("[3A1:V:%d] %s\n", vctx->instance, __func__);

	refcount = atomic_read(&core->video_isp.refcount);
	if (refcount > FIMC_IS_MAX_NODES) {
		err("invalid ischain refcount(%d)", refcount);
		close_vctx(file, video, vctx);
		ret = -EINVAL;
		goto p_err;
	}

	device = &core->ischain[refcount - 1];

	ret = fimc_is_ischain_3a1_open(device, vctx);
	if (ret) {
		err("fimc_is_ischain_3a1_open is fail");
		close_vctx(file, video, vctx);
		goto p_err;
	}

	fimc_is_video_open(vctx,
		device,
		VIDEO_3A1_READY_BUFFERS,
		video,
		FIMC_IS_VIDEO_TYPE_M2M,
		&fimc_is_3a1_qops,
		&fimc_is_ischain_3a1_ops,
		&fimc_is_ischain_sub_ops,
		core->mem.vb2->ops);

p_err:
	return ret;
}
static int fimc_is_ssx_video_close(struct file *file)
{
	int ret = 0;
	int refcount;
	struct fimc_is_video_ctx *vctx = file->private_data;
	struct fimc_is_video *video;
	struct fimc_is_device_sensor *device;

	BUG_ON(!vctx);
	BUG_ON(!GET_VIDEO(vctx));
	BUG_ON(!GET_DEVICE(vctx));

	video = GET_VIDEO(vctx);
	device = GET_DEVICE(vctx);

	ret = fimc_is_sensor_close(device);
	if (ret)
		merr("fimc_is_sensor_close is fail(%d)", device, ret);

	ret = fimc_is_video_close(vctx);
	if (ret)
		merr("fimc_is_video_close is fail(%d)", device, ret);

	refcount = close_vctx(file, video, vctx);
	if (refcount < 0)
		merr("close_vctx is fail(%d)", device, refcount);

	minfo("[SS%d:V] %s(%d):%d\n", device, GET_SSX_ID(video), __func__, refcount, ret);

	return ret;
}
static int fimc_is_ixc_video_close(struct file *file)
{
	int ret = 0;
	int refcount;
	struct fimc_is_video_ctx *vctx = file->private_data;
	struct fimc_is_video *video;
	struct fimc_is_device_ischain *device;

	BUG_ON(!file);
	BUG_ON(!vctx);
	BUG_ON(!GET_VIDEO(vctx));
	BUG_ON(!GET_DEVICE(vctx));

	video = GET_VIDEO(vctx);
	device = GET_DEVICE(vctx);

	ret = fimc_is_ischain_subdev_close(device, vctx);
	if (ret)
		merr("fimc_is_ischain_subdev_close is fail(%d)", device, ret);

	ret = fimc_is_video_close(vctx);
	if (ret)
		merr("fimc_is_video_close is fail(%d)", device, ret);

	refcount = close_vctx(file, video, vctx);
	if (refcount < 0)
		merr("close_vctx is fail(%d)", device, refcount);

	minfo("[I%dC:V] %s(%d,%d):%d\n", device, GET_IXC_ID(video), __func__, atomic_read(&device->open_cnt), refcount, ret);

	return ret;
}
static int fimc_is_comp_video_close(struct file *file)
{
	int ret = 0;
	int refcount;
	struct fimc_is_video_ctx *vctx = file->private_data;
	struct fimc_is_video *video = NULL;
	struct fimc_is_device_companion *device = NULL;

	BUG_ON(!vctx);

	video = video_drvdata(file);
	device = container_of(video, struct fimc_is_device_companion, video);

	ret = fimc_is_companion_close(device);
	if (ret)
		err("fimc_is_companion_close is fail(%d)", ret);

	vctx->device = NULL;

	refcount = close_vctx(file, video, vctx);
	if (refcount < 0)
		merr("close_vctx is fail(%d)", device, refcount);

	minfo("[COM:V] %s():%d\n", device, __func__, ret);

	return ret;
}
示例#9
0
static int fimc_is_vdc_video_open(struct file *file)
{
	int ret = 0;
	u32 refcount;
	struct fimc_is_core *core = video_drvdata(file);
	struct fimc_is_video *video = &core->video_vdc;
	struct fimc_is_video_ctx *vctx = NULL;
	struct fimc_is_device_ischain *device;

	ret = open_vctx(file, video, &vctx, FRAMEMGR_ID_INVALID, FRAMEMGR_ID_DIS);
	if (ret) {
		err("open_vctx is fail(%d)", ret);
		goto p_err;
	}

	pr_info("[VDC:V:%d] %s\n", vctx->instance, __func__);

	refcount = atomic_read(&core->video_isp.refcount);
	if (refcount > FIMC_IS_MAX_NODES) {
		err("invalid ischain refcount(%d)", refcount);
		close_vctx(file, video, vctx);
		ret = -EINVAL;
		goto p_err;
	}

	device = &core->ischain[refcount - 1];

	ret = fimc_is_ischain_sub_open(&device->dis, vctx, NULL);
	if (ret) {
		err("fimc_is_ischain_sub_open is fail");
		close_vctx(file, video, vctx);
		goto p_err;
	}

	fimc_is_video_open(vctx,
		device,
		VIDEO_VDISC_READY_BUFFERS,
		&core->video_vdc,
		FIMC_IS_VIDEO_TYPE_CAPTURE,
		&fimc_is_vdc_qops,
		NULL,
		&fimc_is_ischain_sub_ops,
		core->mem.vb2->ops);

p_err:
	return ret;
}
static int fimc_is_isp_video_open(struct file *file)
{
	int ret = 0;
	struct fimc_is_core *core;
	struct fimc_is_video *video;
	struct fimc_is_video_ctx *vctx;
	struct fimc_is_device_ischain *device;

	vctx = NULL;
	video = video_drvdata(file);
	core = container_of(video, struct fimc_is_core, video_isp);

	ret = open_vctx(file, video, &vctx, FRAMEMGR_ID_ISP_GRP, FRAMEMGR_ID_INVALID);
	if (ret) {
		err("open_vctx is fail(%d)", ret);
		goto p_err;
	}

	info("[ISP:V:%d] %s\n", vctx->instance, __func__);

	device = &core->ischain[vctx->instance];

	ret = fimc_is_video_open(vctx,
		device,
		VIDEO_ISP_READY_BUFFERS,
		video,
		FIMC_IS_VIDEO_TYPE_OUTPUT,
		&fimc_is_isp_qops,
		&fimc_is_ischain_isp_ops,
		NULL);
	if (ret) {
		err("fimc_is_video_open is fail");
		close_vctx(file, video, vctx);
		goto p_err;
	}

	ret = fimc_is_ischain_open(device, vctx, &core->minfo);
	if (ret) {
		err("fimc_is_ischain_open is fail");
		close_vctx(file, video, vctx);
		goto p_err;
	}

p_err:
	return ret;
}
示例#11
0
static int fimc_is_sen_video_open(struct file *file)
{
	int ret = 0;
	struct fimc_is_video *video;
	struct fimc_is_video_ctx *vctx;
	struct fimc_is_device_sensor *device;

	vctx = NULL;
	video = video_drvdata(file);
	device = container_of(video, struct fimc_is_device_sensor, video);

	ret = open_vctx(file, video, &vctx, FRAMEMGR_ID_INVALID, FRAMEMGR_ID_SENSOR);
	if (ret) {
		err("open_vctx is fail(%d)", ret);
		goto p_err;
	}

	info("[SS%d:V:%d] %s\n", video->id, vctx->instance, __func__);

	ret = fimc_is_video_open(vctx,
		device,
		VIDEO_SENSOR_READY_BUFFERS,
		video,
		FIMC_IS_VIDEO_TYPE_CAPTURE,
		&fimc_is_sen_qops,
		NULL,
		NULL);
	if (ret) {
		merr("fimc_is_video_open is fail(%d)", vctx, ret);
		close_vctx(file, video, vctx);
		goto p_err;
	}

	ret = fimc_is_sensor_open(device, vctx);
	if (ret) {
		merr("fimc_is_sen_open is fail(%d)", vctx, ret);
		close_vctx(file, video, vctx);
		goto p_err;
	}

p_err:
	return ret;
}
static int fimc_is_isp_video_open(struct file *file)
{
	int ret = 0;
	struct fimc_is_core *core = video_drvdata(file);
	struct fimc_is_video *video = &core->video_isp;
	struct fimc_is_video_ctx *vctx = NULL;
	struct fimc_is_device_ischain *device = NULL;

	ret = open_vctx(file, video, &vctx, FRAMEMGR_ID_ISP_GRP, FRAMEMGR_ID_INVALID);
	if (ret) {
		err("open_vctx is fail(%d)", ret);
		goto p_err;
	}

	pr_info("[ISP:V:%d] %s\n", vctx->instance, __func__);

	device = &core->ischain[vctx->instance];

	/* for resource manager */
	if (vctx->instance == 0) {
		core->debug_cnt = 0;
		memset(&core->clock.msk_cnt[0], 0, sizeof(int[GROUP_ID_MAX]));
		core->clock.msk_state = 0;
		core->clock.state_3a0 = 0;
		core->clock.dvfs_level = DVFS_L0;
#if defined(CONFIG_SOC_EXYNOS5420)
		core->clock.dvfs_mif_level = DVFS_MIF_L2;
#endif
		core->clock.dvfs_skipcnt = 0;
		core->clock.dvfs_state = 0;
	}

	ret = fimc_is_ischain_open(device, vctx, &core->minfo);
	if (ret) {
		err("fimc_is_ischain_open is fail");
		close_vctx(file, video, vctx);
		goto p_err;
	}

	fimc_is_video_open(vctx,
		device,
		VIDEO_ISP_READY_BUFFERS,
		&core->video_isp,
		FIMC_IS_VIDEO_TYPE_OUTPUT,
		&fimc_is_isp_qops,
		&fimc_is_ischain_isp_ops,
		NULL,
		core->mem.vb2->ops);

p_err:
	return ret;
}
示例#13
0
static int fimc_is_sen_video_close(struct file *file)
{
	int ret = 0;
	struct fimc_is_video *video = NULL;
	struct fimc_is_video_ctx *vctx = NULL;
	struct fimc_is_device_sensor *device = NULL;

	BUG_ON(!file);

	vctx = file->private_data;
	if (!vctx) {
		err("vctx is NULL");
		ret = -EINVAL;
		goto p_err;
	}

	video = vctx->video;
	if (!video) {
		merr("video is NULL", vctx);
		ret = -EINVAL;
		goto p_err;
	}

	info("[SS0:V:%d] %s\n", vctx->instance, __func__);

	device = vctx->device;
	if (!device) {
		merr("device is NULL", vctx);
		ret = -EINVAL;
		goto p_err;
	}

	ret = fimc_is_sensor_close(device);
	if (ret)
		err("fimc_is_sensor_close is fail(%d)", ret);

	ret = fimc_is_video_close(vctx);
	if (ret)
		err("fimc_is_video_close is fail(%d)", ret);

	ret = close_vctx(file, video, vctx);
	if (ret)
		err("close_vctx is fail(%d)", ret);

p_err:
	return ret;
}
static int fimc_is_isp_video_close(struct file *file)
{
	int ret = 0;
	struct fimc_is_video *video = NULL;
	struct fimc_is_video_ctx *vctx = NULL;
	struct fimc_is_device_ischain *device = NULL;

	BUG_ON(!file);

	vctx = file->private_data;
	if (!vctx) {
		err("vctx is NULL");
		ret = -EINVAL;
		goto p_err;
	}

	video = vctx->video;
	if (!video) {
		err("video is NULL");
		ret = -EINVAL;
		goto p_err;
	}

	info("[ISP:V:%d] %s\n", video->id, __func__);

	device = vctx->device;
	if (!device) {
		err("device is NULL");
		ret = -EINVAL;
		goto p_err;
	}

	if (pm_qos_request_active(&device->user_qos))
		pm_qos_remove_request(&device->user_qos);

	fimc_is_ischain_close(device, vctx);
	fimc_is_video_close(vctx);

	ret = close_vctx(file, video, vctx);
	if (ret < 0)
		err("close_vctx is fail(%d)", ret);

p_err:
	return ret;
}
static int fimc_is_comp_video_open(struct file *file)
{
	int ret = 0;
	struct fimc_is_video *video;
	struct fimc_is_video_ctx *vctx;
	struct fimc_is_device_companion *device;
	struct fimc_is_resourcemgr *resourcemgr;

	vctx = NULL;
	video = video_drvdata(file);
	device = container_of(video, struct fimc_is_device_companion, video);
	resourcemgr = video->resourcemgr;
	if (!resourcemgr) {
		err("resourcemgr is NULL");
		ret = -EINVAL;
		goto p_err;
	}

	ret = fimc_is_resource_open(resourcemgr, RESOURCE_TYPE_COMPANION, NULL);
	if (ret) {
		err("fimc_is_resource_open is fail(%d)", ret);
		goto p_err;
	}

	minfo("[COM:V] %s\n", device, __func__);

	ret = open_vctx(file, video, &vctx, device->instance, FRAMEMGR_ID_INVALID);
	if (ret) {
		err("open_vctx is fail(%d)", ret);
		goto p_err;
	}

	vctx->device = device;

	ret = fimc_is_companion_open(device, vctx);
	if (ret) {
		merr("fimc_is_comp_open is fail(%d)", device, ret);
		close_vctx(file, video, vctx);
		goto p_err;
	}

p_err:
	return ret;
}
static int fimc_is_scp_video_close(struct file *file)
{
	int ret = 0;
	struct fimc_is_video *video = NULL;
	struct fimc_is_video_ctx *vctx = NULL;
	struct fimc_is_device_ischain *device = NULL;

	BUG_ON(!file);

	vctx = file->private_data;
	if (!vctx) {
		err("vctx is NULL");
		ret = -EINVAL;
		goto p_err;
	}

	video = vctx->video;
	if (!video) {
		merr("video is NULL", vctx);
		ret = -EINVAL;
		goto p_err;
	}

	pr_info("[SCP:V:%d] %s\n", vctx->instance, __func__);

	device = vctx->device;
	if (!device) {
		err("device is NULL");
		ret = -EINVAL;
		goto p_err;
	}

	fimc_is_ischain_sub_close(&device->scp);
	fimc_is_video_close(vctx);

	ret = close_vctx(file, video, vctx);
	if (ret < 0)
		err("close_vctx is fail(%d)", ret);

p_err:
	return ret;
}
static int fimc_is_ss1_video_open(struct file *file)
{
	int ret = 0;
	struct fimc_is_core *core = video_drvdata(file);
	struct fimc_is_video *video = &core->video_ss1;
	struct fimc_is_video_ctx *vctx = NULL;
	struct fimc_is_device_sensor *device = NULL;

	ret = open_vctx(file, video, &vctx, FRAMEMGR_ID_INVALID, FRAMEMGR_ID_SS1);
	if (ret) {
		err("open_vctx is fail(%d)", ret);
		goto p_err;
	}

	pr_info("[SS1:V:%d] %s\n", vctx->instance, __func__);

	device = &core->sensor[1];
	device->instance = 1;

	fimc_is_video_open(vctx,
		device,
		VIDEO_SENSOR_READY_BUFFERS,
		video,
		FIMC_IS_VIDEO_TYPE_CAPTURE,
		&fimc_is_ss1_qops,
		NULL,
		&fimc_is_ischain_sub_ops,
		core->mem.vb2->ops);

	ret = fimc_is_sensor_open(device, vctx);
	if (ret < 0) {
		err("fimc_is_sensor_open is fail");
		close_vctx(file, video, vctx);
		goto p_err;
	}

p_err:
	return ret;
}