[media] v4l: omap4iss: csi2: Replace manual if statement with a subclk field
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Thu, 10 Oct 2013 12:06:27 +0000 (09:06 -0300)
committerMauro Carvalho Chehab <m.chehab@samsung.com>
Wed, 11 Dec 2013 11:04:39 +0000 (09:04 -0200)
Instead of manually checking whether the CSI2 module is CSI2a or CSI2b
in order to select the right subclock to enable/disable, add a subclk
field to the iss_csi2 structure, initialize it with the corresponding
subclock value and use it at runtime.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
drivers/staging/media/omap4iss/iss_csi2.c
drivers/staging/media/omap4iss/iss_csi2.h

index 7e7e955d4be67640755a0d7d4b533805f8124c6c..e4fc4a0b69db2ad8f06162db02a12ccfe0ee752d 100644 (file)
@@ -1062,10 +1062,7 @@ static int csi2_set_stream(struct v4l2_subdev *sd, int enable)
                if (enable == ISS_PIPELINE_STREAM_STOPPED)
                        return 0;
 
-               if (csi2 == &iss->csi2a)
-                       omap4iss_subclk_enable(iss, OMAP4_ISS_SUBCLK_CSI2_A);
-               else if (csi2 == &iss->csi2b)
-                       omap4iss_subclk_enable(iss, OMAP4_ISS_SUBCLK_CSI2_B);
+               omap4iss_subclk_enable(iss, csi2->subclk);
        }
 
        switch (enable) {
@@ -1106,10 +1103,7 @@ static int csi2_set_stream(struct v4l2_subdev *sd, int enable)
                csi2_if_enable(csi2, 0);
                csi2_irq_ctx_set(csi2, 0);
                omap4iss_csiphy_release(csi2->phy);
-               if (csi2 == &iss->csi2a)
-                       omap4iss_subclk_disable(iss, OMAP4_ISS_SUBCLK_CSI2_A);
-               else if (csi2 == &iss->csi2b)
-                       omap4iss_subclk_disable(iss, OMAP4_ISS_SUBCLK_CSI2_B);
+               omap4iss_subclk_disable(iss, csi2->subclk);
                iss_video_dmaqueue_flags_clr(video_out);
                break;
        }
@@ -1311,6 +1305,7 @@ int omap4iss_csi2_init(struct iss_device *iss)
        csi2a->available = 1;
        csi2a->regs1 = OMAP4_ISS_MEM_CSI2_A_REGS1;
        csi2a->phy = &iss->csiphy1;
+       csi2a->subclk = OMAP4_ISS_SUBCLK_CSI2_A;
        csi2a->state = ISS_PIPELINE_STREAM_STOPPED;
        init_waitqueue_head(&csi2a->wait);
 
@@ -1322,6 +1317,7 @@ int omap4iss_csi2_init(struct iss_device *iss)
        csi2b->available = 1;
        csi2b->regs1 = OMAP4_ISS_MEM_CSI2_B_REGS1;
        csi2b->phy = &iss->csiphy2;
+       csi2b->subclk = OMAP4_ISS_SUBCLK_CSI2_B;
        csi2b->state = ISS_PIPELINE_STREAM_STOPPED;
        init_waitqueue_head(&csi2b->wait);
 
index 69a6263f6cb0a92cd85ccd182621998c2aa0042f..971aa7b080133ea33128138f78a440a1a0a7e43e 100644 (file)
@@ -131,6 +131,8 @@ struct iss_csi2_device {
        /* memory resources, as defined in enum iss_mem_resources */
        unsigned int regs1;
        unsigned int regs2;
+       /* ISP subclock, as defined in enum iss_isp_subclk_resource */
+       unsigned int subclk;
 
        u32 output; /* output to IPIPEIF, memory or both? */
        bool dpcm_decompress;