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()
255 static void ccp2_vp_config(struct isp_ccp2_device *ccp2, in ccp2_vp_config() argument
258 struct isp_device *isp = to_isp_device(ccp2); in ccp2_vp_config()
288 static void ccp2_lcx_config(struct isp_ccp2_device *ccp2, in ccp2_lcx_config() argument
291 struct isp_device *isp = to_isp_device(ccp2); in ccp2_lcx_config()
351 static int ccp2_if_configure(struct isp_ccp2_device *ccp2) in ccp2_if_configure() argument
353 struct isp_pipeline *pipe = to_isp_pipeline(&ccp2->subdev.entity); in ccp2_if_configure()
361 ccp2_pwr_cfg(ccp2); in ccp2_if_configure()
363 pad = media_entity_remote_pad(&ccp2->pads[CCP2_PAD_SINK]); in ccp2_if_configure()
367 ret = ccp2_phyif_config(ccp2, &buscfg->bus.ccp2); in ccp2_if_configure()
371 ccp2_vp_config(ccp2, buscfg->bus.ccp2.vpclk_div + 1); in ccp2_if_configure()
375 format = &ccp2->formats[CCP2_PAD_SINK]; in ccp2_if_configure()
377 ccp2->if_cfg.data_start = lines; in ccp2_if_configure()
378 ccp2->if_cfg.crc = buscfg->bus.ccp2.crc; in ccp2_if_configure()
379 ccp2->if_cfg.format = format->code; in ccp2_if_configure()
380 ccp2->if_cfg.data_size = format->height; in ccp2_if_configure()
382 ccp2_lcx_config(ccp2, &ccp2->if_cfg); in ccp2_if_configure()
387 static int ccp2_adjust_bandwidth(struct isp_ccp2_device *ccp2) in ccp2_adjust_bandwidth() argument
389 struct isp_pipeline *pipe = to_isp_pipeline(&ccp2->subdev.entity); in ccp2_adjust_bandwidth()
390 struct isp_device *isp = to_isp_device(ccp2); in ccp2_adjust_bandwidth()
391 const struct v4l2_mbus_framefmt *ofmt = &ccp2->formats[CCP2_PAD_SOURCE]; in ccp2_adjust_bandwidth()
435 static void ccp2_mem_configure(struct isp_ccp2_device *ccp2, in ccp2_mem_configure() argument
438 struct isp_device *isp = to_isp_device(ccp2); in ccp2_mem_configure()
439 u32 sink_pixcode = ccp2->formats[CCP2_PAD_SINK].code; in ccp2_mem_configure()
440 u32 source_pixcode = ccp2->formats[CCP2_PAD_SOURCE].code; in ccp2_mem_configure()
448 ccp2_pwr_cfg(ccp2); in ccp2_mem_configure()
459 if (ccp2->video_in.bpl_padding == 0) in ccp2_mem_configure()
462 config->src_ofst = ccp2->video_in.bpl_value; in ccp2_mem_configure()
508 ccp2_vp_config(ccp2, ccp2_adjust_bandwidth(ccp2)); in ccp2_mem_configure()
528 static void ccp2_set_inaddr(struct isp_ccp2_device *ccp2, u32 addr) in ccp2_set_inaddr() argument
530 struct isp_device *isp = to_isp_device(ccp2); in ccp2_set_inaddr()
539 static void ccp2_isr_buffer(struct isp_ccp2_device *ccp2) in ccp2_isr_buffer() argument
541 struct isp_pipeline *pipe = to_isp_pipeline(&ccp2->subdev.entity); in ccp2_isr_buffer()
544 buffer = omap3isp_video_buffer_next(&ccp2->video_in); in ccp2_isr_buffer()
546 ccp2_set_inaddr(ccp2, buffer->dma); in ccp2_isr_buffer()
550 if (ccp2->state == ISP_PIPELINE_STREAM_SINGLESHOT) { in ccp2_isr_buffer()
563 void omap3isp_ccp2_isr(struct isp_ccp2_device *ccp2) in omap3isp_ccp2_isr() argument
565 struct isp_pipeline *pipe = to_isp_pipeline(&ccp2->subdev.entity); in omap3isp_ccp2_isr()
566 struct isp_device *isp = to_isp_device(ccp2); in omap3isp_ccp2_isr()
598 if (omap3isp_module_sync_is_stopping(&ccp2->wait, &ccp2->stopping)) in omap3isp_ccp2_isr()
603 ccp2_isr_buffer(ccp2); in omap3isp_ccp2_isr()
624 __ccp2_get_format(struct isp_ccp2_device *ccp2, struct v4l2_subdev_pad_config *cfg, in __ccp2_get_format() argument
628 return v4l2_subdev_get_try_format(&ccp2->subdev, cfg, pad); in __ccp2_get_format()
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
653 if (ccp2->input == CCP2_INPUT_SENSOR) { in ccp2_try_format()
660 } else if (ccp2->input == CCP2_INPUT_MEMORY) { in ccp2_try_format()
676 format = __ccp2_get_format(ccp2, cfg, CCP2_PAD_SINK, which); in ccp2_try_format()
697 struct isp_ccp2_device *ccp2 = v4l2_get_subdevdata(sd); in ccp2_enum_mbus_code() local
709 format = __ccp2_get_format(ccp2, cfg, CCP2_PAD_SINK, in ccp2_enum_mbus_code()
721 struct isp_ccp2_device *ccp2 = v4l2_get_subdevdata(sd); in ccp2_enum_frame_size() local
730 ccp2_try_format(ccp2, cfg, fse->pad, &format, fse->which); in ccp2_enum_frame_size()
740 ccp2_try_format(ccp2, cfg, fse->pad, &format, fse->which); in ccp2_enum_frame_size()
757 struct isp_ccp2_device *ccp2 = v4l2_get_subdevdata(sd); in ccp2_get_format() local
760 format = __ccp2_get_format(ccp2, cfg, fmt->pad, fmt->which); in ccp2_get_format()
778 struct isp_ccp2_device *ccp2 = v4l2_get_subdevdata(sd); in ccp2_set_format() local
781 format = __ccp2_get_format(ccp2, cfg, fmt->pad, fmt->which); in ccp2_set_format()
785 ccp2_try_format(ccp2, cfg, fmt->pad, &fmt->format, fmt->which); in ccp2_set_format()
790 format = __ccp2_get_format(ccp2, cfg, CCP2_PAD_SOURCE, in ccp2_set_format()
793 ccp2_try_format(ccp2, cfg, CCP2_PAD_SOURCE, format, fmt->which); in ccp2_set_format()
831 struct isp_ccp2_device *ccp2 = v4l2_get_subdevdata(sd); in ccp2_s_stream() local
832 struct isp_device *isp = to_isp_device(ccp2); in ccp2_s_stream()
833 struct device *dev = to_device(ccp2); in ccp2_s_stream()
836 if (ccp2->state == ISP_PIPELINE_STREAM_STOPPED) { in ccp2_s_stream()
839 atomic_set(&ccp2->stopping, 0); in ccp2_s_stream()
844 if (ccp2->phy) { in ccp2_s_stream()
845 ret = omap3isp_csiphy_acquire(ccp2->phy, &sd->entity); in ccp2_s_stream()
850 ccp2_if_configure(ccp2); in ccp2_s_stream()
851 ccp2_print_status(ccp2); in ccp2_s_stream()
854 ret = ccp2_if_enable(ccp2, 1); in ccp2_s_stream()
856 if (ccp2->phy) in ccp2_s_stream()
857 omap3isp_csiphy_release(ccp2->phy); in ccp2_s_stream()
863 if (ccp2->state != ISP_PIPELINE_STREAM_SINGLESHOT) { in ccp2_s_stream()
866 format = &ccp2->formats[CCP2_PAD_SINK]; in ccp2_s_stream()
868 ccp2->mem_cfg.hsize_count = format->width; in ccp2_s_stream()
869 ccp2->mem_cfg.vsize_count = format->height; in ccp2_s_stream()
870 ccp2->mem_cfg.src_ofst = 0; in ccp2_s_stream()
872 ccp2_mem_configure(ccp2, &ccp2->mem_cfg); in ccp2_s_stream()
874 ccp2_print_status(ccp2); in ccp2_s_stream()
876 ccp2_mem_enable(ccp2, 1); in ccp2_s_stream()
880 if (omap3isp_module_sync_idle(&sd->entity, &ccp2->wait, in ccp2_s_stream()
881 &ccp2->stopping)) in ccp2_s_stream()
883 if (ccp2->input == CCP2_INPUT_MEMORY) { in ccp2_s_stream()
884 ccp2_mem_enable(ccp2, 0); in ccp2_s_stream()
886 } else if (ccp2->input == CCP2_INPUT_SENSOR) { in ccp2_s_stream()
888 ccp2_if_enable(ccp2, 0); in ccp2_s_stream()
889 if (ccp2->phy) in ccp2_s_stream()
890 omap3isp_csiphy_release(ccp2->phy); in ccp2_s_stream()
895 ccp2->state = enable; in ccp2_s_stream()
935 struct isp_ccp2_device *ccp2 = &video->isp->isp_ccp2; in ccp2_video_queue() local
937 ccp2_set_inaddr(ccp2, buffer->dma); in ccp2_video_queue()
962 struct isp_ccp2_device *ccp2 = v4l2_get_subdevdata(sd); in ccp2_link_setup() local
973 if (ccp2->input == CCP2_INPUT_SENSOR) in ccp2_link_setup()
975 ccp2->input = CCP2_INPUT_MEMORY; in ccp2_link_setup()
977 if (ccp2->input == CCP2_INPUT_MEMORY) in ccp2_link_setup()
978 ccp2->input = CCP2_INPUT_NONE; in ccp2_link_setup()
985 if (ccp2->input == CCP2_INPUT_MEMORY) in ccp2_link_setup()
987 ccp2->input = CCP2_INPUT_SENSOR; in ccp2_link_setup()
989 if (ccp2->input == CCP2_INPUT_SENSOR) in ccp2_link_setup()
990 ccp2->input = CCP2_INPUT_NONE; in ccp2_link_setup()
996 ccp2->output = CCP2_OUTPUT_CCDC; in ccp2_link_setup()
998 ccp2->output = CCP2_OUTPUT_NONE; in ccp2_link_setup()
1018 void omap3isp_ccp2_unregister_entities(struct isp_ccp2_device *ccp2) in omap3isp_ccp2_unregister_entities() argument
1020 v4l2_device_unregister_subdev(&ccp2->subdev); in omap3isp_ccp2_unregister_entities()
1021 omap3isp_video_unregister(&ccp2->video_in); in omap3isp_ccp2_unregister_entities()
1031 int omap3isp_ccp2_register_entities(struct isp_ccp2_device *ccp2, in omap3isp_ccp2_register_entities() argument
1037 ret = v4l2_device_register_subdev(vdev, &ccp2->subdev); in omap3isp_ccp2_register_entities()
1041 ret = omap3isp_video_register(&ccp2->video_in, vdev); in omap3isp_ccp2_register_entities()
1048 omap3isp_ccp2_unregister_entities(ccp2); in omap3isp_ccp2_register_entities()
1061 static int ccp2_init_entities(struct isp_ccp2_device *ccp2) in ccp2_init_entities() argument
1063 struct v4l2_subdev *sd = &ccp2->subdev; in ccp2_init_entities()
1064 struct media_pad *pads = ccp2->pads; in ccp2_init_entities()
1068 ccp2->input = CCP2_INPUT_NONE; in ccp2_init_entities()
1069 ccp2->output = CCP2_OUTPUT_NONE; in ccp2_init_entities()
1075 v4l2_set_subdevdata(sd, ccp2); in ccp2_init_entities()
1100 ccp2->video_in.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; in ccp2_init_entities()
1101 ccp2->video_in.bpl_alignment = 32; in ccp2_init_entities()
1102 ccp2->video_in.bpl_max = 0xffffffe0; in ccp2_init_entities()
1103 ccp2->video_in.isp = to_isp_device(ccp2); in ccp2_init_entities()
1104 ccp2->video_in.ops = &ccp2_video_ops; in ccp2_init_entities()
1105 ccp2->video_in.capture_mem = PAGE_ALIGN(4096 * 4096) * 3; in ccp2_init_entities()
1107 ret = omap3isp_video_init(&ccp2->video_in, "CCP2"); in ccp2_init_entities()
1114 media_entity_cleanup(&ccp2->subdev.entity); in ccp2_init_entities()
1125 struct isp_ccp2_device *ccp2 = &isp->isp_ccp2; in omap3isp_ccp2_init() local
1128 init_waitqueue_head(&ccp2->wait); in omap3isp_ccp2_init()
1142 ccp2->vdds_csib = devm_regulator_get(isp->dev, "vdds_csib"); in omap3isp_ccp2_init()
1143 if (IS_ERR(ccp2->vdds_csib)) { in omap3isp_ccp2_init()
1144 if (PTR_ERR(ccp2->vdds_csib) == -EPROBE_DEFER) { in omap3isp_ccp2_init()
1151 ccp2->vdds_csib = NULL; in omap3isp_ccp2_init()
1153 ccp2->phy = &isp->isp_csiphy2; in omap3isp_ccp2_init()
1155 ccp2->phy = &isp->isp_csiphy1; in omap3isp_ccp2_init()
1158 ret = ccp2_init_entities(ccp2); in omap3isp_ccp2_init()
1162 ccp2_reset(ccp2); in omap3isp_ccp2_init()
1172 struct isp_ccp2_device *ccp2 = &isp->isp_ccp2; in omap3isp_ccp2_cleanup() local
1174 omap3isp_video_cleanup(&ccp2->video_in); in omap3isp_ccp2_cleanup()
1175 media_entity_cleanup(&ccp2->subdev.entity); in omap3isp_ccp2_cleanup()