Lines Matching refs:ccp2
71 static void ccp2_print_status(struct isp_ccp2_device *ccp2) in ccp2_print_status() argument
73 struct isp_device *isp = to_isp_device(ccp2); in ccp2_print_status()
113 static void ccp2_reset(struct isp_ccp2_device *ccp2) in ccp2_reset() argument
115 struct isp_device *isp = to_isp_device(ccp2); in ccp2_reset()
136 static void ccp2_pwr_cfg(struct isp_ccp2_device *ccp2) in ccp2_pwr_cfg() argument
138 struct isp_device *isp = to_isp_device(ccp2); in ccp2_pwr_cfg()
151 static int ccp2_if_enable(struct isp_ccp2_device *ccp2, u8 enable) in ccp2_if_enable() argument
153 struct isp_device *isp = to_isp_device(ccp2); in ccp2_if_enable()
157 if (enable && ccp2->vdds_csib) { in ccp2_if_enable()
158 ret = regulator_enable(ccp2->vdds_csib); in ccp2_if_enable()
174 if (!enable && ccp2->vdds_csib) in ccp2_if_enable()
175 regulator_disable(ccp2->vdds_csib); in ccp2_if_enable()
185 static void ccp2_mem_enable(struct isp_ccp2_device *ccp2, u8 enable) in ccp2_mem_enable() argument
187 struct isp_device *isp = to_isp_device(ccp2); in ccp2_mem_enable()
190 ccp2_if_enable(ccp2, 0); in ccp2_mem_enable()
210 static int ccp2_phyif_config(struct isp_ccp2_device *ccp2, in ccp2_phyif_config() argument
213 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
357 ccp2_pwr_cfg(ccp2); in ccp2_if_configure()
359 pad = media_entity_remote_pad(&ccp2->pads[CCP2_PAD_SINK]); in ccp2_if_configure()
363 ret = ccp2_phyif_config(ccp2, &buscfg->bus.ccp2); in ccp2_if_configure()
367 ccp2_vp_config(ccp2, buscfg->bus.ccp2.vpclk_div + 1); in ccp2_if_configure()
371 format = &ccp2->formats[CCP2_PAD_SINK]; in ccp2_if_configure()
373 ccp2->if_cfg.data_start = lines; in ccp2_if_configure()
374 ccp2->if_cfg.crc = buscfg->bus.ccp2.crc; in ccp2_if_configure()
375 ccp2->if_cfg.format = format->code; in ccp2_if_configure()
376 ccp2->if_cfg.data_size = format->height; in ccp2_if_configure()
378 ccp2_lcx_config(ccp2, &ccp2->if_cfg); in ccp2_if_configure()
383 static int ccp2_adjust_bandwidth(struct isp_ccp2_device *ccp2) in ccp2_adjust_bandwidth() argument
385 struct isp_pipeline *pipe = to_isp_pipeline(&ccp2->subdev.entity); in ccp2_adjust_bandwidth()
386 struct isp_device *isp = to_isp_device(ccp2); in ccp2_adjust_bandwidth()
387 const struct v4l2_mbus_framefmt *ofmt = &ccp2->formats[CCP2_PAD_SOURCE]; in ccp2_adjust_bandwidth()
431 static void ccp2_mem_configure(struct isp_ccp2_device *ccp2, in ccp2_mem_configure() argument
434 struct isp_device *isp = to_isp_device(ccp2); in ccp2_mem_configure()
435 u32 sink_pixcode = ccp2->formats[CCP2_PAD_SINK].code; in ccp2_mem_configure()
436 u32 source_pixcode = ccp2->formats[CCP2_PAD_SOURCE].code; in ccp2_mem_configure()
444 ccp2_pwr_cfg(ccp2); in ccp2_mem_configure()
455 if (ccp2->video_in.bpl_padding == 0) in ccp2_mem_configure()
458 config->src_ofst = ccp2->video_in.bpl_value; in ccp2_mem_configure()
504 ccp2_vp_config(ccp2, ccp2_adjust_bandwidth(ccp2)); in ccp2_mem_configure()
524 static void ccp2_set_inaddr(struct isp_ccp2_device *ccp2, u32 addr) in ccp2_set_inaddr() argument
526 struct isp_device *isp = to_isp_device(ccp2); in ccp2_set_inaddr()
535 static void ccp2_isr_buffer(struct isp_ccp2_device *ccp2) in ccp2_isr_buffer() argument
537 struct isp_pipeline *pipe = to_isp_pipeline(&ccp2->subdev.entity); in ccp2_isr_buffer()
540 buffer = omap3isp_video_buffer_next(&ccp2->video_in); in ccp2_isr_buffer()
542 ccp2_set_inaddr(ccp2, buffer->dma); in ccp2_isr_buffer()
546 if (ccp2->state == ISP_PIPELINE_STREAM_SINGLESHOT) { in ccp2_isr_buffer()
559 void omap3isp_ccp2_isr(struct isp_ccp2_device *ccp2) in omap3isp_ccp2_isr() argument
561 struct isp_pipeline *pipe = to_isp_pipeline(&ccp2->subdev.entity); in omap3isp_ccp2_isr()
562 struct isp_device *isp = to_isp_device(ccp2); in omap3isp_ccp2_isr()
594 if (omap3isp_module_sync_is_stopping(&ccp2->wait, &ccp2->stopping)) in omap3isp_ccp2_isr()
599 ccp2_isr_buffer(ccp2); in omap3isp_ccp2_isr()
620 __ccp2_get_format(struct isp_ccp2_device *ccp2, struct v4l2_subdev_pad_config *cfg, in __ccp2_get_format() argument
624 return v4l2_subdev_get_try_format(&ccp2->subdev, cfg, pad); in __ccp2_get_format()
626 return &ccp2->formats[pad]; in __ccp2_get_format()
637 static void ccp2_try_format(struct isp_ccp2_device *ccp2, in ccp2_try_format() argument
649 if (ccp2->input == CCP2_INPUT_SENSOR) { in ccp2_try_format()
656 } else if (ccp2->input == CCP2_INPUT_MEMORY) { in ccp2_try_format()
672 format = __ccp2_get_format(ccp2, cfg, CCP2_PAD_SINK, which); in ccp2_try_format()
693 struct isp_ccp2_device *ccp2 = v4l2_get_subdevdata(sd); in ccp2_enum_mbus_code() local
705 format = __ccp2_get_format(ccp2, cfg, CCP2_PAD_SINK, in ccp2_enum_mbus_code()
717 struct isp_ccp2_device *ccp2 = v4l2_get_subdevdata(sd); in ccp2_enum_frame_size() local
726 ccp2_try_format(ccp2, cfg, fse->pad, &format, fse->which); in ccp2_enum_frame_size()
736 ccp2_try_format(ccp2, cfg, fse->pad, &format, fse->which); in ccp2_enum_frame_size()
753 struct isp_ccp2_device *ccp2 = v4l2_get_subdevdata(sd); in ccp2_get_format() local
756 format = __ccp2_get_format(ccp2, cfg, fmt->pad, fmt->which); in ccp2_get_format()
774 struct isp_ccp2_device *ccp2 = v4l2_get_subdevdata(sd); in ccp2_set_format() local
777 format = __ccp2_get_format(ccp2, cfg, fmt->pad, fmt->which); in ccp2_set_format()
781 ccp2_try_format(ccp2, cfg, fmt->pad, &fmt->format, fmt->which); in ccp2_set_format()
786 format = __ccp2_get_format(ccp2, cfg, CCP2_PAD_SOURCE, in ccp2_set_format()
789 ccp2_try_format(ccp2, cfg, CCP2_PAD_SOURCE, format, fmt->which); in ccp2_set_format()
827 struct isp_ccp2_device *ccp2 = v4l2_get_subdevdata(sd); in ccp2_s_stream() local
828 struct isp_device *isp = to_isp_device(ccp2); in ccp2_s_stream()
829 struct device *dev = to_device(ccp2); in ccp2_s_stream()
832 if (ccp2->state == ISP_PIPELINE_STREAM_STOPPED) { in ccp2_s_stream()
835 atomic_set(&ccp2->stopping, 0); in ccp2_s_stream()
840 if (ccp2->phy) { in ccp2_s_stream()
841 ret = omap3isp_csiphy_acquire(ccp2->phy); in ccp2_s_stream()
846 ccp2_if_configure(ccp2); in ccp2_s_stream()
847 ccp2_print_status(ccp2); in ccp2_s_stream()
850 ret = ccp2_if_enable(ccp2, 1); in ccp2_s_stream()
852 if (ccp2->phy) in ccp2_s_stream()
853 omap3isp_csiphy_release(ccp2->phy); in ccp2_s_stream()
859 if (ccp2->state != ISP_PIPELINE_STREAM_SINGLESHOT) { in ccp2_s_stream()
862 format = &ccp2->formats[CCP2_PAD_SINK]; in ccp2_s_stream()
864 ccp2->mem_cfg.hsize_count = format->width; in ccp2_s_stream()
865 ccp2->mem_cfg.vsize_count = format->height; in ccp2_s_stream()
866 ccp2->mem_cfg.src_ofst = 0; in ccp2_s_stream()
868 ccp2_mem_configure(ccp2, &ccp2->mem_cfg); in ccp2_s_stream()
870 ccp2_print_status(ccp2); in ccp2_s_stream()
872 ccp2_mem_enable(ccp2, 1); in ccp2_s_stream()
876 if (omap3isp_module_sync_idle(&sd->entity, &ccp2->wait, in ccp2_s_stream()
877 &ccp2->stopping)) in ccp2_s_stream()
879 if (ccp2->input == CCP2_INPUT_MEMORY) { in ccp2_s_stream()
880 ccp2_mem_enable(ccp2, 0); in ccp2_s_stream()
882 } else if (ccp2->input == CCP2_INPUT_SENSOR) { in ccp2_s_stream()
884 ccp2_if_enable(ccp2, 0); in ccp2_s_stream()
885 if (ccp2->phy) in ccp2_s_stream()
886 omap3isp_csiphy_release(ccp2->phy); in ccp2_s_stream()
891 ccp2->state = enable; in ccp2_s_stream()
931 struct isp_ccp2_device *ccp2 = &video->isp->isp_ccp2; in ccp2_video_queue() local
933 ccp2_set_inaddr(ccp2, buffer->dma); in ccp2_video_queue()
958 struct isp_ccp2_device *ccp2 = v4l2_get_subdevdata(sd); in ccp2_link_setup() local
964 if (ccp2->input == CCP2_INPUT_SENSOR) in ccp2_link_setup()
966 ccp2->input = CCP2_INPUT_MEMORY; in ccp2_link_setup()
968 if (ccp2->input == CCP2_INPUT_MEMORY) in ccp2_link_setup()
969 ccp2->input = CCP2_INPUT_NONE; in ccp2_link_setup()
976 if (ccp2->input == CCP2_INPUT_MEMORY) in ccp2_link_setup()
978 ccp2->input = CCP2_INPUT_SENSOR; in ccp2_link_setup()
980 if (ccp2->input == CCP2_INPUT_SENSOR) in ccp2_link_setup()
981 ccp2->input = CCP2_INPUT_NONE; in ccp2_link_setup()
987 ccp2->output = CCP2_OUTPUT_CCDC; in ccp2_link_setup()
989 ccp2->output = CCP2_OUTPUT_NONE; in ccp2_link_setup()
1009 void omap3isp_ccp2_unregister_entities(struct isp_ccp2_device *ccp2) in omap3isp_ccp2_unregister_entities() argument
1011 v4l2_device_unregister_subdev(&ccp2->subdev); in omap3isp_ccp2_unregister_entities()
1012 omap3isp_video_unregister(&ccp2->video_in); in omap3isp_ccp2_unregister_entities()
1022 int omap3isp_ccp2_register_entities(struct isp_ccp2_device *ccp2, in omap3isp_ccp2_register_entities() argument
1028 ret = v4l2_device_register_subdev(vdev, &ccp2->subdev); in omap3isp_ccp2_register_entities()
1032 ret = omap3isp_video_register(&ccp2->video_in, vdev); in omap3isp_ccp2_register_entities()
1039 omap3isp_ccp2_unregister_entities(ccp2); in omap3isp_ccp2_register_entities()
1052 static int ccp2_init_entities(struct isp_ccp2_device *ccp2) in ccp2_init_entities() argument
1054 struct v4l2_subdev *sd = &ccp2->subdev; in ccp2_init_entities()
1055 struct media_pad *pads = ccp2->pads; in ccp2_init_entities()
1059 ccp2->input = CCP2_INPUT_NONE; in ccp2_init_entities()
1060 ccp2->output = CCP2_OUTPUT_NONE; in ccp2_init_entities()
1066 v4l2_set_subdevdata(sd, ccp2); in ccp2_init_entities()
1091 ccp2->video_in.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; in ccp2_init_entities()
1092 ccp2->video_in.bpl_alignment = 32; in ccp2_init_entities()
1093 ccp2->video_in.bpl_max = 0xffffffe0; in ccp2_init_entities()
1094 ccp2->video_in.isp = to_isp_device(ccp2); in ccp2_init_entities()
1095 ccp2->video_in.ops = &ccp2_video_ops; in ccp2_init_entities()
1096 ccp2->video_in.capture_mem = PAGE_ALIGN(4096 * 4096) * 3; in ccp2_init_entities()
1098 ret = omap3isp_video_init(&ccp2->video_in, "CCP2"); in ccp2_init_entities()
1103 ret = media_entity_create_link(&ccp2->video_in.video.entity, 0, in ccp2_init_entities()
1104 &ccp2->subdev.entity, CCP2_PAD_SINK, 0); in ccp2_init_entities()
1111 omap3isp_video_cleanup(&ccp2->video_in); in ccp2_init_entities()
1113 media_entity_cleanup(&ccp2->subdev.entity); in ccp2_init_entities()
1124 struct isp_ccp2_device *ccp2 = &isp->isp_ccp2; in omap3isp_ccp2_init() local
1127 init_waitqueue_head(&ccp2->wait); in omap3isp_ccp2_init()
1141 ccp2->vdds_csib = devm_regulator_get(isp->dev, "vdds_csib"); in omap3isp_ccp2_init()
1142 if (IS_ERR(ccp2->vdds_csib)) { in omap3isp_ccp2_init()
1145 ccp2->vdds_csib = NULL; in omap3isp_ccp2_init()
1148 ccp2->phy = &isp->isp_csiphy1; in omap3isp_ccp2_init()
1151 ret = ccp2_init_entities(ccp2); in omap3isp_ccp2_init()
1155 ccp2_reset(ccp2); in omap3isp_ccp2_init()
1165 struct isp_ccp2_device *ccp2 = &isp->isp_ccp2; in omap3isp_ccp2_cleanup() local
1167 omap3isp_video_cleanup(&ccp2->video_in); in omap3isp_ccp2_cleanup()
1168 media_entity_cleanup(&ccp2->subdev.entity); in omap3isp_ccp2_cleanup()