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);
367 int rkisp1_cap_enum_mbus_codes(struct rkisp1_capture *cap, in rkisp1_cap_enum_mbus_codes() argument
370 const struct rkisp1_capture_fmt_cfg *fmts = cap->config->fmts; in rkisp1_cap_enum_mbus_codes()
378 for (i = 0; i < cap->config->fmt_size; i++) { in rkisp1_cap_enum_mbus_codes()
395 static void rkisp1_mi_config_ctrl(struct rkisp1_capture *cap) in rkisp1_mi_config_ctrl() argument
397 u32 mi_ctrl = rkisp1_read(cap->rkisp1, RKISP1_CIF_MI_CTRL); in rkisp1_mi_config_ctrl()
408 rkisp1_write(cap->rkisp1, RKISP1_CIF_MI_CTRL, mi_ctrl); in rkisp1_mi_config_ctrl()
424 static void rkisp1_irq_frame_end_enable(struct rkisp1_capture *cap) in rkisp1_irq_frame_end_enable() argument
426 u32 mi_imsc = rkisp1_read(cap->rkisp1, RKISP1_CIF_MI_IMSC); in rkisp1_irq_frame_end_enable()
428 mi_imsc |= RKISP1_CIF_MI_FRAME(cap); in rkisp1_irq_frame_end_enable()
429 rkisp1_write(cap->rkisp1, RKISP1_CIF_MI_IMSC, mi_imsc); in rkisp1_irq_frame_end_enable()
432 static void rkisp1_mp_config(struct rkisp1_capture *cap) in rkisp1_mp_config() argument
434 const struct v4l2_pix_format_mplane *pixm = &cap->pix.fmt; in rkisp1_mp_config()
435 struct rkisp1_device *rkisp1 = cap->rkisp1; in rkisp1_mp_config()
438 rkisp1_write(rkisp1, cap->config->mi.y_size_init, in rkisp1_mp_config()
440 rkisp1_write(rkisp1, cap->config->mi.cb_size_init, in rkisp1_mp_config()
442 rkisp1_write(rkisp1, cap->config->mi.cr_size_init, in rkisp1_mp_config()
445 rkisp1_irq_frame_end_enable(cap); in rkisp1_mp_config()
448 if (cap->pix.info->comp_planes == 2) { in rkisp1_mp_config()
450 if (cap->pix.cfg->uv_swap) in rkisp1_mp_config()
457 rkisp1_mi_config_ctrl(cap); in rkisp1_mp_config()
461 reg |= cap->pix.cfg->write_format; in rkisp1_mp_config()
469 static void rkisp1_sp_config(struct rkisp1_capture *cap) in rkisp1_sp_config() argument
471 const struct v4l2_pix_format_mplane *pixm = &cap->pix.fmt; in rkisp1_sp_config()
472 struct rkisp1_device *rkisp1 = cap->rkisp1; in rkisp1_sp_config()
475 rkisp1_write(rkisp1, cap->config->mi.y_size_init, in rkisp1_sp_config()
477 rkisp1_write(rkisp1, cap->config->mi.cb_size_init, in rkisp1_sp_config()
479 rkisp1_write(rkisp1, cap->config->mi.cr_size_init, in rkisp1_sp_config()
484 rkisp1_write(rkisp1, RKISP1_CIF_MI_SP_Y_LLENGTH, cap->sp_y_stride); in rkisp1_sp_config()
486 rkisp1_irq_frame_end_enable(cap); in rkisp1_sp_config()
489 if (cap->pix.info->comp_planes == 2) { in rkisp1_sp_config()
491 if (cap->pix.cfg->uv_swap) in rkisp1_sp_config()
498 rkisp1_mi_config_ctrl(cap); in rkisp1_sp_config()
502 mi_ctrl |= cap->pix.cfg->write_format | in rkisp1_sp_config()
504 cap->pix.cfg->output_format | in rkisp1_sp_config()
509 static void rkisp1_mp_disable(struct rkisp1_capture *cap) in rkisp1_mp_disable() argument
511 u32 mi_ctrl = rkisp1_read(cap->rkisp1, RKISP1_CIF_MI_CTRL); in rkisp1_mp_disable()
515 rkisp1_write(cap->rkisp1, RKISP1_CIF_MI_CTRL, mi_ctrl); in rkisp1_mp_disable()
518 static void rkisp1_sp_disable(struct rkisp1_capture *cap) in rkisp1_sp_disable() argument
520 u32 mi_ctrl = rkisp1_read(cap->rkisp1, RKISP1_CIF_MI_CTRL); in rkisp1_sp_disable()
523 rkisp1_write(cap->rkisp1, RKISP1_CIF_MI_CTRL, mi_ctrl); in rkisp1_sp_disable()
526 static void rkisp1_mp_enable(struct rkisp1_capture *cap) in rkisp1_mp_enable() argument
530 rkisp1_mp_disable(cap); in rkisp1_mp_enable()
532 mi_ctrl = rkisp1_read(cap->rkisp1, RKISP1_CIF_MI_CTRL); in rkisp1_mp_enable()
533 if (v4l2_is_format_bayer(cap->pix.info)) in rkisp1_mp_enable()
539 rkisp1_write(cap->rkisp1, RKISP1_CIF_MI_CTRL, mi_ctrl); in rkisp1_mp_enable()
542 static void rkisp1_sp_enable(struct rkisp1_capture *cap) in rkisp1_sp_enable() argument
544 u32 mi_ctrl = rkisp1_read(cap->rkisp1, RKISP1_CIF_MI_CTRL); in rkisp1_sp_enable()
547 rkisp1_write(cap->rkisp1, RKISP1_CIF_MI_CTRL, mi_ctrl); in rkisp1_sp_enable()
550 static void rkisp1_mp_sp_stop(struct rkisp1_capture *cap) in rkisp1_mp_sp_stop() argument
552 if (!cap->is_streaming) in rkisp1_mp_sp_stop()
554 rkisp1_write(cap->rkisp1, RKISP1_CIF_MI_ICR, RKISP1_CIF_MI_FRAME(cap)); in rkisp1_mp_sp_stop()
555 cap->ops->disable(cap); in rkisp1_mp_sp_stop()
558 static bool rkisp1_mp_is_stopped(struct rkisp1_capture *cap) in rkisp1_mp_is_stopped() argument
563 return !(rkisp1_read(cap->rkisp1, RKISP1_CIF_MI_CTRL_SHD) & en); in rkisp1_mp_is_stopped()
566 static bool rkisp1_sp_is_stopped(struct rkisp1_capture *cap) in rkisp1_sp_is_stopped() argument
568 return !(rkisp1_read(cap->rkisp1, RKISP1_CIF_MI_CTRL_SHD) & in rkisp1_sp_is_stopped()
572 static void rkisp1_mp_set_data_path(struct rkisp1_capture *cap) in rkisp1_mp_set_data_path() argument
574 u32 dpcl = rkisp1_read(cap->rkisp1, RKISP1_CIF_VI_DPCL); in rkisp1_mp_set_data_path()
578 rkisp1_write(cap->rkisp1, RKISP1_CIF_VI_DPCL, dpcl); in rkisp1_mp_set_data_path()
581 static void rkisp1_sp_set_data_path(struct rkisp1_capture *cap) in rkisp1_sp_set_data_path() argument
583 u32 dpcl = rkisp1_read(cap->rkisp1, RKISP1_CIF_VI_DPCL); in rkisp1_sp_set_data_path()
586 rkisp1_write(cap->rkisp1, RKISP1_CIF_VI_DPCL, dpcl); in rkisp1_sp_set_data_path()
611 static int rkisp1_dummy_buf_create(struct rkisp1_capture *cap) in rkisp1_dummy_buf_create() argument
613 const struct v4l2_pix_format_mplane *pixm = &cap->pix.fmt; in rkisp1_dummy_buf_create()
614 struct rkisp1_dummy_buffer *dummy_buf = &cap->buf.dummy; in rkisp1_dummy_buf_create()
621 dummy_buf->vaddr = dma_alloc_attrs(cap->rkisp1->dev, in rkisp1_dummy_buf_create()
632 static void rkisp1_dummy_buf_destroy(struct rkisp1_capture *cap) in rkisp1_dummy_buf_destroy() argument
634 dma_free_attrs(cap->rkisp1->dev, in rkisp1_dummy_buf_destroy()
635 cap->buf.dummy.size, cap->buf.dummy.vaddr, in rkisp1_dummy_buf_destroy()
636 cap->buf.dummy.dma_addr, DMA_ATTR_NO_KERNEL_MAPPING); in rkisp1_dummy_buf_destroy()
639 static void rkisp1_set_next_buf(struct rkisp1_capture *cap) in rkisp1_set_next_buf() argument
641 cap->buf.curr = cap->buf.next; in rkisp1_set_next_buf()
642 cap->buf.next = NULL; in rkisp1_set_next_buf()
644 if (!list_empty(&cap->buf.queue)) { in rkisp1_set_next_buf()
647 cap->buf.next = list_first_entry(&cap->buf.queue, struct rkisp1_buffer, queue); in rkisp1_set_next_buf()
648 list_del(&cap->buf.next->queue); in rkisp1_set_next_buf()
650 buff_addr = cap->buf.next->buff_addr; in rkisp1_set_next_buf()
652 rkisp1_write(cap->rkisp1, cap->config->mi.y_base_ad_init, in rkisp1_set_next_buf()
659 if (cap->pix.cfg->fourcc == V4L2_PIX_FMT_GREY) { in rkisp1_set_next_buf()
660 rkisp1_write(cap->rkisp1, in rkisp1_set_next_buf()
661 cap->config->mi.cb_base_ad_init, in rkisp1_set_next_buf()
662 cap->buf.dummy.dma_addr); in rkisp1_set_next_buf()
663 rkisp1_write(cap->rkisp1, in rkisp1_set_next_buf()
664 cap->config->mi.cr_base_ad_init, in rkisp1_set_next_buf()
665 cap->buf.dummy.dma_addr); in rkisp1_set_next_buf()
667 rkisp1_write(cap->rkisp1, in rkisp1_set_next_buf()
668 cap->config->mi.cb_base_ad_init, in rkisp1_set_next_buf()
670 rkisp1_write(cap->rkisp1, in rkisp1_set_next_buf()
671 cap->config->mi.cr_base_ad_init, in rkisp1_set_next_buf()
679 rkisp1_write(cap->rkisp1, cap->config->mi.y_base_ad_init, in rkisp1_set_next_buf()
680 cap->buf.dummy.dma_addr); in rkisp1_set_next_buf()
681 rkisp1_write(cap->rkisp1, cap->config->mi.cb_base_ad_init, in rkisp1_set_next_buf()
682 cap->buf.dummy.dma_addr); in rkisp1_set_next_buf()
683 rkisp1_write(cap->rkisp1, cap->config->mi.cr_base_ad_init, in rkisp1_set_next_buf()
684 cap->buf.dummy.dma_addr); in rkisp1_set_next_buf()
688 rkisp1_write(cap->rkisp1, cap->config->mi.y_offs_cnt_init, 0); in rkisp1_set_next_buf()
689 rkisp1_write(cap->rkisp1, cap->config->mi.cb_offs_cnt_init, 0); in rkisp1_set_next_buf()
690 rkisp1_write(cap->rkisp1, cap->config->mi.cr_offs_cnt_init, 0); in rkisp1_set_next_buf()
698 static void rkisp1_handle_buffer(struct rkisp1_capture *cap) in rkisp1_handle_buffer() argument
700 struct rkisp1_isp *isp = &cap->rkisp1->isp; in rkisp1_handle_buffer()
703 spin_lock(&cap->buf.lock); in rkisp1_handle_buffer()
704 curr_buf = cap->buf.curr; in rkisp1_handle_buffer()
712 cap->rkisp1->debug.frame_drop[cap->id]++; in rkisp1_handle_buffer()
715 rkisp1_set_next_buf(cap); in rkisp1_handle_buffer()
716 spin_unlock(&cap->buf.lock); in rkisp1_handle_buffer()
736 struct rkisp1_capture *cap = &rkisp1->capture_devs[i]; in rkisp1_capture_isr() local
738 if (!(status & RKISP1_CIF_MI_FRAME(cap))) in rkisp1_capture_isr()
740 if (!cap->is_stopping) { in rkisp1_capture_isr()
741 rkisp1_handle_buffer(cap); in rkisp1_capture_isr()
752 if (!cap->ops->is_stopped(cap)) { in rkisp1_capture_isr()
753 cap->ops->stop(cap); in rkisp1_capture_isr()
756 cap->is_stopping = false; in rkisp1_capture_isr()
757 cap->is_streaming = false; in rkisp1_capture_isr()
758 wake_up(&cap->done); in rkisp1_capture_isr()
774 struct rkisp1_capture *cap = queue->drv_priv; in rkisp1_vb2_queue_setup() local
775 const struct v4l2_pix_format_mplane *pixm = &cap->pix.fmt; in rkisp1_vb2_queue_setup()
799 struct rkisp1_capture *cap = vb->vb2_queue->drv_priv; in rkisp1_vb2_buf_init() local
800 const struct v4l2_pix_format_mplane *pixm = &cap->pix.fmt; in rkisp1_vb2_buf_init()
821 if (cap->pix.info->comp_planes == 3 && cap->pix.cfg->uv_swap) in rkisp1_vb2_buf_init()
832 struct rkisp1_capture *cap = vb->vb2_queue->drv_priv; in rkisp1_vb2_buf_queue() local
834 spin_lock_irq(&cap->buf.lock); in rkisp1_vb2_buf_queue()
835 list_add_tail(&ispbuf->queue, &cap->buf.queue); in rkisp1_vb2_buf_queue()
836 spin_unlock_irq(&cap->buf.lock); in rkisp1_vb2_buf_queue()
841 struct rkisp1_capture *cap = vb->vb2_queue->drv_priv; in rkisp1_vb2_buf_prepare() local
844 for (i = 0; i < cap->pix.fmt.num_planes; i++) { in rkisp1_vb2_buf_prepare()
845 unsigned long size = cap->pix.fmt.plane_fmt[i].sizeimage; in rkisp1_vb2_buf_prepare()
848 dev_err(cap->rkisp1->dev, in rkisp1_vb2_buf_prepare()
859 static void rkisp1_return_all_buffers(struct rkisp1_capture *cap, in rkisp1_return_all_buffers() argument
864 spin_lock_irq(&cap->buf.lock); in rkisp1_return_all_buffers()
865 if (cap->buf.curr) { in rkisp1_return_all_buffers()
866 vb2_buffer_done(&cap->buf.curr->vb.vb2_buf, state); in rkisp1_return_all_buffers()
867 cap->buf.curr = NULL; in rkisp1_return_all_buffers()
869 if (cap->buf.next) { in rkisp1_return_all_buffers()
870 vb2_buffer_done(&cap->buf.next->vb.vb2_buf, state); in rkisp1_return_all_buffers()
871 cap->buf.next = NULL; in rkisp1_return_all_buffers()
873 while (!list_empty(&cap->buf.queue)) { in rkisp1_return_all_buffers()
874 buf = list_first_entry(&cap->buf.queue, in rkisp1_return_all_buffers()
879 spin_unlock_irq(&cap->buf.lock); in rkisp1_return_all_buffers()
888 static void rkisp1_cap_stream_enable(struct rkisp1_capture *cap) in rkisp1_cap_stream_enable() argument
890 struct rkisp1_device *rkisp1 = cap->rkisp1; in rkisp1_cap_stream_enable()
891 struct rkisp1_capture *other = &rkisp1->capture_devs[cap->id ^ 1]; in rkisp1_cap_stream_enable()
893 cap->ops->set_data_path(cap); in rkisp1_cap_stream_enable()
894 cap->ops->config(cap); in rkisp1_cap_stream_enable()
897 spin_lock_irq(&cap->buf.lock); in rkisp1_cap_stream_enable()
898 rkisp1_set_next_buf(cap); in rkisp1_cap_stream_enable()
899 cap->ops->enable(cap); in rkisp1_cap_stream_enable()
913 rkisp1_set_next_buf(cap); in rkisp1_cap_stream_enable()
915 spin_unlock_irq(&cap->buf.lock); in rkisp1_cap_stream_enable()
916 cap->is_streaming = true; in rkisp1_cap_stream_enable()
919 static void rkisp1_cap_stream_disable(struct rkisp1_capture *cap) in rkisp1_cap_stream_disable() argument
924 cap->is_stopping = true; in rkisp1_cap_stream_disable()
925 ret = wait_event_timeout(cap->done, in rkisp1_cap_stream_disable()
926 !cap->is_streaming, in rkisp1_cap_stream_disable()
929 cap->rkisp1->debug.stop_timeout[cap->id]++; in rkisp1_cap_stream_disable()
930 cap->ops->stop(cap); in rkisp1_cap_stream_disable()
931 cap->is_stopping = false; in rkisp1_cap_stream_disable()
932 cap->is_streaming = false; in rkisp1_cap_stream_disable()
943 static void rkisp1_pipeline_stream_disable(struct rkisp1_capture *cap) in rkisp1_pipeline_stream_disable() argument
944 __must_hold(&cap->rkisp1->stream_lock) in rkisp1_pipeline_stream_disable()
946 struct rkisp1_device *rkisp1 = cap->rkisp1; in rkisp1_pipeline_stream_disable()
948 rkisp1_cap_stream_disable(cap); in rkisp1_pipeline_stream_disable()
957 v4l2_subdev_call(&rkisp1->resizer_devs[cap->id].sd, video, s_stream, in rkisp1_pipeline_stream_disable()
967 static int rkisp1_pipeline_stream_enable(struct rkisp1_capture *cap) in rkisp1_pipeline_stream_enable() argument
968 __must_hold(&cap->rkisp1->stream_lock) in rkisp1_pipeline_stream_enable()
970 struct rkisp1_device *rkisp1 = cap->rkisp1; in rkisp1_pipeline_stream_enable()
973 rkisp1_cap_stream_enable(cap); in rkisp1_pipeline_stream_enable()
975 ret = v4l2_subdev_call(&rkisp1->resizer_devs[cap->id].sd, video, in rkisp1_pipeline_stream_enable()
994 v4l2_subdev_call(&rkisp1->resizer_devs[cap->id].sd, video, s_stream, in rkisp1_pipeline_stream_enable()
997 rkisp1_cap_stream_disable(cap); in rkisp1_pipeline_stream_enable()
1004 struct rkisp1_capture *cap = queue->drv_priv; in rkisp1_vb2_stop_streaming() local
1005 struct rkisp1_vdev_node *node = &cap->vnode; in rkisp1_vb2_stop_streaming()
1006 struct rkisp1_device *rkisp1 = cap->rkisp1; in rkisp1_vb2_stop_streaming()
1009 mutex_lock(&cap->rkisp1->stream_lock); in rkisp1_vb2_stop_streaming()
1011 rkisp1_pipeline_stream_disable(cap); in rkisp1_vb2_stop_streaming()
1013 rkisp1_return_all_buffers(cap, VB2_BUF_STATE_ERROR); in rkisp1_vb2_stop_streaming()
1020 rkisp1_dummy_buf_destroy(cap); in rkisp1_vb2_stop_streaming()
1024 mutex_unlock(&cap->rkisp1->stream_lock); in rkisp1_vb2_stop_streaming()
1030 struct rkisp1_capture *cap = queue->drv_priv; in rkisp1_vb2_start_streaming() local
1031 struct media_entity *entity = &cap->vnode.vdev.entity; in rkisp1_vb2_start_streaming()
1034 mutex_lock(&cap->rkisp1->stream_lock); in rkisp1_vb2_start_streaming()
1036 ret = video_device_pipeline_start(&cap->vnode.vdev, &cap->rkisp1->pipe); in rkisp1_vb2_start_streaming()
1038 dev_err(cap->rkisp1->dev, "start pipeline failed %d\n", ret); in rkisp1_vb2_start_streaming()
1042 ret = rkisp1_dummy_buf_create(cap); in rkisp1_vb2_start_streaming()
1046 ret = pm_runtime_resume_and_get(cap->rkisp1->dev); in rkisp1_vb2_start_streaming()
1048 dev_err(cap->rkisp1->dev, "power up failed %d\n", ret); in rkisp1_vb2_start_streaming()
1053 dev_err(cap->rkisp1->dev, "open cif pipeline failed %d\n", ret); in rkisp1_vb2_start_streaming()
1057 ret = rkisp1_pipeline_stream_enable(cap); in rkisp1_vb2_start_streaming()
1061 mutex_unlock(&cap->rkisp1->stream_lock); in rkisp1_vb2_start_streaming()
1068 pm_runtime_put(cap->rkisp1->dev); in rkisp1_vb2_start_streaming()
1070 rkisp1_dummy_buf_destroy(cap); in rkisp1_vb2_start_streaming()
1072 video_device_pipeline_stop(&cap->vnode.vdev); in rkisp1_vb2_start_streaming()
1074 rkisp1_return_all_buffers(cap, VB2_BUF_STATE_QUEUED); in rkisp1_vb2_start_streaming()
1075 mutex_unlock(&cap->rkisp1->stream_lock); in rkisp1_vb2_start_streaming()
1140 rkisp1_find_fmt_cfg(const struct rkisp1_capture *cap, const u32 pixelfmt) in rkisp1_find_fmt_cfg() argument
1144 for (i = 0; i < cap->config->fmt_size; i++) { in rkisp1_find_fmt_cfg()
1145 if (cap->config->fmts[i].fourcc == pixelfmt) in rkisp1_find_fmt_cfg()
1146 return &cap->config->fmts[i]; in rkisp1_find_fmt_cfg()
1151 static void rkisp1_try_fmt(const struct rkisp1_capture *cap, in rkisp1_try_fmt() argument
1156 const struct rkisp1_capture_config *config = cap->config; in rkisp1_try_fmt()
1166 fmt = rkisp1_find_fmt_cfg(cap, pixm->pixelformat); in rkisp1_try_fmt()
1173 RKISP1_RSZ_SRC_MIN_WIDTH, max_widths[cap->id]); in rkisp1_try_fmt()
1175 RKISP1_RSZ_SRC_MIN_HEIGHT, max_heights[cap->id]); in rkisp1_try_fmt()
1182 info = rkisp1_fill_pixfmt(pixm, cap->id); in rkisp1_try_fmt()
1190 static void rkisp1_set_fmt(struct rkisp1_capture *cap, in rkisp1_set_fmt() argument
1193 rkisp1_try_fmt(cap, pixm, &cap->pix.cfg, &cap->pix.info); in rkisp1_set_fmt()
1194 cap->pix.fmt = *pixm; in rkisp1_set_fmt()
1197 if (cap->id == RKISP1_SELFPATH) in rkisp1_set_fmt()
1198 cap->sp_y_stride = pixm->plane_fmt[0].bytesperline / in rkisp1_set_fmt()
1199 cap->pix.info->bpp[0]; in rkisp1_set_fmt()
1205 struct rkisp1_capture *cap = video_drvdata(file); in rkisp1_try_fmt_vid_cap_mplane() local
1207 rkisp1_try_fmt(cap, &f->fmt.pix_mp, NULL, NULL); in rkisp1_try_fmt_vid_cap_mplane()
1215 struct rkisp1_capture *cap = video_drvdata(file); in rkisp1_enum_fmt_vid_cap_mplane() local
1220 if (f->index >= cap->config->fmt_size) in rkisp1_enum_fmt_vid_cap_mplane()
1223 fmt = &cap->config->fmts[f->index]; in rkisp1_enum_fmt_vid_cap_mplane()
1228 for (i = 0; i < cap->config->fmt_size; i++) { in rkisp1_enum_fmt_vid_cap_mplane()
1229 if (cap->config->fmts[i].mbus != f->mbus_code) in rkisp1_enum_fmt_vid_cap_mplane()
1233 f->pixelformat = cap->config->fmts[i].fourcc; in rkisp1_enum_fmt_vid_cap_mplane()
1251 struct rkisp1_capture *cap = video_drvdata(file); in rkisp1_enum_framesizes() local
1259 fsize->stepwise.max_width = max_widths[cap->id]; in rkisp1_enum_framesizes()
1263 fsize->stepwise.max_height = max_heights[cap->id]; in rkisp1_enum_framesizes()
1272 struct rkisp1_capture *cap = video_drvdata(file); in rkisp1_s_fmt_vid_cap_mplane() local
1274 rkisp1_vdev_to_node(&cap->vnode.vdev); in rkisp1_s_fmt_vid_cap_mplane()
1279 rkisp1_set_fmt(cap, &f->fmt.pix_mp); in rkisp1_s_fmt_vid_cap_mplane()
1287 struct rkisp1_capture *cap = video_drvdata(file); in rkisp1_g_fmt_vid_cap_mplane() local
1289 f->fmt.pix_mp = cap->pix.fmt; in rkisp1_g_fmt_vid_cap_mplane()
1295 rkisp1_querycap(struct file *file, void *priv, struct v4l2_capability *cap) in rkisp1_querycap() argument
1297 strscpy(cap->driver, RKISP1_DRIVER_NAME, sizeof(cap->driver)); in rkisp1_querycap()
1298 strscpy(cap->card, RKISP1_DRIVER_NAME, sizeof(cap->card)); in rkisp1_querycap()
1299 strscpy(cap->bus_info, RKISP1_BUS_INFO, sizeof(cap->bus_info)); in rkisp1_querycap()
1330 struct rkisp1_capture *cap = video_get_drvdata(vdev); in rkisp1_capture_link_validate() local
1332 rkisp1_find_fmt_cfg(cap, cap->pix.fmt.pixelformat); in rkisp1_capture_link_validate()
1343 if (sd_fmt.format.height != cap->pix.fmt.height || in rkisp1_capture_link_validate()
1344 sd_fmt.format.width != cap->pix.fmt.width || in rkisp1_capture_link_validate()
1346 dev_dbg(cap->rkisp1->dev, in rkisp1_capture_link_validate()
1351 sd_fmt.format.height, fmt->mbus, cap->pix.fmt.width, in rkisp1_capture_link_validate()
1352 cap->pix.fmt.height); in rkisp1_capture_link_validate()
1375 static void rkisp1_unregister_capture(struct rkisp1_capture *cap) in rkisp1_unregister_capture() argument
1377 if (!video_is_registered(&cap->vnode.vdev)) in rkisp1_unregister_capture()
1380 media_entity_cleanup(&cap->vnode.vdev.entity); in rkisp1_unregister_capture()
1381 vb2_video_unregister_device(&cap->vnode.vdev); in rkisp1_unregister_capture()
1382 mutex_destroy(&cap->vnode.vlock); in rkisp1_unregister_capture()
1394 static int rkisp1_register_capture(struct rkisp1_capture *cap) in rkisp1_register_capture() argument
1399 struct v4l2_device *v4l2_dev = &cap->rkisp1->v4l2_dev; in rkisp1_register_capture()
1400 struct video_device *vdev = &cap->vnode.vdev; in rkisp1_register_capture()
1405 strscpy(vdev->name, dev_names[cap->id], sizeof(vdev->name)); in rkisp1_register_capture()
1418 video_set_drvdata(vdev, cap); in rkisp1_register_capture()
1425 q->drv_priv = cap; in rkisp1_register_capture()
1432 q->dev = cap->rkisp1->dev; in rkisp1_register_capture()
1435 dev_err(cap->rkisp1->dev, in rkisp1_register_capture()
1448 dev_err(cap->rkisp1->dev, in rkisp1_register_capture()
1467 struct rkisp1_capture *cap = &rkisp1->capture_devs[id]; in rkisp1_capture_init() local
1470 memset(cap, 0, sizeof(*cap)); in rkisp1_capture_init()
1471 cap->id = id; in rkisp1_capture_init()
1472 cap->rkisp1 = rkisp1; in rkisp1_capture_init()
1474 INIT_LIST_HEAD(&cap->buf.queue); in rkisp1_capture_init()
1475 init_waitqueue_head(&cap->done); in rkisp1_capture_init()
1476 spin_lock_init(&cap->buf.lock); in rkisp1_capture_init()
1477 if (cap->id == RKISP1_SELFPATH) { in rkisp1_capture_init()
1478 cap->ops = &rkisp1_capture_ops_sp; in rkisp1_capture_init()
1479 cap->config = &rkisp1_capture_config_sp; in rkisp1_capture_init()
1481 cap->ops = &rkisp1_capture_ops_mp; in rkisp1_capture_init()
1482 cap->config = &rkisp1_capture_config_mp; in rkisp1_capture_init()
1485 cap->is_streaming = false; in rkisp1_capture_init()
1491 rkisp1_set_fmt(cap, &pixm); in rkisp1_capture_init()
1500 struct rkisp1_capture *cap = &rkisp1->capture_devs[i]; in rkisp1_capture_devs_register() local
1504 ret = rkisp1_register_capture(cap); in rkisp1_capture_devs_register()