Lines Matching +full:isp +full:- +full:0

1 // SPDX-License-Identifier: GPL-2.0-only
3 * isp.c
5 * TI OMAP3 ISP - Core
7 * Copyright (C) 2006-2010 Nokia Corporation
8 * Copyright (C) 2007-2009 Texas Instruments, Inc.
17 * Stanimir Varbanov <svarbanov@mm-sol.com>
22 * Ivan T. Ivanov <iivanov@mm-sol.com>
23 * RaniSuneela <r-m@ti.com>
24 * Atanas Filipov <afilipov@mm-sol.com>
25 * Gjorgji Rosikopulos <grosikopulos@mm-sol.com>
27 * Nayden Kanchev <nkanchev@mm-sol.com>
28 * Phil Carmody <ext-phil.2.carmody@nokia.com>
32 * Pallavi Kulkarni <p-kulkarni@ti.com>
39 * Troy Laramy <t-laramy@ti.com>
46 #include <linux/dma-mapping.h>
51 #include <linux/omap-iommu.h>
60 #include <asm/dma-iommu.h>
63 #include <media/v4l2-common.h>
64 #include <media/v4l2-fwnode.h>
65 #include <media/v4l2-device.h>
66 #include <media/v4l2-mc.h>
68 #include "isp.h"
82 static void isp_save_ctx(struct isp_device *isp);
84 static void isp_restore_ctx(struct isp_device *isp);
91 0x0000, /* base, len 0x0070 */
92 0x0400, /* ccp2, len 0x01f0 */
93 0x0600, /* ccdc, len 0x00a8 */
94 0x0a00, /* hist, len 0x0048 */
95 0x0c00, /* h3a, len 0x0060 */
96 0x0e00, /* preview, len 0x00a0 */
97 0x1000, /* resizer, len 0x00ac */
98 0x1200, /* sbl, len 0x00fc */
100 0x0000, /* csi2a, len 0x0170 */
101 0x0170, /* csiphy2, len 0x000c */
109 0x0000, /* base, len 0x0070 */
110 0x0400, /* ccp2, len 0x01f0 */
111 0x0600, /* ccdc, len 0x00a8 */
112 0x0a00, /* hist, len 0x0048 */
113 0x0c00, /* h3a, len 0x0060 */
114 0x0e00, /* preview, len 0x00a0 */
115 0x1000, /* resizer, len 0x00ac */
116 0x1200, /* sbl, len 0x00fc */
118 0x0000, /* csi2a, len 0x0170 (1st area) */
119 0x0170, /* csiphy2, len 0x000c */
120 0x01c0, /* csi2a, len 0x0040 (2nd area) */
121 0x0400, /* csi2c, len 0x0170 (1st area) */
122 0x0570, /* csiphy1, len 0x000c */
123 0x05c0, /* csi2c, len 0x0040 (2nd area) */
129 /* Structure for saving/restoring ISP module registers */
131 {OMAP3_ISP_IOMEM_MAIN, ISP_SYSCONFIG, 0},
132 {OMAP3_ISP_IOMEM_MAIN, ISP_CTRL, 0},
133 {OMAP3_ISP_IOMEM_MAIN, ISP_TCTRL_CTRL, 0},
134 {0, ISP_TOK_TERM, 0}
138 * omap3isp_flush - Post pending L3 bus writes by doing a register readback
139 * @isp: OMAP3 ISP device
145 * https://www.mail-archive.com/linux-omap@vger.kernel.org/msg08149.html
147 void omap3isp_flush(struct isp_device *isp) in omap3isp_flush() argument
149 isp_reg_writel(isp, 0, OMAP3_ISP_IOMEM_MAIN, ISP_REVISION); in omap3isp_flush()
150 isp_reg_readl(isp, OMAP3_ISP_IOMEM_MAIN, ISP_REVISION); in omap3isp_flush()
153 /* -----------------------------------------------------------------------------
161 switch (xclk->id) { in isp_xclk_update()
163 isp_reg_clr_set(xclk->isp, OMAP3_ISP_IOMEM_MAIN, ISP_TCTRL_CTRL, in isp_xclk_update()
168 isp_reg_clr_set(xclk->isp, OMAP3_ISP_IOMEM_MAIN, ISP_TCTRL_CTRL, in isp_xclk_update()
179 omap3isp_get(xclk->isp); in isp_xclk_prepare()
181 return 0; in isp_xclk_prepare()
188 omap3isp_put(xclk->isp); in isp_xclk_unprepare()
196 spin_lock_irqsave(&xclk->lock, flags); in isp_xclk_enable()
197 isp_xclk_update(xclk, xclk->divider); in isp_xclk_enable()
198 xclk->enabled = true; in isp_xclk_enable()
199 spin_unlock_irqrestore(&xclk->lock, flags); in isp_xclk_enable()
201 return 0; in isp_xclk_enable()
209 spin_lock_irqsave(&xclk->lock, flags); in isp_xclk_disable()
210 isp_xclk_update(xclk, 0); in isp_xclk_disable()
211 xclk->enabled = false; in isp_xclk_disable()
212 spin_unlock_irqrestore(&xclk->lock, flags); in isp_xclk_disable()
220 return parent_rate / xclk->divider; in isp_xclk_recalc_rate()
232 if (*rate == 0) in isp_xclk_calc_divider()
237 divider = ISPTCTRL_CTRL_DIV_BYPASS - 1; in isp_xclk_calc_divider()
259 spin_lock_irqsave(&xclk->lock, flags); in isp_xclk_set_rate()
261 xclk->divider = divider; in isp_xclk_set_rate()
262 if (xclk->enabled) in isp_xclk_set_rate()
265 spin_unlock_irqrestore(&xclk->lock, flags); in isp_xclk_set_rate()
267 dev_dbg(xclk->isp->dev, "%s: cam_xclk%c set to %lu Hz (div %u)\n", in isp_xclk_set_rate()
268 __func__, xclk->id == ISP_XCLK_A ? 'a' : 'b', rate, divider); in isp_xclk_set_rate()
269 return 0; in isp_xclk_set_rate()
286 unsigned int idx = clkspec->args[0]; in isp_xclk_src_get()
287 struct isp_device *isp = data; in isp_xclk_src_get() local
289 if (idx >= ARRAY_SIZE(isp->xclks)) in isp_xclk_src_get()
290 return ERR_PTR(-ENOENT); in isp_xclk_src_get()
292 return isp->xclks[idx].clk; in isp_xclk_src_get()
295 static int isp_xclk_init(struct isp_device *isp) in isp_xclk_init() argument
297 struct device_node *np = isp->dev->of_node; in isp_xclk_init()
301 for (i = 0; i < ARRAY_SIZE(isp->xclks); ++i) in isp_xclk_init()
302 isp->xclks[i].clk = ERR_PTR(-EINVAL); in isp_xclk_init()
304 for (i = 0; i < ARRAY_SIZE(isp->xclks); ++i) { in isp_xclk_init()
305 struct isp_xclk *xclk = &isp->xclks[i]; in isp_xclk_init()
307 xclk->isp = isp; in isp_xclk_init()
308 xclk->id = i == 0 ? ISP_XCLK_A : ISP_XCLK_B; in isp_xclk_init()
309 xclk->divider = 1; in isp_xclk_init()
310 spin_lock_init(&xclk->lock); in isp_xclk_init()
312 init.name = i == 0 ? "cam_xclka" : "cam_xclkb"; in isp_xclk_init()
317 xclk->hw.init = &init; in isp_xclk_init()
324 xclk->clk = clk_register(NULL, &xclk->hw); in isp_xclk_init()
325 if (IS_ERR(xclk->clk)) in isp_xclk_init()
326 return PTR_ERR(xclk->clk); in isp_xclk_init()
330 of_clk_add_provider(np, isp_xclk_src_get, isp); in isp_xclk_init()
332 return 0; in isp_xclk_init()
335 static void isp_xclk_cleanup(struct isp_device *isp) in isp_xclk_cleanup() argument
337 struct device_node *np = isp->dev->of_node; in isp_xclk_cleanup()
343 for (i = 0; i < ARRAY_SIZE(isp->xclks); ++i) { in isp_xclk_cleanup()
344 struct isp_xclk *xclk = &isp->xclks[i]; in isp_xclk_cleanup()
346 if (!IS_ERR(xclk->clk)) in isp_xclk_cleanup()
347 clk_unregister(xclk->clk); in isp_xclk_cleanup()
351 /* -----------------------------------------------------------------------------
356 * isp_enable_interrupts - Enable ISP interrupts.
357 * @isp: OMAP3 ISP device
359 static void isp_enable_interrupts(struct isp_device *isp) in isp_enable_interrupts() argument
374 isp_reg_writel(isp, irq, OMAP3_ISP_IOMEM_MAIN, ISP_IRQ0STATUS); in isp_enable_interrupts()
375 isp_reg_writel(isp, irq, OMAP3_ISP_IOMEM_MAIN, ISP_IRQ0ENABLE); in isp_enable_interrupts()
379 * isp_disable_interrupts - Disable ISP interrupts.
380 * @isp: OMAP3 ISP device
382 static void isp_disable_interrupts(struct isp_device *isp) in isp_disable_interrupts() argument
384 isp_reg_writel(isp, 0, OMAP3_ISP_IOMEM_MAIN, ISP_IRQ0ENABLE); in isp_disable_interrupts()
388 * isp_core_init - ISP core settings
389 * @isp: OMAP3 ISP device
392 * Set the power settings for the ISP and SBL bus and configure the HS/VS
396 * enabled, as the sensor might be free-running and the ISP default setting
399 static void isp_core_init(struct isp_device *isp, int idle) in isp_core_init() argument
401 isp_reg_writel(isp, in isp_core_init()
405 ((isp->revision == ISP_REVISION_15_0) ? in isp_core_init()
406 ISP_SYSCONFIG_AUTOIDLE : 0), in isp_core_init()
409 isp_reg_writel(isp, in isp_core_init()
410 (isp->autoidle ? ISPCTRL_SBL_AUTOIDLE : 0) | in isp_core_init()
424 * and the ISP platform data.
426 void omap3isp_configure_bridge(struct isp_device *isp, in omap3isp_configure_bridge() argument
433 ispctrl_val = isp_reg_readl(isp, OMAP3_ISP_IOMEM_MAIN, ISP_CTRL); in omap3isp_configure_bridge()
443 ispctrl_val |= parcfg->clk_pol << ISPCTRL_PAR_CLK_POL_SHIFT; in omap3isp_configure_bridge()
444 shift += parcfg->data_lane_shift; in omap3isp_configure_bridge()
465 isp_reg_writel(isp, ispctrl_val, OMAP3_ISP_IOMEM_MAIN, ISP_CTRL); in omap3isp_configure_bridge()
468 void omap3isp_hist_dma_done(struct isp_device *isp) in omap3isp_hist_dma_done() argument
470 if (omap3isp_ccdc_busy(&isp->isp_ccdc) || in omap3isp_hist_dma_done()
471 omap3isp_stat_pcr_busy(&isp->isp_hist)) { in omap3isp_hist_dma_done()
473 atomic_set(&isp->isp_hist.buf_err, 1); in omap3isp_hist_dma_done()
474 dev_dbg(isp->dev, in omap3isp_hist_dma_done()
479 static inline void __maybe_unused isp_isr_dbg(struct isp_device *isp, in isp_isr_dbg() argument
518 dev_dbg(isp->dev, "ISP IRQ: "); in isp_isr_dbg()
520 for (i = 0; i < ARRAY_SIZE(name); i++) { in isp_isr_dbg()
527 static void isp_isr_sbl(struct isp_device *isp) in isp_isr_sbl() argument
529 struct device *dev = isp->dev; in isp_isr_sbl()
537 sbl_pcr = isp_reg_readl(isp, OMAP3_ISP_IOMEM_SBL, ISPSBL_PCR); in isp_isr_sbl()
538 isp_reg_writel(isp, sbl_pcr, OMAP3_ISP_IOMEM_SBL, ISPSBL_PCR); in isp_isr_sbl()
542 dev_dbg(dev, "SBL overflow (PCR = 0x%08x)\n", sbl_pcr); in isp_isr_sbl()
545 pipe = to_isp_pipeline(&isp->isp_ccp2.subdev.entity); in isp_isr_sbl()
547 pipe->error = true; in isp_isr_sbl()
551 pipe = to_isp_pipeline(&isp->isp_csi2a.subdev.entity); in isp_isr_sbl()
553 pipe->error = true; in isp_isr_sbl()
557 pipe = to_isp_pipeline(&isp->isp_ccdc.subdev.entity); in isp_isr_sbl()
559 pipe->error = true; in isp_isr_sbl()
563 pipe = to_isp_pipeline(&isp->isp_prev.subdev.entity); in isp_isr_sbl()
565 pipe->error = true; in isp_isr_sbl()
572 pipe = to_isp_pipeline(&isp->isp_res.subdev.entity); in isp_isr_sbl()
574 pipe->error = true; in isp_isr_sbl()
578 omap3isp_stat_sbl_overflow(&isp->isp_af); in isp_isr_sbl()
581 omap3isp_stat_sbl_overflow(&isp->isp_aewb); in isp_isr_sbl()
585 * isp_isr - Interrupt Service Routine for Camera ISP module.
587 * @_isp: Pointer to the OMAP3 ISP device
598 struct isp_device *isp = _isp; in isp_isr() local
601 irqstatus = isp_reg_readl(isp, OMAP3_ISP_IOMEM_MAIN, ISP_IRQ0STATUS); in isp_isr()
602 isp_reg_writel(isp, irqstatus, OMAP3_ISP_IOMEM_MAIN, ISP_IRQ0STATUS); in isp_isr()
604 isp_isr_sbl(isp); in isp_isr()
607 omap3isp_csi2_isr(&isp->isp_csi2a); in isp_isr()
610 omap3isp_ccp2_isr(&isp->isp_ccp2); in isp_isr()
613 if (isp->isp_ccdc.output & CCDC_OUTPUT_PREVIEW) in isp_isr()
614 omap3isp_preview_isr_frame_sync(&isp->isp_prev); in isp_isr()
615 if (isp->isp_ccdc.output & CCDC_OUTPUT_RESIZER) in isp_isr()
616 omap3isp_resizer_isr_frame_sync(&isp->isp_res); in isp_isr()
617 omap3isp_stat_isr_frame_sync(&isp->isp_aewb); in isp_isr()
618 omap3isp_stat_isr_frame_sync(&isp->isp_af); in isp_isr()
619 omap3isp_stat_isr_frame_sync(&isp->isp_hist); in isp_isr()
623 omap3isp_ccdc_isr(&isp->isp_ccdc, irqstatus & ccdc_events); in isp_isr()
626 if (isp->isp_prev.output & PREVIEW_OUTPUT_RESIZER) in isp_isr()
627 omap3isp_resizer_isr_frame_sync(&isp->isp_res); in isp_isr()
628 omap3isp_preview_isr(&isp->isp_prev); in isp_isr()
632 omap3isp_resizer_isr(&isp->isp_res); in isp_isr()
635 omap3isp_stat_isr(&isp->isp_aewb); in isp_isr()
638 omap3isp_stat_isr(&isp->isp_af); in isp_isr()
641 omap3isp_stat_isr(&isp->isp_hist); in isp_isr()
643 omap3isp_flush(isp); in isp_isr()
646 isp_isr_dbg(isp, irqstatus); in isp_isr()
656 /* -----------------------------------------------------------------------------
661 * isp_pipeline_enable - Enable streaming on a pipeline
662 * @pipe: ISP pipeline
668 * Return 0 if successful, or the return value of the failed video::s_stream
674 struct isp_device *isp = pipe->output->isp; in isp_pipeline_enable() local
686 if (media_entity_enum_intersects(&pipe->ent_enum, &isp->crashed)) in isp_pipeline_enable()
687 return -EIO; in isp_pipeline_enable()
689 spin_lock_irqsave(&pipe->lock, flags); in isp_pipeline_enable()
690 pipe->state &= ~(ISP_PIPELINE_IDLE_INPUT | ISP_PIPELINE_IDLE_OUTPUT); in isp_pipeline_enable()
691 spin_unlock_irqrestore(&pipe->lock, flags); in isp_pipeline_enable()
693 pipe->do_propagation = false; in isp_pipeline_enable()
695 mutex_lock(&isp->media_dev.graph_mutex); in isp_pipeline_enable()
697 entity = &pipe->output->video.entity; in isp_pipeline_enable()
699 pad = &entity->pads[0]; in isp_pipeline_enable()
700 if (!(pad->flags & MEDIA_PAD_FL_SINK)) in isp_pipeline_enable()
704 if (!pad || !is_media_entity_v4l2_subdev(pad->entity)) in isp_pipeline_enable()
707 entity = pad->entity; in isp_pipeline_enable()
711 if (ret < 0 && ret != -ENOIOCTLCMD) { in isp_pipeline_enable()
712 mutex_unlock(&isp->media_dev.graph_mutex); in isp_pipeline_enable()
716 if (subdev == &isp->isp_ccdc.subdev) { in isp_pipeline_enable()
717 v4l2_subdev_call(&isp->isp_aewb.subdev, video, in isp_pipeline_enable()
719 v4l2_subdev_call(&isp->isp_af.subdev, video, in isp_pipeline_enable()
721 v4l2_subdev_call(&isp->isp_hist.subdev, video, in isp_pipeline_enable()
723 pipe->do_propagation = true; in isp_pipeline_enable()
726 /* Stop at the first external sub-device. */ in isp_pipeline_enable()
727 if (subdev->dev != isp->dev) in isp_pipeline_enable()
731 mutex_unlock(&isp->media_dev.graph_mutex); in isp_pipeline_enable()
733 return 0; in isp_pipeline_enable()
736 static int isp_pipeline_wait_resizer(struct isp_device *isp) in isp_pipeline_wait_resizer() argument
738 return omap3isp_resizer_busy(&isp->isp_res); in isp_pipeline_wait_resizer()
741 static int isp_pipeline_wait_preview(struct isp_device *isp) in isp_pipeline_wait_preview() argument
743 return omap3isp_preview_busy(&isp->isp_prev); in isp_pipeline_wait_preview()
746 static int isp_pipeline_wait_ccdc(struct isp_device *isp) in isp_pipeline_wait_ccdc() argument
748 return omap3isp_stat_busy(&isp->isp_af) in isp_pipeline_wait_ccdc()
749 || omap3isp_stat_busy(&isp->isp_aewb) in isp_pipeline_wait_ccdc()
750 || omap3isp_stat_busy(&isp->isp_hist) in isp_pipeline_wait_ccdc()
751 || omap3isp_ccdc_busy(&isp->isp_ccdc); in isp_pipeline_wait_ccdc()
756 static int isp_pipeline_wait(struct isp_device *isp, in isp_pipeline_wait() argument
757 int(*busy)(struct isp_device *isp)) in isp_pipeline_wait() argument
762 if (!busy(isp)) in isp_pipeline_wait()
763 return 0; in isp_pipeline_wait()
770 * isp_pipeline_disable - Disable streaming on a pipeline
771 * @pipe: ISP pipeline
777 * Return 0 if all modules have been properly stopped, or -ETIMEDOUT if a module
778 * can't be stopped (in which case a software reset of the ISP is probably
783 struct isp_device *isp = pipe->output->isp; in isp_pipeline_disable() local
787 int failure = 0; in isp_pipeline_disable()
794 entity = &pipe->output->video.entity; in isp_pipeline_disable()
796 pad = &entity->pads[0]; in isp_pipeline_disable()
797 if (!(pad->flags & MEDIA_PAD_FL_SINK)) in isp_pipeline_disable()
801 if (!pad || !is_media_entity_v4l2_subdev(pad->entity)) in isp_pipeline_disable()
804 entity = pad->entity; in isp_pipeline_disable()
807 if (subdev == &isp->isp_ccdc.subdev) { in isp_pipeline_disable()
808 v4l2_subdev_call(&isp->isp_aewb.subdev, in isp_pipeline_disable()
809 video, s_stream, 0); in isp_pipeline_disable()
810 v4l2_subdev_call(&isp->isp_af.subdev, in isp_pipeline_disable()
811 video, s_stream, 0); in isp_pipeline_disable()
812 v4l2_subdev_call(&isp->isp_hist.subdev, in isp_pipeline_disable()
813 video, s_stream, 0); in isp_pipeline_disable()
816 ret = v4l2_subdev_call(subdev, video, s_stream, 0); in isp_pipeline_disable()
818 /* Stop at the first external sub-device. */ in isp_pipeline_disable()
819 if (subdev->dev != isp->dev) in isp_pipeline_disable()
822 if (subdev == &isp->isp_res.subdev) in isp_pipeline_disable()
823 ret |= isp_pipeline_wait(isp, isp_pipeline_wait_resizer); in isp_pipeline_disable()
824 else if (subdev == &isp->isp_prev.subdev) in isp_pipeline_disable()
825 ret |= isp_pipeline_wait(isp, isp_pipeline_wait_preview); in isp_pipeline_disable()
826 else if (subdev == &isp->isp_ccdc.subdev) in isp_pipeline_disable()
827 ret |= isp_pipeline_wait(isp, isp_pipeline_wait_ccdc); in isp_pipeline_disable()
831 * to trigger an ISP reset the next time the device is released, in isp_pipeline_disable()
842 dev_info(isp->dev, "Unable to stop %s\n", subdev->name); in isp_pipeline_disable()
843 isp->stop_failure = true; in isp_pipeline_disable()
844 if (subdev == &isp->isp_prev.subdev) in isp_pipeline_disable()
845 media_entity_enum_set(&isp->crashed, in isp_pipeline_disable()
846 &subdev->entity); in isp_pipeline_disable()
847 failure = -ETIMEDOUT; in isp_pipeline_disable()
855 * omap3isp_pipeline_set_stream - Enable/disable streaming on a pipeline
856 * @pipe: ISP pipeline
860 * single-shot or continuous mode.
862 * Return 0 if successful, or the return value of the failed video::s_stream
876 if (ret == 0 || state == ISP_PIPELINE_STREAM_STOPPED) in omap3isp_pipeline_set_stream()
877 pipe->stream_state = state; in omap3isp_pipeline_set_stream()
883 * omap3isp_pipeline_cancel_stream - Cancel stream on a pipeline
884 * @pipe: ISP pipeline
893 if (pipe->input) in omap3isp_pipeline_cancel_stream()
894 omap3isp_video_cancel_stream(pipe->input); in omap3isp_pipeline_cancel_stream()
895 if (pipe->output) in omap3isp_pipeline_cancel_stream()
896 omap3isp_video_cancel_stream(pipe->output); in omap3isp_pipeline_cancel_stream()
900 * isp_pipeline_resume - Resume streaming on a pipeline
901 * @pipe: ISP pipeline
903 * Resume video output and input and re-enable pipeline.
907 int singleshot = pipe->stream_state == ISP_PIPELINE_STREAM_SINGLESHOT; in isp_pipeline_resume()
909 omap3isp_video_resume(pipe->output, !singleshot); in isp_pipeline_resume()
911 omap3isp_video_resume(pipe->input, 0); in isp_pipeline_resume()
912 isp_pipeline_enable(pipe, pipe->stream_state); in isp_pipeline_resume()
916 * isp_pipeline_suspend - Suspend streaming on a pipeline
917 * @pipe: ISP pipeline
927 * isp_pipeline_is_last - Verify if entity has an enabled link to the output
929 * @me: ISP module's media entity
931 * Returns 1 if the entity has an enabled link to the output video node or 0
941 if (!pipe || pipe->stream_state == ISP_PIPELINE_STREAM_STOPPED) in isp_pipeline_is_last()
942 return 0; in isp_pipeline_is_last()
943 pad = media_pad_remote_pad_first(&pipe->output->pad); in isp_pipeline_is_last()
944 return pad->entity == me; in isp_pipeline_is_last()
948 * isp_suspend_module_pipeline - Suspend pipeline to which belongs the module
949 * @me: ISP module's media entity
962 * isp_resume_module_pipeline - Resume pipeline to which belongs the module
963 * @me: ISP module's media entity
976 * isp_suspend_modules - Suspend ISP submodules.
977 * @isp: OMAP3 ISP device
979 * Returns 0 if suspend left in idle state all the submodules properly,
982 static int __maybe_unused isp_suspend_modules(struct isp_device *isp) in isp_suspend_modules() argument
986 omap3isp_stat_suspend(&isp->isp_aewb); in isp_suspend_modules()
987 omap3isp_stat_suspend(&isp->isp_af); in isp_suspend_modules()
988 omap3isp_stat_suspend(&isp->isp_hist); in isp_suspend_modules()
989 isp_suspend_module_pipeline(&isp->isp_res.subdev.entity); in isp_suspend_modules()
990 isp_suspend_module_pipeline(&isp->isp_prev.subdev.entity); in isp_suspend_modules()
991 isp_suspend_module_pipeline(&isp->isp_ccdc.subdev.entity); in isp_suspend_modules()
992 isp_suspend_module_pipeline(&isp->isp_csi2a.subdev.entity); in isp_suspend_modules()
993 isp_suspend_module_pipeline(&isp->isp_ccp2.subdev.entity); in isp_suspend_modules()
996 while (omap3isp_stat_busy(&isp->isp_af) in isp_suspend_modules()
997 || omap3isp_stat_busy(&isp->isp_aewb) in isp_suspend_modules()
998 || omap3isp_stat_busy(&isp->isp_hist) in isp_suspend_modules()
999 || omap3isp_preview_busy(&isp->isp_prev) in isp_suspend_modules()
1000 || omap3isp_resizer_busy(&isp->isp_res) in isp_suspend_modules()
1001 || omap3isp_ccdc_busy(&isp->isp_ccdc)) { in isp_suspend_modules()
1003 dev_info(isp->dev, "can't stop modules.\n"); in isp_suspend_modules()
1009 return 0; in isp_suspend_modules()
1013 * isp_resume_modules - Resume ISP submodules.
1014 * @isp: OMAP3 ISP device
1016 static void __maybe_unused isp_resume_modules(struct isp_device *isp) in isp_resume_modules() argument
1018 omap3isp_stat_resume(&isp->isp_aewb); in isp_resume_modules()
1019 omap3isp_stat_resume(&isp->isp_af); in isp_resume_modules()
1020 omap3isp_stat_resume(&isp->isp_hist); in isp_resume_modules()
1021 isp_resume_module_pipeline(&isp->isp_res.subdev.entity); in isp_resume_modules()
1022 isp_resume_module_pipeline(&isp->isp_prev.subdev.entity); in isp_resume_modules()
1023 isp_resume_module_pipeline(&isp->isp_ccdc.subdev.entity); in isp_resume_modules()
1024 isp_resume_module_pipeline(&isp->isp_csi2a.subdev.entity); in isp_resume_modules()
1025 isp_resume_module_pipeline(&isp->isp_ccp2.subdev.entity); in isp_resume_modules()
1029 * isp_reset - Reset ISP with a timeout wait for idle.
1030 * @isp: OMAP3 ISP device
1032 static int isp_reset(struct isp_device *isp) in isp_reset() argument
1034 unsigned long timeout = 0; in isp_reset()
1036 isp_reg_writel(isp, in isp_reset()
1037 isp_reg_readl(isp, OMAP3_ISP_IOMEM_MAIN, ISP_SYSCONFIG) in isp_reset()
1040 while (!(isp_reg_readl(isp, OMAP3_ISP_IOMEM_MAIN, in isp_reset()
1041 ISP_SYSSTATUS) & 0x1)) { in isp_reset()
1043 dev_alert(isp->dev, "cannot reset ISP\n"); in isp_reset()
1044 return -ETIMEDOUT; in isp_reset()
1049 isp->stop_failure = false; in isp_reset()
1050 media_entity_enum_zero(&isp->crashed); in isp_reset()
1051 return 0; in isp_reset()
1055 * isp_save_context - Saves the values of the ISP module registers.
1056 * @isp: OMAP3 ISP device
1061 isp_save_context(struct isp_device *isp, struct isp_reg *reg_list) in isp_save_context() argument
1065 for (; next->reg != ISP_TOK_TERM; next++) in isp_save_context()
1066 next->val = isp_reg_readl(isp, next->mmio_range, next->reg); in isp_save_context()
1070 * isp_restore_context - Restores the values of the ISP module registers.
1071 * @isp: OMAP3 ISP device
1076 isp_restore_context(struct isp_device *isp, struct isp_reg *reg_list) in isp_restore_context() argument
1080 for (; next->reg != ISP_TOK_TERM; next++) in isp_restore_context()
1081 isp_reg_writel(isp, next->val, next->mmio_range, next->reg); in isp_restore_context()
1085 * isp_save_ctx - Saves ISP, CCDC, HIST, H3A, PREV, RESZ & MMU context.
1086 * @isp: OMAP3 ISP device
1088 * Routine for saving the context of each module in the ISP.
1091 static void isp_save_ctx(struct isp_device *isp) in isp_save_ctx() argument
1093 isp_save_context(isp, isp_reg_list); in isp_save_ctx()
1094 omap_iommu_save_ctx(isp->dev); in isp_save_ctx()
1098 * isp_restore_ctx - Restores ISP, CCDC, HIST, H3A, PREV, RESZ & MMU context.
1099 * @isp: OMAP3 ISP device
1101 * Routine for restoring the context of each module in the ISP.
1104 static void isp_restore_ctx(struct isp_device *isp) in isp_restore_ctx() argument
1106 isp_restore_context(isp, isp_reg_list); in isp_restore_ctx()
1107 omap_iommu_restore_ctx(isp->dev); in isp_restore_ctx()
1108 omap3isp_ccdc_restore_context(isp); in isp_restore_ctx()
1109 omap3isp_preview_restore_context(isp); in isp_restore_ctx()
1112 /* -----------------------------------------------------------------------------
1125 void omap3isp_sbl_enable(struct isp_device *isp, enum isp_sbl_resource res) in omap3isp_sbl_enable() argument
1127 u32 sbl = 0; in omap3isp_sbl_enable()
1129 isp->sbl_resources |= res; in omap3isp_sbl_enable()
1131 if (isp->sbl_resources & OMAP3_ISP_SBL_CSI1_READ) in omap3isp_sbl_enable()
1134 if (isp->sbl_resources & OMAP3_ISP_SBL_CCDC_LSC_READ) in omap3isp_sbl_enable()
1137 if (isp->sbl_resources & OMAP3_ISP_SBL_CSI2C_WRITE) in omap3isp_sbl_enable()
1140 if (isp->sbl_resources & OMAP3_ISP_SBL_RESIZER_WRITE) in omap3isp_sbl_enable()
1143 if (isp->sbl_resources & OMAP3_ISP_SBL_WRITE) in omap3isp_sbl_enable()
1146 if (isp->sbl_resources & OMAP3_ISP_SBL_READ) in omap3isp_sbl_enable()
1149 isp_reg_set(isp, OMAP3_ISP_IOMEM_MAIN, ISP_CTRL, sbl); in omap3isp_sbl_enable()
1152 void omap3isp_sbl_disable(struct isp_device *isp, enum isp_sbl_resource res) in omap3isp_sbl_disable() argument
1154 u32 sbl = 0; in omap3isp_sbl_disable()
1156 isp->sbl_resources &= ~res; in omap3isp_sbl_disable()
1158 if (!(isp->sbl_resources & OMAP3_ISP_SBL_CSI1_READ)) in omap3isp_sbl_disable()
1161 if (!(isp->sbl_resources & OMAP3_ISP_SBL_CCDC_LSC_READ)) in omap3isp_sbl_disable()
1164 if (!(isp->sbl_resources & OMAP3_ISP_SBL_CSI2C_WRITE)) in omap3isp_sbl_disable()
1167 if (!(isp->sbl_resources & OMAP3_ISP_SBL_RESIZER_WRITE)) in omap3isp_sbl_disable()
1170 if (!(isp->sbl_resources & OMAP3_ISP_SBL_WRITE)) in omap3isp_sbl_disable()
1173 if (!(isp->sbl_resources & OMAP3_ISP_SBL_READ)) in omap3isp_sbl_disable()
1176 isp_reg_clr(isp, OMAP3_ISP_IOMEM_MAIN, ISP_CTRL, sbl); in omap3isp_sbl_disable()
1180 * isp_module_sync_idle - Helper to sync module with its idle state
1181 * @me: ISP submodule's media entity
1182 * @wait: ISP submodule's wait queue for streamoff/interrupt synchronization
1185 * This function checks if ISP submodule needs to wait for next interrupt. If
1193 if (pipe->stream_state == ISP_PIPELINE_STREAM_STOPPED || in omap3isp_module_sync_idle()
1194 (pipe->stream_state == ISP_PIPELINE_STREAM_SINGLESHOT && in omap3isp_module_sync_idle()
1196 return 0; in omap3isp_module_sync_idle()
1215 struct isp_video *video = pipe->output; in omap3isp_module_sync_idle()
1217 spin_lock_irqsave(&video->irqlock, flags); in omap3isp_module_sync_idle()
1218 if (video->dmaqueue_flags & ISP_VIDEO_DMAQUEUE_UNDERRUN) { in omap3isp_module_sync_idle()
1219 spin_unlock_irqrestore(&video->irqlock, flags); in omap3isp_module_sync_idle()
1220 atomic_set(stopping, 0); in omap3isp_module_sync_idle()
1222 return 0; in omap3isp_module_sync_idle()
1224 spin_unlock_irqrestore(&video->irqlock, flags); in omap3isp_module_sync_idle()
1227 atomic_set(stopping, 0); in omap3isp_module_sync_idle()
1229 return -ETIMEDOUT; in omap3isp_module_sync_idle()
1233 return 0; in omap3isp_module_sync_idle()
1237 * omap3isp_module_sync_is_stopping - Helper to verify if module was stopping
1238 * @wait: ISP submodule's wait queue for streamoff/interrupt synchronization
1241 * This function checks if ISP submodule was stopping. In case of yes, it
1242 * notices the caller by setting stopping to 0 and waking up the wait queue.
1243 * Returns 1 if it was stopping or 0 otherwise.
1248 if (atomic_cmpxchg(stopping, 1, 0)) { in omap3isp_module_sync_is_stopping()
1253 return 0; in omap3isp_module_sync_is_stopping()
1256 /* --------------------------------------------------------------------------
1266 static void __isp_subclk_update(struct isp_device *isp) in __isp_subclk_update() argument
1268 u32 clk = 0; in __isp_subclk_update()
1271 if (isp->subclk_resources & in __isp_subclk_update()
1275 if (isp->subclk_resources & OMAP3_ISP_SUBCLK_HIST) in __isp_subclk_update()
1278 if (isp->subclk_resources & OMAP3_ISP_SUBCLK_RESIZER) in __isp_subclk_update()
1284 if (isp->subclk_resources & OMAP3_ISP_SUBCLK_CCDC) in __isp_subclk_update()
1287 if (isp->subclk_resources & OMAP3_ISP_SUBCLK_PREVIEW) in __isp_subclk_update()
1290 isp_reg_clr_set(isp, OMAP3_ISP_IOMEM_MAIN, ISP_CTRL, in __isp_subclk_update()
1294 void omap3isp_subclk_enable(struct isp_device *isp, in omap3isp_subclk_enable() argument
1297 isp->subclk_resources |= res; in omap3isp_subclk_enable()
1299 __isp_subclk_update(isp); in omap3isp_subclk_enable()
1302 void omap3isp_subclk_disable(struct isp_device *isp, in omap3isp_subclk_disable() argument
1305 isp->subclk_resources &= ~res; in omap3isp_subclk_disable()
1307 __isp_subclk_update(isp); in omap3isp_subclk_disable()
1311 * isp_enable_clocks - Enable ISP clocks
1312 * @isp: OMAP3 ISP device
1314 * Return 0 if successful, or clk_prepare_enable return value if any of them
1317 static int isp_enable_clocks(struct isp_device *isp) in isp_enable_clocks() argument
1322 r = clk_prepare_enable(isp->clock[ISP_CLK_CAM_ICK]); in isp_enable_clocks()
1324 dev_err(isp->dev, "failed to enable cam_ick clock\n"); in isp_enable_clocks()
1327 r = clk_set_rate(isp->clock[ISP_CLK_CAM_MCLK], CM_CAM_MCLK_HZ); in isp_enable_clocks()
1329 dev_err(isp->dev, "clk_set_rate for cam_mclk failed\n"); in isp_enable_clocks()
1332 r = clk_prepare_enable(isp->clock[ISP_CLK_CAM_MCLK]); in isp_enable_clocks()
1334 dev_err(isp->dev, "failed to enable cam_mclk clock\n"); in isp_enable_clocks()
1337 rate = clk_get_rate(isp->clock[ISP_CLK_CAM_MCLK]); in isp_enable_clocks()
1339 dev_warn(isp->dev, "unexpected cam_mclk rate:\n" in isp_enable_clocks()
1342 r = clk_prepare_enable(isp->clock[ISP_CLK_CSI2_FCK]); in isp_enable_clocks()
1344 dev_err(isp->dev, "failed to enable csi2_fck clock\n"); in isp_enable_clocks()
1347 return 0; in isp_enable_clocks()
1350 clk_disable_unprepare(isp->clock[ISP_CLK_CAM_MCLK]); in isp_enable_clocks()
1352 clk_disable_unprepare(isp->clock[ISP_CLK_CAM_ICK]); in isp_enable_clocks()
1358 * isp_disable_clocks - Disable ISP clocks
1359 * @isp: OMAP3 ISP device
1361 static void isp_disable_clocks(struct isp_device *isp) in isp_disable_clocks() argument
1363 clk_disable_unprepare(isp->clock[ISP_CLK_CAM_ICK]); in isp_disable_clocks()
1364 clk_disable_unprepare(isp->clock[ISP_CLK_CAM_MCLK]); in isp_disable_clocks()
1365 clk_disable_unprepare(isp->clock[ISP_CLK_CSI2_FCK]); in isp_disable_clocks()
1375 static int isp_get_clocks(struct isp_device *isp) in isp_get_clocks() argument
1380 for (i = 0; i < ARRAY_SIZE(isp_clocks); ++i) { in isp_get_clocks()
1381 clk = devm_clk_get(isp->dev, isp_clocks[i]); in isp_get_clocks()
1383 dev_err(isp->dev, "clk_get %s failed\n", isp_clocks[i]); in isp_get_clocks()
1387 isp->clock[i] = clk; in isp_get_clocks()
1390 return 0; in isp_get_clocks()
1394 * omap3isp_get - Acquire the ISP resource.
1398 * Increment the reference count on the ISP. If the first reference is taken,
1399 * enable clocks and power-up all submodules.
1401 * Return a pointer to the ISP device structure, or NULL if an error occurred.
1403 static struct isp_device *__omap3isp_get(struct isp_device *isp, bool irq) in __omap3isp_get() argument
1405 struct isp_device *__isp = isp; in __omap3isp_get()
1407 if (isp == NULL) in __omap3isp_get()
1410 mutex_lock(&isp->isp_mutex); in __omap3isp_get()
1411 if (isp->ref_count > 0) in __omap3isp_get()
1414 if (isp_enable_clocks(isp) < 0) { in __omap3isp_get()
1420 if (isp->has_context) in __omap3isp_get()
1421 isp_restore_ctx(isp); in __omap3isp_get()
1424 isp_enable_interrupts(isp); in __omap3isp_get()
1428 isp->ref_count++; in __omap3isp_get()
1429 mutex_unlock(&isp->isp_mutex); in __omap3isp_get()
1434 struct isp_device *omap3isp_get(struct isp_device *isp) in omap3isp_get() argument
1436 return __omap3isp_get(isp, true); in omap3isp_get()
1440 * omap3isp_put - Release the ISP
1442 * Decrement the reference count on the ISP. If the last reference is released,
1443 * power-down all submodules, disable clocks and free temporary buffers.
1445 static void __omap3isp_put(struct isp_device *isp, bool save_ctx) in __omap3isp_put() argument
1447 if (isp == NULL) in __omap3isp_put()
1450 mutex_lock(&isp->isp_mutex); in __omap3isp_put()
1451 BUG_ON(isp->ref_count == 0); in __omap3isp_put()
1452 if (--isp->ref_count == 0) { in __omap3isp_put()
1453 isp_disable_interrupts(isp); in __omap3isp_put()
1455 isp_save_ctx(isp); in __omap3isp_put()
1456 isp->has_context = 1; in __omap3isp_put()
1458 /* Reset the ISP if an entity has failed to stop. This is the in __omap3isp_put()
1461 if (!media_entity_enum_empty(&isp->crashed) || in __omap3isp_put()
1462 isp->stop_failure) in __omap3isp_put()
1463 isp_reset(isp); in __omap3isp_put()
1464 isp_disable_clocks(isp); in __omap3isp_put()
1466 mutex_unlock(&isp->isp_mutex); in __omap3isp_put()
1469 void omap3isp_put(struct isp_device *isp) in omap3isp_put() argument
1471 __omap3isp_put(isp, true); in omap3isp_put()
1474 /* --------------------------------------------------------------------------
1479 * omap3isp_print_status - Prints the values of the ISP Control Module registers
1480 * @isp: OMAP3 ISP device
1482 #define ISP_PRINT_REGISTER(isp, name)\ argument
1483 dev_dbg(isp->dev, "###ISP " #name "=0x%08x\n", \
1484 isp_reg_readl(isp, OMAP3_ISP_IOMEM_MAIN, ISP_##name))
1485 #define SBL_PRINT_REGISTER(isp, name)\ argument
1486 dev_dbg(isp->dev, "###SBL " #name "=0x%08x\n", \
1487 isp_reg_readl(isp, OMAP3_ISP_IOMEM_SBL, ISPSBL_##name))
1489 void omap3isp_print_status(struct isp_device *isp) in omap3isp_print_status() argument
1491 dev_dbg(isp->dev, "-------------ISP Register dump--------------\n"); in omap3isp_print_status()
1493 ISP_PRINT_REGISTER(isp, SYSCONFIG); in omap3isp_print_status()
1494 ISP_PRINT_REGISTER(isp, SYSSTATUS); in omap3isp_print_status()
1495 ISP_PRINT_REGISTER(isp, IRQ0ENABLE); in omap3isp_print_status()
1496 ISP_PRINT_REGISTER(isp, IRQ0STATUS); in omap3isp_print_status()
1497 ISP_PRINT_REGISTER(isp, TCTRL_GRESET_LENGTH); in omap3isp_print_status()
1498 ISP_PRINT_REGISTER(isp, TCTRL_PSTRB_REPLAY); in omap3isp_print_status()
1499 ISP_PRINT_REGISTER(isp, CTRL); in omap3isp_print_status()
1500 ISP_PRINT_REGISTER(isp, TCTRL_CTRL); in omap3isp_print_status()
1501 ISP_PRINT_REGISTER(isp, TCTRL_FRAME); in omap3isp_print_status()
1502 ISP_PRINT_REGISTER(isp, TCTRL_PSTRB_DELAY); in omap3isp_print_status()
1503 ISP_PRINT_REGISTER(isp, TCTRL_STRB_DELAY); in omap3isp_print_status()
1504 ISP_PRINT_REGISTER(isp, TCTRL_SHUT_DELAY); in omap3isp_print_status()
1505 ISP_PRINT_REGISTER(isp, TCTRL_PSTRB_LENGTH); in omap3isp_print_status()
1506 ISP_PRINT_REGISTER(isp, TCTRL_STRB_LENGTH); in omap3isp_print_status()
1507 ISP_PRINT_REGISTER(isp, TCTRL_SHUT_LENGTH); in omap3isp_print_status()
1509 SBL_PRINT_REGISTER(isp, PCR); in omap3isp_print_status()
1510 SBL_PRINT_REGISTER(isp, SDR_REQ_EXP); in omap3isp_print_status()
1512 dev_dbg(isp->dev, "--------------------------------------------\n"); in omap3isp_print_status()
1520 * As the ISP can't properly handle an input video stream interruption on a non
1521 * frame boundary, the ISP pipelines need to be stopped before sensors get
1523 * which can be provided by the ISP, the ISP can't be completely suspended
1528 * ISP clocks get disabled in suspend(). Similarly, the clocks are re-enabled in
1531 * TODO: PM dependencies between the ISP and sensors are not modelled explicitly
1536 struct isp_device *isp = dev_get_drvdata(dev); in isp_pm_prepare() local
1539 WARN_ON(mutex_is_locked(&isp->isp_mutex)); in isp_pm_prepare()
1541 if (isp->ref_count == 0) in isp_pm_prepare()
1542 return 0; in isp_pm_prepare()
1544 reset = isp_suspend_modules(isp); in isp_pm_prepare()
1545 isp_disable_interrupts(isp); in isp_pm_prepare()
1546 isp_save_ctx(isp); in isp_pm_prepare()
1548 isp_reset(isp); in isp_pm_prepare()
1550 return 0; in isp_pm_prepare()
1555 struct isp_device *isp = dev_get_drvdata(dev); in isp_pm_suspend() local
1557 WARN_ON(mutex_is_locked(&isp->isp_mutex)); in isp_pm_suspend()
1559 if (isp->ref_count) in isp_pm_suspend()
1560 isp_disable_clocks(isp); in isp_pm_suspend()
1562 return 0; in isp_pm_suspend()
1567 struct isp_device *isp = dev_get_drvdata(dev); in isp_pm_resume() local
1569 if (isp->ref_count == 0) in isp_pm_resume()
1570 return 0; in isp_pm_resume()
1572 return isp_enable_clocks(isp); in isp_pm_resume()
1577 struct isp_device *isp = dev_get_drvdata(dev); in isp_pm_complete() local
1579 if (isp->ref_count == 0) in isp_pm_complete()
1582 isp_restore_ctx(isp); in isp_pm_complete()
1583 isp_enable_interrupts(isp); in isp_pm_complete()
1584 isp_resume_modules(isp); in isp_pm_complete()
1596 static void isp_unregister_entities(struct isp_device *isp) in isp_unregister_entities() argument
1598 media_device_unregister(&isp->media_dev); in isp_unregister_entities()
1600 omap3isp_csi2_unregister_entities(&isp->isp_csi2a); in isp_unregister_entities()
1601 omap3isp_ccp2_unregister_entities(&isp->isp_ccp2); in isp_unregister_entities()
1602 omap3isp_ccdc_unregister_entities(&isp->isp_ccdc); in isp_unregister_entities()
1603 omap3isp_preview_unregister_entities(&isp->isp_prev); in isp_unregister_entities()
1604 omap3isp_resizer_unregister_entities(&isp->isp_res); in isp_unregister_entities()
1605 omap3isp_stat_unregister_entities(&isp->isp_aewb); in isp_unregister_entities()
1606 omap3isp_stat_unregister_entities(&isp->isp_af); in isp_unregister_entities()
1607 omap3isp_stat_unregister_entities(&isp->isp_hist); in isp_unregister_entities()
1609 v4l2_device_unregister(&isp->v4l2_dev); in isp_unregister_entities()
1610 media_device_cleanup(&isp->media_dev); in isp_unregister_entities()
1614 struct isp_device *isp, struct media_entity *entity, in isp_link_entity() argument
1629 input = &isp->isp_ccdc.subdev.entity; in isp_link_entity()
1631 flags = 0; in isp_link_entity()
1635 input = &isp->isp_csi2a.subdev.entity; in isp_link_entity()
1642 input = &isp->isp_ccp2.subdev.entity; in isp_link_entity()
1644 flags = 0; in isp_link_entity()
1648 input = &isp->isp_csi2c.subdev.entity; in isp_link_entity()
1654 dev_err(isp->dev, "%s: invalid interface type %u\n", __func__, in isp_link_entity()
1656 return -EINVAL; in isp_link_entity()
1661 * ISP. The sub-devices of those interfaces aren't initialised in isp_link_entity()
1663 * non-zero. in isp_link_entity()
1665 if (!input->num_pads) { in isp_link_entity()
1666 dev_err(isp->dev, "%s: invalid input %u\n", entity->name, in isp_link_entity()
1668 return -EINVAL; in isp_link_entity()
1671 for (i = 0; i < entity->num_pads; i++) { in isp_link_entity()
1672 if (entity->pads[i].flags & MEDIA_PAD_FL_SOURCE) in isp_link_entity()
1675 if (i == entity->num_pads) { in isp_link_entity()
1676 dev_err(isp->dev, "%s: no source pad in external entity %s\n", in isp_link_entity()
1677 __func__, entity->name); in isp_link_entity()
1678 return -EINVAL; in isp_link_entity()
1684 static int isp_register_entities(struct isp_device *isp) in isp_register_entities() argument
1688 isp->media_dev.dev = isp->dev; in isp_register_entities()
1689 strscpy(isp->media_dev.model, "TI OMAP3 ISP", in isp_register_entities()
1690 sizeof(isp->media_dev.model)); in isp_register_entities()
1691 isp->media_dev.hw_revision = isp->revision; in isp_register_entities()
1692 isp->media_dev.ops = &isp_media_ops; in isp_register_entities()
1693 media_device_init(&isp->media_dev); in isp_register_entities()
1695 isp->v4l2_dev.mdev = &isp->media_dev; in isp_register_entities()
1696 ret = v4l2_device_register(isp->dev, &isp->v4l2_dev); in isp_register_entities()
1697 if (ret < 0) { in isp_register_entities()
1698 dev_err(isp->dev, "%s: V4L2 device registration failed (%d)\n", in isp_register_entities()
1704 ret = omap3isp_ccp2_register_entities(&isp->isp_ccp2, &isp->v4l2_dev); in isp_register_entities()
1705 if (ret < 0) in isp_register_entities()
1708 ret = omap3isp_csi2_register_entities(&isp->isp_csi2a, &isp->v4l2_dev); in isp_register_entities()
1709 if (ret < 0) in isp_register_entities()
1712 ret = omap3isp_ccdc_register_entities(&isp->isp_ccdc, &isp->v4l2_dev); in isp_register_entities()
1713 if (ret < 0) in isp_register_entities()
1716 ret = omap3isp_preview_register_entities(&isp->isp_prev, in isp_register_entities()
1717 &isp->v4l2_dev); in isp_register_entities()
1718 if (ret < 0) in isp_register_entities()
1721 ret = omap3isp_resizer_register_entities(&isp->isp_res, &isp->v4l2_dev); in isp_register_entities()
1722 if (ret < 0) in isp_register_entities()
1725 ret = omap3isp_stat_register_entities(&isp->isp_aewb, &isp->v4l2_dev); in isp_register_entities()
1726 if (ret < 0) in isp_register_entities()
1729 ret = omap3isp_stat_register_entities(&isp->isp_af, &isp->v4l2_dev); in isp_register_entities()
1730 if (ret < 0) in isp_register_entities()
1733 ret = omap3isp_stat_register_entities(&isp->isp_hist, &isp->v4l2_dev); in isp_register_entities()
1734 if (ret < 0) in isp_register_entities()
1738 if (ret < 0) in isp_register_entities()
1739 isp_unregister_entities(isp); in isp_register_entities()
1745 * isp_create_links() - Create links for internal and external ISP entities
1746 * @isp : Pointer to ISP device
1748 * This function creates all links between ISP internal and external entities.
1753 static int isp_create_links(struct isp_device *isp) in isp_create_links() argument
1759 &isp->isp_csi2a.subdev.entity, CSI2_PAD_SOURCE, in isp_create_links()
1760 &isp->isp_csi2a.video_out.video.entity, 0, 0); in isp_create_links()
1761 if (ret < 0) in isp_create_links()
1765 &isp->isp_ccp2.video_in.video.entity, 0, in isp_create_links()
1766 &isp->isp_ccp2.subdev.entity, CCP2_PAD_SINK, 0); in isp_create_links()
1767 if (ret < 0) in isp_create_links()
1771 &isp->isp_ccdc.subdev.entity, CCDC_PAD_SOURCE_OF, in isp_create_links()
1772 &isp->isp_ccdc.video_out.video.entity, 0, 0); in isp_create_links()
1773 if (ret < 0) in isp_create_links()
1777 &isp->isp_prev.video_in.video.entity, 0, in isp_create_links()
1778 &isp->isp_prev.subdev.entity, PREV_PAD_SINK, 0); in isp_create_links()
1779 if (ret < 0) in isp_create_links()
1783 &isp->isp_prev.subdev.entity, PREV_PAD_SOURCE, in isp_create_links()
1784 &isp->isp_prev.video_out.video.entity, 0, 0); in isp_create_links()
1785 if (ret < 0) in isp_create_links()
1789 &isp->isp_res.video_in.video.entity, 0, in isp_create_links()
1790 &isp->isp_res.subdev.entity, RESZ_PAD_SINK, 0); in isp_create_links()
1791 if (ret < 0) in isp_create_links()
1795 &isp->isp_res.subdev.entity, RESZ_PAD_SOURCE, in isp_create_links()
1796 &isp->isp_res.video_out.video.entity, 0, 0); in isp_create_links()
1798 if (ret < 0) in isp_create_links()
1803 &isp->isp_csi2a.subdev.entity, CSI2_PAD_SOURCE, in isp_create_links()
1804 &isp->isp_ccdc.subdev.entity, CCDC_PAD_SINK, 0); in isp_create_links()
1805 if (ret < 0) in isp_create_links()
1809 &isp->isp_ccp2.subdev.entity, CCP2_PAD_SOURCE, in isp_create_links()
1810 &isp->isp_ccdc.subdev.entity, CCDC_PAD_SINK, 0); in isp_create_links()
1811 if (ret < 0) in isp_create_links()
1815 &isp->isp_ccdc.subdev.entity, CCDC_PAD_SOURCE_VP, in isp_create_links()
1816 &isp->isp_prev.subdev.entity, PREV_PAD_SINK, 0); in isp_create_links()
1817 if (ret < 0) in isp_create_links()
1821 &isp->isp_ccdc.subdev.entity, CCDC_PAD_SOURCE_OF, in isp_create_links()
1822 &isp->isp_res.subdev.entity, RESZ_PAD_SINK, 0); in isp_create_links()
1823 if (ret < 0) in isp_create_links()
1827 &isp->isp_prev.subdev.entity, PREV_PAD_SOURCE, in isp_create_links()
1828 &isp->isp_res.subdev.entity, RESZ_PAD_SINK, 0); in isp_create_links()
1829 if (ret < 0) in isp_create_links()
1833 &isp->isp_ccdc.subdev.entity, CCDC_PAD_SOURCE_VP, in isp_create_links()
1834 &isp->isp_aewb.subdev.entity, 0, in isp_create_links()
1836 if (ret < 0) in isp_create_links()
1840 &isp->isp_ccdc.subdev.entity, CCDC_PAD_SOURCE_VP, in isp_create_links()
1841 &isp->isp_af.subdev.entity, 0, in isp_create_links()
1843 if (ret < 0) in isp_create_links()
1847 &isp->isp_ccdc.subdev.entity, CCDC_PAD_SOURCE_VP, in isp_create_links()
1848 &isp->isp_hist.subdev.entity, 0, in isp_create_links()
1850 if (ret < 0) in isp_create_links()
1853 return 0; in isp_create_links()
1856 static void isp_cleanup_modules(struct isp_device *isp) in isp_cleanup_modules() argument
1858 omap3isp_h3a_aewb_cleanup(isp); in isp_cleanup_modules()
1859 omap3isp_h3a_af_cleanup(isp); in isp_cleanup_modules()
1860 omap3isp_hist_cleanup(isp); in isp_cleanup_modules()
1861 omap3isp_resizer_cleanup(isp); in isp_cleanup_modules()
1862 omap3isp_preview_cleanup(isp); in isp_cleanup_modules()
1863 omap3isp_ccdc_cleanup(isp); in isp_cleanup_modules()
1864 omap3isp_ccp2_cleanup(isp); in isp_cleanup_modules()
1865 omap3isp_csi2_cleanup(isp); in isp_cleanup_modules()
1866 omap3isp_csiphy_cleanup(isp); in isp_cleanup_modules()
1869 static int isp_initialize_modules(struct isp_device *isp) in isp_initialize_modules() argument
1873 ret = omap3isp_csiphy_init(isp); in isp_initialize_modules()
1874 if (ret < 0) { in isp_initialize_modules()
1875 dev_err(isp->dev, "CSI PHY initialization failed\n"); in isp_initialize_modules()
1879 ret = omap3isp_csi2_init(isp); in isp_initialize_modules()
1880 if (ret < 0) { in isp_initialize_modules()
1881 dev_err(isp->dev, "CSI2 initialization failed\n"); in isp_initialize_modules()
1885 ret = omap3isp_ccp2_init(isp); in isp_initialize_modules()
1886 if (ret < 0) { in isp_initialize_modules()
1887 dev_err_probe(isp->dev, ret, "CCP2 initialization failed\n"); in isp_initialize_modules()
1891 ret = omap3isp_ccdc_init(isp); in isp_initialize_modules()
1892 if (ret < 0) { in isp_initialize_modules()
1893 dev_err(isp->dev, "CCDC initialization failed\n"); in isp_initialize_modules()
1897 ret = omap3isp_preview_init(isp); in isp_initialize_modules()
1898 if (ret < 0) { in isp_initialize_modules()
1899 dev_err(isp->dev, "Preview initialization failed\n"); in isp_initialize_modules()
1903 ret = omap3isp_resizer_init(isp); in isp_initialize_modules()
1904 if (ret < 0) { in isp_initialize_modules()
1905 dev_err(isp->dev, "Resizer initialization failed\n"); in isp_initialize_modules()
1909 ret = omap3isp_hist_init(isp); in isp_initialize_modules()
1910 if (ret < 0) { in isp_initialize_modules()
1911 dev_err(isp->dev, "Histogram initialization failed\n"); in isp_initialize_modules()
1915 ret = omap3isp_h3a_aewb_init(isp); in isp_initialize_modules()
1916 if (ret < 0) { in isp_initialize_modules()
1917 dev_err(isp->dev, "H3A AEWB initialization failed\n"); in isp_initialize_modules()
1921 ret = omap3isp_h3a_af_init(isp); in isp_initialize_modules()
1922 if (ret < 0) { in isp_initialize_modules()
1923 dev_err(isp->dev, "H3A AF initialization failed\n"); in isp_initialize_modules()
1927 return 0; in isp_initialize_modules()
1930 omap3isp_h3a_aewb_cleanup(isp); in isp_initialize_modules()
1932 omap3isp_hist_cleanup(isp); in isp_initialize_modules()
1934 omap3isp_resizer_cleanup(isp); in isp_initialize_modules()
1936 omap3isp_preview_cleanup(isp); in isp_initialize_modules()
1938 omap3isp_ccdc_cleanup(isp); in isp_initialize_modules()
1940 omap3isp_ccp2_cleanup(isp); in isp_initialize_modules()
1942 omap3isp_csi2_cleanup(isp); in isp_initialize_modules()
1944 omap3isp_csiphy_cleanup(isp); in isp_initialize_modules()
1949 static void isp_detach_iommu(struct isp_device *isp) in isp_detach_iommu() argument
1952 arm_iommu_detach_device(isp->dev); in isp_detach_iommu()
1953 arm_iommu_release_mapping(isp->mapping); in isp_detach_iommu()
1954 isp->mapping = NULL; in isp_detach_iommu()
1958 static int isp_attach_iommu(struct isp_device *isp) in isp_attach_iommu() argument
1968 mapping = arm_iommu_create_mapping(isp->dev, SZ_1G, SZ_2G); in isp_attach_iommu()
1970 dev_err(isp->dev, "failed to create ARM IOMMU mapping\n"); in isp_attach_iommu()
1974 isp->mapping = mapping; in isp_attach_iommu()
1977 ret = arm_iommu_attach_device(isp->dev, mapping); in isp_attach_iommu()
1978 if (ret < 0) { in isp_attach_iommu()
1979 dev_err(isp->dev, "failed to attach device to VA mapping\n"); in isp_attach_iommu()
1983 return 0; in isp_attach_iommu()
1986 arm_iommu_release_mapping(isp->mapping); in isp_attach_iommu()
1987 isp->mapping = NULL; in isp_attach_iommu()
1990 return -ENODEV; in isp_attach_iommu()
1995 * isp_remove - Remove ISP platform device
1996 * @pdev: Pointer to ISP platform device
1998 * Always returns 0.
2002 struct isp_device *isp = platform_get_drvdata(pdev); in isp_remove() local
2004 v4l2_async_nf_unregister(&isp->notifier); in isp_remove()
2005 v4l2_async_nf_cleanup(&isp->notifier); in isp_remove()
2006 isp_unregister_entities(isp); in isp_remove()
2007 isp_cleanup_modules(isp); in isp_remove()
2008 isp_xclk_cleanup(isp); in isp_remove()
2010 __omap3isp_get(isp, false); in isp_remove()
2011 isp_detach_iommu(isp); in isp_remove()
2012 __omap3isp_put(isp, false); in isp_remove()
2014 media_entity_enum_cleanup(&isp->crashed); in isp_remove()
2016 kfree(isp); in isp_remove()
2020 ISP_OF_PHY_PARALLEL = 0,
2029 struct isp_device *isp = container_of(async, struct isp_device, in isp_subdev_notifier_bound() local
2032 &container_of(asc, struct isp_async_subdev, asd)->bus; in isp_subdev_notifier_bound()
2035 mutex_lock(&isp->media_dev.graph_mutex); in isp_subdev_notifier_bound()
2036 ret = isp_link_entity(isp, &sd->entity, bus_cfg->interface); in isp_subdev_notifier_bound()
2037 mutex_unlock(&isp->media_dev.graph_mutex); in isp_subdev_notifier_bound()
2044 struct isp_device *isp = container_of(async, struct isp_device, in isp_subdev_notifier_complete() local
2048 mutex_lock(&isp->media_dev.graph_mutex); in isp_subdev_notifier_complete()
2049 ret = media_entity_enum_init(&isp->crashed, &isp->media_dev); in isp_subdev_notifier_complete()
2050 mutex_unlock(&isp->media_dev.graph_mutex); in isp_subdev_notifier_complete()
2054 ret = v4l2_device_register_subdev_nodes(&isp->v4l2_dev); in isp_subdev_notifier_complete()
2055 if (ret < 0) in isp_subdev_notifier_complete()
2058 return media_device_register(&isp->media_dev); in isp_subdev_notifier_complete()
2065 buscfg->interface = ISP_INTERFACE_PARALLEL; in isp_parse_of_parallel_endpoint()
2066 buscfg->bus.parallel.data_lane_shift = vep->bus.parallel.data_shift; in isp_parse_of_parallel_endpoint()
2067 buscfg->bus.parallel.clk_pol = in isp_parse_of_parallel_endpoint()
2068 !!(vep->bus.parallel.flags & V4L2_MBUS_PCLK_SAMPLE_FALLING); in isp_parse_of_parallel_endpoint()
2069 buscfg->bus.parallel.hs_pol = in isp_parse_of_parallel_endpoint()
2070 !!(vep->bus.parallel.flags & V4L2_MBUS_VSYNC_ACTIVE_LOW); in isp_parse_of_parallel_endpoint()
2071 buscfg->bus.parallel.vs_pol = in isp_parse_of_parallel_endpoint()
2072 !!(vep->bus.parallel.flags & V4L2_MBUS_HSYNC_ACTIVE_LOW); in isp_parse_of_parallel_endpoint()
2073 buscfg->bus.parallel.fld_pol = in isp_parse_of_parallel_endpoint()
2074 !!(vep->bus.parallel.flags & V4L2_MBUS_FIELD_EVEN_LOW); in isp_parse_of_parallel_endpoint()
2075 buscfg->bus.parallel.data_pol = in isp_parse_of_parallel_endpoint()
2076 !!(vep->bus.parallel.flags & V4L2_MBUS_DATA_ACTIVE_LOW); in isp_parse_of_parallel_endpoint()
2077 buscfg->bus.parallel.bt656 = vep->bus_type == V4L2_MBUS_BT656; in isp_parse_of_parallel_endpoint()
2086 buscfg->bus.csi2.lanecfg.clk.pos = vep->bus.mipi_csi2.clock_lane; in isp_parse_of_csi2_endpoint()
2087 buscfg->bus.csi2.lanecfg.clk.pol = in isp_parse_of_csi2_endpoint()
2088 vep->bus.mipi_csi2.lane_polarities[0]; in isp_parse_of_csi2_endpoint()
2090 buscfg->bus.csi2.lanecfg.clk.pol, in isp_parse_of_csi2_endpoint()
2091 buscfg->bus.csi2.lanecfg.clk.pos); in isp_parse_of_csi2_endpoint()
2093 buscfg->bus.csi2.num_data_lanes = vep->bus.mipi_csi2.num_data_lanes; in isp_parse_of_csi2_endpoint()
2095 for (i = 0; i < buscfg->bus.csi2.num_data_lanes; i++) { in isp_parse_of_csi2_endpoint()
2096 buscfg->bus.csi2.lanecfg.data[i].pos = in isp_parse_of_csi2_endpoint()
2097 vep->bus.mipi_csi2.data_lanes[i]; in isp_parse_of_csi2_endpoint()
2098 buscfg->bus.csi2.lanecfg.data[i].pol = in isp_parse_of_csi2_endpoint()
2099 vep->bus.mipi_csi2.lane_polarities[i + 1]; in isp_parse_of_csi2_endpoint()
2102 buscfg->bus.csi2.lanecfg.data[i].pol, in isp_parse_of_csi2_endpoint()
2103 buscfg->bus.csi2.lanecfg.data[i].pos); in isp_parse_of_csi2_endpoint()
2109 buscfg->bus.csi2.crc = 1; in isp_parse_of_csi2_endpoint()
2116 buscfg->bus.ccp2.lanecfg.clk.pos = vep->bus.mipi_csi1.clock_lane; in isp_parse_of_csi1_endpoint()
2117 buscfg->bus.ccp2.lanecfg.clk.pol = vep->bus.mipi_csi1.lane_polarity[0]; in isp_parse_of_csi1_endpoint()
2119 buscfg->bus.ccp2.lanecfg.clk.pol, in isp_parse_of_csi1_endpoint()
2120 buscfg->bus.ccp2.lanecfg.clk.pos); in isp_parse_of_csi1_endpoint()
2122 buscfg->bus.ccp2.lanecfg.data[0].pos = vep->bus.mipi_csi1.data_lane; in isp_parse_of_csi1_endpoint()
2123 buscfg->bus.ccp2.lanecfg.data[0].pol = in isp_parse_of_csi1_endpoint()
2124 vep->bus.mipi_csi1.lane_polarity[1]; in isp_parse_of_csi1_endpoint()
2127 buscfg->bus.ccp2.lanecfg.data[0].pol, in isp_parse_of_csi1_endpoint()
2128 buscfg->bus.ccp2.lanecfg.data[0].pos); in isp_parse_of_csi1_endpoint()
2130 buscfg->bus.ccp2.strobe_clk_pol = vep->bus.mipi_csi1.clock_inv; in isp_parse_of_csi1_endpoint()
2131 buscfg->bus.ccp2.phy_layer = vep->bus.mipi_csi1.strobe; in isp_parse_of_csi1_endpoint()
2132 buscfg->bus.ccp2.ccp2_mode = vep->bus_type == V4L2_MBUS_CCP2; in isp_parse_of_csi1_endpoint()
2133 buscfg->bus.ccp2.vp_clk_pol = 1; in isp_parse_of_csi1_endpoint()
2135 buscfg->bus.ccp2.crc = 1; in isp_parse_of_csi1_endpoint()
2149 static int isp_parse_of_endpoints(struct isp_device *isp) in isp_parse_of_endpoints() argument
2156 dev_fwnode(isp->dev), ISP_OF_PHY_PARALLEL, 0, in isp_parse_of_endpoints()
2165 dev_dbg(isp->dev, "parsing parallel interface\n"); in isp_parse_of_endpoints()
2170 isd = v4l2_async_nf_add_fwnode_remote(&isp->notifier, in isp_parse_of_endpoints()
2174 isp_parse_of_parallel_endpoint(isp->dev, &vep, &isd->bus); in isp_parse_of_endpoints()
2180 for (i = 0; i < ARRAY_SIZE(isp_bus_interfaces); i++) { in isp_parse_of_endpoints()
2187 dev_fwnode(isp->dev), isp_bus_interfaces[i].phy, 0, in isp_parse_of_endpoints()
2193 dev_dbg(isp->dev, "parsing serial interface %u, node %pOF\n", i, in isp_parse_of_endpoints()
2197 if (ret == -ENXIO) { in isp_parse_of_endpoints()
2202 if (ret == -ENXIO) { in isp_parse_of_endpoints()
2210 isd = v4l2_async_nf_add_fwnode_remote(&isp->notifier, in isp_parse_of_endpoints()
2218 isd->bus.interface = in isp_parse_of_endpoints()
2220 isp_parse_of_csi2_endpoint(isp->dev, &vep, &isd->bus); in isp_parse_of_endpoints()
2224 isd->bus.interface = in isp_parse_of_endpoints()
2226 isp_parse_of_csi1_endpoint(isp->dev, &vep, in isp_parse_of_endpoints()
2227 &isd->bus); in isp_parse_of_endpoints()
2238 return 0; in isp_parse_of_endpoints()
2247 * isp_probe - Probe ISP platform device
2248 * @pdev: Pointer to ISP platform device
2250 * Returns 0 if successful,
2251 * -ENOMEM if no memory available,
2252 * -ENODEV if no platform device resources found
2254 * -EINVAL if couldn't install ISR,
2259 struct isp_device *isp; in isp_probe() local
2264 isp = kzalloc(sizeof(*isp), GFP_KERNEL); in isp_probe()
2265 if (!isp) { in isp_probe()
2266 dev_err(&pdev->dev, "could not allocate memory\n"); in isp_probe()
2267 return -ENOMEM; in isp_probe()
2270 ret = fwnode_property_read_u32(of_fwnode_handle(pdev->dev.of_node), in isp_probe()
2271 "ti,phy-type", &isp->phy_type); in isp_probe()
2275 isp->syscon = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, in isp_probe()
2277 if (IS_ERR(isp->syscon)) { in isp_probe()
2278 ret = PTR_ERR(isp->syscon); in isp_probe()
2282 ret = of_property_read_u32_index(pdev->dev.of_node, in isp_probe()
2283 "syscon", 1, &isp->syscon_offset); in isp_probe()
2287 isp->autoidle = autoidle; in isp_probe()
2289 mutex_init(&isp->isp_mutex); in isp_probe()
2290 spin_lock_init(&isp->stat_lock); in isp_probe()
2291 isp->dev = &pdev->dev; in isp_probe()
2293 isp->ref_count = 0; in isp_probe()
2295 ret = dma_coerce_mask_and_coherent(isp->dev, DMA_BIT_MASK(32)); in isp_probe()
2299 platform_set_drvdata(pdev, isp); in isp_probe()
2302 isp->isp_csiphy1.vdd = devm_regulator_get(&pdev->dev, "vdd-csiphy1"); in isp_probe()
2303 if (IS_ERR(isp->isp_csiphy1.vdd)) { in isp_probe()
2304 ret = PTR_ERR(isp->isp_csiphy1.vdd); in isp_probe()
2308 isp->isp_csiphy2.vdd = devm_regulator_get(&pdev->dev, "vdd-csiphy2"); in isp_probe()
2309 if (IS_ERR(isp->isp_csiphy2.vdd)) { in isp_probe()
2310 ret = PTR_ERR(isp->isp_csiphy2.vdd); in isp_probe()
2316 * The ISP clock tree is revision-dependent. We thus need to enable ICLK in isp_probe()
2319 * Start by mapping the ISP MMIO area, which is in two pieces. in isp_probe()
2320 * The ISP IOMMU is in between. Map both now, and fill in the in isp_probe()
2321 * ISP revision specific portions a little later in the in isp_probe()
2324 for (i = 0; i < 2; i++) { in isp_probe()
2325 unsigned int map_idx = i ? OMAP3_ISP_IOMEM_CSI2A_REGS1 : 0; in isp_probe()
2327 isp->mmio_base[map_idx] = in isp_probe()
2329 if (IS_ERR(isp->mmio_base[map_idx])) { in isp_probe()
2330 ret = PTR_ERR(isp->mmio_base[map_idx]); in isp_probe()
2335 ret = isp_get_clocks(isp); in isp_probe()
2336 if (ret < 0) in isp_probe()
2339 ret = clk_enable(isp->clock[ISP_CLK_CAM_ICK]); in isp_probe()
2340 if (ret < 0) in isp_probe()
2343 isp->revision = isp_reg_readl(isp, OMAP3_ISP_IOMEM_MAIN, ISP_REVISION); in isp_probe()
2344 dev_info(isp->dev, "Revision %d.%d found\n", in isp_probe()
2345 (isp->revision & 0xf0) >> 4, isp->revision & 0x0f); in isp_probe()
2347 clk_disable(isp->clock[ISP_CLK_CAM_ICK]); in isp_probe()
2349 if (__omap3isp_get(isp, false) == NULL) { in isp_probe()
2350 ret = -ENODEV; in isp_probe()
2354 ret = isp_reset(isp); in isp_probe()
2355 if (ret < 0) in isp_probe()
2358 ret = isp_xclk_init(isp); in isp_probe()
2359 if (ret < 0) in isp_probe()
2363 for (m = 0; m < ARRAY_SIZE(isp_res_maps); m++) in isp_probe()
2364 if (isp->revision == isp_res_maps[m].isp_rev) in isp_probe()
2368 dev_err(isp->dev, "No resource map found for ISP rev %d.%d\n", in isp_probe()
2369 (isp->revision & 0xf0) >> 4, isp->revision & 0xf); in isp_probe()
2370 ret = -ENODEV; in isp_probe()
2375 isp->mmio_base[i] = in isp_probe()
2376 isp->mmio_base[0] + isp_res_maps[m].offset[i]; in isp_probe()
2379 isp->mmio_base[i] = in isp_probe()
2380 isp->mmio_base[OMAP3_ISP_IOMEM_CSI2A_REGS1] in isp_probe()
2383 isp->mmio_hist_base_phys = in isp_probe()
2384 mem->start + isp_res_maps[m].offset[OMAP3_ISP_IOMEM_HIST]; in isp_probe()
2387 ret = isp_attach_iommu(isp); in isp_probe()
2388 if (ret < 0) { in isp_probe()
2389 dev_err(&pdev->dev, "unable to attach to IOMMU\n"); in isp_probe()
2394 ret = platform_get_irq(pdev, 0); in isp_probe()
2395 if (ret < 0) in isp_probe()
2397 isp->irq_num = ret; in isp_probe()
2399 if (devm_request_irq(isp->dev, isp->irq_num, isp_isr, IRQF_SHARED, in isp_probe()
2400 "OMAP3 ISP", isp)) { in isp_probe()
2401 dev_err(isp->dev, "Unable to request IRQ\n"); in isp_probe()
2402 ret = -EINVAL; in isp_probe()
2407 ret = isp_initialize_modules(isp); in isp_probe()
2408 if (ret < 0) in isp_probe()
2411 ret = isp_register_entities(isp); in isp_probe()
2412 if (ret < 0) in isp_probe()
2415 ret = isp_create_links(isp); in isp_probe()
2416 if (ret < 0) in isp_probe()
2419 isp->notifier.ops = &isp_subdev_notifier_ops; in isp_probe()
2421 v4l2_async_nf_init(&isp->notifier, &isp->v4l2_dev); in isp_probe()
2423 ret = isp_parse_of_endpoints(isp); in isp_probe()
2424 if (ret < 0) in isp_probe()
2427 ret = v4l2_async_nf_register(&isp->notifier); in isp_probe()
2431 isp_core_init(isp, 1); in isp_probe()
2432 omap3isp_put(isp); in isp_probe()
2434 return 0; in isp_probe()
2437 v4l2_async_nf_cleanup(&isp->notifier); in isp_probe()
2438 isp_unregister_entities(isp); in isp_probe()
2440 isp_cleanup_modules(isp); in isp_probe()
2442 isp_detach_iommu(isp); in isp_probe()
2444 isp_xclk_cleanup(isp); in isp_probe()
2445 __omap3isp_put(isp, false); in isp_probe()
2447 mutex_destroy(&isp->isp_mutex); in isp_probe()
2449 kfree(isp); in isp_probe()
2462 { "omap3isp", 0 },
2468 { .compatible = "ti,omap3-isp" },
2487 MODULE_DESCRIPTION("TI OMAP3 ISP driver");