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_scc_video_open(struct file *file) { int ret = 0; struct fimc_is_core *core = video_drvdata(file); struct fimc_is_device_ischain *ischain = core->ischain[core->ischain_index]; struct fimc_is_group *group = &ischain->group_isp; struct fimc_is_subdev *scc = &ischain->scc; struct fimc_is_video_ctx *video_ctx = NULL; dbg_scc("%s\n", __func__); video_ctx = kzalloc(sizeof *video_ctx, GFP_KERNEL); if (video_ctx == NULL) { dev_err(&(core->pdev->dev), "%s:: Failed to kzalloc\n", __func__); ret = -ENOMEM; goto exit; } file->private_data = video_ctx; fimc_is_video_open(video_ctx, ischain, VIDEO_SCC_READY_BUFFERS, &(core->video_scc.common), V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, &fimc_is_scc_qops, core->mem.vb2->ops); fimc_is_subdev_open(scc, group, ENTRY_SCALERC, video_ctx, NULL); exit: 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; }
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; }
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; }
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_bayer_video_open(struct file *file) { struct fimc_is_core *core = video_drvdata(file); struct fimc_is_video_sensor *video = &core->video_sensor; struct fimc_is_device_sensor *sensor = &core->sensor; dbg_sensor("%s\n", __func__); file->private_data = video; fimc_is_video_open(&video->common, sensor, VIDEO_SENSOR_READY_BUFFERS); fimc_is_sensor_open(sensor); return 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; }
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_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; }