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_pad_remote_pad_first(&ccp2->pads[CCP2_PAD_SINK]); in ccp2_if_configure()
366 ret = ccp2_phyif_config(ccp2, &buscfg->bus.ccp2); in ccp2_if_configure()
370 ccp2_vp_config(ccp2, buscfg->bus.ccp2.vpclk_div + 1); in ccp2_if_configure()
374 format = &ccp2->formats[CCP2_PAD_SINK]; in ccp2_if_configure()
376 ccp2->if_cfg.data_start = lines; in ccp2_if_configure()
377 ccp2->if_cfg.crc = buscfg->bus.ccp2.crc; in ccp2_if_configure()
378 ccp2->if_cfg.format = format->code; in ccp2_if_configure()
379 ccp2->if_cfg.data_size = format->height; in ccp2_if_configure()
381 ccp2_lcx_config(ccp2, &ccp2->if_cfg); in ccp2_if_configure()
386 static int ccp2_adjust_bandwidth(struct isp_ccp2_device *ccp2) in ccp2_adjust_bandwidth() argument
388 struct isp_pipeline *pipe = to_isp_pipeline(&ccp2->subdev.entity); in ccp2_adjust_bandwidth()
389 struct isp_device *isp = to_isp_device(ccp2); in ccp2_adjust_bandwidth()
390 const struct v4l2_mbus_framefmt *ofmt = &ccp2->formats[CCP2_PAD_SOURCE]; in ccp2_adjust_bandwidth()
434 static void ccp2_mem_configure(struct isp_ccp2_device *ccp2, in ccp2_mem_configure() argument
437 struct isp_device *isp = to_isp_device(ccp2); in ccp2_mem_configure()
438 u32 sink_pixcode = ccp2->formats[CCP2_PAD_SINK].code; in ccp2_mem_configure()
439 u32 source_pixcode = ccp2->formats[CCP2_PAD_SOURCE].code; in ccp2_mem_configure()
447 ccp2_pwr_cfg(ccp2); in ccp2_mem_configure()
458 if (ccp2->video_in.bpl_padding == 0) in ccp2_mem_configure()
461 config->src_ofst = ccp2->video_in.bpl_value; in ccp2_mem_configure()
507 ccp2_vp_config(ccp2, ccp2_adjust_bandwidth(ccp2)); in ccp2_mem_configure()
527 static void ccp2_set_inaddr(struct isp_ccp2_device *ccp2, u32 addr) in ccp2_set_inaddr() argument
529 struct isp_device *isp = to_isp_device(ccp2); in ccp2_set_inaddr()
538 static void ccp2_isr_buffer(struct isp_ccp2_device *ccp2) in ccp2_isr_buffer() argument
540 struct isp_pipeline *pipe = to_isp_pipeline(&ccp2->subdev.entity); in ccp2_isr_buffer()
543 buffer = omap3isp_video_buffer_next(&ccp2->video_in); in ccp2_isr_buffer()
545 ccp2_set_inaddr(ccp2, buffer->dma); in ccp2_isr_buffer()
549 if (ccp2->state == ISP_PIPELINE_STREAM_SINGLESHOT) { in ccp2_isr_buffer()
562 void omap3isp_ccp2_isr(struct isp_ccp2_device *ccp2) in omap3isp_ccp2_isr() argument
564 struct isp_pipeline *pipe = to_isp_pipeline(&ccp2->subdev.entity); in omap3isp_ccp2_isr()
565 struct isp_device *isp = to_isp_device(ccp2); in omap3isp_ccp2_isr()
597 if (omap3isp_module_sync_is_stopping(&ccp2->wait, &ccp2->stopping)) in omap3isp_ccp2_isr()
602 ccp2_isr_buffer(ccp2); in omap3isp_ccp2_isr()
623 __ccp2_get_format(struct isp_ccp2_device *ccp2, in __ccp2_get_format() argument
630 return &ccp2->formats[pad]; in __ccp2_get_format()
641 static void ccp2_try_format(struct isp_ccp2_device *ccp2, in ccp2_try_format() argument
654 if (ccp2->input == CCP2_INPUT_SENSOR) { in ccp2_try_format()
661 } else if (ccp2->input == CCP2_INPUT_MEMORY) { in ccp2_try_format()
677 format = __ccp2_get_format(ccp2, sd_state, CCP2_PAD_SINK, in ccp2_try_format()
699 struct isp_ccp2_device *ccp2 = v4l2_get_subdevdata(sd); in ccp2_enum_mbus_code() local
711 format = __ccp2_get_format(ccp2, sd_state, CCP2_PAD_SINK, in ccp2_enum_mbus_code()
723 struct isp_ccp2_device *ccp2 = v4l2_get_subdevdata(sd); in ccp2_enum_frame_size() local
732 ccp2_try_format(ccp2, sd_state, fse->pad, &format, fse->which); in ccp2_enum_frame_size()
742 ccp2_try_format(ccp2, sd_state, fse->pad, &format, fse->which); in ccp2_enum_frame_size()
760 struct isp_ccp2_device *ccp2 = v4l2_get_subdevdata(sd); in ccp2_get_format() local
763 format = __ccp2_get_format(ccp2, sd_state, fmt->pad, fmt->which); in ccp2_get_format()
782 struct isp_ccp2_device *ccp2 = v4l2_get_subdevdata(sd); in ccp2_set_format() local
785 format = __ccp2_get_format(ccp2, sd_state, fmt->pad, fmt->which); in ccp2_set_format()
789 ccp2_try_format(ccp2, sd_state, fmt->pad, &fmt->format, fmt->which); in ccp2_set_format()
794 format = __ccp2_get_format(ccp2, sd_state, CCP2_PAD_SOURCE, in ccp2_set_format()
797 ccp2_try_format(ccp2, sd_state, CCP2_PAD_SOURCE, format, in ccp2_set_format()
836 struct isp_ccp2_device *ccp2 = v4l2_get_subdevdata(sd); in ccp2_s_stream() local
837 struct isp_device *isp = to_isp_device(ccp2); in ccp2_s_stream()
838 struct device *dev = to_device(ccp2); in ccp2_s_stream()
841 if (ccp2->state == ISP_PIPELINE_STREAM_STOPPED) { in ccp2_s_stream()
844 atomic_set(&ccp2->stopping, 0); in ccp2_s_stream()
849 if (ccp2->phy) { in ccp2_s_stream()
850 ret = omap3isp_csiphy_acquire(ccp2->phy, &sd->entity); in ccp2_s_stream()
855 ccp2_if_configure(ccp2); in ccp2_s_stream()
856 ccp2_print_status(ccp2); in ccp2_s_stream()
859 ret = ccp2_if_enable(ccp2, 1); in ccp2_s_stream()
861 if (ccp2->phy) in ccp2_s_stream()
862 omap3isp_csiphy_release(ccp2->phy); in ccp2_s_stream()
868 if (ccp2->state != ISP_PIPELINE_STREAM_SINGLESHOT) { in ccp2_s_stream()
871 format = &ccp2->formats[CCP2_PAD_SINK]; in ccp2_s_stream()
873 ccp2->mem_cfg.hsize_count = format->width; in ccp2_s_stream()
874 ccp2->mem_cfg.vsize_count = format->height; in ccp2_s_stream()
875 ccp2->mem_cfg.src_ofst = 0; in ccp2_s_stream()
877 ccp2_mem_configure(ccp2, &ccp2->mem_cfg); in ccp2_s_stream()
879 ccp2_print_status(ccp2); in ccp2_s_stream()
881 ccp2_mem_enable(ccp2, 1); in ccp2_s_stream()
885 if (omap3isp_module_sync_idle(&sd->entity, &ccp2->wait, in ccp2_s_stream()
886 &ccp2->stopping)) in ccp2_s_stream()
888 if (ccp2->input == CCP2_INPUT_MEMORY) { in ccp2_s_stream()
889 ccp2_mem_enable(ccp2, 0); in ccp2_s_stream()
891 } else if (ccp2->input == CCP2_INPUT_SENSOR) { in ccp2_s_stream()
893 ccp2_if_enable(ccp2, 0); in ccp2_s_stream()
894 if (ccp2->phy) in ccp2_s_stream()
895 omap3isp_csiphy_release(ccp2->phy); in ccp2_s_stream()
900 ccp2->state = enable; in ccp2_s_stream()
940 struct isp_ccp2_device *ccp2 = &video->isp->isp_ccp2; in ccp2_video_queue() local
942 ccp2_set_inaddr(ccp2, buffer->dma); in ccp2_video_queue()
967 struct isp_ccp2_device *ccp2 = v4l2_get_subdevdata(sd); in ccp2_link_setup() local
978 if (ccp2->input == CCP2_INPUT_SENSOR) in ccp2_link_setup()
980 ccp2->input = CCP2_INPUT_MEMORY; in ccp2_link_setup()
982 if (ccp2->input == CCP2_INPUT_MEMORY) in ccp2_link_setup()
983 ccp2->input = CCP2_INPUT_NONE; in ccp2_link_setup()
990 if (ccp2->input == CCP2_INPUT_MEMORY) in ccp2_link_setup()
992 ccp2->input = CCP2_INPUT_SENSOR; in ccp2_link_setup()
994 if (ccp2->input == CCP2_INPUT_SENSOR) in ccp2_link_setup()
995 ccp2->input = CCP2_INPUT_NONE; in ccp2_link_setup()
1001 ccp2->output = CCP2_OUTPUT_CCDC; in ccp2_link_setup()
1003 ccp2->output = CCP2_OUTPUT_NONE; in ccp2_link_setup()
1023 void omap3isp_ccp2_unregister_entities(struct isp_ccp2_device *ccp2) in omap3isp_ccp2_unregister_entities() argument
1025 v4l2_device_unregister_subdev(&ccp2->subdev); in omap3isp_ccp2_unregister_entities()
1026 omap3isp_video_unregister(&ccp2->video_in); in omap3isp_ccp2_unregister_entities()
1036 int omap3isp_ccp2_register_entities(struct isp_ccp2_device *ccp2, in omap3isp_ccp2_register_entities() argument
1042 ccp2->subdev.dev = vdev->mdev->dev; in omap3isp_ccp2_register_entities()
1043 ret = v4l2_device_register_subdev(vdev, &ccp2->subdev); in omap3isp_ccp2_register_entities()
1047 ret = omap3isp_video_register(&ccp2->video_in, vdev); in omap3isp_ccp2_register_entities()
1054 omap3isp_ccp2_unregister_entities(ccp2); in omap3isp_ccp2_register_entities()
1067 static int ccp2_init_entities(struct isp_ccp2_device *ccp2) in ccp2_init_entities() argument
1069 struct v4l2_subdev *sd = &ccp2->subdev; in ccp2_init_entities()
1070 struct media_pad *pads = ccp2->pads; in ccp2_init_entities()
1074 ccp2->input = CCP2_INPUT_NONE; in ccp2_init_entities()
1075 ccp2->output = CCP2_OUTPUT_NONE; in ccp2_init_entities()
1081 v4l2_set_subdevdata(sd, ccp2); in ccp2_init_entities()
1106 ccp2->video_in.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; in ccp2_init_entities()
1107 ccp2->video_in.bpl_alignment = 32; in ccp2_init_entities()
1108 ccp2->video_in.bpl_max = 0xffffffe0; in ccp2_init_entities()
1109 ccp2->video_in.isp = to_isp_device(ccp2); in ccp2_init_entities()
1110 ccp2->video_in.ops = &ccp2_video_ops; in ccp2_init_entities()
1111 ccp2->video_in.capture_mem = PAGE_ALIGN(4096 * 4096) * 3; in ccp2_init_entities()
1113 ret = omap3isp_video_init(&ccp2->video_in, "CCP2"); in ccp2_init_entities()
1120 media_entity_cleanup(&ccp2->subdev.entity); in ccp2_init_entities()
1131 struct isp_ccp2_device *ccp2 = &isp->isp_ccp2; in omap3isp_ccp2_init() local
1134 init_waitqueue_head(&ccp2->wait); in omap3isp_ccp2_init()
1148 ccp2->vdds_csib = devm_regulator_get(isp->dev, "vdds_csib"); in omap3isp_ccp2_init()
1149 if (IS_ERR(ccp2->vdds_csib)) { in omap3isp_ccp2_init()
1150 if (PTR_ERR(ccp2->vdds_csib) == -EPROBE_DEFER) { in omap3isp_ccp2_init()
1157 ccp2->vdds_csib = NULL; in omap3isp_ccp2_init()
1159 ccp2->phy = &isp->isp_csiphy2; in omap3isp_ccp2_init()
1161 ccp2->phy = &isp->isp_csiphy1; in omap3isp_ccp2_init()
1164 ret = ccp2_init_entities(ccp2); in omap3isp_ccp2_init()
1168 ccp2_reset(ccp2); in omap3isp_ccp2_init()
1178 struct isp_ccp2_device *ccp2 = &isp->isp_ccp2; in omap3isp_ccp2_cleanup() local
1180 omap3isp_video_cleanup(&ccp2->video_in); in omap3isp_ccp2_cleanup()
1181 media_entity_cleanup(&ccp2->subdev.entity); in omap3isp_ccp2_cleanup()