summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2013-10-10 09:06:27 -0300
committerMauro Carvalho Chehab <m.chehab@samsung.com>2013-12-11 09:04:39 -0200
commit216814fb0167673c6417b5db83ade84e58031e2c (patch)
tree7216fe2dd92ed1133407c4baac108cced5aaa15d
parentf3632ba850c70bf24a80295621857166e0c0b14c (diff)
downloadlinux-216814fb0167673c6417b5db83ade84e58031e2c.tar.gz
[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 <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
-rw-r--r--drivers/staging/media/omap4iss/iss_csi2.c12
-rw-r--r--drivers/staging/media/omap4iss/iss_csi2.h2
2 files changed, 6 insertions, 8 deletions
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;