Lines Matching refs:ccp2
68 static void ccp2_print_status(struct isp_ccp2_device *ccp2) in ccp2_print_status() argument
70 struct isp_device *isp = to_isp_device(ccp2); in ccp2_print_status()
110 static void ccp2_reset(struct isp_ccp2_device *ccp2) in ccp2_reset() argument
112 struct isp_device *isp = to_isp_device(ccp2); in ccp2_reset()
133 static void ccp2_pwr_cfg(struct isp_ccp2_device *ccp2) in ccp2_pwr_cfg() argument
135 struct isp_device *isp = to_isp_device(ccp2); in ccp2_pwr_cfg()
148 static int ccp2_if_enable(struct isp_ccp2_device *ccp2, u8 enable) in ccp2_if_enable() argument
150 struct isp_device *isp = to_isp_device(ccp2); in ccp2_if_enable()
154 if (enable && ccp2->vdds_csib) { in ccp2_if_enable()
155 ret = regulator_enable(ccp2->vdds_csib); in ccp2_if_enable()
171 if (!enable && ccp2->vdds_csib) in ccp2_if_enable()
172 regulator_disable(ccp2->vdds_csib); in ccp2_if_enable()
182 static void ccp2_mem_enable(struct isp_ccp2_device *ccp2, u8 enable) in ccp2_mem_enable() argument
184 struct isp_device *isp = to_isp_device(ccp2); in ccp2_mem_enable()
187 ccp2_if_enable(ccp2, 0); in ccp2_mem_enable()
207 static int ccp2_phyif_config(struct isp_ccp2_device *ccp2, in ccp2_phyif_config() argument
210 struct isp_device *isp = to_isp_device(ccp2); in ccp2_phyif_config()
252 static void ccp2_vp_config(struct isp_ccp2_device *ccp2, in ccp2_vp_config() argument
255 struct isp_device *isp = to_isp_device(ccp2); in ccp2_vp_config()
285 static void ccp2_lcx_config(struct isp_ccp2_device *ccp2, in ccp2_lcx_config() argument
288 struct isp_device *isp = to_isp_device(ccp2); in ccp2_lcx_config()
348 static int ccp2_if_configure(struct isp_ccp2_device *ccp2) in ccp2_if_configure() argument
350 struct isp_pipeline *pipe = to_isp_pipeline(&ccp2->subdev.entity); in ccp2_if_configure()
358 ccp2_pwr_cfg(ccp2); in ccp2_if_configure()
360 pad = media_entity_remote_pad(&ccp2->pads[CCP2_PAD_SINK]); in ccp2_if_configure()
364 ret = ccp2_phyif_config(ccp2, &buscfg->bus.ccp2); in ccp2_if_configure()
368 ccp2_vp_config(ccp2, buscfg->bus.ccp2.vpclk_div + 1); in ccp2_if_configure()
372 format = &ccp2->formats[CCP2_PAD_SINK]; in ccp2_if_configure()
374 ccp2->if_cfg.data_start = lines; in ccp2_if_configure()
375 ccp2->if_cfg.crc = buscfg->bus.ccp2.crc; in ccp2_if_configure()
376 ccp2->if_cfg.format = format->code; in ccp2_if_configure()
377 ccp2->if_cfg.data_size = format->height; in ccp2_if_configure()
379 ccp2_lcx_config(ccp2, &ccp2->if_cfg); in ccp2_if_configure()
384 static int ccp2_adjust_bandwidth(struct isp_ccp2_device *ccp2) in ccp2_adjust_bandwidth() argument
386 struct isp_pipeline *pipe = to_isp_pipeline(&ccp2->subdev.entity); in ccp2_adjust_bandwidth()
387 struct isp_device *isp = to_isp_device(ccp2); in ccp2_adjust_bandwidth()
388 const struct v4l2_mbus_framefmt *ofmt = &ccp2->formats[CCP2_PAD_SOURCE]; in ccp2_adjust_bandwidth()
432 static void ccp2_mem_configure(struct isp_ccp2_device *ccp2, in ccp2_mem_configure() argument
435 struct isp_device *isp = to_isp_device(ccp2); in ccp2_mem_configure()
436 u32 sink_pixcode = ccp2->formats[CCP2_PAD_SINK].code; in ccp2_mem_configure()
437 u32 source_pixcode = ccp2->formats[CCP2_PAD_SOURCE].code; in ccp2_mem_configure()
445 ccp2_pwr_cfg(ccp2); in ccp2_mem_configure()
456 if (ccp2->video_in.bpl_padding == 0) in ccp2_mem_configure()
459 config->src_ofst = ccp2->video_in.bpl_value; in ccp2_mem_configure()
505 ccp2_vp_config(ccp2, ccp2_adjust_bandwidth(ccp2)); in ccp2_mem_configure()
525 static void ccp2_set_inaddr(struct isp_ccp2_device *ccp2, u32 addr) in ccp2_set_inaddr() argument
527 struct isp_device *isp = to_isp_device(ccp2); in ccp2_set_inaddr()
536 static void ccp2_isr_buffer(struct isp_ccp2_device *ccp2) in ccp2_isr_buffer() argument
538 struct isp_pipeline *pipe = to_isp_pipeline(&ccp2->subdev.entity); in ccp2_isr_buffer()
541 buffer = omap3isp_video_buffer_next(&ccp2->video_in); in ccp2_isr_buffer()
543 ccp2_set_inaddr(ccp2, buffer->dma); in ccp2_isr_buffer()
547 if (ccp2->state == ISP_PIPELINE_STREAM_SINGLESHOT) { in ccp2_isr_buffer()
560 void omap3isp_ccp2_isr(struct isp_ccp2_device *ccp2) in omap3isp_ccp2_isr() argument
562 struct isp_pipeline *pipe = to_isp_pipeline(&ccp2->subdev.entity); in omap3isp_ccp2_isr()
563 struct isp_device *isp = to_isp_device(ccp2); in omap3isp_ccp2_isr()
595 if (omap3isp_module_sync_is_stopping(&ccp2->wait, &ccp2->stopping)) in omap3isp_ccp2_isr()
600 ccp2_isr_buffer(ccp2); in omap3isp_ccp2_isr()
621 __ccp2_get_format(struct isp_ccp2_device *ccp2, struct v4l2_subdev_pad_config *cfg, in __ccp2_get_format() argument
625 return v4l2_subdev_get_try_format(&ccp2->subdev, cfg, pad); in __ccp2_get_format()
627 return &ccp2->formats[pad]; in __ccp2_get_format()
638 static void ccp2_try_format(struct isp_ccp2_device *ccp2, in ccp2_try_format() argument
650 if (ccp2->input == CCP2_INPUT_SENSOR) { in ccp2_try_format()
657 } else if (ccp2->input == CCP2_INPUT_MEMORY) { in ccp2_try_format()
673 format = __ccp2_get_format(ccp2, cfg, CCP2_PAD_SINK, which); in ccp2_try_format()
694 struct isp_ccp2_device *ccp2 = v4l2_get_subdevdata(sd); in ccp2_enum_mbus_code() local
706 format = __ccp2_get_format(ccp2, cfg, CCP2_PAD_SINK, in ccp2_enum_mbus_code()
718 struct isp_ccp2_device *ccp2 = v4l2_get_subdevdata(sd); in ccp2_enum_frame_size() local
727 ccp2_try_format(ccp2, cfg, fse->pad, &format, fse->which); in ccp2_enum_frame_size()
737 ccp2_try_format(ccp2, cfg, fse->pad, &format, fse->which); in ccp2_enum_frame_size()
754 struct isp_ccp2_device *ccp2 = v4l2_get_subdevdata(sd); in ccp2_get_format() local
757 format = __ccp2_get_format(ccp2, cfg, fmt->pad, fmt->which); in ccp2_get_format()
775 struct isp_ccp2_device *ccp2 = v4l2_get_subdevdata(sd); in ccp2_set_format() local
778 format = __ccp2_get_format(ccp2, cfg, fmt->pad, fmt->which); in ccp2_set_format()
782 ccp2_try_format(ccp2, cfg, fmt->pad, &fmt->format, fmt->which); in ccp2_set_format()
787 format = __ccp2_get_format(ccp2, cfg, CCP2_PAD_SOURCE, in ccp2_set_format()
790 ccp2_try_format(ccp2, cfg, CCP2_PAD_SOURCE, format, fmt->which); in ccp2_set_format()
828 struct isp_ccp2_device *ccp2 = v4l2_get_subdevdata(sd); in ccp2_s_stream() local
829 struct isp_device *isp = to_isp_device(ccp2); in ccp2_s_stream()
830 struct device *dev = to_device(ccp2); in ccp2_s_stream()
833 if (ccp2->state == ISP_PIPELINE_STREAM_STOPPED) { in ccp2_s_stream()
836 atomic_set(&ccp2->stopping, 0); in ccp2_s_stream()
841 if (ccp2->phy) { in ccp2_s_stream()
842 ret = omap3isp_csiphy_acquire(ccp2->phy, &sd->entity); in ccp2_s_stream()
847 ccp2_if_configure(ccp2); in ccp2_s_stream()
848 ccp2_print_status(ccp2); in ccp2_s_stream()
851 ret = ccp2_if_enable(ccp2, 1); in ccp2_s_stream()
853 if (ccp2->phy) in ccp2_s_stream()
854 omap3isp_csiphy_release(ccp2->phy); in ccp2_s_stream()
860 if (ccp2->state != ISP_PIPELINE_STREAM_SINGLESHOT) { in ccp2_s_stream()
863 format = &ccp2->formats[CCP2_PAD_SINK]; in ccp2_s_stream()
865 ccp2->mem_cfg.hsize_count = format->width; in ccp2_s_stream()
866 ccp2->mem_cfg.vsize_count = format->height; in ccp2_s_stream()
867 ccp2->mem_cfg.src_ofst = 0; in ccp2_s_stream()
869 ccp2_mem_configure(ccp2, &ccp2->mem_cfg); in ccp2_s_stream()
871 ccp2_print_status(ccp2); in ccp2_s_stream()
873 ccp2_mem_enable(ccp2, 1); in ccp2_s_stream()
877 if (omap3isp_module_sync_idle(&sd->entity, &ccp2->wait, in ccp2_s_stream()
878 &ccp2->stopping)) in ccp2_s_stream()
880 if (ccp2->input == CCP2_INPUT_MEMORY) { in ccp2_s_stream()
881 ccp2_mem_enable(ccp2, 0); in ccp2_s_stream()
883 } else if (ccp2->input == CCP2_INPUT_SENSOR) { in ccp2_s_stream()
885 ccp2_if_enable(ccp2, 0); in ccp2_s_stream()
886 if (ccp2->phy) in ccp2_s_stream()
887 omap3isp_csiphy_release(ccp2->phy); in ccp2_s_stream()
892 ccp2->state = enable; in ccp2_s_stream()
932 struct isp_ccp2_device *ccp2 = &video->isp->isp_ccp2; in ccp2_video_queue() local
934 ccp2_set_inaddr(ccp2, buffer->dma); in ccp2_video_queue()
959 struct isp_ccp2_device *ccp2 = v4l2_get_subdevdata(sd); in ccp2_link_setup() local
970 if (ccp2->input == CCP2_INPUT_SENSOR) in ccp2_link_setup()
972 ccp2->input = CCP2_INPUT_MEMORY; in ccp2_link_setup()
974 if (ccp2->input == CCP2_INPUT_MEMORY) in ccp2_link_setup()
975 ccp2->input = CCP2_INPUT_NONE; in ccp2_link_setup()
982 if (ccp2->input == CCP2_INPUT_MEMORY) in ccp2_link_setup()
984 ccp2->input = CCP2_INPUT_SENSOR; in ccp2_link_setup()
986 if (ccp2->input == CCP2_INPUT_SENSOR) in ccp2_link_setup()
987 ccp2->input = CCP2_INPUT_NONE; in ccp2_link_setup()
993 ccp2->output = CCP2_OUTPUT_CCDC; in ccp2_link_setup()
995 ccp2->output = CCP2_OUTPUT_NONE; in ccp2_link_setup()
1015 void omap3isp_ccp2_unregister_entities(struct isp_ccp2_device *ccp2) in omap3isp_ccp2_unregister_entities() argument
1017 v4l2_device_unregister_subdev(&ccp2->subdev); in omap3isp_ccp2_unregister_entities()
1018 omap3isp_video_unregister(&ccp2->video_in); in omap3isp_ccp2_unregister_entities()
1028 int omap3isp_ccp2_register_entities(struct isp_ccp2_device *ccp2, in omap3isp_ccp2_register_entities() argument
1034 ccp2->subdev.dev = vdev->mdev->dev; in omap3isp_ccp2_register_entities()
1035 ret = v4l2_device_register_subdev(vdev, &ccp2->subdev); in omap3isp_ccp2_register_entities()
1039 ret = omap3isp_video_register(&ccp2->video_in, vdev); in omap3isp_ccp2_register_entities()
1046 omap3isp_ccp2_unregister_entities(ccp2); in omap3isp_ccp2_register_entities()
1059 static int ccp2_init_entities(struct isp_ccp2_device *ccp2) in ccp2_init_entities() argument
1061 struct v4l2_subdev *sd = &ccp2->subdev; in ccp2_init_entities()
1062 struct media_pad *pads = ccp2->pads; in ccp2_init_entities()
1066 ccp2->input = CCP2_INPUT_NONE; in ccp2_init_entities()
1067 ccp2->output = CCP2_OUTPUT_NONE; in ccp2_init_entities()
1073 v4l2_set_subdevdata(sd, ccp2); in ccp2_init_entities()
1098 ccp2->video_in.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; in ccp2_init_entities()
1099 ccp2->video_in.bpl_alignment = 32; in ccp2_init_entities()
1100 ccp2->video_in.bpl_max = 0xffffffe0; in ccp2_init_entities()
1101 ccp2->video_in.isp = to_isp_device(ccp2); in ccp2_init_entities()
1102 ccp2->video_in.ops = &ccp2_video_ops; in ccp2_init_entities()
1103 ccp2->video_in.capture_mem = PAGE_ALIGN(4096 * 4096) * 3; in ccp2_init_entities()
1105 ret = omap3isp_video_init(&ccp2->video_in, "CCP2"); in ccp2_init_entities()
1112 media_entity_cleanup(&ccp2->subdev.entity); in ccp2_init_entities()
1123 struct isp_ccp2_device *ccp2 = &isp->isp_ccp2; in omap3isp_ccp2_init() local
1126 init_waitqueue_head(&ccp2->wait); in omap3isp_ccp2_init()
1140 ccp2->vdds_csib = devm_regulator_get(isp->dev, "vdds_csib"); in omap3isp_ccp2_init()
1141 if (IS_ERR(ccp2->vdds_csib)) { in omap3isp_ccp2_init()
1142 if (PTR_ERR(ccp2->vdds_csib) == -EPROBE_DEFER) { in omap3isp_ccp2_init()
1149 ccp2->vdds_csib = NULL; in omap3isp_ccp2_init()
1151 ccp2->phy = &isp->isp_csiphy2; in omap3isp_ccp2_init()
1153 ccp2->phy = &isp->isp_csiphy1; in omap3isp_ccp2_init()
1156 ret = ccp2_init_entities(ccp2); in omap3isp_ccp2_init()
1160 ccp2_reset(ccp2); in omap3isp_ccp2_init()
1170 struct isp_ccp2_device *ccp2 = &isp->isp_ccp2; in omap3isp_ccp2_cleanup() local
1172 omap3isp_video_cleanup(&ccp2->video_in); in omap3isp_ccp2_cleanup()
1173 media_entity_cleanup(&ccp2->subdev.entity); in omap3isp_ccp2_cleanup()