Lines Matching refs:csi2

31 			   struct isp_csi2_device *csi2, u8 enable)  in csi2_if_enable()  argument
33 struct isp_csi2_ctrl_cfg *currctrl = &csi2->ctrl; in csi2_if_enable()
35 isp_reg_clr_set(isp, csi2->regs1, ISPCSI2_CTRL, ISPCSI2_CTRL_IF_EN, in csi2_if_enable()
47 struct isp_csi2_device *csi2, in csi2_recv_config() argument
52 reg = isp_reg_readl(isp, csi2->regs1, ISPCSI2_CTRL); in csi2_recv_config()
77 isp_reg_writel(isp, reg, csi2->regs1, ISPCSI2_CTRL); in csi2_recv_config()
168 static u16 csi2_ctx_map_format(struct isp_csi2_device *csi2) in csi2_ctx_map_format() argument
170 const struct v4l2_mbus_framefmt *fmt = &csi2->formats[CSI2_PAD_SINK]; in csi2_ctx_map_format()
195 if (!(csi2->output & CSI2_OUTPUT_CCDC) && in csi2_ctx_map_format()
196 !(csi2->output & CSI2_OUTPUT_MEMORY)) { in csi2_ctx_map_format()
204 destidx = csi2->frame_skip ? 0 : !!(csi2->output & CSI2_OUTPUT_CCDC); in csi2_ctx_map_format()
205 is_3630 = csi2->isp->revision == ISP_REVISION_15_0; in csi2_ctx_map_format()
207 return __csi2_fmt_map[fmtidx][destidx][csi2->dpcm_decompress][is_3630]; in csi2_ctx_map_format()
220 static void csi2_set_outaddr(struct isp_csi2_device *csi2, u32 addr) in csi2_set_outaddr() argument
222 struct isp_device *isp = csi2->isp; in csi2_set_outaddr()
223 struct isp_csi2_ctx_cfg *ctx = &csi2->contexts[0]; in csi2_set_outaddr()
228 csi2->regs1, ISPCSI2_CTX_DAT_PING_ADDR(ctx->ctxnum)); in csi2_set_outaddr()
230 csi2->regs1, ISPCSI2_CTX_DAT_PONG_ADDR(ctx->ctxnum)); in csi2_set_outaddr()
251 struct isp_csi2_device *csi2, u8 ctxnum, u8 enable) in csi2_ctx_enable() argument
253 struct isp_csi2_ctx_cfg *ctx = &csi2->contexts[ctxnum]; in csi2_ctx_enable()
257 reg = isp_reg_readl(isp, csi2->regs1, ISPCSI2_CTX_CTRL1(ctxnum)); in csi2_ctx_enable()
260 if (csi2->frame_skip) in csi2_ctx_enable()
261 skip = csi2->frame_skip; in csi2_ctx_enable()
262 else if (csi2->output & CSI2_OUTPUT_MEMORY) in csi2_ctx_enable()
273 isp_reg_writel(isp, reg, csi2->regs1, ISPCSI2_CTX_CTRL1(ctxnum)); in csi2_ctx_enable()
283 struct isp_csi2_device *csi2, in csi2_ctx_config() argument
289 reg = isp_reg_readl(isp, csi2->regs1, ISPCSI2_CTX_CTRL1(ctx->ctxnum)); in csi2_ctx_config()
306 isp_reg_writel(isp, reg, csi2->regs1, ISPCSI2_CTX_CTRL1(ctx->ctxnum)); in csi2_ctx_config()
309 reg = isp_reg_readl(isp, csi2->regs1, ISPCSI2_CTX_CTRL2(ctx->ctxnum)); in csi2_ctx_config()
329 isp_reg_writel(isp, reg, csi2->regs1, ISPCSI2_CTX_CTRL2(ctx->ctxnum)); in csi2_ctx_config()
332 reg = isp_reg_readl(isp, csi2->regs1, ISPCSI2_CTX_CTRL3(ctx->ctxnum)); in csi2_ctx_config()
336 isp_reg_writel(isp, reg, csi2->regs1, ISPCSI2_CTX_CTRL3(ctx->ctxnum)); in csi2_ctx_config()
339 reg = isp_reg_readl(isp, csi2->regs1, in csi2_ctx_config()
343 isp_reg_writel(isp, reg, csi2->regs1, in csi2_ctx_config()
347 csi2->regs1, ISPCSI2_CTX_DAT_PING_ADDR(ctx->ctxnum)); in csi2_ctx_config()
350 csi2->regs1, ISPCSI2_CTX_DAT_PONG_ADDR(ctx->ctxnum)); in csi2_ctx_config()
358 struct isp_csi2_device *csi2, in csi2_timing_config() argument
363 reg = isp_reg_readl(isp, csi2->regs1, ISPCSI2_TIMING); in csi2_timing_config()
384 isp_reg_writel(isp, reg, csi2->regs1, ISPCSI2_TIMING); in csi2_timing_config()
392 struct isp_csi2_device *csi2, int enable) in csi2_irq_ctx_set() argument
397 isp_reg_writel(isp, ISPCSI2_CTX_IRQSTATUS_FE_IRQ, csi2->regs1, in csi2_irq_ctx_set()
400 isp_reg_set(isp, csi2->regs1, ISPCSI2_CTX_IRQENABLE(i), in csi2_irq_ctx_set()
403 isp_reg_clr(isp, csi2->regs1, ISPCSI2_CTX_IRQENABLE(i), in csi2_irq_ctx_set()
413 struct isp_csi2_device *csi2, int enable) in csi2_irq_complexio1_set() argument
443 isp_reg_writel(isp, reg, csi2->regs1, ISPCSI2_PHY_IRQSTATUS); in csi2_irq_complexio1_set()
445 reg |= isp_reg_readl(isp, csi2->regs1, ISPCSI2_PHY_IRQENABLE); in csi2_irq_complexio1_set()
448 isp_reg_writel(isp, reg, csi2->regs1, ISPCSI2_PHY_IRQENABLE); in csi2_irq_complexio1_set()
456 struct isp_csi2_device *csi2, int enable) in csi2_irq_status_set() argument
467 isp_reg_writel(isp, reg, csi2->regs1, ISPCSI2_IRQSTATUS); in csi2_irq_status_set()
469 reg |= isp_reg_readl(isp, csi2->regs1, ISPCSI2_IRQENABLE); in csi2_irq_status_set()
473 isp_reg_writel(isp, reg, csi2->regs1, ISPCSI2_IRQENABLE); in csi2_irq_status_set()
483 int omap3isp_csi2_reset(struct isp_csi2_device *csi2) in omap3isp_csi2_reset() argument
485 struct isp_device *isp = csi2->isp; in omap3isp_csi2_reset()
490 if (!csi2->available) in omap3isp_csi2_reset()
493 if (csi2->phy->entity) in omap3isp_csi2_reset()
496 isp_reg_set(isp, csi2->regs1, ISPCSI2_SYSCONFIG, in omap3isp_csi2_reset()
500 reg = isp_reg_readl(isp, csi2->regs1, ISPCSI2_SYSSTATUS) & in omap3isp_csi2_reset()
515 isp_reg_set(isp, csi2->regs1, ISPCSI2_PHY_CFG, in omap3isp_csi2_reset()
520 reg = isp_reg_readl(isp, csi2->phy->phy_regs, ISPCSIPHY_REG1) in omap3isp_csi2_reset()
534 isp_reg_clr_set(isp, csi2->regs1, ISPCSI2_SYSCONFIG, in omap3isp_csi2_reset()
541 isp_reg_clr_set(isp, csi2->regs1, ISPCSI2_SYSCONFIG, in omap3isp_csi2_reset()
549 static int csi2_configure(struct isp_csi2_device *csi2) in csi2_configure() argument
551 struct isp_pipeline *pipe = to_isp_pipeline(&csi2->subdev.entity); in csi2_configure()
553 struct isp_device *isp = csi2->isp; in csi2_configure()
554 struct isp_csi2_timing_cfg *timing = &csi2->timing[0]; in csi2_configure()
564 if (csi2->contexts[0].enabled || csi2->ctrl.if_enable) in csi2_configure()
567 pad = media_entity_remote_pad(&csi2->pads[CSI2_PAD_SINK]); in csi2_configure()
571 csi2->frame_skip = 0; in csi2_configure()
572 v4l2_subdev_call(sensor, sensor, g_skip_frames, &csi2->frame_skip); in csi2_configure()
574 csi2->ctrl.vp_out_ctrl = in csi2_configure()
579 csi2->ctrl.vp_out_ctrl); in csi2_configure()
580 csi2->ctrl.frame_mode = ISP_CSI2_FRAME_IMMEDIATE; in csi2_configure()
581 csi2->ctrl.ecc_enable = buscfg->bus.csi2.crc; in csi2_configure()
594 if (csi2->formats[CSI2_PAD_SINK].code != in csi2_configure()
595 csi2->formats[CSI2_PAD_SOURCE].code) in csi2_configure()
596 csi2->dpcm_decompress = true; in csi2_configure()
598 csi2->dpcm_decompress = false; in csi2_configure()
600 csi2->contexts[0].format_id = csi2_ctx_map_format(csi2); in csi2_configure()
602 if (csi2->video_out.bpl_padding == 0) in csi2_configure()
603 csi2->contexts[0].data_offset = 0; in csi2_configure()
605 csi2->contexts[0].data_offset = csi2->video_out.bpl_value; in csi2_configure()
614 csi2->contexts[0].eof_enabled = 1; in csi2_configure()
615 csi2->contexts[0].eol_enabled = 1; in csi2_configure()
617 csi2_irq_complexio1_set(isp, csi2, 1); in csi2_configure()
618 csi2_irq_ctx_set(isp, csi2, 1); in csi2_configure()
619 csi2_irq_status_set(isp, csi2, 1); in csi2_configure()
622 csi2_timing_config(isp, csi2, timing); in csi2_configure()
623 csi2_recv_config(isp, csi2, &csi2->ctrl); in csi2_configure()
624 csi2_ctx_config(isp, csi2, &csi2->contexts[0]); in csi2_configure()
636 static void csi2_print_status(struct isp_csi2_device *csi2) in csi2_print_status() argument
638 struct isp_device *isp = csi2->isp; in csi2_print_status()
640 if (!csi2->available) in csi2_print_status()
645 CSI2_PRINT_REGISTER(isp, csi2->regs1, SYSCONFIG); in csi2_print_status()
646 CSI2_PRINT_REGISTER(isp, csi2->regs1, SYSSTATUS); in csi2_print_status()
647 CSI2_PRINT_REGISTER(isp, csi2->regs1, IRQENABLE); in csi2_print_status()
648 CSI2_PRINT_REGISTER(isp, csi2->regs1, IRQSTATUS); in csi2_print_status()
649 CSI2_PRINT_REGISTER(isp, csi2->regs1, CTRL); in csi2_print_status()
650 CSI2_PRINT_REGISTER(isp, csi2->regs1, DBG_H); in csi2_print_status()
651 CSI2_PRINT_REGISTER(isp, csi2->regs1, GNQ); in csi2_print_status()
652 CSI2_PRINT_REGISTER(isp, csi2->regs1, PHY_CFG); in csi2_print_status()
653 CSI2_PRINT_REGISTER(isp, csi2->regs1, PHY_IRQSTATUS); in csi2_print_status()
654 CSI2_PRINT_REGISTER(isp, csi2->regs1, SHORT_PACKET); in csi2_print_status()
655 CSI2_PRINT_REGISTER(isp, csi2->regs1, PHY_IRQENABLE); in csi2_print_status()
656 CSI2_PRINT_REGISTER(isp, csi2->regs1, DBG_P); in csi2_print_status()
657 CSI2_PRINT_REGISTER(isp, csi2->regs1, TIMING); in csi2_print_status()
658 CSI2_PRINT_REGISTER(isp, csi2->regs1, CTX_CTRL1(0)); in csi2_print_status()
659 CSI2_PRINT_REGISTER(isp, csi2->regs1, CTX_CTRL2(0)); in csi2_print_status()
660 CSI2_PRINT_REGISTER(isp, csi2->regs1, CTX_DAT_OFST(0)); in csi2_print_status()
661 CSI2_PRINT_REGISTER(isp, csi2->regs1, CTX_DAT_PING_ADDR(0)); in csi2_print_status()
662 CSI2_PRINT_REGISTER(isp, csi2->regs1, CTX_DAT_PONG_ADDR(0)); in csi2_print_status()
663 CSI2_PRINT_REGISTER(isp, csi2->regs1, CTX_IRQENABLE(0)); in csi2_print_status()
664 CSI2_PRINT_REGISTER(isp, csi2->regs1, CTX_IRQSTATUS(0)); in csi2_print_status()
665 CSI2_PRINT_REGISTER(isp, csi2->regs1, CTX_CTRL3(0)); in csi2_print_status()
678 static void csi2_isr_buffer(struct isp_csi2_device *csi2) in csi2_isr_buffer() argument
680 struct isp_device *isp = csi2->isp; in csi2_isr_buffer()
683 csi2_ctx_enable(isp, csi2, 0, 0); in csi2_isr_buffer()
685 buffer = omap3isp_video_buffer_next(&csi2->video_out); in csi2_isr_buffer()
694 csi2_set_outaddr(csi2, buffer->dma); in csi2_isr_buffer()
695 csi2_ctx_enable(isp, csi2, 0, 1); in csi2_isr_buffer()
698 static void csi2_isr_ctx(struct isp_csi2_device *csi2, in csi2_isr_ctx() argument
701 struct isp_device *isp = csi2->isp; in csi2_isr_ctx()
705 status = isp_reg_readl(isp, csi2->regs1, ISPCSI2_CTX_IRQSTATUS(n)); in csi2_isr_ctx()
706 isp_reg_writel(isp, status, csi2->regs1, ISPCSI2_CTX_IRQSTATUS(n)); in csi2_isr_ctx()
721 if (csi2->frame_skip) { in csi2_isr_ctx()
722 csi2->frame_skip--; in csi2_isr_ctx()
723 if (csi2->frame_skip == 0) { in csi2_isr_ctx()
724 ctx->format_id = csi2_ctx_map_format(csi2); in csi2_isr_ctx()
725 csi2_ctx_config(isp, csi2, ctx); in csi2_isr_ctx()
726 csi2_ctx_enable(isp, csi2, n, 1); in csi2_isr_ctx()
731 if (csi2->output & CSI2_OUTPUT_MEMORY) in csi2_isr_ctx()
732 csi2_isr_buffer(csi2); in csi2_isr_ctx()
738 void omap3isp_csi2_isr(struct isp_csi2_device *csi2) in omap3isp_csi2_isr() argument
740 struct isp_pipeline *pipe = to_isp_pipeline(&csi2->subdev.entity); in omap3isp_csi2_isr()
742 struct isp_device *isp = csi2->isp; in omap3isp_csi2_isr()
744 if (!csi2->available) in omap3isp_csi2_isr()
747 csi2_irqstatus = isp_reg_readl(isp, csi2->regs1, ISPCSI2_IRQSTATUS); in omap3isp_csi2_isr()
748 isp_reg_writel(isp, csi2_irqstatus, csi2->regs1, ISPCSI2_IRQSTATUS); in omap3isp_csi2_isr()
752 cpxio1_irqstatus = isp_reg_readl(isp, csi2->regs1, in omap3isp_csi2_isr()
755 csi2->regs1, ISPCSI2_PHY_IRQSTATUS); in omap3isp_csi2_isr()
781 if (omap3isp_module_sync_is_stopping(&csi2->wait, &csi2->stopping)) in omap3isp_csi2_isr()
786 csi2_isr_ctx(csi2, &csi2->contexts[0]); in omap3isp_csi2_isr()
804 struct isp_csi2_device *csi2 = &isp->isp_csi2a; in csi2_queue() local
806 csi2_set_outaddr(csi2, buffer->dma); in csi2_queue()
814 if (csi2->video_out.dmaqueue_flags & ISP_VIDEO_DMAQUEUE_UNDERRUN) { in csi2_queue()
816 csi2_if_enable(isp, csi2, 1); in csi2_queue()
817 csi2_ctx_enable(isp, csi2, 0, 1); in csi2_queue()
818 isp_video_dmaqueue_flags_clr(&csi2->video_out); in csi2_queue()
833 __csi2_get_format(struct isp_csi2_device *csi2, struct v4l2_subdev_pad_config *cfg, in __csi2_get_format() argument
837 return v4l2_subdev_get_try_format(&csi2->subdev, cfg, pad); in __csi2_get_format()
839 return &csi2->formats[pad]; in __csi2_get_format()
843 csi2_try_format(struct isp_csi2_device *csi2, struct v4l2_subdev_pad_config *cfg, in csi2_try_format() argument
873 format = __csi2_get_format(csi2, cfg, CSI2_PAD_SINK, which); in csi2_try_format()
902 struct isp_csi2_device *csi2 = v4l2_get_subdevdata(sd); in csi2_enum_mbus_code() local
912 format = __csi2_get_format(csi2, cfg, CSI2_PAD_SINK, in csi2_enum_mbus_code()
939 struct isp_csi2_device *csi2 = v4l2_get_subdevdata(sd); in csi2_enum_frame_size() local
948 csi2_try_format(csi2, cfg, fse->pad, &format, fse->which); in csi2_enum_frame_size()
958 csi2_try_format(csi2, cfg, fse->pad, &format, fse->which); in csi2_enum_frame_size()
975 struct isp_csi2_device *csi2 = v4l2_get_subdevdata(sd); in csi2_get_format() local
978 format = __csi2_get_format(csi2, cfg, fmt->pad, fmt->which); in csi2_get_format()
996 struct isp_csi2_device *csi2 = v4l2_get_subdevdata(sd); in csi2_set_format() local
999 format = __csi2_get_format(csi2, cfg, fmt->pad, fmt->which); in csi2_set_format()
1003 csi2_try_format(csi2, cfg, fmt->pad, &fmt->format, fmt->which); in csi2_set_format()
1008 format = __csi2_get_format(csi2, cfg, CSI2_PAD_SOURCE, in csi2_set_format()
1011 csi2_try_format(csi2, cfg, CSI2_PAD_SOURCE, format, fmt->which); in csi2_set_format()
1050 struct isp_csi2_device *csi2 = v4l2_get_subdevdata(sd); in csi2_set_stream() local
1051 struct isp_device *isp = csi2->isp; in csi2_set_stream()
1052 struct isp_video *video_out = &csi2->video_out; in csi2_set_stream()
1056 if (omap3isp_csiphy_acquire(csi2->phy, &sd->entity) < 0) in csi2_set_stream()
1058 if (csi2->output & CSI2_OUTPUT_MEMORY) in csi2_set_stream()
1060 csi2_configure(csi2); in csi2_set_stream()
1061 csi2_print_status(csi2); in csi2_set_stream()
1069 if (csi2->output & CSI2_OUTPUT_MEMORY && in csi2_set_stream()
1073 atomic_set(&csi2->stopping, 0); in csi2_set_stream()
1074 csi2_ctx_enable(isp, csi2, 0, 1); in csi2_set_stream()
1075 csi2_if_enable(isp, csi2, 1); in csi2_set_stream()
1080 if (csi2->state == ISP_PIPELINE_STREAM_STOPPED) in csi2_set_stream()
1082 if (omap3isp_module_sync_idle(&sd->entity, &csi2->wait, in csi2_set_stream()
1083 &csi2->stopping)) in csi2_set_stream()
1086 csi2_ctx_enable(isp, csi2, 0, 0); in csi2_set_stream()
1087 csi2_if_enable(isp, csi2, 0); in csi2_set_stream()
1088 csi2_irq_ctx_set(isp, csi2, 0); in csi2_set_stream()
1089 omap3isp_csiphy_release(csi2->phy); in csi2_set_stream()
1095 csi2->state = enable; in csi2_set_stream()
1140 struct isp_csi2_device *csi2 = v4l2_get_subdevdata(sd); in csi2_link_setup() local
1141 struct isp_csi2_ctrl_cfg *ctrl = &csi2->ctrl; in csi2_link_setup()
1156 if (csi2->output & ~CSI2_OUTPUT_MEMORY) in csi2_link_setup()
1158 csi2->output |= CSI2_OUTPUT_MEMORY; in csi2_link_setup()
1160 csi2->output &= ~CSI2_OUTPUT_MEMORY; in csi2_link_setup()
1166 if (csi2->output & ~CSI2_OUTPUT_CCDC) in csi2_link_setup()
1168 csi2->output |= CSI2_OUTPUT_CCDC; in csi2_link_setup()
1170 csi2->output &= ~CSI2_OUTPUT_CCDC; in csi2_link_setup()
1180 (csi2->output & CSI2_OUTPUT_MEMORY) ? false : true; in csi2_link_setup()
1181 ctrl->vp_clk_enable = !!(csi2->output & CSI2_OUTPUT_CCDC); in csi2_link_setup()
1192 void omap3isp_csi2_unregister_entities(struct isp_csi2_device *csi2) in omap3isp_csi2_unregister_entities() argument
1194 v4l2_device_unregister_subdev(&csi2->subdev); in omap3isp_csi2_unregister_entities()
1195 omap3isp_video_unregister(&csi2->video_out); in omap3isp_csi2_unregister_entities()
1198 int omap3isp_csi2_register_entities(struct isp_csi2_device *csi2, in omap3isp_csi2_register_entities() argument
1204 ret = v4l2_device_register_subdev(vdev, &csi2->subdev); in omap3isp_csi2_register_entities()
1208 ret = omap3isp_video_register(&csi2->video_out, vdev); in omap3isp_csi2_register_entities()
1215 omap3isp_csi2_unregister_entities(csi2); in omap3isp_csi2_register_entities()
1228 static int csi2_init_entities(struct isp_csi2_device *csi2) in csi2_init_entities() argument
1230 struct v4l2_subdev *sd = &csi2->subdev; in csi2_init_entities()
1231 struct media_pad *pads = csi2->pads; in csi2_init_entities()
1240 v4l2_set_subdevdata(sd, csi2); in csi2_init_entities()
1255 csi2->video_out.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; in csi2_init_entities()
1256 csi2->video_out.ops = &csi2_ispvideo_ops; in csi2_init_entities()
1257 csi2->video_out.bpl_alignment = 32; in csi2_init_entities()
1258 csi2->video_out.bpl_zero_padding = 1; in csi2_init_entities()
1259 csi2->video_out.bpl_max = 0x1ffe0; in csi2_init_entities()
1260 csi2->video_out.isp = csi2->isp; in csi2_init_entities()
1261 csi2->video_out.capture_mem = PAGE_ALIGN(4096 * 4096) * 3; in csi2_init_entities()
1263 ret = omap3isp_video_init(&csi2->video_out, "CSI2a"); in csi2_init_entities()
1270 media_entity_cleanup(&csi2->subdev.entity); in csi2_init_entities()