Lines Matching full:cap

63 	void (*config)(struct rkisp1_capture *cap);
64 void (*stop)(struct rkisp1_capture *cap);
65 void (*enable)(struct rkisp1_capture *cap);
66 void (*disable)(struct rkisp1_capture *cap);
67 void (*set_data_path)(struct rkisp1_capture *cap);
68 bool (*is_stopped)(struct rkisp1_capture *cap);
345 int rkisp1_cap_enum_mbus_codes(struct rkisp1_capture *cap, in rkisp1_cap_enum_mbus_codes() argument
348 const struct rkisp1_capture_fmt_cfg *fmts = cap->config->fmts; in rkisp1_cap_enum_mbus_codes()
356 for (i = 0; i < cap->config->fmt_size; i++) { in rkisp1_cap_enum_mbus_codes()
373 static void rkisp1_mi_config_ctrl(struct rkisp1_capture *cap) in rkisp1_mi_config_ctrl() argument
375 u32 mi_ctrl = rkisp1_read(cap->rkisp1, RKISP1_CIF_MI_CTRL); in rkisp1_mi_config_ctrl()
386 rkisp1_write(cap->rkisp1, RKISP1_CIF_MI_CTRL, mi_ctrl); in rkisp1_mi_config_ctrl()
402 static void rkisp1_irq_frame_end_enable(struct rkisp1_capture *cap) in rkisp1_irq_frame_end_enable() argument
404 u32 mi_imsc = rkisp1_read(cap->rkisp1, RKISP1_CIF_MI_IMSC); in rkisp1_irq_frame_end_enable()
406 mi_imsc |= RKISP1_CIF_MI_FRAME(cap); in rkisp1_irq_frame_end_enable()
407 rkisp1_write(cap->rkisp1, RKISP1_CIF_MI_IMSC, mi_imsc); in rkisp1_irq_frame_end_enable()
410 static void rkisp1_mp_config(struct rkisp1_capture *cap) in rkisp1_mp_config() argument
412 const struct v4l2_pix_format_mplane *pixm = &cap->pix.fmt; in rkisp1_mp_config()
413 struct rkisp1_device *rkisp1 = cap->rkisp1; in rkisp1_mp_config()
416 rkisp1_write(rkisp1, cap->config->mi.y_size_init, in rkisp1_mp_config()
418 rkisp1_write(rkisp1, cap->config->mi.cb_size_init, in rkisp1_mp_config()
420 rkisp1_write(rkisp1, cap->config->mi.cr_size_init, in rkisp1_mp_config()
423 rkisp1_irq_frame_end_enable(cap); in rkisp1_mp_config()
426 if (cap->pix.info->comp_planes == 2) { in rkisp1_mp_config()
428 if (cap->pix.cfg->uv_swap) in rkisp1_mp_config()
435 rkisp1_mi_config_ctrl(cap); in rkisp1_mp_config()
439 reg |= cap->pix.cfg->write_format; in rkisp1_mp_config()
447 static void rkisp1_sp_config(struct rkisp1_capture *cap) in rkisp1_sp_config() argument
449 const struct v4l2_pix_format_mplane *pixm = &cap->pix.fmt; in rkisp1_sp_config()
450 struct rkisp1_device *rkisp1 = cap->rkisp1; in rkisp1_sp_config()
453 rkisp1_write(rkisp1, cap->config->mi.y_size_init, in rkisp1_sp_config()
455 rkisp1_write(rkisp1, cap->config->mi.cb_size_init, in rkisp1_sp_config()
457 rkisp1_write(rkisp1, cap->config->mi.cr_size_init, in rkisp1_sp_config()
462 rkisp1_write(rkisp1, RKISP1_CIF_MI_SP_Y_LLENGTH, cap->sp_y_stride); in rkisp1_sp_config()
464 rkisp1_irq_frame_end_enable(cap); in rkisp1_sp_config()
467 if (cap->pix.info->comp_planes == 2) { in rkisp1_sp_config()
469 if (cap->pix.cfg->uv_swap) in rkisp1_sp_config()
476 rkisp1_mi_config_ctrl(cap); in rkisp1_sp_config()
480 mi_ctrl |= cap->pix.cfg->write_format | in rkisp1_sp_config()
482 cap->pix.cfg->output_format | in rkisp1_sp_config()
487 static void rkisp1_mp_disable(struct rkisp1_capture *cap) in rkisp1_mp_disable() argument
489 u32 mi_ctrl = rkisp1_read(cap->rkisp1, RKISP1_CIF_MI_CTRL); in rkisp1_mp_disable()
493 rkisp1_write(cap->rkisp1, RKISP1_CIF_MI_CTRL, mi_ctrl); in rkisp1_mp_disable()
496 static void rkisp1_sp_disable(struct rkisp1_capture *cap) in rkisp1_sp_disable() argument
498 u32 mi_ctrl = rkisp1_read(cap->rkisp1, RKISP1_CIF_MI_CTRL); in rkisp1_sp_disable()
501 rkisp1_write(cap->rkisp1, RKISP1_CIF_MI_CTRL, mi_ctrl); in rkisp1_sp_disable()
504 static void rkisp1_mp_enable(struct rkisp1_capture *cap) in rkisp1_mp_enable() argument
508 rkisp1_mp_disable(cap); in rkisp1_mp_enable()
510 mi_ctrl = rkisp1_read(cap->rkisp1, RKISP1_CIF_MI_CTRL); in rkisp1_mp_enable()
511 if (v4l2_is_format_bayer(cap->pix.info)) in rkisp1_mp_enable()
517 rkisp1_write(cap->rkisp1, RKISP1_CIF_MI_CTRL, mi_ctrl); in rkisp1_mp_enable()
520 static void rkisp1_sp_enable(struct rkisp1_capture *cap) in rkisp1_sp_enable() argument
522 u32 mi_ctrl = rkisp1_read(cap->rkisp1, RKISP1_CIF_MI_CTRL); in rkisp1_sp_enable()
525 rkisp1_write(cap->rkisp1, RKISP1_CIF_MI_CTRL, mi_ctrl); in rkisp1_sp_enable()
528 static void rkisp1_mp_sp_stop(struct rkisp1_capture *cap) in rkisp1_mp_sp_stop() argument
530 if (!cap->is_streaming) in rkisp1_mp_sp_stop()
532 rkisp1_write(cap->rkisp1, RKISP1_CIF_MI_ICR, RKISP1_CIF_MI_FRAME(cap)); in rkisp1_mp_sp_stop()
533 cap->ops->disable(cap); in rkisp1_mp_sp_stop()
536 static bool rkisp1_mp_is_stopped(struct rkisp1_capture *cap) in rkisp1_mp_is_stopped() argument
541 return !(rkisp1_read(cap->rkisp1, RKISP1_CIF_MI_CTRL_SHD) & en); in rkisp1_mp_is_stopped()
544 static bool rkisp1_sp_is_stopped(struct rkisp1_capture *cap) in rkisp1_sp_is_stopped() argument
546 return !(rkisp1_read(cap->rkisp1, RKISP1_CIF_MI_CTRL_SHD) & in rkisp1_sp_is_stopped()
550 static void rkisp1_mp_set_data_path(struct rkisp1_capture *cap) in rkisp1_mp_set_data_path() argument
552 u32 dpcl = rkisp1_read(cap->rkisp1, RKISP1_CIF_VI_DPCL); in rkisp1_mp_set_data_path()
556 rkisp1_write(cap->rkisp1, RKISP1_CIF_VI_DPCL, dpcl); in rkisp1_mp_set_data_path()
559 static void rkisp1_sp_set_data_path(struct rkisp1_capture *cap) in rkisp1_sp_set_data_path() argument
561 u32 dpcl = rkisp1_read(cap->rkisp1, RKISP1_CIF_VI_DPCL); in rkisp1_sp_set_data_path()
564 rkisp1_write(cap->rkisp1, RKISP1_CIF_VI_DPCL, dpcl); in rkisp1_sp_set_data_path()
589 static int rkisp1_dummy_buf_create(struct rkisp1_capture *cap) in rkisp1_dummy_buf_create() argument
591 const struct v4l2_pix_format_mplane *pixm = &cap->pix.fmt; in rkisp1_dummy_buf_create()
592 struct rkisp1_dummy_buffer *dummy_buf = &cap->buf.dummy; in rkisp1_dummy_buf_create()
599 dummy_buf->vaddr = dma_alloc_attrs(cap->rkisp1->dev, in rkisp1_dummy_buf_create()
610 static void rkisp1_dummy_buf_destroy(struct rkisp1_capture *cap) in rkisp1_dummy_buf_destroy() argument
612 dma_free_attrs(cap->rkisp1->dev, in rkisp1_dummy_buf_destroy()
613 cap->buf.dummy.size, cap->buf.dummy.vaddr, in rkisp1_dummy_buf_destroy()
614 cap->buf.dummy.dma_addr, DMA_ATTR_NO_KERNEL_MAPPING); in rkisp1_dummy_buf_destroy()
617 static void rkisp1_set_next_buf(struct rkisp1_capture *cap) in rkisp1_set_next_buf() argument
619 cap->buf.curr = cap->buf.next; in rkisp1_set_next_buf()
620 cap->buf.next = NULL; in rkisp1_set_next_buf()
622 if (!list_empty(&cap->buf.queue)) { in rkisp1_set_next_buf()
625 cap->buf.next = list_first_entry(&cap->buf.queue, struct rkisp1_buffer, queue); in rkisp1_set_next_buf()
626 list_del(&cap->buf.next->queue); in rkisp1_set_next_buf()
628 buff_addr = cap->buf.next->buff_addr; in rkisp1_set_next_buf()
630 rkisp1_write(cap->rkisp1, cap->config->mi.y_base_ad_init, in rkisp1_set_next_buf()
637 if (cap->pix.cfg->fourcc == V4L2_PIX_FMT_GREY) { in rkisp1_set_next_buf()
638 rkisp1_write(cap->rkisp1, in rkisp1_set_next_buf()
639 cap->config->mi.cb_base_ad_init, in rkisp1_set_next_buf()
640 cap->buf.dummy.dma_addr); in rkisp1_set_next_buf()
641 rkisp1_write(cap->rkisp1, in rkisp1_set_next_buf()
642 cap->config->mi.cr_base_ad_init, in rkisp1_set_next_buf()
643 cap->buf.dummy.dma_addr); in rkisp1_set_next_buf()
645 rkisp1_write(cap->rkisp1, in rkisp1_set_next_buf()
646 cap->config->mi.cb_base_ad_init, in rkisp1_set_next_buf()
648 rkisp1_write(cap->rkisp1, in rkisp1_set_next_buf()
649 cap->config->mi.cr_base_ad_init, in rkisp1_set_next_buf()
657 rkisp1_write(cap->rkisp1, cap->config->mi.y_base_ad_init, in rkisp1_set_next_buf()
658 cap->buf.dummy.dma_addr); in rkisp1_set_next_buf()
659 rkisp1_write(cap->rkisp1, cap->config->mi.cb_base_ad_init, in rkisp1_set_next_buf()
660 cap->buf.dummy.dma_addr); in rkisp1_set_next_buf()
661 rkisp1_write(cap->rkisp1, cap->config->mi.cr_base_ad_init, in rkisp1_set_next_buf()
662 cap->buf.dummy.dma_addr); in rkisp1_set_next_buf()
666 rkisp1_write(cap->rkisp1, cap->config->mi.y_offs_cnt_init, 0); in rkisp1_set_next_buf()
667 rkisp1_write(cap->rkisp1, cap->config->mi.cb_offs_cnt_init, 0); in rkisp1_set_next_buf()
668 rkisp1_write(cap->rkisp1, cap->config->mi.cr_offs_cnt_init, 0); in rkisp1_set_next_buf()
676 static void rkisp1_handle_buffer(struct rkisp1_capture *cap) in rkisp1_handle_buffer() argument
678 struct rkisp1_isp *isp = &cap->rkisp1->isp; in rkisp1_handle_buffer()
681 spin_lock(&cap->buf.lock); in rkisp1_handle_buffer()
682 curr_buf = cap->buf.curr; in rkisp1_handle_buffer()
690 cap->rkisp1->debug.frame_drop[cap->id]++; in rkisp1_handle_buffer()
693 rkisp1_set_next_buf(cap); in rkisp1_handle_buffer()
694 spin_unlock(&cap->buf.lock); in rkisp1_handle_buffer()
711 struct rkisp1_capture *cap = &rkisp1->capture_devs[i]; in rkisp1_capture_isr() local
713 if (!(status & RKISP1_CIF_MI_FRAME(cap))) in rkisp1_capture_isr()
715 if (!cap->is_stopping) { in rkisp1_capture_isr()
716 rkisp1_handle_buffer(cap); in rkisp1_capture_isr()
727 if (!cap->ops->is_stopped(cap)) { in rkisp1_capture_isr()
728 cap->ops->stop(cap); in rkisp1_capture_isr()
731 cap->is_stopping = false; in rkisp1_capture_isr()
732 cap->is_streaming = false; in rkisp1_capture_isr()
733 wake_up(&cap->done); in rkisp1_capture_isr()
749 struct rkisp1_capture *cap = queue->drv_priv; in rkisp1_vb2_queue_setup() local
750 const struct v4l2_pix_format_mplane *pixm = &cap->pix.fmt; in rkisp1_vb2_queue_setup()
774 struct rkisp1_capture *cap = vb->vb2_queue->drv_priv; in rkisp1_vb2_buf_init() local
775 const struct v4l2_pix_format_mplane *pixm = &cap->pix.fmt; in rkisp1_vb2_buf_init()
796 if (cap->pix.info->comp_planes == 3 && cap->pix.cfg->uv_swap) in rkisp1_vb2_buf_init()
807 struct rkisp1_capture *cap = vb->vb2_queue->drv_priv; in rkisp1_vb2_buf_queue() local
809 spin_lock_irq(&cap->buf.lock); in rkisp1_vb2_buf_queue()
810 list_add_tail(&ispbuf->queue, &cap->buf.queue); in rkisp1_vb2_buf_queue()
811 spin_unlock_irq(&cap->buf.lock); in rkisp1_vb2_buf_queue()
816 struct rkisp1_capture *cap = vb->vb2_queue->drv_priv; in rkisp1_vb2_buf_prepare() local
819 for (i = 0; i < cap->pix.fmt.num_planes; i++) { in rkisp1_vb2_buf_prepare()
820 unsigned long size = cap->pix.fmt.plane_fmt[i].sizeimage; in rkisp1_vb2_buf_prepare()
823 dev_err(cap->rkisp1->dev, in rkisp1_vb2_buf_prepare()
834 static void rkisp1_return_all_buffers(struct rkisp1_capture *cap, in rkisp1_return_all_buffers() argument
839 spin_lock_irq(&cap->buf.lock); in rkisp1_return_all_buffers()
840 if (cap->buf.curr) { in rkisp1_return_all_buffers()
841 vb2_buffer_done(&cap->buf.curr->vb.vb2_buf, state); in rkisp1_return_all_buffers()
842 cap->buf.curr = NULL; in rkisp1_return_all_buffers()
844 if (cap->buf.next) { in rkisp1_return_all_buffers()
845 vb2_buffer_done(&cap->buf.next->vb.vb2_buf, state); in rkisp1_return_all_buffers()
846 cap->buf.next = NULL; in rkisp1_return_all_buffers()
848 while (!list_empty(&cap->buf.queue)) { in rkisp1_return_all_buffers()
849 buf = list_first_entry(&cap->buf.queue, in rkisp1_return_all_buffers()
854 spin_unlock_irq(&cap->buf.lock); in rkisp1_return_all_buffers()
863 static void rkisp1_cap_stream_enable(struct rkisp1_capture *cap) in rkisp1_cap_stream_enable() argument
865 struct rkisp1_device *rkisp1 = cap->rkisp1; in rkisp1_cap_stream_enable()
866 struct rkisp1_capture *other = &rkisp1->capture_devs[cap->id ^ 1]; in rkisp1_cap_stream_enable()
868 cap->ops->set_data_path(cap); in rkisp1_cap_stream_enable()
869 cap->ops->config(cap); in rkisp1_cap_stream_enable()
872 spin_lock_irq(&cap->buf.lock); in rkisp1_cap_stream_enable()
873 rkisp1_set_next_buf(cap); in rkisp1_cap_stream_enable()
874 cap->ops->enable(cap); in rkisp1_cap_stream_enable()
888 rkisp1_set_next_buf(cap); in rkisp1_cap_stream_enable()
890 spin_unlock_irq(&cap->buf.lock); in rkisp1_cap_stream_enable()
891 cap->is_streaming = true; in rkisp1_cap_stream_enable()
894 static void rkisp1_cap_stream_disable(struct rkisp1_capture *cap) in rkisp1_cap_stream_disable() argument
899 cap->is_stopping = true; in rkisp1_cap_stream_disable()
900 ret = wait_event_timeout(cap->done, in rkisp1_cap_stream_disable()
901 !cap->is_streaming, in rkisp1_cap_stream_disable()
904 cap->rkisp1->debug.stop_timeout[cap->id]++; in rkisp1_cap_stream_disable()
905 cap->ops->stop(cap); in rkisp1_cap_stream_disable()
906 cap->is_stopping = false; in rkisp1_cap_stream_disable()
907 cap->is_streaming = false; in rkisp1_cap_stream_disable()
918 static void rkisp1_pipeline_stream_disable(struct rkisp1_capture *cap) in rkisp1_pipeline_stream_disable() argument
919 __must_hold(&cap->rkisp1->stream_lock) in rkisp1_pipeline_stream_disable()
921 struct rkisp1_device *rkisp1 = cap->rkisp1; in rkisp1_pipeline_stream_disable()
923 rkisp1_cap_stream_disable(cap); in rkisp1_pipeline_stream_disable()
932 v4l2_subdev_call(&rkisp1->resizer_devs[cap->id].sd, video, s_stream, in rkisp1_pipeline_stream_disable()
942 static int rkisp1_pipeline_stream_enable(struct rkisp1_capture *cap) in rkisp1_pipeline_stream_enable() argument
943 __must_hold(&cap->rkisp1->stream_lock) in rkisp1_pipeline_stream_enable()
945 struct rkisp1_device *rkisp1 = cap->rkisp1; in rkisp1_pipeline_stream_enable()
948 rkisp1_cap_stream_enable(cap); in rkisp1_pipeline_stream_enable()
950 ret = v4l2_subdev_call(&rkisp1->resizer_devs[cap->id].sd, video, in rkisp1_pipeline_stream_enable()
969 v4l2_subdev_call(&rkisp1->resizer_devs[cap->id].sd, video, s_stream, in rkisp1_pipeline_stream_enable()
972 rkisp1_cap_stream_disable(cap); in rkisp1_pipeline_stream_enable()
979 struct rkisp1_capture *cap = queue->drv_priv; in rkisp1_vb2_stop_streaming() local
980 struct rkisp1_vdev_node *node = &cap->vnode; in rkisp1_vb2_stop_streaming()
981 struct rkisp1_device *rkisp1 = cap->rkisp1; in rkisp1_vb2_stop_streaming()
984 mutex_lock(&cap->rkisp1->stream_lock); in rkisp1_vb2_stop_streaming()
986 rkisp1_pipeline_stream_disable(cap); in rkisp1_vb2_stop_streaming()
988 rkisp1_return_all_buffers(cap, VB2_BUF_STATE_ERROR); in rkisp1_vb2_stop_streaming()
995 rkisp1_dummy_buf_destroy(cap); in rkisp1_vb2_stop_streaming()
999 mutex_unlock(&cap->rkisp1->stream_lock); in rkisp1_vb2_stop_streaming()
1005 struct rkisp1_capture *cap = queue->drv_priv; in rkisp1_vb2_start_streaming() local
1006 struct media_entity *entity = &cap->vnode.vdev.entity; in rkisp1_vb2_start_streaming()
1009 mutex_lock(&cap->rkisp1->stream_lock); in rkisp1_vb2_start_streaming()
1011 ret = video_device_pipeline_start(&cap->vnode.vdev, &cap->rkisp1->pipe); in rkisp1_vb2_start_streaming()
1013 dev_err(cap->rkisp1->dev, "start pipeline failed %d\n", ret); in rkisp1_vb2_start_streaming()
1017 ret = rkisp1_dummy_buf_create(cap); in rkisp1_vb2_start_streaming()
1021 ret = pm_runtime_resume_and_get(cap->rkisp1->dev); in rkisp1_vb2_start_streaming()
1023 dev_err(cap->rkisp1->dev, "power up failed %d\n", ret); in rkisp1_vb2_start_streaming()
1028 dev_err(cap->rkisp1->dev, "open cif pipeline failed %d\n", ret); in rkisp1_vb2_start_streaming()
1032 ret = rkisp1_pipeline_stream_enable(cap); in rkisp1_vb2_start_streaming()
1036 mutex_unlock(&cap->rkisp1->stream_lock); in rkisp1_vb2_start_streaming()
1043 pm_runtime_put(cap->rkisp1->dev); in rkisp1_vb2_start_streaming()
1045 rkisp1_dummy_buf_destroy(cap); in rkisp1_vb2_start_streaming()
1047 video_device_pipeline_stop(&cap->vnode.vdev); in rkisp1_vb2_start_streaming()
1049 rkisp1_return_all_buffers(cap, VB2_BUF_STATE_QUEUED); in rkisp1_vb2_start_streaming()
1050 mutex_unlock(&cap->rkisp1->stream_lock); in rkisp1_vb2_start_streaming()
1115 rkisp1_find_fmt_cfg(const struct rkisp1_capture *cap, const u32 pixelfmt) in rkisp1_find_fmt_cfg() argument
1119 for (i = 0; i < cap->config->fmt_size; i++) { in rkisp1_find_fmt_cfg()
1120 if (cap->config->fmts[i].fourcc == pixelfmt) in rkisp1_find_fmt_cfg()
1121 return &cap->config->fmts[i]; in rkisp1_find_fmt_cfg()
1126 static void rkisp1_try_fmt(const struct rkisp1_capture *cap, in rkisp1_try_fmt() argument
1131 const struct rkisp1_capture_config *config = cap->config; in rkisp1_try_fmt()
1139 fmt = rkisp1_find_fmt_cfg(cap, pixm->pixelformat); in rkisp1_try_fmt()
1146 RKISP1_RSZ_SRC_MIN_WIDTH, max_widths[cap->id]); in rkisp1_try_fmt()
1148 RKISP1_RSZ_SRC_MIN_HEIGHT, max_heights[cap->id]); in rkisp1_try_fmt()
1155 info = rkisp1_fill_pixfmt(pixm, cap->id); in rkisp1_try_fmt()
1163 static void rkisp1_set_fmt(struct rkisp1_capture *cap, in rkisp1_set_fmt() argument
1166 rkisp1_try_fmt(cap, pixm, &cap->pix.cfg, &cap->pix.info); in rkisp1_set_fmt()
1167 cap->pix.fmt = *pixm; in rkisp1_set_fmt()
1170 if (cap->id == RKISP1_SELFPATH) in rkisp1_set_fmt()
1171 cap->sp_y_stride = pixm->plane_fmt[0].bytesperline / in rkisp1_set_fmt()
1172 cap->pix.info->bpp[0]; in rkisp1_set_fmt()
1178 struct rkisp1_capture *cap = video_drvdata(file); in rkisp1_try_fmt_vid_cap_mplane() local
1180 rkisp1_try_fmt(cap, &f->fmt.pix_mp, NULL, NULL); in rkisp1_try_fmt_vid_cap_mplane()
1188 struct rkisp1_capture *cap = video_drvdata(file); in rkisp1_enum_fmt_vid_cap_mplane() local
1193 if (f->index >= cap->config->fmt_size) in rkisp1_enum_fmt_vid_cap_mplane()
1196 fmt = &cap->config->fmts[f->index]; in rkisp1_enum_fmt_vid_cap_mplane()
1201 for (i = 0; i < cap->config->fmt_size; i++) { in rkisp1_enum_fmt_vid_cap_mplane()
1202 if (cap->config->fmts[i].mbus != f->mbus_code) in rkisp1_enum_fmt_vid_cap_mplane()
1206 f->pixelformat = cap->config->fmts[i].fourcc; in rkisp1_enum_fmt_vid_cap_mplane()
1216 struct rkisp1_capture *cap = video_drvdata(file); in rkisp1_s_fmt_vid_cap_mplane() local
1218 rkisp1_vdev_to_node(&cap->vnode.vdev); in rkisp1_s_fmt_vid_cap_mplane()
1223 rkisp1_set_fmt(cap, &f->fmt.pix_mp); in rkisp1_s_fmt_vid_cap_mplane()
1231 struct rkisp1_capture *cap = video_drvdata(file); in rkisp1_g_fmt_vid_cap_mplane() local
1233 f->fmt.pix_mp = cap->pix.fmt; in rkisp1_g_fmt_vid_cap_mplane()
1239 rkisp1_querycap(struct file *file, void *priv, struct v4l2_capability *cap) in rkisp1_querycap() argument
1241 strscpy(cap->driver, RKISP1_DRIVER_NAME, sizeof(cap->driver)); in rkisp1_querycap()
1242 strscpy(cap->card, RKISP1_DRIVER_NAME, sizeof(cap->card)); in rkisp1_querycap()
1243 strscpy(cap->bus_info, RKISP1_BUS_INFO, sizeof(cap->bus_info)); in rkisp1_querycap()
1273 struct rkisp1_capture *cap = video_get_drvdata(vdev); in rkisp1_capture_link_validate() local
1275 rkisp1_find_fmt_cfg(cap, cap->pix.fmt.pixelformat); in rkisp1_capture_link_validate()
1286 if (sd_fmt.format.height != cap->pix.fmt.height || in rkisp1_capture_link_validate()
1287 sd_fmt.format.width != cap->pix.fmt.width || in rkisp1_capture_link_validate()
1289 dev_dbg(cap->rkisp1->dev, in rkisp1_capture_link_validate()
1294 sd_fmt.format.height, fmt->mbus, cap->pix.fmt.width, in rkisp1_capture_link_validate()
1295 cap->pix.fmt.height); in rkisp1_capture_link_validate()
1318 static void rkisp1_unregister_capture(struct rkisp1_capture *cap) in rkisp1_unregister_capture() argument
1320 if (!video_is_registered(&cap->vnode.vdev)) in rkisp1_unregister_capture()
1323 media_entity_cleanup(&cap->vnode.vdev.entity); in rkisp1_unregister_capture()
1324 vb2_video_unregister_device(&cap->vnode.vdev); in rkisp1_unregister_capture()
1325 mutex_destroy(&cap->vnode.vlock); in rkisp1_unregister_capture()
1337 static int rkisp1_register_capture(struct rkisp1_capture *cap) in rkisp1_register_capture() argument
1341 struct v4l2_device *v4l2_dev = &cap->rkisp1->v4l2_dev; in rkisp1_register_capture()
1342 struct video_device *vdev = &cap->vnode.vdev; in rkisp1_register_capture()
1347 strscpy(vdev->name, dev_names[cap->id], sizeof(vdev->name)); in rkisp1_register_capture()
1360 video_set_drvdata(vdev, cap); in rkisp1_register_capture()
1367 q->drv_priv = cap; in rkisp1_register_capture()
1374 q->dev = cap->rkisp1->dev; in rkisp1_register_capture()
1377 dev_err(cap->rkisp1->dev, in rkisp1_register_capture()
1390 dev_err(cap->rkisp1->dev, in rkisp1_register_capture()
1409 struct rkisp1_capture *cap = &rkisp1->capture_devs[id]; in rkisp1_capture_init() local
1412 memset(cap, 0, sizeof(*cap)); in rkisp1_capture_init()
1413 cap->id = id; in rkisp1_capture_init()
1414 cap->rkisp1 = rkisp1; in rkisp1_capture_init()
1416 INIT_LIST_HEAD(&cap->buf.queue); in rkisp1_capture_init()
1417 init_waitqueue_head(&cap->done); in rkisp1_capture_init()
1418 spin_lock_init(&cap->buf.lock); in rkisp1_capture_init()
1419 if (cap->id == RKISP1_SELFPATH) { in rkisp1_capture_init()
1420 cap->ops = &rkisp1_capture_ops_sp; in rkisp1_capture_init()
1421 cap->config = &rkisp1_capture_config_sp; in rkisp1_capture_init()
1423 cap->ops = &rkisp1_capture_ops_mp; in rkisp1_capture_init()
1424 cap->config = &rkisp1_capture_config_mp; in rkisp1_capture_init()
1427 cap->is_streaming = false; in rkisp1_capture_init()
1433 rkisp1_set_fmt(cap, &pixm); in rkisp1_capture_init()
1442 struct rkisp1_capture *cap = &rkisp1->capture_devs[i]; in rkisp1_capture_devs_register() local
1446 ret = rkisp1_register_capture(cap); in rkisp1_capture_devs_register()