From: Laurent Pinchart Date: Thu, 10 Oct 2013 12:06:27 +0000 (-0300) Subject: [media] v4l: omap4iss: csi2: Replace manual if statement with a subclk field X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=216814fb0167673c6417b5db83ade84e58031e2c;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [media] v4l: omap4iss: csi2: Replace manual if statement with a subclk field 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 Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/staging/media/omap4iss/iss_csi2.c b/drivers/staging/media/omap4iss/iss_csi2.c index 7e7e955d4be6..e4fc4a0b69db 100644 --- a/drivers/staging/media/omap4iss/iss_csi2.c +++ b/drivers/staging/media/omap4iss/iss_csi2.c @@ -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); diff --git a/drivers/staging/media/omap4iss/iss_csi2.h b/drivers/staging/media/omap4iss/iss_csi2.h index 69a6263f6cb0..971aa7b08013 100644 --- a/drivers/staging/media/omap4iss/iss_csi2.h +++ b/drivers/staging/media/omap4iss/iss_csi2.h @@ -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;