Lines Matching refs:fimc
35 static struct v4l2_subdev *fimc_subdev_register(struct fimc_dev *fimc, in fimc_subdev_register() argument
39 struct fimc_vid_cap *vid_cap = &fimc->vid_cap; in fimc_subdev_register()
59 static void fimc_subdev_unregister(struct fimc_dev *fimc) in fimc_subdev_unregister() argument
61 struct fimc_vid_cap *vid_cap = &fimc->vid_cap; in fimc_subdev_unregister()
86 static int fimc_subdev_attach(struct fimc_dev *fimc, int index) in fimc_subdev_attach() argument
88 struct fimc_vid_cap *vid_cap = &fimc->vid_cap; in fimc_subdev_attach()
89 struct s5p_platform_fimc *pdata = fimc->pdata; in fimc_subdev_attach()
100 sd = fimc_subdev_register(fimc, isp_info); in fimc_subdev_attach()
112 fimc->id); in fimc_subdev_attach()
116 static int fimc_isp_subdev_init(struct fimc_dev *fimc, unsigned int index) in fimc_isp_subdev_init() argument
119 struct s5p_platform_fimc *pdata = fimc->pdata; in fimc_isp_subdev_init()
128 clk_set_rate(fimc->clock[CLK_CAM], isp_info->clk_frequency); in fimc_isp_subdev_init()
130 ret = clk_enable(fimc->clock[CLK_CAM]); in fimc_isp_subdev_init()
134 ret = fimc_subdev_attach(fimc, index); in fimc_isp_subdev_init()
138 ret = fimc_hw_set_camera_polarity(fimc, isp_info); in fimc_isp_subdev_init()
142 ret = v4l2_subdev_call(fimc->vid_cap.sd, core, s_power, 1); in fimc_isp_subdev_init()
147 fimc_subdev_unregister(fimc); in fimc_isp_subdev_init()
149 v4l2_err(&fimc->vid_cap.v4l2_dev, "ISP initialization failed: %d\n", in fimc_isp_subdev_init()
155 static int fimc_stop_capture(struct fimc_dev *fimc) in fimc_stop_capture() argument
161 cap = &fimc->vid_cap; in fimc_stop_capture()
163 if (!fimc_capture_active(fimc)) in fimc_stop_capture()
166 spin_lock_irqsave(&fimc->slock, flags); in fimc_stop_capture()
167 set_bit(ST_CAPT_SHUT, &fimc->state); in fimc_stop_capture()
168 fimc_deactivate_capture(fimc); in fimc_stop_capture()
169 spin_unlock_irqrestore(&fimc->slock, flags); in fimc_stop_capture()
171 wait_event_timeout(fimc->irq_queue, in fimc_stop_capture()
172 !test_bit(ST_CAPT_SHUT, &fimc->state), in fimc_stop_capture()
177 spin_lock_irqsave(&fimc->slock, flags); in fimc_stop_capture()
178 fimc->state &= ~(1 << ST_CAPT_RUN | 1 << ST_CAPT_PEND | in fimc_stop_capture()
181 fimc->vid_cap.active_buf_cnt = 0; in fimc_stop_capture()
194 spin_unlock_irqrestore(&fimc->slock, flags); in fimc_stop_capture()
196 dbg("state: 0x%lx", fimc->state); in fimc_stop_capture()
203 struct fimc_dev *fimc = ctx->fimc_dev; in start_streaming() local
207 fimc_hw_reset(fimc); in start_streaming()
209 ret = v4l2_subdev_call(fimc->vid_cap.sd, video, s_stream, 1); in start_streaming()
217 isp_info = &fimc->pdata->isp_info[fimc->vid_cap.input_index]; in start_streaming()
218 fimc_hw_set_camera_type(fimc, isp_info); in start_streaming()
219 fimc_hw_set_camera_source(fimc, isp_info); in start_streaming()
220 fimc_hw_set_camera_offset(fimc, &ctx->s_frame); in start_streaming()
239 INIT_LIST_HEAD(&fimc->vid_cap.pending_buf_q); in start_streaming()
240 INIT_LIST_HEAD(&fimc->vid_cap.active_buf_q); in start_streaming()
241 fimc->vid_cap.active_buf_cnt = 0; in start_streaming()
242 fimc->vid_cap.frame_count = 0; in start_streaming()
243 fimc->vid_cap.buf_index = 0; in start_streaming()
245 set_bit(ST_CAPT_PEND, &fimc->state); in start_streaming()
253 struct fimc_dev *fimc = ctx->fimc_dev; in stop_streaming() local
255 if (!fimc_capture_active(fimc)) in stop_streaming()
258 return fimc_stop_capture(fimc); in stop_streaming()
332 struct fimc_dev *fimc = ctx->fimc_dev; in buffer_queue() local
335 struct fimc_vid_cap *vid_cap = &fimc->vid_cap; in buffer_queue()
339 spin_lock_irqsave(&fimc->slock, flags); in buffer_queue()
342 if (!test_bit(ST_CAPT_STREAM, &fimc->state) in buffer_queue()
348 fimc_hw_set_output_addr(fimc, &buf->paddr, buf_id); in buffer_queue()
361 !test_and_set_bit(ST_CAPT_STREAM, &fimc->state)) in buffer_queue()
364 spin_unlock_irqrestore(&fimc->slock, flags); in buffer_queue()
392 struct fimc_dev *fimc = video_drvdata(file); in fimc_capture_open() local
395 dbg("pid: %d, state: 0x%lx", task_pid_nr(current), fimc->state); in fimc_capture_open()
398 if (fimc_m2m_active(fimc)) in fimc_capture_open()
401 if (++fimc->vid_cap.refcnt == 1) { in fimc_capture_open()
402 ret = fimc_isp_subdev_init(fimc, 0); in fimc_capture_open()
404 fimc->vid_cap.refcnt--; in fimc_capture_open()
409 file->private_data = fimc->vid_cap.ctx; in fimc_capture_open()
416 struct fimc_dev *fimc = video_drvdata(file); in fimc_capture_close() local
418 dbg("pid: %d, state: 0x%lx", task_pid_nr(current), fimc->state); in fimc_capture_close()
420 if (--fimc->vid_cap.refcnt == 0) { in fimc_capture_close()
421 fimc_stop_capture(fimc); in fimc_capture_close()
422 vb2_queue_release(&fimc->vid_cap.vbq); in fimc_capture_close()
424 v4l2_err(&fimc->vid_cap.v4l2_dev, "releasing ISP\n"); in fimc_capture_close()
426 v4l2_subdev_call(fimc->vid_cap.sd, core, s_power, 0); in fimc_capture_close()
427 clk_disable(fimc->clock[CLK_CAM]); in fimc_capture_close()
428 fimc_subdev_unregister(fimc); in fimc_capture_close()
438 struct fimc_dev *fimc = ctx->fimc_dev; in fimc_capture_poll() local
440 return vb2_poll(&fimc->vid_cap.vbq, file, wait); in fimc_capture_poll()
446 struct fimc_dev *fimc = ctx->fimc_dev; in fimc_capture_mmap() local
448 return vb2_mmap(&fimc->vid_cap.vbq, vma); in fimc_capture_mmap()
465 struct fimc_dev *fimc = ctx->fimc_dev; in fimc_vidioc_querycap_capture() local
467 strncpy(cap->driver, fimc->pdev->name, sizeof(cap->driver) - 1); in fimc_vidioc_querycap_capture()
468 strncpy(cap->card, fimc->pdev->name, sizeof(cap->card) - 1); in fimc_vidioc_querycap_capture()
481 struct fimc_dev *fimc = ctx->fimc_dev; in sync_capture_fmt() local
482 struct v4l2_mbus_framefmt *fmt = &fimc->vid_cap.fmt; in sync_capture_fmt()
488 ret = v4l2_subdev_call(fimc->vid_cap.sd, video, s_mbus_fmt, fmt); in sync_capture_fmt()
517 struct fimc_dev *fimc = ctx->fimc_dev; in fimc_cap_s_fmt_mplane() local
530 if (vb2_is_busy(&fimc->vid_cap.vbq) || fimc_capture_active(fimc)) in fimc_cap_s_fmt_mplane()
585 struct fimc_dev *fimc = ctx->fimc_dev; in fimc_cap_s_input() local
586 struct s5p_platform_fimc *pdata = fimc->pdata; in fimc_cap_s_input()
595 if (fimc->vid_cap.sd) { in fimc_cap_s_input()
596 int ret = v4l2_subdev_call(fimc->vid_cap.sd, core, s_power, 0); in fimc_cap_s_input()
600 clk_disable(fimc->clock[CLK_CAM]); in fimc_cap_s_input()
604 fimc_subdev_unregister(fimc); in fimc_cap_s_input()
606 return fimc_isp_subdev_init(fimc, i); in fimc_cap_s_input()
623 struct fimc_dev *fimc = ctx->fimc_dev; in fimc_cap_streamon() local
625 if (fimc_capture_active(fimc) || !fimc->vid_cap.sd) in fimc_cap_streamon()
629 v4l2_err(&fimc->vid_cap.v4l2_dev, "Format is not set\n"); in fimc_cap_streamon()
633 return vb2_streamon(&fimc->vid_cap.vbq, type); in fimc_cap_streamon()
640 struct fimc_dev *fimc = ctx->fimc_dev; in fimc_cap_streamoff() local
642 return vb2_streamoff(&fimc->vid_cap.vbq, type); in fimc_cap_streamoff()
748 struct fimc_dev *fimc = ctx->fimc_dev; in fimc_cap_s_crop() local
751 if (fimc_capture_active(fimc)) in fimc_cap_s_crop()
759 v4l2_err(&fimc->vid_cap.v4l2_dev, in fimc_cap_s_crop()
770 v4l2_err(&fimc->vid_cap.v4l2_dev, "Out of the scaler range\n"); in fimc_cap_s_crop()
814 int fimc_register_capture_device(struct fimc_dev *fimc) in fimc_register_capture_device() argument
816 struct v4l2_device *v4l2_dev = &fimc->vid_cap.v4l2_dev; in fimc_register_capture_device()
829 ctx->fimc_dev = fimc; in fimc_register_capture_device()
843 "%s.capture", dev_name(&fimc->pdev->dev)); in fimc_register_capture_device()
856 dev_name(&fimc->pdev->dev)); in fimc_register_capture_device()
862 vfd->lock = &fimc->lock; in fimc_register_capture_device()
863 video_set_drvdata(vfd, fimc); in fimc_register_capture_device()
865 vid_cap = &fimc->vid_cap; in fimc_register_capture_device()
878 q = &fimc->vid_cap.vbq; in fimc_register_capture_device()
882 q->drv_priv = fimc->vid_cap.ctx; in fimc_register_capture_device()
906 dev_err(&fimc->pdev->dev, "failed to install\n"); in fimc_register_capture_device()
910 void fimc_unregister_capture_device(struct fimc_dev *fimc) in fimc_unregister_capture_device() argument
912 struct fimc_vid_cap *capture = &fimc->vid_cap; in fimc_unregister_capture_device()