linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [OMAPZOOM][PATCH] CSI2: Fix to csi2 reset.
@ 2009-03-16  0:12 Dominic Curran
  0 siblings, 0 replies; only message in thread
From: Dominic Curran @ 2009-03-16  0:12 UTC (permalink / raw)
  To: linux-omap

From: Dominic Curran <dcurran@ti.com>
Subject: [OMAPZOOM][PATCH] CSI2: Fix to csi2 reset.

This patch fixes an issue where CSI2 setup is incorrect for the
following scenario:
 QBUF
 STREAMON
 DQBUF
 STREAMOFF
 QBUF
 STREAMON   <- csi2 setup incorrect at power_on
 DQBUF      <- forever wait here

When STREAMOFF occurs then csi2 register setup ends up in an unknown
state.
This patch performs a csi2 reset everytime a PowerOn occurs to get it back into 
know state.

SUMMARY:
board-*.c - Remove the 'if' condition so that csi2 reset is called everytime.

isp.c     - Configuration in isp_csi2_ctx_config_format() depends on
            changes that happen in isp_csi2_ctrl_config_vp_only_enable().
            Thus change order so that isp_csi2_ctrl_config_vp_only_enable()
            is called first.

ispcsi2.c - Clear internal structures at beginning of every reset.


Signed-off-by: Dominic Curran <dcurran@ti.com>
---
 arch/arm/mach-omap2/board-3430sdp.c |    6 ++----
 arch/arm/mach-omap2/board-ldp.c     |    4 ++--
 arch/arm/mach-omap2/board-zoom2.c   |    3 +--
 drivers/media/video/isp/isp.c       |    6 +++---
 drivers/media/video/isp/ispcsi2.c   |    4 ++++
 5 files changed, 12 insertions(+), 11 deletions(-)

Index: omapzoom04/arch/arm/mach-omap2/board-3430sdp.c
===================================================================
--- omapzoom04.orig/arch/arm/mach-omap2/board-3430sdp.c
+++ omapzoom04/arch/arm/mach-omap2/board-3430sdp.c
@@ -835,8 +835,7 @@ static int ov3640_sensor_power_set(enum 
 	switch (power) {
 	case V4L2_POWER_ON:
 		printk(KERN_DEBUG "ov3640_sensor_power_set(ON)\n");
-		if (previous_power == V4L2_POWER_OFF)
-			isp_csi2_reset();
+		isp_csi2_reset();
 
 		lanecfg.clk.pol = OV3640_CSI2_CLOCK_POLARITY;
 		lanecfg.clk.pos = OV3640_CSI2_CLOCK_LANE;
@@ -1019,8 +1018,7 @@ static int imx046_sensor_power_set(enum 
 	case V4L2_POWER_ON:
 		/* Power Up Sequence */
 		printk(KERN_DEBUG "imx046_sensor_power_set(ON)\n");
-		if (previous_power == V4L2_POWER_OFF)
-			isp_csi2_reset();
+		isp_csi2_reset();
 
 		lanecfg.clk.pol = IMX046_CSI2_CLOCK_POLARITY;
 		lanecfg.clk.pos = IMX046_CSI2_CLOCK_LANE;
Index: omapzoom04/arch/arm/mach-omap2/board-ldp.c
===================================================================
--- omapzoom04.orig/arch/arm/mach-omap2/board-ldp.c
+++ omapzoom04/arch/arm/mach-omap2/board-ldp.c
@@ -675,8 +675,8 @@ static int ov3640_sensor_power_set(enum 
 	switch (power) {
 	case V4L2_POWER_ON:
 		printk(KERN_DEBUG "ov3640_sensor_power_set(ON)\n");
-		if (previous_power == V4L2_POWER_OFF)
-			isp_csi2_reset();
+		isp_csi2_reset();
+
 		lanecfg.clk.pol = OV3640_CSI2_CLOCK_POLARITY;
 		lanecfg.clk.pos = OV3640_CSI2_CLOCK_LANE;
 		lanecfg.data[0].pol = OV3640_CSI2_DATA0_POLARITY;
Index: omapzoom04/arch/arm/mach-omap2/board-zoom2.c
===================================================================
--- omapzoom04.orig/arch/arm/mach-omap2/board-zoom2.c
+++ omapzoom04/arch/arm/mach-omap2/board-zoom2.c
@@ -397,8 +397,7 @@ static int imx046_sensor_power_set(enum 
 	case V4L2_POWER_ON:
 		/* Power Up Sequence */
 		printk(KERN_DEBUG "imx046_sensor_power_set(ON)\n");
-		if (previous_power == V4L2_POWER_OFF)
-			isp_csi2_reset();
+		isp_csi2_reset();
 
 		lanecfg.clk.pol = IMX046_CSI2_CLOCK_POLARITY;
 		lanecfg.clk.pos = IMX046_CSI2_CLOCK_LANE;
Index: omapzoom04/drivers/media/video/isp/isp.c
===================================================================
--- omapzoom04.orig/drivers/media/video/isp/isp.c
+++ omapzoom04/drivers/media/video/isp/isp.c
@@ -907,9 +907,6 @@ int isp_configure_interface(struct isp_i
 		ispctrl_val &= ~ISPCTRL_PAR_BRIDGE_BENDIAN;
 		ispctrl_val |= (0x03 << ISPCTRL_PAR_BRIDGE_SHIFT);
 
-		isp_csi2_ctx_config_format(0, config->u.csi.format);
-		isp_csi2_ctx_update(0, false);
-
 		if (config->u.csi.crc)
 			isp_csi2_ctrl_config_ecc_enable(true);
 
@@ -918,6 +915,9 @@ int isp_configure_interface(struct isp_i
 		isp_csi2_ctrl_config_vp_clk_enable(true);
 		isp_csi2_ctrl_update(false);
 
+		isp_csi2_ctx_config_format(0, config->u.csi.format);
+		isp_csi2_ctx_update(0, false);
+
 		isp_csi2_irq_complexio1_set(1);
 		isp_csi2_irq_status_set(1);
 		isp_csi2_irq_set(1);
Index: omapzoom04/drivers/media/video/isp/ispcsi2.c
===================================================================
--- omapzoom04.orig/drivers/media/video/isp/ispcsi2.c
+++ omapzoom04/drivers/media/video/isp/ispcsi2.c
@@ -1966,6 +1966,10 @@ int isp_csi2_reset(void)
 	u8 soft_reset_retries = 0;
 	int i;
 
+	memset(&current_csi2_cfg, 0x00, sizeof(struct isp_csi2_cfg));
+	memset(&current_csi2_cfg_update, 0x00,
+			sizeof(struct isp_csi2_cfg_update));
+
 	reg = omap_readl(ISPCSI2_SYSCONFIG);
 	reg |= ISPCSI2_SYSCONFIG_SOFT_RESET_RESET;
 	omap_writel(reg, ISPCSI2_SYSCONFIG);

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-03-16  0:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-16  0:12 [OMAPZOOM][PATCH] CSI2: Fix to csi2 reset Dominic Curran

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).