static int fimc_is_scp_video_s_ctrl(struct file *file, void *priv, struct v4l2_control *ctrl) { int ret = 0; unsigned long flags; struct fimc_is_video_ctx *vctx = file->private_data; struct fimc_is_framemgr *framemgr; struct fimc_is_frame *frame; BUG_ON(!vctx); BUG_ON(!ctrl); mdbgv_scp("%s\n", vctx, __func__); framemgr = GET_DST_FRAMEMGR(vctx); frame = NULL; switch (ctrl->id) { case V4L2_CID_IS_FORCE_DONE: if (framemgr->frame_pro_cnt) { err("force done can be performed(process count %d)", framemgr->frame_pro_cnt); ret = -EINVAL; } else if (!framemgr->frame_req_cnt) { err("force done can be performed(request count %d)", framemgr->frame_req_cnt); ret = -EINVAL; } else { framemgr_e_barrier_irqs(framemgr, 0, flags); fimc_is_frame_request_head(framemgr, &frame); if (frame) { fimc_is_frame_trans_req_to_com(framemgr, frame); buffer_done(vctx, frame->index); } else { err("frame is NULL"); ret = -EINVAL; } framemgr_x_barrier_irqr(framemgr, 0, flags); } break; default: err("unsupported ioctl(%d)\n", ctrl->id); ret = -EINVAL; break; } return ret; }
static int fimc_is_scc_video_s_ctrl(struct file *file, void *priv, struct v4l2_control *ctrl) { int ret = 0; unsigned long flags; struct fimc_is_video_ctx *video_ctx = file->private_data; struct fimc_is_device_ischain *ischain = video_ctx->device; struct fimc_is_subdev *scc = &ischain->scc; struct fimc_is_framemgr *framemgr = &scc->framemgr; struct fimc_is_frame_shot *frame; dbg_scc("%s\n", __func__); switch (ctrl->id) { case V4L2_CID_IS_FORCE_DONE: if (framemgr->frame_process_cnt) { err("force done can be performed(process count %d)", framemgr->frame_process_cnt); ret = -EINVAL; } else if (!framemgr->frame_request_cnt) { err("force done can be performed(request count %d)", framemgr->frame_request_cnt); ret = -EINVAL; } else { framemgr_e_barrier_irqs(framemgr, 0, flags); fimc_is_frame_request_head(framemgr, &frame); if (frame) { fimc_is_frame_trans_req_to_com(framemgr, frame); buffer_done(video_ctx, frame->index); } else { err("frame is NULL"); ret = -EINVAL; } framemgr_x_barrier_irqr(framemgr, 0, flags); } break; default: err("unsupported ioctl(%d)\n", ctrl->id); ret = -EINVAL; break; } return ret; }
static int fimc_is_scp_video_s_ctrl(struct file *file, void *priv, struct v4l2_control *ctrl) { int ret = 0; unsigned long flags; struct fimc_is_video_ctx *vctx = file->private_data; struct fimc_is_device_ischain *device; struct fimc_is_framemgr *framemgr; struct fimc_is_frame *frame; BUG_ON(!vctx); BUG_ON(!ctrl); mdbgv_scp("%s\n", vctx, __func__); device = vctx->device; if (!device) { merr("device is NULL", vctx); ret = -EINVAL; goto p_err; } framemgr = GET_DST_FRAMEMGR(vctx); frame = NULL; switch (ctrl->id) { case V4L2_CID_IS_FORCE_DONE: if (framemgr->frame_pro_cnt) { err("force done can be performed(process count %d)", framemgr->frame_pro_cnt); ret = -EINVAL; } else if (!framemgr->frame_req_cnt) { err("force done can be performed(request count %d)", framemgr->frame_req_cnt); ret = -EINVAL; } else { framemgr_e_barrier_irqs(framemgr, 0, flags); fimc_is_frame_request_head(framemgr, &frame); if (frame) { fimc_is_frame_trans_req_to_com(framemgr, frame); buffer_done(vctx, frame->index); } else { err("frame is NULL"); ret = -EINVAL; } framemgr_x_barrier_irqr(framemgr, 0, flags); } break; case V4L2_CID_IS_COLOR_RANGE: if (test_bit(FIMC_IS_SUBDEV_START, &device->group_isp.leader.state)) { err("failed to change color range: device started already (0x%08x)", ctrl->value); ret = -EINVAL; } else { device->setfile &= ~FIMC_IS_SCP_CRANGE_MASK; if (ctrl->value) device->setfile |= (FIMC_IS_CRANGE_LIMITED << FIMC_IS_SCP_CRANGE_SHIFT); } break; default: err("unsupported ioctl(%d)\n", ctrl->id); ret = -EINVAL; break; } p_err: return ret; }
static void tasklet_func_flite_end(unsigned long data) { struct fimc_is_device_flite *flite; struct fimc_is_device_sensor *sensor; struct fimc_is_framemgr *framemgr; struct fimc_is_frame_shot *frame; u32 index, bdone; u32 fcount; flite = (struct fimc_is_device_flite *)data; sensor = (struct fimc_is_device_sensor *)flite->private_data; framemgr = flite->framemgr; bdone = flite->tasklet_param_end; fcount = atomic_read(&flite->fcount); #ifdef DBG_STREAMING printk(KERN_INFO "E%d %d\n", bdone, fcount); #endif framemgr_e_barrier(framemgr, FMGR_IDX_1 + bdone); spin_lock(&flite->slock_state); if (test_bit(bdone, &flite->state)) { fimc_is_frame_process_head(framemgr, &frame); if (frame) { #ifdef MEASURE_TIME #ifndef INTERNAL_TIME do_gettimeofday(&frame->tzone[TM_FLITE_END]); #endif #endif index = frame->index; fimc_is_frame_trans_pro_to_com(framemgr, frame); #ifdef AUTO_MODE if (!work_pending(&flite->work_queue)) { flite->work = index; schedule_work(&flite->work_queue); } else { struct fimc_is_device_ischain *ischain; ischain = sensor->ischain; frame->shot_ext->request_scc = 0; frame->shot_ext->request_scp = 0; buffer_done(flite->video, index); err("work pending, %d frame drop", index); fimc_is_frame_print_all(ischain->framemgr); } #else buffer_done(flite->video, index); #endif fimc_is_frame_request_head(framemgr, &frame); if (frame) { flite_hw_set_start_addr(flite->regs, bdone, frame->dvaddr_buffer[0]); set_bit(bdone, &flite->state); fimc_is_frame_trans_req_to_pro(framemgr, frame); } else { flite_hw_set_unuse_buffer(flite->regs, bdone); clear_bit(bdone, &flite->state); #ifdef TASKLET_MSG err("request shot is empty0(%d slot)", bdone); #endif fimc_is_frame_print_all(framemgr); /*this is debugging ponit for deadlock*/ /* fimc_is_ischain_print_status(sensor->ischain); */ } } else { #ifdef TASKLET_MSG err("process shot is empty(state is invalid(%d, %ld))", bdone, flite->state); #endif fimc_is_frame_print_all(framemgr); } } else { fimc_is_frame_request_head(framemgr, &frame); if (frame) { flite_hw_set_start_addr(flite->regs, bdone, frame->dvaddr_buffer[0]); flite_hw_set_use_buffer(flite->regs, bdone); set_bit(bdone, &flite->state); fimc_is_frame_trans_req_to_pro(framemgr, frame); } else { #ifdef TASKLET_MSG err("request shot is empty1(%d slot)", bdone); #endif fimc_is_frame_print_all(framemgr); } } spin_unlock(&flite->slock_state); framemgr_x_barrier(framemgr, FMGR_IDX_1 + bdone); }