[OMAPZOOM][PATCH] OV3640: Make camera sensor goto standby.

2009-03-15 Thread Dominic Curran
From: Dominic Curran 
Subject: [OMAPZOOM][PATCH] OV3640: Make camera sensor goto standby.

This patch ensures that the OV3640 goes/comes back from standby 
when the kernel requests the appropriate power state.

This also seems to fix an issue where ECC errors are seen at STREAMON time.
This could possibly be because the sensor is probably still streaming when the 
receiver is being setup. Putting the sensor into standby would stop it 
streaming until setup of reciever is complete.

Signed-off-by: Dominic Curran 
---
 arch/arm/mach-omap2/board-3430sdp.c |4 +++-
 arch/arm/mach-omap2/board-ldp.c |4 +++-
 2 files changed, 6 insertions(+), 2 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
@@ -908,7 +908,8 @@ static int ov3640_sensor_power_set(enum 
mdelay(10);
enable_fpga_vio_1v8(1);
udelay(100);
-   }
+   } else
+   omap_set_gpio_dataout(OV3640_STANDBY_GPIO, 0);
break;
case V4L2_POWER_OFF:
printk(KERN_DEBUG "ov3640_sensor_power_set(OFF)\n");
@@ -932,6 +933,7 @@ static int ov3640_sensor_power_set(enum 
break;
case V4L2_POWER_STANDBY:
printk(KERN_DEBUG "ov3640_sensor_power_set(STANDBY)\n");
+   omap_set_gpio_dataout(OV3640_STANDBY_GPIO, 1);
break;
}
previous_power = power;
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
@@ -742,7 +742,8 @@ static int ov3640_sensor_power_set(enum 
omap_set_gpio_dataout(OV3640_RESET_GPIO, 0);
udelay(100);
omap_set_gpio_dataout(OV3640_RESET_GPIO, 1);
-   }
+   } else
+   omap_set_gpio_dataout(OV3640_STANDBY_GPIO, 0);
break;
case V4L2_POWER_OFF:
printk(KERN_DEBUG "ov3640_sensor_power_set(OFF)\n");
@@ -764,6 +765,7 @@ static int ov3640_sensor_power_set(enum 
break;
case V4L2_POWER_STANDBY:
printk(KERN_DEBUG "ov3640_sensor_power_set(STANDBY)\n");
+   omap_set_gpio_dataout(OV3640_STANDBY_GPIO, 1);
break;
}
previous_power = power;
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[OMAPZOOM][PATCH] CSI2: Fix to csi2 reset.

2009-03-15 Thread Dominic Curran
From: Dominic Curran 
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 
---
 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/

[OMAPZOOM][PATCH] ISP: Add default white balance values to board file.

2009-02-26 Thread Dominic Curran
From: Dominic Curran 
Subject: [OMAPZOOM][PATCH] ISP: Add default white balance values to board file.

This patch stores the sensors default white balance coefficient values in the 
board file.
This patch keeps the same coef for MT9P012 & OV3640, but changes the 
coefficients 
for the IMX046.
Changing the coefficients for the IMX046 fixes a yellowish tint in the image.

The patch is based on top of the set of patches labeled 'Component Order'.

Signed-off-by: Dominic Curran 
---
 arch/arm/mach-omap2/board-3430sdp.c  |   12 
 arch/arm/mach-omap2/board-ldp.c  |4 
 arch/arm/mach-omap2/board-zoom2.c|4 
 drivers/media/video/isp/isp.c|1 +
 drivers/media/video/isp/isp.h|3 +++
 drivers/media/video/isp/isppreview.c |   18 ++
 drivers/media/video/isp/isppreview.h |2 ++
 7 files changed, 44 insertions(+)

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
@@ -660,6 +660,10 @@ static struct isp_interface_config mt9p0
.wenlog = ISPCCDC_CFG_WENLOG_OR,
.dcsub = 42,
.raw_fmt_in = ISPCCDC_INPUT_FMT_GR_BG,
+   .wbal.coef0 = 0x23,
+   .wbal.coef1 = 0x20,
+   .wbal.coef2 = 0x20,
+   .wbal.coef3 = 0x30,
.u.par.par_bridge = 0x0,
.u.par.par_clk_pol = 0x0,
 };
@@ -783,6 +787,10 @@ static struct isp_interface_config ov364
.wenlog = ISPCCDC_CFG_WENLOG_AND,
.dcsub = OV3640_BLACK_LEVEL_10BIT,
.raw_fmt_in = ISPCCDC_INPUT_FMT_BG_GR,
+   .wbal.coef0 = 0x23,
+   .wbal.coef1 = 0x20,
+   .wbal.coef2 = 0x20,
+   .wbal.coef3 = 0x30,
.u.csi.crc = 0x0,
.u.csi.mode = 0x0,
.u.csi.edge = 0x0,
@@ -991,6 +999,10 @@ static struct isp_interface_config imx04
.wenlog = ISPCCDC_CFG_WENLOG_OR,
.dcsub  = IMX046_BLACK_LEVEL_AVG,
.raw_fmt_in = ISPCCDC_INPUT_FMT_RG_GB,
+   .wbal.coef0 = 0x23,
+   .wbal.coef1 = 0x20,
+   .wbal.coef2 = 0x20,
+   .wbal.coef3 = 0x39,
.u.csi.crc  = 0x0,
.u.csi.mode = 0x0,
.u.csi.edge = 0x0,
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
@@ -625,6 +625,10 @@ static struct isp_interface_config ov364
.wenlog = ISPCCDC_CFG_WENLOG_AND,
.dcsub = OV3640_BLACK_LEVEL_10BIT,
.raw_fmt_in = ISPCCDC_INPUT_FMT_BG_GR,
+   .wbal.coef0 = 0x23,
+   .wbal.coef1 = 0x20,
+   .wbal.coef2 = 0x20,
+   .wbal.coef3 = 0x30,
.u.csi.crc = 0x0,
.u.csi.mode = 0x0,
.u.csi.edge = 0x0,
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
@@ -371,6 +371,10 @@ static struct isp_interface_config imx04
.wenlog = ISPCCDC_CFG_WENLOG_OR,
.dcsub  = IMX046_BLACK_LEVEL_AVG,
.raw_fmt_in = ISPCCDC_INPUT_FMT_RG_GB,
+   .wbal.coef0 = 0x23,
+   .wbal.coef1 = 0x20,
+   .wbal.coef2 = 0x20,
+   .wbal.coef3 = 0x39,
.u.csi.crc  = 0x0,
.u.csi.mode = 0x0,
.u.csi.edge = 0x0,
Index: omapzoom04/drivers/media/video/isp/isp.c
===
--- omapzoom04.orig/drivers/media/video/isp/isp.c
+++ omapzoom04/drivers/media/video/isp/isp.c
@@ -952,6 +952,7 @@ int isp_configure_interface(struct isp_i
ispccdc_set_wenlog(config->wenlog);
ispccdc_set_dcsub(config->dcsub);
ispccdc_set_crop_offset(config->raw_fmt_in);
+   isppreview_set_whitebalance(&config->wbal);
 
return 0;
 }
Index: omapzoom04/drivers/media/video/isp/isp.h
===
--- omapzoom04.orig/drivers/media/video/isp/isp.h
+++ omapzoom04/drivers/media/video/isp/isp.h
@@ -27,6 +27,8 @@
 #include 
 #include 
 
+#include 
+
 #include "ispmmu.h"
 
 #define OMAP_ISP_CCDC  (1 << 0)
@@ -205,6 +207,7 @@ struct isp_interface_config {
u32 wenlog;
u32 dcsub;
enum ispccdc_raw_fmt raw_fmt_in;
+   struct ispprev_wbal wbal;
union {
struct par {
unsigned par_bridge:2;
Index: omapzoom04/drivers/media/video/isp/isppreview.c
===
--- omapzoom04.orig/drivers/media/video/isp/isppr

[OMAPZOOM][PATCH 3/3] ISP: Remove unneeded Previewer offset settings.

2009-02-26 Thread Dominic Curran
From: Dominic Curran 
Subject: [OMAPZOOM][PATCH 3/3] ISP: Remove unneeded Previewer offset settings.

Before this patch set the component order was controlled by chnaging offsets in 
the Previewer module.
This was rather unsatifactory because output component order from CCDC differed 
depending on sensor.

The 2nd patch in this series fixes this and causes the CCDC output component 
order to be consistent for all sensors regardless of the input order.

This means that input component order is always the same for Previewer, and 
therefore there is no need to compensate for different offsets in Previewer.

This patch removed the Preveiwer offset compensation from the board file, whic 
is 
now unnecessary.


Signed-off-by: Dominic Curran 
---
 arch/arm/mach-omap2/board-3430sdp.c |6 --
 arch/arm/mach-omap2/board-ldp.c |2 --
 arch/arm/mach-omap2/board-zoom2.c   |2 --
 drivers/media/video/isp/isp.c   |1 -
 drivers/media/video/isp/isp.h   |2 --
 5 files changed, 13 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
@@ -657,8 +657,6 @@ static struct isp_interface_config mt9p0
.strobe = 0x0,
.prestrobe = 0x0,
.shutter = 0x0,
-   .prev_sph = 2,
-   .prev_slv = 0,
.wenlog = ISPCCDC_CFG_WENLOG_OR,
.dcsub = 42,
.raw_fmt_in = ISPCCDC_INPUT_FMT_GR_BG,
@@ -782,8 +780,6 @@ static struct isp_interface_config ov364
.strobe = 0x0,
.prestrobe = 0x0,
.shutter = 0x0,
-   .prev_sph = 2,
-   .prev_slv = 0,
.wenlog = ISPCCDC_CFG_WENLOG_AND,
.dcsub = OV3640_BLACK_LEVEL_10BIT,
.raw_fmt_in = ISPCCDC_INPUT_FMT_BG_GR,
@@ -992,8 +988,6 @@ static struct isp_interface_config imx04
.strobe = 0x0,
.prestrobe  = 0x0,
.shutter= 0x0,
-   .prev_sph   = 2,
-   .prev_slv   = 0,
.wenlog = ISPCCDC_CFG_WENLOG_OR,
.dcsub  = IMX046_BLACK_LEVEL_AVG,
.raw_fmt_in = ISPCCDC_INPUT_FMT_RG_GB,
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
@@ -622,8 +622,6 @@ static struct isp_interface_config ov364
.strobe = 0x0,
.prestrobe = 0x0,
.shutter = 0x0,
-   .prev_sph = 2,
-   .prev_slv = 0,
.wenlog = ISPCCDC_CFG_WENLOG_AND,
.dcsub = OV3640_BLACK_LEVEL_10BIT,
.raw_fmt_in = ISPCCDC_INPUT_FMT_BG_GR,
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
@@ -368,8 +368,6 @@ static struct isp_interface_config imx04
.strobe = 0x0,
.prestrobe  = 0x0,
.shutter= 0x0,
-   .prev_sph   = 2,
-   .prev_slv   = 0,
.wenlog = ISPCCDC_CFG_WENLOG_OR,
.dcsub  = IMX046_BLACK_LEVEL_AVG,
.raw_fmt_in = ISPCCDC_INPUT_FMT_RG_GB,
Index: omapzoom04/drivers/media/video/isp/isp.c
===
--- omapzoom04.orig/drivers/media/video/isp/isp.c
+++ omapzoom04/drivers/media/video/isp/isp.c
@@ -949,7 +949,6 @@ int isp_configure_interface(struct isp_i
ISPCCDC_VDINT);
 
/* Set sensor specific fields in CCDC and Previewer module.*/
-   isppreview_set_skip(config->prev_sph, config->prev_slv);
ispccdc_set_wenlog(config->wenlog);
ispccdc_set_dcsub(config->dcsub);
ispccdc_set_crop_offset(config->raw_fmt_in);
Index: omapzoom04/drivers/media/video/isp/isp.h
===
--- omapzoom04.orig/drivers/media/video/isp/isp.h
+++ omapzoom04/drivers/media/video/isp/isp.h
@@ -202,8 +202,6 @@ struct isp_interface_config {
int strobe;
int prestrobe;
int shutter;
-   u32 prev_sph;
-   u32 prev_slv;
u32 wenlog;
u32 dcsub;
enum ispccdc_raw_fmt raw_fmt_in;
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[OMAPZOOM][PATCH 2/3] ISP: Add CCDC offset info to board file.

2009-02-26 Thread Dominic Curran
From: Dominic Curran 
Subject: [OMAPZOOM][PATCH 2/3] ISP: Add CCDC offset info to board file.

Adds new enums which signal what component order CCDC input should expect:
  ISPCCDC_INPUT_FMT_GR_BG
  ISPCCDC_INPUT_FMT_RG_GB
  ISPCCDC_INPUT_FMT_BG_GR
  ISPCCDC_INPUT_FMT_GB_RG
These are set per sensor, and the setup has been moved to the board files.

This enum value is then passed to CCDC which turns it into a horiz/vert offset 
that will set the register fields:
 ISPCCDC_FMT_HORZ.ISPCCDC_FMT_HORZ_FMTSPH_SHIFT
 ISPCCDC_FMT_VERT.ISPCCDC_FMT_VERT_FMTSLV_SHIFT

This patch causes the CCDC output component order to be consistent for all 
sensors regardless of the input order.

Signed-off-by: Dominic Curran 
---
 arch/arm/mach-omap2/board-3430sdp.c |5 +++
 arch/arm/mach-omap2/board-ldp.c |3 +-
 arch/arm/mach-omap2/board-zoom2.c   |1 
 drivers/media/video/isp/isp.c   |1 
 drivers/media/video/isp/isp.h   |8 ++
 drivers/media/video/isp/ispccdc.c   |   48 
 drivers/media/video/isp/ispccdc.h   |2 +
 7 files changed, 61 insertions(+), 7 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
@@ -661,6 +661,7 @@ static struct isp_interface_config mt9p0
.prev_slv = 0,
.wenlog = ISPCCDC_CFG_WENLOG_OR,
.dcsub = 42,
+   .raw_fmt_in = ISPCCDC_INPUT_FMT_GR_BG,
.u.par.par_bridge = 0x0,
.u.par.par_clk_pol = 0x0,
 };
@@ -782,9 +783,10 @@ static struct isp_interface_config ov364
.prestrobe = 0x0,
.shutter = 0x0,
.prev_sph = 2,
-   .prev_slv = 1,
+   .prev_slv = 0,
.wenlog = ISPCCDC_CFG_WENLOG_AND,
.dcsub = OV3640_BLACK_LEVEL_10BIT,
+   .raw_fmt_in = ISPCCDC_INPUT_FMT_BG_GR,
.u.csi.crc = 0x0,
.u.csi.mode = 0x0,
.u.csi.edge = 0x0,
@@ -994,6 +996,7 @@ static struct isp_interface_config imx04
.prev_slv   = 0,
.wenlog = ISPCCDC_CFG_WENLOG_OR,
.dcsub  = IMX046_BLACK_LEVEL_AVG,
+   .raw_fmt_in = ISPCCDC_INPUT_FMT_RG_GB,
.u.csi.crc  = 0x0,
.u.csi.mode = 0x0,
.u.csi.edge = 0x0,
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
@@ -623,9 +623,10 @@ static struct isp_interface_config ov364
.prestrobe = 0x0,
.shutter = 0x0,
.prev_sph = 2,
-   .prev_slv = 1,
+   .prev_slv = 0,
.wenlog = ISPCCDC_CFG_WENLOG_AND,
.dcsub = OV3640_BLACK_LEVEL_10BIT,
+   .raw_fmt_in = ISPCCDC_INPUT_FMT_BG_GR,
.u.csi.crc = 0x0,
.u.csi.mode = 0x0,
.u.csi.edge = 0x0,
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
@@ -372,6 +372,7 @@ static struct isp_interface_config imx04
.prev_slv   = 0,
.wenlog = ISPCCDC_CFG_WENLOG_OR,
.dcsub  = IMX046_BLACK_LEVEL_AVG,
+   .raw_fmt_in = ISPCCDC_INPUT_FMT_RG_GB,
.u.csi.crc  = 0x0,
.u.csi.mode = 0x0,
.u.csi.edge = 0x0,
Index: omapzoom04/drivers/media/video/isp/isp.c
===
--- omapzoom04.orig/drivers/media/video/isp/isp.c
+++ omapzoom04/drivers/media/video/isp/isp.c
@@ -952,6 +952,7 @@ int isp_configure_interface(struct isp_i
isppreview_set_skip(config->prev_sph, config->prev_slv);
ispccdc_set_wenlog(config->wenlog);
ispccdc_set_dcsub(config->dcsub);
+   ispccdc_set_crop_offset(config->raw_fmt_in);
 
return 0;
 }
Index: omapzoom04/drivers/media/video/isp/isp.h
===
--- omapzoom04.orig/drivers/media/video/isp/isp.h
+++ omapzoom04/drivers/media/video/isp/isp.h
@@ -123,6 +123,13 @@ enum isp_callback_type {
CBK_END,
 };
 
+enum ispccdc_raw_fmt {
+   ISPCCDC_INPUT_FMT_GR_BG,
+   ISPCCDC_INPUT_FMT_RG_GB,
+   ISPCCDC_INPUT_FMT_BG_GR,
+   ISPCCDC_INPUT_FMT_GB_RG,
+};
+
 /**
  * struct isp_reg - Structure for ISP register values.
  * @reg: 32-bit Register address.
@@ -199,6 +206,7 @@ struct isp_interface_config {
u32 prev_slv;
u32 wenlog;
u32 dcsub;
+   enum ispccdc_raw_fmt raw_fmt_in;
union {
struct par {
unsigned par_bridge:2;
Index: omapzoom04/drivers/media/vide

[OMAPZOOM][PATCH 0/3] ISP: Component order

2009-02-26 Thread Dominic Curran
From: Dominic Curran 
Subject:[OMAPZOOM][PATCH 0/3] ISP: Component order

The RAW10 component order for all three sensors I test with (MT9P012, OV3640 & 
IMX046) is different.  This patch set uses different horz/vert offsets in CCDC 
so that the output RAW component order is the same for all sensors.

Currently sph and slv in the board file (for MT & OV) are used to fix component 
order in Previewer. However this approach doesn't work for the Sony IMX046 
sensor.
This patch causes the component order output of CCDC to be the same for all 
sensors.  Since the order is the same going into Previewer this means that 
there 
is not need for sph and slv to change per sensor.

 woffsethoffset  RAW10 test YUV test
MT9P012GR..BG  1  0OK OK
IMX046 RG..GB  0  0OK OK
OV3640 BG..GR  1  1OK OK

Patch:
1/3  Removes original bug introduced with IMX046 patch.
2/3  Changes in CCDC to all easy setup of component order in board file.
3/3  Remove no longer needed prev_sph & prev_slv from boad file. 

Testing:
The following tests have been run using this patch set [x = working]:
(Test apps below are internal TI tools which test basic V4L2 functions)

IMX046  streaming 3 YUYV QVGA 1 500 x
streaming 3 YUYV VGA 1 500  x
streaming 3 YUYV 208 154 1 500  x
streaming 3 YUYV 854 480 1 500  x
fps 3 YUYV 640 480 200 30fps
fps 3 YUYV 3280 2464 100   7.5fps
burst_mode 3 YUYV 816 616 1 file.yuvx
burst_mode 3 YUYV 3280 2464 1 file.yuv  x
burst_mode 3 RAW10 3280 616 1 file.raw  x (h)

MT9P012 ./streaming_frame 1 15 YUYV QVGA 1 200  x
./streaming_frame 1 30 YUYV QVGA 1 200  x
./streaming_frame 1 15 YUYV VGA 1 200   x
./streaming_frame 1 30 YUYV VGA 1 200   x
burst_mode 1 YUYV 5MP 1 file.yuvx
burst_mode 1 RAW10 5MP 1 file.raw   x (h)
streaming_zoom 1 YUYV VGA   x


OV3640  streaming 2 YUYV 256 192 1 300  x
streaming 2 YUYV QVGA 1 300 x
streaming 2 YUYV VGA 1 300  x
burst_mode 2 YUYV XGA 1 file.yuvx
burst_mode 2 YUYV QXGA 1 file.yuv   x
burst_mode 2 RAW10 QXGA 1 file.raw  x (h)
fps 2 YUYV VGA 200  30fps
fps 2 YUYV QXGA 100 15  15fps
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[OMAPZOOM][PATCH 1/3] ISP: Remove hardcoding of CCDC input offset.

2009-02-26 Thread Dominic Curran
From: Dominic Curran 
Subject: [OMAPZOOM][PATCH 1/3] ISP: Remove hardcoding of CCDC input offset.

The Sony IMX046 patch set introduced a bug when setting CCDC input offsets.
The Sony patch set the horz & vert offsets to 0.
This worked from the Sony IMX046, but broke settings for other sensors like 
MT9P012 & OV3640.
The reason is that all three sensors send their data with different component 
orders.

The effect was to mess up colours in previewer module for MT9P012 & OV3640.
This patch reverts that bug.

The other patches in this set will provide a better way of setting these 
offsets, 
thus allowing easy setup for any type kind of incoming componenet order.

Signed-off-by: Dominic Curran 
---
 drivers/media/video/isp/ispccdc.c |2 --
 1 file changed, 2 deletions(-)

Index: omapzoom04/drivers/media/video/isp/ispccdc.c
===
--- omapzoom04.orig/drivers/media/video/isp/ispccdc.c
+++ omapzoom04/drivers/media/video/isp/ispccdc.c
@@ -1265,8 +1265,6 @@ int ispccdc_config_size(u32 input_w, u32
}
 
if (ispccdc_obj.ccdc_outfmt == CCDC_OTHERS_VP) {
-   ispccdc_obj.ccdcin_woffset = 0;
-   ispccdc_obj.ccdcin_hoffset = 0;
omap_writel((ispccdc_obj.ccdcin_woffset <<
ISPCCDC_FMT_HORZ_FMTSPH_SHIFT) |
(ispccdc_obj.ccdcin_w <<
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[OMAPZOOM] ISP: Fix indexing bug in csi2 module.

2009-02-19 Thread Dominic Curran
From: Dominic Curran 
Subject: [OMAPZOOM] ISP: Fix indexing bug in csi2 module.

This patch fixes an indexing bug in the CSI2 module.
The functions:
 isp_csi2_timings_update(..)
 isp_csi2_timings_get(..)
expect either a 1 or 2 which references the complexio number being referenced.
The bug was that they were being passed a 0 & 1.

The issue was originally found by HP.

Signed-off-by: Dominic Curran 
---
 drivers/media/video/isp/ispcsi2.c |   16 
 1 file changed, 8 insertions(+), 8 deletions(-)

Index: omapzoom04/drivers/media/video/isp/ispcsi2.c
===
--- omapzoom04.orig/drivers/media/video/isp/ispcsi2.c
+++ omapzoom04/drivers/media/video/isp/ispcsi2.c
@@ -1526,7 +1526,7 @@ int isp_csi2_timings_config_forcerxmode(
struct isp_csi2_timings_cfg *currtimings;
struct isp_csi2_timings_cfg_update *currtimings_u;
 
-   if (io > 2) {
+   if (io < 1 || io > 2) {
printk(KERN_ERR "CSI2 - Timings config: Invalid IO number\n");
return -EINVAL;
}
@@ -1552,7 +1552,7 @@ int isp_csi2_timings_config_stopstate_16
struct isp_csi2_timings_cfg *currtimings;
struct isp_csi2_timings_cfg_update *currtimings_u;
 
-   if (io > 2) {
+   if (io < 1 || io > 2) {
printk(KERN_ERR "CSI2 - Timings config: Invalid IO number\n");
return -EINVAL;
}
@@ -1578,7 +1578,7 @@ int isp_csi2_timings_config_stopstate_4x
struct isp_csi2_timings_cfg *currtimings;
struct isp_csi2_timings_cfg_update *currtimings_u;
 
-   if (io > 2) {
+   if (io < 1 || io > 2) {
printk(KERN_ERR "CSI2 - Timings config: Invalid IO number\n");
return -EINVAL;
}
@@ -1604,7 +1604,7 @@ int isp_csi2_timings_config_stopstate_cn
struct isp_csi2_timings_cfg *currtimings;
struct isp_csi2_timings_cfg_update *currtimings_u;
 
-   if (io > 2) {
+   if (io < 1 || io > 2) {
printk(KERN_ERR "CSI2 - Timings config: Invalid IO number\n");
return -EINVAL;
}
@@ -1636,7 +1636,7 @@ int isp_csi2_timings_update(u8 io, bool 
struct isp_csi2_timings_cfg_update *currtimings_u;
u32 reg;
 
-   if (io > 2) {
+   if (io < 1 || io > 2) {
printk(KERN_ERR "CSI2 - Timings config: Invalid IO number\n");
return -EINVAL;
}
@@ -1706,7 +1706,7 @@ int isp_csi2_timings_get(u8 io)
struct isp_csi2_timings_cfg_update *currtimings_u;
u32 reg;
 
-   if (io > 2) {
+   if (io < 1 || io > 2) {
printk(KERN_ERR "CSI2 - Timings config: Invalid IO number\n");
return -EINVAL;
}
@@ -1758,7 +1758,7 @@ int isp_csi2_timings_update_all(bool for
 {
int i;
 
-   for (i = 0; i < 2; i++)
+   for (i = 1; i < 3; i++)
isp_csi2_timings_update(i, force_update);
return 0;
 }
@@ -1772,7 +1772,7 @@ int isp_csi2_timings_get_all(void)
 {
int i;
 
-   for (i = 0; i < 2; i++)
+   for (i = 1; i < 3; i++)
isp_csi2_timings_get(i);
return 0;
 }
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[OMAPZOOM][PATCH] Testing for TWL4030 in board file change.

2009-02-16 Thread Dominic Curran
From: Dominic Curran 
Subject: [OMAPZOOM][PATCH] Testing for TWL4030 in board file change.

This patch changes the method of testing for TWL4030 in the sensor portion of 
the 
board file.
Previously, if TWL4030 was not built into kernel then the build would be 
stopped 
by code in the board file simular to:
 #ifndef CONFIG_TWL4030_CORE
 #error "no power companion board defined!"
 #endif

However for debugging purposes it maybe required to build without TWL4030.
Therefore this patch allows the kernel to be compiled without a build error 
when 
TWL4030 is not present.
In such a case the sensor power function will build, but when called 
immediately 
return a -ENODEV error (so initilization of sensor will go no further).

This change is targeted at all camera sensors within the board files for SDP, 
Zoom1 & Zoom2.

Alternative fixes to this problem like changes to Kconfig were considered, but 
rejected as inappropriate solutions.

Signed-off-by: Dominic Curran 
---
 arch/arm/mach-omap2/board-3430sdp.c |   32 
 arch/arm/mach-omap2/board-ldp.c |9 +
 arch/arm/mach-omap2/board-zoom2.c   |   13 -
 3 files changed, 33 insertions(+), 21 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
@@ -45,9 +45,6 @@
 #include "ti-compat.h"
 
 #ifdef CONFIG_VIDEO_OMAP3
-#ifndef CONFIG_TWL4030_CORE
-#error "no power companion board defined!"
-#endif
 #include 
 #include <../drivers/media/video/omap34xxcam.h>
 #include <../drivers/media/video/isp/ispreg.h>
@@ -668,14 +665,17 @@ static struct isp_interface_config mt9p0
 static int mt9p012_sensor_power_set(enum v4l2_power power)
 {
static enum v4l2_power previous_power = V4L2_POWER_OFF;
+
+#ifndef CONFIG_TWL4030_CORE
+   return -ENODEV;
+#endif
+
switch (power) {
case V4L2_POWER_OFF:
/* Power Down Sequence */
 #ifdef CONFIG_TWL4030_CORE
twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
VAUX_DEV_GRP_NONE, TWL4030_VAUX2_DEV_GRP);
-#else
-#error "no power companion board defined!"
 #endif
enable_fpga_vio_1v8(0);
omap_free_gpio(MT9P012_RESET_GPIO);
@@ -718,8 +718,6 @@ static int mt9p012_sensor_power_set(enum
VAUX_2_8_V, TWL4030_VAUX2_DEDICATED);
twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
VAUX_DEV_GRP_P1, TWL4030_VAUX2_DEV_GRP);
-#else
-#error "no power companion board defined!"
 #endif
}
 
@@ -832,6 +830,11 @@ static int ov3640_sensor_power_set(enum 
struct isp_csi2_lanes_cfg lanecfg;
struct isp_csi2_phy_cfg phyconfig;
static enum v4l2_power previous_power = V4L2_POWER_OFF;
+
+#ifndef CONFIG_TWL4030_CORE
+   return -ENODEV;
+#endif
+
switch (power) {
case V4L2_POWER_ON:
printk(KERN_DEBUG "ov3640_sensor_power_set(ON)\n");
@@ -876,10 +879,9 @@ static int ov3640_sensor_power_set(enum 
twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
VAUX_DEV_GRP_P1, TWL4030_VAUX2_DEV_GRP);
 #endif
-   udelay(100);
-#else
-#error "no power companion board defined!"
 #endif
+   udelay(100);
+
/* Request and configure gpio pins */
if (omap_request_gpio(OV3640_RESET_GPIO) != 0) {
printk(KERN_ERR "Could not request GPIO %d",
@@ -923,8 +925,6 @@ static int ov3640_sensor_power_set(enum 
twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
VAUX_DEV_GRP_NONE, TWL4030_VAUX2_DEV_GRP);
 #endif
-#else
-#error "no power companion board defined!"
 #endif
enable_fpga_vio_1v8(0);
omap_free_gpio(OV3640_RESET_GPIO);
@@ -1015,6 +1015,10 @@ static int imx046_sensor_power_set(enum 
static enum v4l2_power previous_power = V4L2_POWER_OFF;
int err = 0;
 
+#ifndef CONFIG_TWL4030_CORE
+   return -ENODEV;
+#endif
+
switch (power) {
case V4L2_POWER_ON:
/* Power Up Sequence */
@@ -1059,6 +1063,7 @@ static int imx046_sensor_power_set(enum 
omap_set_gpio_direction(IMX046_RESET_GPIO,
GPIO_DIR_OUTPUT);
 
+#ifdef CONFIG_TWL4030_CORE
/* turn on analog power */
twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
VAUX_2_8_V, TWL4030_VAUX2_DEDICATED);
@@ -1069,6 +1074,7 @@ static int imx046_sensor_power_set(enum 

[OMAPZOOM][PATCH v2 3/3] LV8093: Add support to zoom2 board file.

2009-02-13 Thread Dominic Curran
From: Dominic Curran 
Subject: [OMAPZOOM][PATCH v2 3/3] LV8093: Add support to zoom2 board file.

Add support for the LV8093 to the OMAP3430 Zoom2 board file.
The LV8093 is the lens driver for the Sony IMX046 camera.

Signed-off-by: Kraig Proehl 
Signed-off-by: Dominic Curran 
---
 arch/arm/configs/omap_zoom2_defconfig |1 +
 arch/arm/mach-omap2/board-zoom2.c |   28 
 2 files changed, 29 insertions(+)

Index: omapzoom04/arch/arm/configs/omap_zoom2_defconfig
===
--- omapzoom04.orig/arch/arm/configs/omap_zoom2_defconfig
+++ omapzoom04/arch/arm/configs/omap_zoom2_defconfig
@@ -995,6 +995,7 @@ CONFIG_VIDEO_CAPTURE_DRIVERS=y
 # CONFIG_VIDEO_DW9710 is not set
 # CONFIG_VIDEO_OV3640 is not set
 CONFIG_VIDEO_IMX046=y
+CONFIG_VIDEO_LV8093=y
 # CONFIG_VIDEO_SAA711X is not set
 # CONFIG_VIDEO_SAA717X is not set
 # CONFIG_VIDEO_TVP5150 is not set
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
@@ -75,6 +75,10 @@
 #endif
 #endif
 
+#if defined(CONFIG_VIDEO_LV8093) || defined(CONFIG_VIDEO_LV8093_MODULE)
+#include <../drivers/media/video/lv8093.h>
+#endif
+
 #ifdef CONFIG_TOUCHSCREEN_SYNAPTICS
 #define OMAP_SYNAPTICS_GPIO163
 #endif
@@ -326,6 +330,24 @@ static struct twl4030_keypad_data ldp_kp
.irq= TWL4030_MODIRQ_KEYPAD,
 };
 
+#if defined(CONFIG_VIDEO_LV8093) || defined(CONFIG_VIDEO_LV8093_MODULE)
+static int lv8093_lens_set_prv_data(void *priv)
+{
+   struct omap34xxcam_hw_config *hwc = priv;
+
+   hwc->dev_index = 2;
+   hwc->dev_minor = 5;
+   hwc->dev_type = OMAP34XXCAM_SLAVE_LENS;
+   hwc->interface_type = ISP_CSIA;
+   return 0;
+}
+
+static struct lv8093_platform_data zoom2_lv8093_platform_data = {
+   .power_set  = NULL,
+   .priv_data_set  = lv8093_lens_set_prv_data,
+};
+#endif
+
 #if defined(CONFIG_VIDEO_IMX046) || defined(CONFIG_VIDEO_IMX046_MODULE)
 
 static struct omap34xxcam_sensor_config imx046_hwc = {
@@ -716,6 +738,12 @@ static struct i2c_board_info __initdata 
.platform_data = &zoom2_imx046_platform_data,
},
 #endif
+#if defined(CONFIG_VIDEO_LV8093) || defined(CONFIG_VIDEO_LV8093_MODULE)
+   {
+   I2C_BOARD_INFO(LV8093_NAME,  LV8093_AF_I2C_ADDR),
+   .platform_data = &zoom2_lv8093_platform_data,
+   },
+#endif
 };
 
 static int __init omap_i2c_init(void)
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[OMAPZOOM][PATCH v2 2/3] LV8093: Add to Kconfig.

2009-02-13 Thread Dominic Curran
From: Dominic Curran 
Subject: [OMAPZOOM][PATCH v2 2/3] LV8093: Add to Kconfig.

Add LV8093 support to Kconfig and Makefile.

Signed-off-by: Kraig Proehl 
Signed-off-by: Dominic Curran 
---
 drivers/media/video/Kconfig  |6 ++
 drivers/media/video/Makefile |1 +
 2 files changed, 7 insertions(+)

Index: omapzoom04/drivers/media/video/Kconfig
===
--- omapzoom04.orig/drivers/media/video/Kconfig
+++ omapzoom04/drivers/media/video/Kconfig
@@ -341,6 +341,12 @@ config VIDEO_IMX046
  This is a Video4Linux2 sensor-level driver for the Sony
  IMX046 camera.
 
+config VIDEO_LV8093
+   tristate "Piezo Actuator Lens driver for LV8093"
+   depends on I2C && VIDEO_V4L2
+   ---help---
+ This is a Video4Linux2 lens driver for the Sanyo LV8093.
+
 config VIDEO_SAA7110
tristate "Philips SAA7110 video decoder"
depends on VIDEO_V4L1 && I2C
Index: omapzoom04/drivers/media/video/Makefile
===
--- omapzoom04.orig/drivers/media/video/Makefile
+++ omapzoom04/drivers/media/video/Makefile
@@ -116,6 +116,7 @@ obj-$(CONFIG_VIDEO_MT9P012) += mt9p012.o
 obj-$(CONFIG_VIDEO_DW9710) += dw9710.o
 obj-$(CONFIG_VIDEO_OV3640) += ov3640.o
 obj-$(CONFIG_VIDEO_IMX046) += imx046.o
+obj-$(CONFIG_VIDEO_LV8093) += lv8093.o
 
 obj-$(CONFIG_USB_DABUSB)+= dabusb.o
 obj-$(CONFIG_USB_OV511) += ov511.o
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[OMAPZOOM][PATCH v2 1/3] LV8093: Add driver for LV8093 lens actuator.

2009-02-13 Thread Dominic Curran
From: Dominic Curran 
Subject: [OMAPZOOM][PATCH v2 1/3] LV8093: Add driver for LV8093 lens actuator.

Support for the Sanyo LV8093CS piezo-actuator lens driver.
The lens position cannot be read back from this device, and it
only takes relative positions.  Thus it:
 - Supports the VIDIOC_G_CTRL ioctl to return BUSY bit (0 - Ready, ~0 - Busy)
 - Supports the VIDIOC_S_CTRL ioctl with the V4L2_CID_FOCUS_RELATIVE control ID.

One relative step requested through the V4L2_CID_FOCUS_RELATIVE control will
produce a 5.0um step @ 5.2mm/s of the lens.

Signed-off-by: Kraig Proehl 
Signed-off-by: Dominic Curran 
---
 drivers/media/video/lv8093.c |  595 +++
 drivers/media/video/lv8093.h |   92 ++
 2 files changed, 687 insertions(+)

Index: omapzoom04/drivers/media/video/lv8093.c
===
--- /dev/null
+++ omapzoom04/drivers/media/video/lv8093.c
@@ -0,0 +1,595 @@
+/*
+ * drivers/media/video/lv8093.c
+ *
+ * LV8093 Piezo Motor (LENS) driver
+ *
+ * Copyright (C) 2008-2009 Texas Instruments.
+ * Copyright (C) 2009 Hewlett-Packard.
+ *
+ * This package is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include "lv8093.h"
+
+static int
+lv8093_probe(struct i2c_client *client, const struct i2c_device_id *id);
+static int __exit lv8093_remove(struct i2c_client *client);
+
+struct lv8093_device {
+   const struct lv8093_platform_data *pdata;
+   struct v4l2_int_device *v4l2_int_device;
+   struct i2c_client *i2c_client;
+   int state;
+   int power_state;
+};
+
+static const struct i2c_device_id lv8093_id[] = {
+   {LV8093_NAME, 0},
+   {}
+};
+
+MODULE_DEVICE_TABLE(i2c, lv8093_id);
+
+static struct i2c_driver lv8093_i2c_driver = {
+   .driver = {
+  .name = LV8093_NAME,
+  .owner = THIS_MODULE,
+  },
+   .probe = lv8093_probe,
+   .remove = __exit_p(lv8093_remove),
+   .id_table = lv8093_id,
+};
+
+static struct lv8093_device lv8093 = {
+   .state = LENS_NOT_DETECTED,
+};
+
+static struct vcontrol {
+   struct v4l2_queryctrl qc;
+} video_control[] = {
+   {
+   {
+   .id = V4L2_CID_FOCUS_RELATIVE,
+   .type = V4L2_CTRL_TYPE_INTEGER,
+   .name = "Lens Relative Position",
+   .minimum = 0,
+   .maximum = 0,
+   .step = LV8093_MAX_RELATIVE_STEP,
+   .default_value = 0,
+   }
+   ,}
+};
+
+static struct i2c_driver lv8093_i2c_driver;
+
+static struct lv8093_lens_settings {
+   u8 reg;
+   u8 val;
+} lens_settings[] = {
+   {   /* Set control register */
+   .reg = CAMAF_LV8093_CTL_REG,
+   .val = CAMAF_LV8093_GATE0 |
+   CAMAF_LV8093_ENIN |
+   CAMAF_LV8093_CKSEL_ONE |
+   CAMAF_LV8093_RET2 |
+   CAMAF_LV8093_INIT_OFF,
+   },
+   {   /* Specify number of clocks per period */
+   .reg = CAMAF_LV8093_RST_REG,
+   .val = (LV8093_CLK_PER_PERIOD - 1),
+   },
+   {   /* Set the GATE_A pulse set value */
+   .reg = CAMAF_LV8093_GTAS_REG,
+   .val = (LV8093_TIME_GATEA + 1),
+   },
+   {   /* Set the GATE_B pulse reset value */
+   .reg = CAMAF_LV8093_GTBR_REG,
+   .val = (LV8093_TIME_GATEA + 1 + LV8093_TIME_OFF),
+   },
+   {   /* Set the GATE_B pulse set value */
+   .reg = CAMAF_LV8093_GTBS_REG,
+   .val = (LV8093_TIME_GATEA + 1 +
+   LV8093_TIME_OFF + LV8093_TIME_GATEB),
+   },
+   {   /* Specific the number of output pulse steps */
+   .reg = CAMAF_LV8093_STP_REG,
+   .val = LV8093_STP,
+   },
+   {   /* Set the number of swing back of init sequence performed */
+   .reg = CAMAF_LV8093_MOV_REG,
+   .val = 0,
+   },
+};
+
+/**
+ * find_vctrl - Finds the requested ID in the video control structure array
+ * @id: ID of control to search the video control array for
+ *
+ * Returns the index of the requested ID from the control structure array
+ */
+static int find_vctrl(int id)
+{
+   int i;
+
+   if (id < V4L2_CID_BASE)
+   return -EDOM;
+
+   for (i = (ARRAY_SIZE(video_control) - 1); i >= 0; i--)
+   if (video_control[i].qc.id 

[OMAPZOOM][PATCH v2 0/3] LV8093: Lens driver.

2009-02-13 Thread Dominic Curran
From: Dominic Curran 
Subject: [OMAPZOOM][PATCH v2 0/3] LV8093: Lens driver.

Support for the Sanyo LV8093CS piezo-actuator lens driver.

Driver was first submitted couple of weeks ago to omap-linux & linux-media.

Took a few comments and this is 2nd submittion.

thanks
dom
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[OMAPZOOM][PATCH] ISP: Fix printk's error messages.

2009-02-02 Thread Dominic Curran
From: Dominic Curran 
Subject: [OMAPZOOM][PATCH] ISP: Fix printk's error messages.

This patch adds CRLF characters to some printk's.
Added 'ISP_ERR' at beginning of message a thats how other printks are formated 
in 
this module.
Reported-by: Alexey Klimov 

Signed-off-by: Dominic Curran 
---
 drivers/media/video/isp/isp.c |7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

Index: omapzoom04/drivers/media/video/isp/isp.c
===
--- omapzoom04.orig/drivers/media/video/isp/isp.c
+++ omapzoom04/drivers/media/video/isp/isp.c
@@ -1175,13 +1175,14 @@ u32 isp_buf_allocation(void)
buff_addr = (void *) vmalloc(ISP_BUFFER_MAX_SIZE);
 
if (!buff_addr) {
-   printk(KERN_ERR "Cannot allocate memory ");
+   printk(KERN_ERR "ISP_ERR: Cannot allocate "
+   "ISP_WORKAROUND memory\n");
return -ENOMEM;
}
 
sglist_alloc = videobuf_vmalloc_to_sg(buff_addr, ISP_BUFFER_MAX_PAGES);
if (!sglist_alloc) {
-   printk(KERN_ERR "videobuf_vmalloc_to_sg error");
+   printk(KERN_ERR "ISP_ERR: videobuf_vmalloc_to_sg failed\n");
return -ENOMEM;
}
num_sc = dma_map_sg(NULL, sglist_alloc, ISP_BUFFER_MAX_PAGES, 1);
@@ -1196,7 +1197,7 @@ u32 isp_buf_mmap(void)
 {
buff_addr_mapped = ispmmu_map_sg(sglist_alloc, ISP_BUFFER_MAX_PAGES);
if (!buff_addr_mapped) {
-   printk(KERN_ERR "ispmmu_map_sg mapping failed ");
+   printk(KERN_ERR "ISP_ERR: ispmmu_map_sg mapping failed\n");
return -ENOMEM;
}
isppreview_set_outaddr(buff_addr_mapped);
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[OMAPZOOM][PATCH] CAM: Alloc ISP Workaround buffer at driver init.

2009-01-30 Thread Dominic Curran
From: Dominic Curran 
Subject: [PATCH] CAM: Alloc ISP Workaround buffer at driver init.

This patch allows the ISP Workaround buffer to be allocated at boot time.
Previously the buffer was being allocated everytime a handle to the driver
was opened.
Because the ISP Workaround buffer can be very large then there is
significant benefit for the buffer to be allocated only once during camera 
driver initialization.

Signed-off-by: Pallavi Kulkarni 
Signed-off-by: Sergio Aguirre 
Signed-off-by: Dominic Curran 
---
 arch/arm/configs/omap_3430sdp_defconfig |1 +
 arch/arm/configs/omap_zoom2_defconfig   |1 +
 drivers/media/video/Kconfig |8 
 drivers/media/video/isp/isp.c   |   30 +-
 4 files changed, 39 insertions(+), 1 deletion(-)



Index: omapzoom04/arch/arm/configs/omap_3430sdp_defconfig
===
--- omapzoom04.orig/arch/arm/configs/omap_3430sdp_defconfig
+++ omapzoom04/arch/arm/configs/omap_3430sdp_defconfig
@@ -1077,6 +1077,7 @@ CONFIG_VIDEO_OMAP24XX_TVOUT=y
 CONFIG_VIDEO_OMAP3=y
 CONFIG_VIDEO_OMAP34XX_ISP_PREVIEWER=y
 CONFIG_VIDEO_OMAP34XX_ISP_RESIZER=y
+CONFIG_VIDEO_OMAP3_BUFFALLOC=y
 # CONFIG_VIDEO_OMAP2 is not set
 # CONFIG_V4L_USB_DRIVERS is not set
 # CONFIG_SOC_CAMERA is not set
Index: omapzoom04/arch/arm/configs/omap_zoom2_defconfig
===
--- omapzoom04.orig/arch/arm/configs/omap_zoom2_defconfig
+++ omapzoom04/arch/arm/configs/omap_zoom2_defconfig
@@ -1032,6 +1032,7 @@ CONFIG_VIDEO_OMAP24XX_TVOUT=y
 CONFIG_VIDEO_OMAP3=y
 CONFIG_VIDEO_OMAP34XX_ISP_PREVIEWER=y
 CONFIG_VIDEO_OMAP34XX_ISP_RESIZER=y
+CONFIG_VIDEO_OMAP3_BUFFALLOC=y
 # CONFIG_VIDEO_OMAP2 is not set
 # CONFIG_SOC_CAMERA is not set
 # CONFIG_VIDEO_SH_MOBILE_CEU is not set
Index: omapzoom04/drivers/media/video/Kconfig
===
--- omapzoom04.orig/drivers/media/video/Kconfig
+++ omapzoom04/drivers/media/video/Kconfig
@@ -842,6 +842,14 @@ config VIDEO_OMAP3
 
 source "drivers/media/video/isp/Kconfig"
 
+config VIDEO_OMAP3_BUFFALLOC
+   bool "OMAP3430 ISP Workaround: Allocate memory at driver init"
+   depends on VIDEO_OMAP3 && ARCH_OMAP3430
+   default y
+   ---help---
+ This option is for allocating the workaround buffer at
+ camera init time.
+
 config VIDEO_OMAP2
tristate "OMAP 2 Camera support (EXPERIMENTAL)"
select VIDEOBUF_GEN
Index: omapzoom04/drivers/media/video/isp/isp.c
===
--- omapzoom04.orig/drivers/media/video/isp/isp.c
+++ omapzoom04/drivers/media/video/isp/isp.c
@@ -1185,6 +1185,15 @@ u32 isp_buf_allocation(void)
return -ENOMEM;
}
num_sc = dma_map_sg(NULL, sglist_alloc, ISP_BUFFER_MAX_PAGES, 1);
+   return 0;
+}
+
+/**
+ *  isp_buf_mmap - Create MMU scatter-gather list.
+ *
+ **/
+u32 isp_buf_mmap(void)
+{
buff_addr_mapped = ispmmu_map_sg(sglist_alloc, ISP_BUFFER_MAX_PAGES);
if (!buff_addr_mapped) {
printk(KERN_ERR "ispmmu_map_sg mapping failed ");
@@ -1340,9 +1349,14 @@ u32 isp_calc_pipeline(struct v4l2_pix_fo
isppreview_config_datapath(PRV_RAW_CCDC, PREVIEW_MEM);
ispresizer_config_datapath(RSZ_MEM_YUV);
if (alloc_done == 0) {
+#if !defined(CONFIG_VIDEO_OMAP3_BUFFALLOC)
rval = isp_buf_allocation();
if (rval)
return -EINVAL;
+#endif
+   rval = isp_buf_mmap();
+   if (rval)
+   return -EINVAL;
}
 #else
isppreview_config_datapath(PRV_RAW_CCDC, PREVIEW_RSZ);
@@ -2367,7 +2381,7 @@ int isp_put(void)
if (--isp_obj.ref_count == 0) {
isp_save_ctx();
off_mode = 1;
-#if ISP_WORKAROUND
+#if ISP_WORKAROUND && !defined(CONFIG_VIDEO_OMAP3_BUFFALLOC)
isp_buf_free();
 #endif
isp_release_resources();
@@ -2420,6 +2434,9 @@ EXPORT_SYMBOL(isp_restore_context);
  **/
 static int __init isp_init(void)
 {
+#if ISP_WORKAROUND && defined(CONFIG_VIDEO_OMAP3_BUFFALLOC)
+   int rval;
+#endif
DPRINTK_ISPCTRL("+isp_init for Omap 3430 Camera ISP\n");
isp_obj.ref_count = 0;
 
@@ -2427,6 +2444,14 @@ static int __init isp_init(void)
spin_lock_init(&isp_obj.isp_temp_buf_lock);
spin_lock_init(&isp_obj.lock);
 
+#if ISP_WORKAROUND && defined(CONFIG_VIDEO_OMAP3_BUFFALLOC)
+   if (alloc_done == 0) {
+   rval = isp_buf_allocation();
+   if (rval)
+   return -EINVAL;
+

[OMAPZOOM][PATCH v2 6/6] Add support for Sony imx046 to OMAP zoom2 board.

2009-01-30 Thread Dominic Curran
From: Dominic Curran 
Subject: [OMAPZOOM][PATCH v2 6/6] Add support for Sony imx046 to OMAP zoom2 
board.

Support for the Sony IMX046 sensor on the OMAP Zoom2 board.

Signed-off-by: Dominic Curran 
---
 arch/arm/configs/omap_zoom2_defconfig |1 
 arch/arm/mach-omap2/board-zoom2.c |  206 +-
 2 files changed, 205 insertions(+), 2 deletions(-)

Index: omapzoom04/arch/arm/configs/omap_zoom2_defconfig
===
--- omapzoom04.orig/arch/arm/configs/omap_zoom2_defconfig
+++ omapzoom04/arch/arm/configs/omap_zoom2_defconfig
@@ -994,6 +994,7 @@ CONFIG_VIDEO_CAPTURE_DRIVERS=y
 # CONFIG_VIDEO_MT9P012 is not set
 # CONFIG_VIDEO_DW9710 is not set
 # CONFIG_VIDEO_OV3640 is not set
+CONFIG_VIDEO_IMX046=y
 # CONFIG_VIDEO_SAA711X is not set
 # CONFIG_VIDEO_SAA717X is not set
 # CONFIG_VIDEO_TVP5150 is not set
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
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -50,6 +51,30 @@
 #include 
 #endif
 
+#ifdef CONFIG_VIDEO_OMAP3
+#include 
+#include <../drivers/media/video/omap34xxcam.h>
+#include <../drivers/media/video/isp/ispreg.h>
+#if defined(CONFIG_VIDEO_IMX046) || defined(CONFIG_VIDEO_IMX046_MODULE)
+#include <../drivers/media/video/imx046.h>
+#include <../drivers/media/video/isp/ispcsi2.h>
+#define IMX046_CSI2_CLOCK_POLARITY 0   /* +/- pin order */
+#define IMX046_CSI2_DATA0_POLARITY 0   /* +/- pin order */
+#define IMX046_CSI2_DATA1_POLARITY 0   /* +/- pin order */
+#define IMX046_CSI2_CLOCK_LANE 1/* Clock lane position: 1 */
+#define IMX046_CSI2_DATA0_LANE 2/* Data0 lane position: 2 */
+#define IMX046_CSI2_DATA1_LANE 3/* Data1 lane position: 3 */
+#define IMX046_CSI2_PHY_THS_TERM   2
+#define IMX046_CSI2_PHY_THS_SETTLE 23
+#define IMX046_CSI2_PHY_TCLK_TERM  0
+#define IMX046_CSI2_PHY_TCLK_MISS  1
+#define IMX046_CSI2_PHY_TCLK_SETTLE14
+#ifndef CONFIG_TWL4030_CORE
+#error "no power companion board defined!"
+#endif
+#endif
+#endif
+
 #ifdef CONFIG_TOUCHSCREEN_SYNAPTICS
 #define OMAP_SYNAPTICS_GPIO163
 #endif
@@ -301,6 +326,175 @@ static struct twl4030_keypad_data ldp_kp
.irq= TWL4030_MODIRQ_KEYPAD,
 };
 
+#if defined(CONFIG_VIDEO_IMX046) || defined(CONFIG_VIDEO_IMX046_MODULE)
+
+static struct omap34xxcam_sensor_config imx046_hwc = {
+   .sensor_isp  = 0,
+   .xclk= OMAP34XXCAM_XCLK_B,
+   .capture_mem = PAGE_ALIGN(3280 * 2464 * 2) * 2,
+};
+
+static int imx046_sensor_set_prv_data(void *priv)
+{
+   struct omap34xxcam_hw_config *hwc = priv;
+
+   hwc->u.sensor.xclk  = imx046_hwc.xclk;
+   hwc->u.sensor.sensor_isp = imx046_hwc.sensor_isp;
+   hwc->dev_index  = 2;
+   hwc->dev_minor  = 5;
+   hwc->dev_type   = OMAP34XXCAM_SLAVE_SENSOR;
+   hwc->interface_type = ISP_CSIA;
+
+   hwc->csi2.hw_csi2.lanes.clock.polarity   = IMX046_CSI2_CLOCK_POLARITY;
+   hwc->csi2.hw_csi2.lanes.clock.position   = IMX046_CSI2_CLOCK_LANE;
+   hwc->csi2.hw_csi2.lanes.data[0].polarity = IMX046_CSI2_DATA0_POLARITY;
+   hwc->csi2.hw_csi2.lanes.data[0].position = IMX046_CSI2_DATA0_LANE;
+   hwc->csi2.hw_csi2.lanes.data[1].polarity = IMX046_CSI2_DATA1_POLARITY;
+   hwc->csi2.hw_csi2.lanes.data[1].position = IMX046_CSI2_DATA1_LANE;
+   hwc->csi2.hw_csi2.phy.ths_term= IMX046_CSI2_PHY_THS_TERM;
+   hwc->csi2.hw_csi2.phy.ths_settle  = IMX046_CSI2_PHY_THS_SETTLE;
+   hwc->csi2.hw_csi2.phy.tclk_term   = IMX046_CSI2_PHY_TCLK_TERM;
+   hwc->csi2.hw_csi2.phy.tclk_miss   = IMX046_CSI2_PHY_TCLK_MISS;
+   hwc->csi2.hw_csi2.phy.tclk_settle = IMX046_CSI2_PHY_TCLK_SETTLE;
+   return 0;
+}
+
+static struct isp_interface_config imx046_if_config = {
+   .ccdc_par_ser   = ISP_CSIA,
+   .dataline_shift = 0x0,
+   .hsvs_syncdetect= ISPCTRL_SYNC_DETECT_VSRISE,
+   .vdint0_timing  = 0x0,
+   .vdint1_timing  = 0x0,
+   .strobe = 0x0,
+   .prestrobe  = 0x0,
+   .shutter= 0x0,
+   .prev_sph   = 2,
+   .prev_slv   = 0,
+   .wenlog = ISPCCDC_CFG_WENLOG_OR,
+   .dcsub  = IMX046_BLACK_LEVEL_AVG,
+   .u.csi.crc  = 0x0,
+   .u.csi.mode = 0x0,
+   .u.csi.edge = 0x0,
+   .u.csi.signalling   = 0x0,
+   .u.csi.strobe_clock_inv = 0x0,
+   .u.csi.vs_edge  = 0x0,
+   .u.csi.channel  = 0x0,
+   .u.csi.vpclk  

[OMAPZOOM][PATCH v2 5/6] ZOOM2: Rename the zoom2 i2c struct.

2009-01-30 Thread Dominic Curran
From: Dominic Curran 
Subject: [OMAPZOOM][PATCH v2 5/6] ZOOM2: Rename the zoom2 i2c struct.

Rename i2c structures to something sensible.
This patch is not specific for imx046 sensor.
Do this in preparation for i2c changes for imx046 sensor.

Signed-off-by: Greg Hofer 
Signed-off-by: Dominic Curran 
---
 arch/arm/mach-omap2/board-zoom2.c |   14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

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
@@ -472,7 +472,7 @@ static struct twl4030_platform_data ldp_
.keypad = &ldp_kp_twl4030_data,
 };
 
-static struct i2c_board_info __initdata ldp_i2c_boardinfo[] = {
+static struct i2c_board_info __initdata zoom2_i2c_bus1_info[] = {
{
I2C_BOARD_INFO("twl4030", 0x48),
.flags = I2C_CLIENT_WAKE,
@@ -507,7 +507,7 @@ static struct synaptics_i2c_rmi_platform
.power  = &synaptics_power,
 };
 
-static struct i2c_board_info __initdata ldp3430_i2c_board_info[] = {
+static struct i2c_board_info __initdata zoom2_i2c_bus2_info[] = {
{
I2C_BOARD_INFO(SYNAPTICS_I2C_RMI_NAME,  SYNAPTICS_I2C_ADDR),
.platform_data = &ldp3430_synaptics_platform_data,
@@ -518,12 +518,12 @@ static struct i2c_board_info __initdata 
 
 static int __init omap_i2c_init(void)
 {
-   omap_register_i2c_bus(1, 2600, ldp_i2c_boardinfo,
-   ARRAY_SIZE(ldp_i2c_boardinfo));
+   omap_register_i2c_bus(1, 2600, zoom2_i2c_bus1_info,
+   ARRAY_SIZE(zoom2_i2c_bus1_info));
 #ifdef CONFIG_TOUCHSCREEN_SYNAPTICS
-   ldp3430_i2c_board_info[0].irq = OMAP_GPIO_IRQ(OMAP_SYNAPTICS_GPIO);
-   omap_register_i2c_bus(2, 100, ldp3430_i2c_board_info,
-   ARRAY_SIZE(ldp3430_i2c_board_info));
+   zoom2_i2c_bus2_info[0].irq = OMAP_GPIO_IRQ(OMAP_SYNAPTICS_GPIO);
+   omap_register_i2c_bus(2, 100, zoom2_i2c_bus2_info,
+   ARRAY_SIZE(zoom2_i2c_bus2_info));
 #endif
omap_register_i2c_bus(3, 400, NULL, 0);
return 0;
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[OMAPZOOM][PATCH v2 4/6] Add support for Sony imx046 to OMAP3430 SDP board.

2009-01-30 Thread Dominic Curran
From: Dominic Curran 
Subject: [OMAPZOOM][PATCH v2 4/6] Add support for Sony imx046 to OMAP3430 SDP 
board.

Support for the Sony IMX046 sensor on the OMAP3430 SDP board.

Signed-off-by: Greg Hofer 
Signed-off-by: Dominic Curran 
---
 arch/arm/mach-omap2/board-3430sdp.c |  197 
 1 file changed, 197 insertions(+)

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
@@ -45,6 +45,9 @@
 #include "ti-compat.h"
 
 #ifdef CONFIG_VIDEO_OMAP3
+#ifndef CONFIG_TWL4030_CORE
+#error "no power companion board defined!"
+#endif
 #include 
 #include <../drivers/media/video/omap34xxcam.h>
 #include <../drivers/media/video/isp/ispreg.h>
@@ -52,9 +55,11 @@
 #define FPGA_SPR_GPIO1_3v3 (0x1 << 14)
 #define FPGA_GPIO6_DIR_CTRL(0x1 << 6)
 static void __iomem *fpga_map_addr;
+
 #if defined(CONFIG_VIDEO_MT9P012) || defined(CONFIG_VIDEO_MT9P012_MODULE)
 #include <../drivers/media/video/mt9p012.h>
 #endif
+
 #if defined(CONFIG_VIDEO_OV3640) || defined(CONFIG_VIDEO_OV3640_MODULE)
 #include <../drivers/media/video/ov3640.h>
 #include <../drivers/media/video/isp/ispcsi2.h>
@@ -71,6 +76,22 @@ static   struct omap34xxcam_hw_config *hwc
 #define OV3640_CSI2_PHY_TCLK_MISS  1
 #define OV3640_CSI2_PHY_TCLK_SETTLE14
 #endif
+
+#if defined(CONFIG_VIDEO_IMX046) || defined(CONFIG_VIDEO_IMX046_MODULE)
+#include <../drivers/media/video/imx046.h>
+#include <../drivers/media/video/isp/ispcsi2.h>
+#define IMX046_CSI2_CLOCK_POLARITY 0   /* +/- pin order */
+#define IMX046_CSI2_DATA0_POLARITY 0   /* +/- pin order */
+#define IMX046_CSI2_DATA1_POLARITY 0   /* +/- pin order */
+#define IMX046_CSI2_CLOCK_LANE 1/* Clock lane position: 1 */
+#define IMX046_CSI2_DATA0_LANE 2/* Data0 lane position: 2 */
+#define IMX046_CSI2_DATA1_LANE 3/* Data1 lane position: 3 */
+#define IMX046_CSI2_PHY_THS_TERM   2
+#define IMX046_CSI2_PHY_THS_SETTLE 23
+#define IMX046_CSI2_PHY_TCLK_TERM  0
+#define IMX046_CSI2_PHY_TCLK_MISS  1
+#define IMX046_CSI2_PHY_TCLK_SETTLE14
+#endif
 #endif
 
 #ifdef CONFIG_VIDEO_DW9710
@@ -926,6 +947,176 @@ static struct ov3640_platform_data sdp34
 
 #endif
 
+
+#if defined(CONFIG_VIDEO_IMX046) || defined(CONFIG_VIDEO_IMX046_MODULE)
+
+static struct omap34xxcam_sensor_config imx046_hwc = {
+   .sensor_isp  = 0,
+   .xclk= OMAP34XXCAM_XCLK_B,
+   .capture_mem = PAGE_ALIGN(3280 * 2464 * 2) * 2,
+};
+
+static int imx046_sensor_set_prv_data(void *priv)
+{
+   struct omap34xxcam_hw_config *hwc = priv;
+
+   hwc->u.sensor.xclk  = imx046_hwc.xclk;
+   hwc->u.sensor.sensor_isp = imx046_hwc.sensor_isp;
+   hwc->dev_index  = 2;
+   hwc->dev_minor  = 5;
+   hwc->dev_type   = OMAP34XXCAM_SLAVE_SENSOR;
+   hwc->interface_type = ISP_CSIA;
+
+   hwc->csi2.hw_csi2.lanes.clock.polarity   = IMX046_CSI2_CLOCK_POLARITY;
+   hwc->csi2.hw_csi2.lanes.clock.position   = IMX046_CSI2_CLOCK_LANE;
+   hwc->csi2.hw_csi2.lanes.data[0].polarity = IMX046_CSI2_DATA0_POLARITY;
+   hwc->csi2.hw_csi2.lanes.data[0].position = IMX046_CSI2_DATA0_LANE;
+   hwc->csi2.hw_csi2.lanes.data[1].polarity = IMX046_CSI2_DATA1_POLARITY;
+   hwc->csi2.hw_csi2.lanes.data[1].position = IMX046_CSI2_DATA1_LANE;
+   hwc->csi2.hw_csi2.phy.ths_term= IMX046_CSI2_PHY_THS_TERM;
+   hwc->csi2.hw_csi2.phy.ths_settle  = IMX046_CSI2_PHY_THS_SETTLE;
+   hwc->csi2.hw_csi2.phy.tclk_term   = IMX046_CSI2_PHY_TCLK_TERM;
+   hwc->csi2.hw_csi2.phy.tclk_miss   = IMX046_CSI2_PHY_TCLK_MISS;
+   hwc->csi2.hw_csi2.phy.tclk_settle = IMX046_CSI2_PHY_TCLK_SETTLE;
+   return 0;
+}
+
+static struct isp_interface_config imx046_if_config = {
+   .ccdc_par_ser   = ISP_CSIA,
+   .dataline_shift = 0x0,
+   .hsvs_syncdetect= ISPCTRL_SYNC_DETECT_VSRISE,
+   .vdint0_timing  = 0x0,
+   .vdint1_timing  = 0x0,
+   .strobe = 0x0,
+   .prestrobe  = 0x0,
+   .shutter= 0x0,
+   .prev_sph   = 2,
+   .prev_slv   = 0,
+   .wenlog = ISPCCDC_CFG_WENLOG_OR,
+   .dcsub  = IMX046_BLACK_LEVEL_AVG,
+   .u.csi.crc  = 0x0,
+   .u.csi.mode = 0x0,
+   .u.csi.edge = 0x0,
+   .u.csi.signalling   = 0x0,
+   .u.csi.strobe_clock_inv = 0x0,
+   .u.csi.vs_edge  = 0x0,
+   .u.csi.channel  = 0x0,
+   .u.csi.vpclk= 0x2,
+   .u.csi.data_start   = 0x0,
+   .u.csi.data_size= 0x0,
+   .u.csi.

[OMAPZOOM][PATCH v2 3/6] IMX046: Add support for Sony imx046 sensor.

2009-01-30 Thread Dominic Curran
From: Dominic Curran 
Subject: [OMAPZOOM][PATCH v2 3/6] IMX046: Add support for Sony imx046 sensor.

This patch adds the driver files for the Sony IMX046 8MP camera sensor.
Driver sets up the sensor to send frame data via the MIPI CSI2 i/f.
Sensor is setup to output the following base sizes:
 - 3280 x 2464 (8MP)
 - 3280 x 616  (2MP)
 - 820  x 616
Sensor's output image format is Bayer10 (GrR/BGb).

Driver has V4L2 controls for:
 - Exposure
 - Analog Gain

Signed-off-by: Greg Hofer 
Signed-off-by: Dominic Curran 
---
 drivers/media/video/Kconfig  |7 
 drivers/media/video/Makefile |1 
 drivers/media/video/imx046.c | 1632 +++
 drivers/media/video/imx046.h |  326 
 4 files changed, 1966 insertions(+)
 create mode 100644 drivers/media/video/imx046.c
 create mode 100644 drivers/media/video/imx046.h

Index: omapzoom04/drivers/media/video/Kconfig
===
--- omapzoom04.orig/drivers/media/video/Kconfig
+++ omapzoom04/drivers/media/video/Kconfig
@@ -334,6 +334,13 @@ config VIDEO_OV3640_CSI2
  This enables the use of the CSI2 serial bus for the ov3640
  camera.
 
+config VIDEO_IMX046
+   tristate "Sony IMX046 sensor driver (8MP)"
+   depends on I2C && VIDEO_V4L2
+   ---help---
+ This is a Video4Linux2 sensor-level driver for the Sony
+ IMX046 camera.
+
 config VIDEO_SAA7110
tristate "Philips SAA7110 video decoder"
depends on VIDEO_V4L1 && I2C
Index: omapzoom04/drivers/media/video/Makefile
===
--- omapzoom04.orig/drivers/media/video/Makefile
+++ omapzoom04/drivers/media/video/Makefile
@@ -115,6 +115,7 @@ obj-$(CONFIG_VIDEO_OV9640)  += ov9640.o
 obj-$(CONFIG_VIDEO_MT9P012)+= mt9p012.o
 obj-$(CONFIG_VIDEO_DW9710) += dw9710.o
 obj-$(CONFIG_VIDEO_OV3640) += ov3640.o
+obj-$(CONFIG_VIDEO_IMX046) += imx046.o
 
 obj-$(CONFIG_USB_DABUSB)+= dabusb.o
 obj-$(CONFIG_USB_OV511) += ov511.o
Index: omapzoom04/drivers/media/video/imx046.c
===
--- /dev/null
+++ omapzoom04/drivers/media/video/imx046.c
@@ -0,0 +1,1632 @@
+/*
+ * drivers/media/video/imx046.c
+ *
+ * Sony imx046 sensor driver
+ *
+ *
+ * Copyright (C) 2008 Hewlett Packard
+ *
+ * Leverage mt9p012.c
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2. This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#include 
+#include 
+
+#include 
+
+#include "imx046.h"
+#include "omap34xxcam.h"
+#include "isp/isp.h"
+#include "isp/ispcsi2.h"
+
+
+#define IMX046_DRIVER_NAME  "imx046"
+#define IMX046_MOD_NAME "IMX046: "
+
+#define I2C_M_WR 0
+
+
+/* from IMX046ES_registerSetting_I2C_MIPI_2lane_def_080925.xls */
+const static struct imx046_reg initial_list[] = {
+   {IMX046_REG_IMAGE_ORIENTATION, 0x03, I2C_8BIT},
+   {IMX046_REG_COARSE_INT_TIME, 0x0120, I2C_16BIT},
+   {IMX046_REG_ANALOG_GAIN_GLOBAL, 0x80, I2C_16BIT},
+   {0x300A, 0x80, I2C_8BIT},
+   {IMX046_REG_Y_OPBADDR_START_DI, 0x08, I2C_8BIT},
+   {IMX046_REG_Y_OPBADDR_END_DI, 0x37, I2C_8BIT},
+   {IMX046_REG_CHCODE_OUTCHSINGLE, 0x60, I2C_8BIT},
+   {IMX046_REG_OUTIF, 0x01, I2C_8BIT},
+   {IMX046_REG_RGPOF_RGPOFV2, 0x28, I2C_8BIT},
+   {IMX046_REG_CPCKAUTOEN, 0x00, I2C_8BIT},
+   {IMX046_REG_RGCPVFB, 0x60, I2C_8BIT},
+   {IMX046_REG_RGAZPDRV, 0x24, I2C_8BIT},
+   {IMX046_REG_RGAZTEST, 0x34, I2C_8BIT},
+   {IMX046_REG_RGVSUNLV, 0x3B, I2C_8BIT},
+   {IMX046_REG_CLPOWER, 0x30, I2C_8BIT},
+   {IMX046_REG_CLPOWERSP, 0x00, I2C_8BIT},
+   {IMX046_REG_ACLDIRV_TVADDCLP, 0x00, I2C_8BIT},
+   {IMX046_REG_OPB_CTRL, 0x0080, I2C_16BIT},
+   {0x30AB, 0x1C, I2C_8BIT},
+   {0x30B0, 0x32, I2C_8BIT},
+   {0x30B2, 0x83, I2C_8BIT},
+   {IMX046_REG_RAW10CH2V2P_LO, 0xD8, I2C_8BIT},
+   {IMX046_REG_RAW10CH2V2D_LO, 0x17, I2C_8BIT},
+   {IMX046_REG_COMP8CH1V2P_LO, 0xCF, I2C_8BIT},
+   {IMX046_REG_COMP8CH1V2D_LO, 0xF1, I2C_8BIT},
+   {IMX046_REG_RAW10CH1V2P_LO, 0xD8, I2C_8BIT},
+   {IMX046_REG_RAW10CH1V2D_LO, 0x17, I2C_8BIT},
+   {0x3302, 0x0A, I2C_8BIT},
+   {0x3303, 0x09, I2C_8BIT},
+   {IMX046_REG_RGTLPX, 0x05, I2C_8BIT},
+   {IMX046_REG_RGTCLKPREPARE, 0x04, I2C_8BIT},
+   {IMX046_REG_RGTCLKZERO, 0x15, I2C_8BIT},
+   {IMX046_REG_RGTCLKPRE, 0x03, I2C_8BIT},
+   {IMX046_REG_RGTCLKPOST, 0x13, I2C_8BIT},
+   {IMX046_REG_RGTCLKTRAIL, 0x05, I2C_8BIT},
+   {IMX046_REG_RGTHSEXIT, 0x0B, I2C_8BIT},
+   {0x302B, 0x38, I2C_8BIT},  /* for 18Mhz xclk */
+   {I2C_REG_TERM, I2C_VAL_TERM, I2C_LEN_TERM}
+};
+
+/**
+ * struct imx046_sensor - main structure for storage of sensor information
+

[OMAPZOOM][PATCH v2 2/6] Increase isp workaround buffer size for 8MP sensor.

2009-01-30 Thread Dominic Curran
From: Dominic Curran 
Subject: [OMAPZOOM][PATCH v2 2/6] Increase isp workaround buffer size for 8MP 
sensor.

A temporary buffer is created to hold the image while it is written by
Previewer module and then read by Resizer module. This is called LSC
Workaround. To take into account the Sony IMX046 8MP sensor that buffer
needs to be increased in size.
Changed the #defines to be upper case.
Patch also fixes the initialization of a couple of CCDC values.

Signed-off-by: Dominic Curran 
---
 drivers/media/video/isp/isp.c |   10 +-
 drivers/media/video/isp/isp.h |7 +--
 drivers/media/video/isp/ispccdc.c |2 ++
 drivers/media/video/isp/ispmmu.h  |3 +++
 4 files changed, 15 insertions(+), 7 deletions(-)

Index: omapzoom04/drivers/media/video/isp/isp.c
===
--- omapzoom04.orig/drivers/media/video/isp/isp.c
+++ omapzoom04/drivers/media/video/isp/isp.c
@@ -1172,20 +1172,20 @@ void omapisp_unset_callback()
  **/
 u32 isp_buf_allocation(void)
 {
-   buff_addr = (void *) vmalloc(buffer_size);
+   buff_addr = (void *) vmalloc(ISP_BUFFER_MAX_SIZE);
 
if (!buff_addr) {
printk(KERN_ERR "Cannot allocate memory ");
return -ENOMEM;
}
 
-   sglist_alloc = videobuf_vmalloc_to_sg(buff_addr, no_of_pages);
+   sglist_alloc = videobuf_vmalloc_to_sg(buff_addr, ISP_BUFFER_MAX_PAGES);
if (!sglist_alloc) {
printk(KERN_ERR "videobuf_vmalloc_to_sg error");
return -ENOMEM;
}
-   num_sc = dma_map_sg(NULL, sglist_alloc, no_of_pages, 1);
-   buff_addr_mapped = ispmmu_map_sg(sglist_alloc, no_of_pages);
+   num_sc = dma_map_sg(NULL, sglist_alloc, ISP_BUFFER_MAX_PAGES, 1);
+   buff_addr_mapped = ispmmu_map_sg(sglist_alloc, ISP_BUFFER_MAX_PAGES);
if (!buff_addr_mapped) {
printk(KERN_ERR "ispmmu_map_sg mapping failed ");
return -ENOMEM;
@@ -1217,7 +1217,7 @@ void isp_buf_free(void)
 {
if (alloc_done == 1) {
ispmmu_unmap(buff_addr_mapped);
-   dma_unmap_sg(NULL, sglist_alloc, no_of_pages, 1);
+   dma_unmap_sg(NULL, sglist_alloc, ISP_BUFFER_MAX_PAGES, 1);
kfree(sglist_alloc);
vfree(buff_addr);
alloc_done = 0;
Index: omapzoom04/drivers/media/video/isp/isp.h
===
--- omapzoom04.orig/drivers/media/video/isp/isp.h
+++ omapzoom04/drivers/media/video/isp/isp.h
@@ -26,6 +26,9 @@
 #define OMAP_ISP_TOP_H
 #include 
 #include 
+
+#include "ispmmu.h"
+
 #define OMAP_ISP_CCDC  (1 << 0)
 #define OMAP_ISP_PREVIEW   (1 << 1)
 #define OMAP_ISP_RESIZER   (1 << 2)
@@ -69,8 +72,8 @@
 #define NUM_ISP_CAPTURE_FORMATS(sizeof(isp_formats) /\
sizeof(isp_formats[0]))
 #define ISP_WORKAROUND 1
-#define buffer_size (1024 * 1024 * 10)
-#define no_of_pages (buffer_size / (4 * 1024))
+#define ISP_BUFFER_MAX_SIZE (1024 * 1024 * 16)
+#define ISP_BUFFER_MAX_PAGES (ISP_BUFFER_MAX_SIZE / ISPMMU_PAGE_SIZE)
 
 typedef int (*isp_vbq_callback_ptr) (struct videobuf_buffer *vb);
 typedef void (*isp_callback_t) (unsigned long status,
Index: omapzoom04/drivers/media/video/isp/ispccdc.c
===
--- omapzoom04.orig/drivers/media/video/isp/ispccdc.c
+++ omapzoom04/drivers/media/video/isp/ispccdc.c
@@ -1265,6 +1265,8 @@ int ispccdc_config_size(u32 input_w, u32
}
 
if (ispccdc_obj.ccdc_outfmt == CCDC_OTHERS_VP) {
+   ispccdc_obj.ccdcin_woffset = 0;
+   ispccdc_obj.ccdcin_hoffset = 0;
omap_writel((ispccdc_obj.ccdcin_woffset <<
ISPCCDC_FMT_HORZ_FMTSPH_SHIFT) |
(ispccdc_obj.ccdcin_w <<
Index: omapzoom04/drivers/media/video/isp/ispmmu.h
===
--- omapzoom04.orig/drivers/media/video/isp/ispmmu.h
+++ omapzoom04/drivers/media/video/isp/ispmmu.h
@@ -59,6 +59,9 @@
 /* Number of entries per L2 Page table */
 #define ISPMMU_L2D_ENTRIES_NR  256
 
+/* Size of MMU page in bytes */
+#define ISPMMU_PAGE_SIZE   4096
+
 /*
  * Statically allocate 16KB for L2 page tables. 16KB can be used for
  * up to 16 L2 page tables which cover up to 16MB space. We use an array of 16
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[OMAPZOOM][PATCH v2 1/6] CSI2: Add function to change number of data lanes used.

2009-01-30 Thread Dominic Curran
From: Dominic Curran 
Subject: [OMAPZOOM][PATCH v2 1/6] CSI2: Add function to change number of data 
lanes used.

Add new CSI2 function.
New function is isp_csi2_complexio_lanes_count().
Sets the number of CSI2 data lanes that should be used.

Signed-off-by: Dominic Curran 
Signed-off-by: Greg Hofer 
---
 drivers/media/video/isp/ispcsi2.c |   33 +++--
 drivers/media/video/isp/ispcsi2.h |5 +
 2 files changed, 36 insertions(+), 2 deletions(-)
 mode change 100644 => 100755 drivers/media/video/isp/ispcsi2.c
 mode change 100644 => 100755 drivers/media/video/isp/ispcsi2.h

Index: omapzoom04/drivers/media/video/isp/ispcsi2.c
===
--- omapzoom04.orig/drivers/media/video/isp/ispcsi2.c
+++ omapzoom04/drivers/media/video/isp/ispcsi2.c
@@ -112,6 +112,11 @@ int isp_csi2_complexio_lanes_config(stru
currlanes_u->data[i] = true;
update_complexio_cfg1 = true;
}
+   /* If the lane position is non zero then we can assume that
+* the initial lane state is on.
+*/
+   if (currlanes->data[i].pos)
+   currlanes->data[i].state = ISP_CSI2_LANE_ON;
}
 
if (currlanes->clk.pos != reqcfg->clk.pos) {
@@ -158,9 +163,10 @@ int isp_csi2_complexio_lanes_update(bool
1));
reg |= (currlanes->data[i].pol <<
ISPCSI2_COMPLEXIO_CFG1_DATA_POL_SHIFT(i + 1));
-   reg |= (currlanes->data[i].pos <<
+   if (currlanes->data[i].state == ISP_CSI2_LANE_ON)
+   reg |= (currlanes->data[i].pos <<
ISPCSI2_COMPLEXIO_CFG1_DATA_POSITION_SHIFT(i +
-   1));
+1));
currlanes_u->data[i] = false;
}
}
@@ -181,6 +187,29 @@ int isp_csi2_complexio_lanes_update(bool
 }
 
 /**
+ * isp_csi2_complexio_lanes_count - Turn data lanes on/off dynamically.
+ * @ cnt: Number of data lanes to enable.
+ *
+ * Always returns 0.
+ **/
+int isp_csi2_complexio_lanes_count(int cnt)
+{
+   struct isp_csi2_lanes_cfg *currlanes = ¤t_csi2_cfg.lanes;
+   int i;
+
+   for (i = 0; i < 4; i++) {
+   if (i < cnt)
+   currlanes->data[i].state = ISP_CSI2_LANE_ON;
+   else
+   currlanes->data[i].state = ISP_CSI2_LANE_OFF;
+   }
+
+   isp_csi2_complexio_lanes_update(true);
+   return 0;
+}
+EXPORT_SYMBOL(isp_csi2_complexio_lanes_count);
+
+/**
  * isp_csi2_complexio_lanes_get - Gets CSI2 ComplexIO lanes configuration.
  *
  * Gets settings from HW registers and fills in the internal driver memory
Index: omapzoom04/drivers/media/video/isp/ispcsi2.h
===
--- omapzoom04.orig/drivers/media/video/isp/ispcsi2.h
+++ omapzoom04/drivers/media/video/isp/ispcsi2.h
@@ -20,6 +20,9 @@
 #define OMAP_ISP_CSI2_API_H
 #include 
 
+#define ISP_CSI2_LANE_OFF  0
+#define ISP_CSI2_LANE_ON   1
+
 enum isp_csi2_irqevents {
OCP_ERR_IRQ = 0x4000,
SHORT_PACKET_IRQ = 0x2000,
@@ -63,6 +66,7 @@ enum isp_csi2_frame_mode {
 struct csi2_lanecfg {
u8 pos;
u8 pol;
+   u8 state;   /*Current state - 1-Used  0-Unused */
 };
 
 struct isp_csi2_lanes_cfg {
@@ -175,6 +179,7 @@ struct isp_csi2_cfg_update {
 
 int isp_csi2_complexio_lanes_config(struct isp_csi2_lanes_cfg *reqcfg);
 int isp_csi2_complexio_lanes_update(bool force_update);
+int isp_csi2_complexio_lanes_count(int cnt);
 int isp_csi2_complexio_lanes_get(void);
 int isp_csi2_complexio_power_autoswitch(bool enable);
 int isp_csi2_complexio_power(enum isp_csi2_power_cmds power_cmd);
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[OMAPZOOM][PATCH v2 0/6] Add support for Sony imx046 sensor.

2009-01-30 Thread Dominic Curran
From: Dominic Curran 
Subject: [OMAPZOOM][PATCH v2 0/6] Add support for Sony imx046 sensor.

This set of patches adds support for the Sony IMX046 camera.

Submitting version 2 with comments from:
 - Vaibhav Hiremath
 - Hans Verkuil

Driver supports:
 - Sensor output format RAW10 (YUV conversion through CCDC)
 - Output resolution 
- 3280x2464 @ 7.5fps  (8MP)
- 3280x616
- 820x616   @ 30fps
 - Frame rate control
 - Exposure & Gain control
 - Platforms: SDP3430 & Zoom2

thanks
dom
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[OMAPZOOM][PATCH 6/6] Add support for Sony imx046 to OMAP zoom2 board.

2009-01-29 Thread Dominic Curran
From: Dominic Curran 
Subject: [OMAPZOOM][PATCH 6/6] Add support for Sony imx046 to OMAP zoom2 board.

Support for the Sony IMX046 sensor on the OMAP Zoom2 board.

Signed-off-by: Dominic Curran 
---
 arch/arm/configs/omap_zoom2_defconfig |1 
 arch/arm/mach-omap2/board-zoom2.c |  206 +-
 2 files changed, 205 insertions(+), 2 deletions(-)

Index: omapzoom04/arch/arm/configs/omap_zoom2_defconfig
===
--- omapzoom04.orig/arch/arm/configs/omap_zoom2_defconfig
+++ omapzoom04/arch/arm/configs/omap_zoom2_defconfig
@@ -994,6 +994,7 @@ CONFIG_VIDEO_CAPTURE_DRIVERS=y
 # CONFIG_VIDEO_MT9P012 is not set
 # CONFIG_VIDEO_DW9710 is not set
 # CONFIG_VIDEO_OV3640 is not set
+CONFIG_VIDEO_IMX046=y
 # CONFIG_VIDEO_SAA711X is not set
 # CONFIG_VIDEO_SAA717X is not set
 # CONFIG_VIDEO_TVP5150 is not set
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
@@ -23,6 +23,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -50,6 +51,30 @@
 #include 
 #endif
 
+#ifdef CONFIG_VIDEO_OMAP3
+#include 
+#include <../drivers/media/video/omap34xxcam.h>
+#include <../drivers/media/video/isp/ispreg.h>
+#if defined(CONFIG_VIDEO_IMX046) || defined(CONFIG_VIDEO_IMX046_MODULE)
+#include <../drivers/media/video/imx046.h>
+#include <../drivers/media/video/isp/ispcsi2.h>
+#define IMX046_CSI2_CLOCK_POLARITY 0   /* +/- pin order */
+#define IMX046_CSI2_DATA0_POLARITY 0   /* +/- pin order */
+#define IMX046_CSI2_DATA1_POLARITY 0   /* +/- pin order */
+#define IMX046_CSI2_CLOCK_LANE 1/* Clock lane position: 1 */
+#define IMX046_CSI2_DATA0_LANE 2/* Data0 lane position: 2 */
+#define IMX046_CSI2_DATA1_LANE 3/* Data1 lane position: 3 */
+#define IMX046_CSI2_PHY_THS_TERM   2
+#define IMX046_CSI2_PHY_THS_SETTLE 23
+#define IMX046_CSI2_PHY_TCLK_TERM  0
+#define IMX046_CSI2_PHY_TCLK_MISS  1
+#define IMX046_CSI2_PHY_TCLK_SETTLE14
+#ifndef CONFIG_TWL4030_CORE
+#error "no power companion board defined!"
+#endif
+#endif
+#endif
+
 #ifdef CONFIG_TOUCHSCREEN_SYNAPTICS
 #define OMAP_SYNAPTICS_GPIO163
 #endif
@@ -301,6 +326,175 @@ static struct twl4030_keypad_data ldp_kp
.irq= TWL4030_MODIRQ_KEYPAD,
 };
 
+#if defined(CONFIG_VIDEO_IMX046) || defined(CONFIG_VIDEO_IMX046_MODULE)
+
+static struct omap34xxcam_sensor_config imx046_hwc = {
+   .sensor_isp = 0,
+   .xclk = OMAP34XXCAM_XCLK_B,
+   .capture_mem = PAGE_ALIGN(3280 * 2464 * 2) * 2,
+};
+
+static int imx046_sensor_set_prv_data(void *priv)
+{
+   struct omap34xxcam_hw_config *hwc = priv;
+
+   hwc->u.sensor.xclk = imx046_hwc.xclk;
+   hwc->u.sensor.sensor_isp = imx046_hwc.sensor_isp;
+   hwc->dev_index = 2;
+   hwc->dev_minor = 5;
+   hwc->dev_type = OMAP34XXCAM_SLAVE_SENSOR;
+   hwc->interface_type = ISP_CSIA;
+
+   hwc->csi2.hw_csi2.lanes.clock.polarity = IMX046_CSI2_CLOCK_POLARITY;
+   hwc->csi2.hw_csi2.lanes.clock.position = IMX046_CSI2_CLOCK_LANE;
+   hwc->csi2.hw_csi2.lanes.data[0].polarity = IMX046_CSI2_DATA0_POLARITY;
+   hwc->csi2.hw_csi2.lanes.data[0].position = IMX046_CSI2_DATA0_LANE;
+   hwc->csi2.hw_csi2.lanes.data[1].polarity = IMX046_CSI2_DATA1_POLARITY;
+   hwc->csi2.hw_csi2.lanes.data[1].position = IMX046_CSI2_DATA1_LANE;
+   hwc->csi2.hw_csi2.phy.ths_term = IMX046_CSI2_PHY_THS_TERM;
+   hwc->csi2.hw_csi2.phy.ths_settle = IMX046_CSI2_PHY_THS_SETTLE;
+   hwc->csi2.hw_csi2.phy.tclk_term = IMX046_CSI2_PHY_TCLK_TERM;
+   hwc->csi2.hw_csi2.phy.tclk_miss = IMX046_CSI2_PHY_TCLK_MISS;
+   hwc->csi2.hw_csi2.phy.tclk_settle = IMX046_CSI2_PHY_TCLK_SETTLE;
+   return 0;
+}
+
+static struct isp_interface_config imx046_if_config = {
+   .ccdc_par_ser = ISP_CSIA,
+   .dataline_shift = 0x0,
+   .hsvs_syncdetect = ISPCTRL_SYNC_DETECT_VSRISE,
+   .vdint0_timing = 0x0,
+   .vdint1_timing = 0x0,
+   .strobe = 0x0,
+   .prestrobe = 0x0,
+   .shutter = 0x0,
+   .prev_sph = 2,
+   .prev_slv = 0,
+   .wenlog = ISPCCDC_CFG_WENLOG_OR,
+   .dcsub = IMX046_BLACK_LEVEL_AVG,
+   .u.csi.crc = 0x0,
+   .u.csi.mode = 0x0,
+   .u.csi.edge = 0x0,
+   .u.csi.signalling = 0x0,
+   .u.csi.strobe_clock_inv = 0x0,
+   .u.csi.vs_edge = 0x0,
+   .u.csi.channel = 0x0,
+   .u.csi.vpclk = 0x2,
+   .u.csi.data_start = 0x0,
+   .u.csi.data_size = 0x0,
+   .u.csi.format = V4L2_PIX_FMT_SGRBG10,
+};
+
+
+static int imx046_sensor_power_set(enum v4l2_power power)
+{
+   struct isp_csi2_lanes_cfg lanecfg;
+   struct isp_csi2_phy_cfg phyconfig;
+   static enum v4l

[OMAPZOOM][PATCH 4/6] Add support for Sony imx046 to OMAP3430 SDP board.

2009-01-29 Thread Dominic Curran
From: Dominic Curran 
Subject: [OMAPZOOM][PATCH 4/6] Add support for Sony imx046 to OMAP3430 SDP 
board.

Support for the Sony IMX046 sensor on the OMAP3430 SDP board.

Signed-off-by: Greg Hofer 
Signed-off-by: Dominic Curran 
---
 arch/arm/mach-omap2/board-3430sdp.c |  197 
 1 file changed, 197 insertions(+)

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
@@ -45,6 +45,9 @@
 #include "ti-compat.h"
 
 #ifdef CONFIG_VIDEO_OMAP3
+#ifndef CONFIG_TWL4030_CORE
+#error "no power companion board defined!"
+#endif
 #include 
 #include <../drivers/media/video/omap34xxcam.h>
 #include <../drivers/media/video/isp/ispreg.h>
@@ -52,9 +55,11 @@
 #define FPGA_SPR_GPIO1_3v3 (0x1 << 14)
 #define FPGA_GPIO6_DIR_CTRL(0x1 << 6)
 static void __iomem *fpga_map_addr;
+
 #if defined(CONFIG_VIDEO_MT9P012) || defined(CONFIG_VIDEO_MT9P012_MODULE)
 #include <../drivers/media/video/mt9p012.h>
 #endif
+
 #if defined(CONFIG_VIDEO_OV3640) || defined(CONFIG_VIDEO_OV3640_MODULE)
 #include <../drivers/media/video/ov3640.h>
 #include <../drivers/media/video/isp/ispcsi2.h>
@@ -71,6 +76,22 @@ static   struct omap34xxcam_hw_config *hwc
 #define OV3640_CSI2_PHY_TCLK_MISS  1
 #define OV3640_CSI2_PHY_TCLK_SETTLE14
 #endif
+
+#if defined(CONFIG_VIDEO_IMX046) || defined(CONFIG_VIDEO_IMX046_MODULE)
+#include <../drivers/media/video/imx046.h>
+#include <../drivers/media/video/isp/ispcsi2.h>
+#define IMX046_CSI2_CLOCK_POLARITY 0   /* +/- pin order */
+#define IMX046_CSI2_DATA0_POLARITY 0   /* +/- pin order */
+#define IMX046_CSI2_DATA1_POLARITY 0   /* +/- pin order */
+#define IMX046_CSI2_CLOCK_LANE 1/* Clock lane position: 1 */
+#define IMX046_CSI2_DATA0_LANE 2/* Data0 lane position: 2 */
+#define IMX046_CSI2_DATA1_LANE 3/* Data1 lane position: 3 */
+#define IMX046_CSI2_PHY_THS_TERM   2
+#define IMX046_CSI2_PHY_THS_SETTLE 23
+#define IMX046_CSI2_PHY_TCLK_TERM  0
+#define IMX046_CSI2_PHY_TCLK_MISS  1
+#define IMX046_CSI2_PHY_TCLK_SETTLE14
+#endif
 #endif
 
 #ifdef CONFIG_VIDEO_DW9710
@@ -926,6 +947,176 @@ static struct ov3640_platform_data sdp34
 
 #endif
 
+
+#if defined(CONFIG_VIDEO_IMX046) || defined(CONFIG_VIDEO_IMX046_MODULE)
+
+static struct omap34xxcam_sensor_config imx046_hwc = {
+   .sensor_isp = 0,
+   .xclk = OMAP34XXCAM_XCLK_B,
+   .capture_mem = PAGE_ALIGN(3280 * 2464 * 2) * 2,
+};
+
+static int imx046_sensor_set_prv_data(void *priv)
+{
+   struct omap34xxcam_hw_config *hwc = priv;
+
+   hwc->u.sensor.xclk = imx046_hwc.xclk;
+   hwc->u.sensor.sensor_isp = imx046_hwc.sensor_isp;
+   hwc->dev_index = 2;
+   hwc->dev_minor = 5;
+   hwc->dev_type = OMAP34XXCAM_SLAVE_SENSOR;
+   hwc->interface_type = ISP_CSIA;
+
+   hwc->csi2.hw_csi2.lanes.clock.polarity = IMX046_CSI2_CLOCK_POLARITY;
+   hwc->csi2.hw_csi2.lanes.clock.position = IMX046_CSI2_CLOCK_LANE;
+   hwc->csi2.hw_csi2.lanes.data[0].polarity = IMX046_CSI2_DATA0_POLARITY;
+   hwc->csi2.hw_csi2.lanes.data[0].position = IMX046_CSI2_DATA0_LANE;
+   hwc->csi2.hw_csi2.lanes.data[1].polarity = IMX046_CSI2_DATA1_POLARITY;
+   hwc->csi2.hw_csi2.lanes.data[1].position = IMX046_CSI2_DATA1_LANE;
+   hwc->csi2.hw_csi2.phy.ths_term = IMX046_CSI2_PHY_THS_TERM;
+   hwc->csi2.hw_csi2.phy.ths_settle = IMX046_CSI2_PHY_THS_SETTLE;
+   hwc->csi2.hw_csi2.phy.tclk_term = IMX046_CSI2_PHY_TCLK_TERM;
+   hwc->csi2.hw_csi2.phy.tclk_miss = IMX046_CSI2_PHY_TCLK_MISS;
+   hwc->csi2.hw_csi2.phy.tclk_settle = IMX046_CSI2_PHY_TCLK_SETTLE;
+   return 0;
+}
+
+static struct isp_interface_config imx046_if_config = {
+   .ccdc_par_ser = ISP_CSIA,
+   .dataline_shift = 0x0,
+   .hsvs_syncdetect = ISPCTRL_SYNC_DETECT_VSRISE,
+   .vdint0_timing = 0x0,
+   .vdint1_timing = 0x0,
+   .strobe = 0x0,
+   .prestrobe = 0x0,
+   .shutter = 0x0,
+   .prev_sph = 2,
+   .prev_slv = 0,
+   .wenlog = ISPCCDC_CFG_WENLOG_OR,
+   .dcsub = IMX046_BLACK_LEVEL_AVG,
+   .u.csi.crc = 0x0,
+   .u.csi.mode = 0x0,
+   .u.csi.edge = 0x0,
+   .u.csi.signalling = 0x0,
+   .u.csi.strobe_clock_inv = 0x0,
+   .u.csi.vs_edge = 0x0,
+   .u.csi.channel = 0x0,
+   .u.csi.vpclk = 0x2,
+   .u.csi.data_start = 0x0,
+   .u.csi.data_size = 0x0,
+   .u.csi.format = V4L2_PIX_FMT_SGRBG10,
+};
+
+
+static int imx046_sensor_power_set(enum v4l2_power power)
+{
+   struct isp_csi2_lanes_cfg lanecfg;
+   struct isp_csi2_phy_cfg phyconfig;
+   static enum v4l2_power previous_power = V4L2_POWER_OFF;
+   int err = 0;
+
+

[OMAPZOOM][PATCH 5/6] ZOOM2: Rename the zoom2 i2c struct.

2009-01-29 Thread Dominic Curran
From: Dominic Curran 
Subject: [OMAPZOOM][PATCH 5/6] ZOOM2: Rename the zoom2 i2c struct.

Rename i2c structures to something sensible.
This patch is not specific for imx046 sensor.
Do this in preparation for i2c changes for imx046 sensor.

Signed-off-by: Greg Hofer 
Signed-off-by: Dominic Curran 
---
 arch/arm/mach-omap2/board-zoom2.c |   14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

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
@@ -472,7 +472,7 @@ static struct twl4030_platform_data ldp_
.keypad = &ldp_kp_twl4030_data,
 };
 
-static struct i2c_board_info __initdata ldp_i2c_boardinfo[] = {
+static struct i2c_board_info __initdata zoom2_i2c_bus1_info[] = {
{
I2C_BOARD_INFO("twl4030", 0x48),
.flags = I2C_CLIENT_WAKE,
@@ -507,7 +507,7 @@ static struct synaptics_i2c_rmi_platform
.power  = &synaptics_power,
 };
 
-static struct i2c_board_info __initdata ldp3430_i2c_board_info[] = {
+static struct i2c_board_info __initdata zoom2_i2c_bus2_info[] = {
{
I2C_BOARD_INFO(SYNAPTICS_I2C_RMI_NAME,  SYNAPTICS_I2C_ADDR),
.platform_data = &ldp3430_synaptics_platform_data,
@@ -518,12 +518,12 @@ static struct i2c_board_info __initdata 
 
 static int __init omap_i2c_init(void)
 {
-   omap_register_i2c_bus(1, 2600, ldp_i2c_boardinfo,
-   ARRAY_SIZE(ldp_i2c_boardinfo));
+   omap_register_i2c_bus(1, 2600, zoom2_i2c_bus1_info,
+   ARRAY_SIZE(zoom2_i2c_bus1_info));
 #ifdef CONFIG_TOUCHSCREEN_SYNAPTICS
-   ldp3430_i2c_board_info[0].irq = OMAP_GPIO_IRQ(OMAP_SYNAPTICS_GPIO);
-   omap_register_i2c_bus(2, 100, ldp3430_i2c_board_info,
-   ARRAY_SIZE(ldp3430_i2c_board_info));
+   zoom2_i2c_bus2_info[0].irq = OMAP_GPIO_IRQ(OMAP_SYNAPTICS_GPIO);
+   omap_register_i2c_bus(2, 100, zoom2_i2c_bus2_info,
+   ARRAY_SIZE(zoom2_i2c_bus2_info));
 #endif
omap_register_i2c_bus(3, 400, NULL, 0);
return 0;
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[OMAPZOOM][PATCH 3/6] IMX046: Add support for Sony imx046 sensor.

2009-01-29 Thread Dominic Curran
From: Dominic Curran 
Subject: [OMAPZOOM][PATCH 3/6] IMX046: Add support for Sony imx046 sensor.

This patch adds the driver files for the Sony IMX046 8MP camera sensor.
Driver sets up the sensor to send frame data via the MIPI CSI2 i/f.
Sensor is setup to output the following base sizes:
 - 3280 x 2464 (8MP)
 - 3280 x 616  (2MP)
 - 820  x 616
Sensor's output image format is Bayer10 (GrR/BGb).

Driver has V4L2 controls for:
 - Exposure
 - Analog Gain

Signed-off-by: Greg Hofer 
Signed-off-by: Dominic Curran 
---
 drivers/media/video/Kconfig  |8 
 drivers/media/video/Makefile |1 
 drivers/media/video/imx046.c | 1635 +++
 drivers/media/video/imx046.h |  326 
 4 files changed, 1970 insertions(+)
 create mode 100644 drivers/media/video/imx046.c
 create mode 100644 drivers/media/video/imx046.h

Index: omapzoom04/drivers/media/video/Kconfig
===
--- omapzoom04.orig/drivers/media/video/Kconfig
+++ omapzoom04/drivers/media/video/Kconfig
@@ -334,6 +334,14 @@ config VIDEO_OV3640_CSI2
  This enables the use of the CSI2 serial bus for the ov3640
  camera.
 
+config VIDEO_IMX046
+   tristate "Sony IMX046 sensor driver (8MP)"
+   depends on I2C && VIDEO_V4L2
+   ---help---
+ This is a Video4Linux2 sensor-level driver for the Sony
+ IMX046 camera.  It is currently working with the TI OMAP3
+  camera controller.
+
 config VIDEO_SAA7110
tristate "Philips SAA7110 video decoder"
depends on VIDEO_V4L1 && I2C
Index: omapzoom04/drivers/media/video/Makefile
===
--- omapzoom04.orig/drivers/media/video/Makefile
+++ omapzoom04/drivers/media/video/Makefile
@@ -115,6 +115,7 @@ obj-$(CONFIG_VIDEO_OV9640)  += ov9640.o
 obj-$(CONFIG_VIDEO_MT9P012)+= mt9p012.o
 obj-$(CONFIG_VIDEO_DW9710) += dw9710.o
 obj-$(CONFIG_VIDEO_OV3640) += ov3640.o
+obj-$(CONFIG_VIDEO_IMX046) += imx046.o
 
 obj-$(CONFIG_USB_DABUSB)+= dabusb.o
 obj-$(CONFIG_USB_OV511) += ov511.o
Index: omapzoom04/drivers/media/video/imx046.c
===
--- /dev/null
+++ omapzoom04/drivers/media/video/imx046.c
@@ -0,0 +1,1635 @@
+/*
+ * drivers/media/video/imx046.c
+ *
+ * Sony imx046 sensor driver
+ *
+ *
+ * Copyright (C) 2008 Hewlett Packard
+ *
+ * Leverage mt9p012.c
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2. This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#include 
+#include 
+#include 
+
+#include "imx046.h"
+#include "omap34xxcam.h"
+#include "isp/isp.h"
+#include "isp/ispcsi2.h"
+
+
+#define IMX046_DRIVER_NAME  "imx046"
+#define IMX046_MOD_NAME "IMX046: "
+
+#define I2C_M_WR 0
+
+
+/* from IMX046ES_registerSetting_I2C_MIPI_2lane_def_080925.xls */
+const static struct imx046_reg initial_list[] = {
+   {IMX046_REG_IMAGE_ORIENTATION, 0x03, I2C_8BIT},
+   {IMX046_REG_COARSE_INT_TIME, 0x0120, I2C_16BIT},
+   {IMX046_REG_ANALOG_GAIN_GLOBAL, 0x80, I2C_16BIT},
+   {0x300A, 0x80, I2C_8BIT},
+   {IMX046_REG_Y_OPBADDR_START_DI, 0x08, I2C_8BIT},
+   {IMX046_REG_Y_OPBADDR_END_DI, 0x37, I2C_8BIT},
+   {IMX046_REG_CHCODE_OUTCHSINGLE, 0x60, I2C_8BIT},
+   {IMX046_REG_OUTIF, 0x01, I2C_8BIT},
+   {IMX046_REG_RGPOF_RGPOFV2, 0x28, I2C_8BIT},
+   {IMX046_REG_CPCKAUTOEN, 0x00, I2C_8BIT},
+   {IMX046_REG_RGCPVFB, 0x60, I2C_8BIT},
+   {IMX046_REG_RGAZPDRV, 0x24, I2C_8BIT},
+   {IMX046_REG_RGAZTEST, 0x34, I2C_8BIT},
+   {IMX046_REG_RGVSUNLV, 0x3B, I2C_8BIT},
+   {IMX046_REG_CLPOWER, 0x30, I2C_8BIT},
+   {IMX046_REG_CLPOWERSP, 0x00, I2C_8BIT},
+   {IMX046_REG_ACLDIRV_TVADDCLP, 0x00, I2C_8BIT},
+   {IMX046_REG_OPB_CTRL, 0x0080, I2C_16BIT},
+   {0x30AB, 0x1C, I2C_8BIT},
+   {0x30B0, 0x32, I2C_8BIT},
+   {0x30B2, 0x83, I2C_8BIT},
+   {IMX046_REG_RAW10CH2V2P_LO, 0xD8, I2C_8BIT},
+   {IMX046_REG_RAW10CH2V2D_LO, 0x17, I2C_8BIT},
+   {IMX046_REG_COMP8CH1V2P_LO, 0xCF, I2C_8BIT},
+   {IMX046_REG_COMP8CH1V2D_LO, 0xF1, I2C_8BIT},
+   {IMX046_REG_RAW10CH1V2P_LO, 0xD8, I2C_8BIT},
+   {IMX046_REG_RAW10CH1V2D_LO, 0x17, I2C_8BIT},
+   {0x3302, 0x0A, I2C_8BIT},
+   {0x3303, 0x09, I2C_8BIT},
+   {IMX046_REG_RGTLPX, 0x05, I2C_8BIT},
+   {IMX046_REG_RGTCLKPREPARE, 0x04, I2C_8BIT},
+   {IMX046_REG_RGTCLKZERO, 0x15, I2C_8BIT},
+   {IMX046_REG_RGTCLKPRE, 0x03, I2C_8BIT},
+   {IMX046_REG_RGTCLKPOST, 0x13, I2C_8BIT},
+   {IMX046_REG_RGTCLKTRAIL, 0x05, I2C_8BIT},
+   {IMX046_REG_RGTHSEXIT, 0x0B, I2C_8BIT},
+   {0x302B, 0x38, I2C_8BIT},  /* for 18Mhz xclk */
+   {I2C_REG_TERM, I2C_VAL_TERM, I2C_LEN_TERM}
+};
+
+/**
+ * st

[OMAPZOOM][PATCH 2/6] Increase isp workaround buffer size for 8MP sensor.

2009-01-29 Thread Dominic Curran
From: Dominic Curran 
Subject: [OMAPZOOM][PATCH 2/6] Increase isp workaround buffer size for 8MP 
sensor.

A temporary buffer is created to hold the image while it is written by
Previewer module and then read by Resizer module. This is called LSC
Workaround. To take into account the Sony IMX046 8MP sensor that buffer
needs to be increased in size.
Changed the #defines to be upper case.
Patch also fixes the initialization of a couple of CCDC values.

Signed-off-by: Dominic Curran 
---
 drivers/media/video/isp/isp.c |   10 +-
 drivers/media/video/isp/isp.h |4 ++--
 drivers/media/video/isp/ispccdc.c |2 ++
 3 files changed, 9 insertions(+), 7 deletions(-)

Index: omapzoom04/drivers/media/video/isp/isp.c
===
--- omapzoom04.orig/drivers/media/video/isp/isp.c
+++ omapzoom04/drivers/media/video/isp/isp.c
@@ -1172,20 +1172,20 @@ void omapisp_unset_callback()
  **/
 u32 isp_buf_allocation(void)
 {
-   buff_addr = (void *) vmalloc(buffer_size);
+   buff_addr = (void *) vmalloc(ISP_BUFFER_MAX_SIZE);
 
if (!buff_addr) {
printk(KERN_ERR "Cannot allocate memory ");
return -ENOMEM;
}
 
-   sglist_alloc = videobuf_vmalloc_to_sg(buff_addr, no_of_pages);
+   sglist_alloc = videobuf_vmalloc_to_sg(buff_addr, ISP_BUFFER_MAX_PAGES);
if (!sglist_alloc) {
printk(KERN_ERR "videobuf_vmalloc_to_sg error");
return -ENOMEM;
}
-   num_sc = dma_map_sg(NULL, sglist_alloc, no_of_pages, 1);
-   buff_addr_mapped = ispmmu_map_sg(sglist_alloc, no_of_pages);
+   num_sc = dma_map_sg(NULL, sglist_alloc, ISP_BUFFER_MAX_PAGES, 1);
+   buff_addr_mapped = ispmmu_map_sg(sglist_alloc, ISP_BUFFER_MAX_PAGES);
if (!buff_addr_mapped) {
printk(KERN_ERR "ispmmu_map_sg mapping failed ");
return -ENOMEM;
@@ -1217,7 +1217,7 @@ void isp_buf_free(void)
 {
if (alloc_done == 1) {
ispmmu_unmap(buff_addr_mapped);
-   dma_unmap_sg(NULL, sglist_alloc, no_of_pages, 1);
+   dma_unmap_sg(NULL, sglist_alloc, ISP_BUFFER_MAX_PAGES, 1);
kfree(sglist_alloc);
vfree(buff_addr);
alloc_done = 0;
Index: omapzoom04/drivers/media/video/isp/isp.h
===
--- omapzoom04.orig/drivers/media/video/isp/isp.h
+++ omapzoom04/drivers/media/video/isp/isp.h
@@ -69,8 +69,8 @@
 #define NUM_ISP_CAPTURE_FORMATS(sizeof(isp_formats) /\
sizeof(isp_formats[0]))
 #define ISP_WORKAROUND 1
-#define buffer_size (1024 * 1024 * 10)
-#define no_of_pages (buffer_size / (4 * 1024))
+#define ISP_BUFFER_MAX_SIZE (1024 * 1024 * 16)
+#define ISP_BUFFER_MAX_PAGES (ISP_BUFFER_MAX_SIZE / (4 * 1024))
 
 typedef int (*isp_vbq_callback_ptr) (struct videobuf_buffer *vb);
 typedef void (*isp_callback_t) (unsigned long status,
Index: omapzoom04/drivers/media/video/isp/ispccdc.c
===
--- omapzoom04.orig/drivers/media/video/isp/ispccdc.c
+++ omapzoom04/drivers/media/video/isp/ispccdc.c
@@ -1265,6 +1265,8 @@ int ispccdc_config_size(u32 input_w, u32
}
 
if (ispccdc_obj.ccdc_outfmt == CCDC_OTHERS_VP) {
+   ispccdc_obj.ccdcin_woffset = 0;
+   ispccdc_obj.ccdcin_hoffset = 0;
omap_writel((ispccdc_obj.ccdcin_woffset <<
ISPCCDC_FMT_HORZ_FMTSPH_SHIFT) |
(ispccdc_obj.ccdcin_w <<
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[OMAPZOOM][PATCH 1/6] CSI2: Add function to change number of data lanes used.

2009-01-29 Thread Dominic Curran
From: Dominic Curran 
Subject: [OMAPZOOM][PATCH 1/6] CSI2: Add function to change number of data 
lanes 
used.

Add new CSI2 function.
New function is isp_csi2_complexio_lanes_count().
Sets the number of CSI2 data lanes that should be used.

Signed-off-by: Dominic Curran 
Signed-off-by: Greg Hofer 
---
 drivers/media/video/isp/ispcsi2.c |   33 +++--
 drivers/media/video/isp/ispcsi2.h |5 +
 2 files changed, 36 insertions(+), 2 deletions(-)
 mode change 100644 => 100755 drivers/media/video/isp/ispcsi2.c
 mode change 100644 => 100755 drivers/media/video/isp/ispcsi2.h

Index: omapzoom04/drivers/media/video/isp/ispcsi2.c
===
--- omapzoom04.orig/drivers/media/video/isp/ispcsi2.c
+++ omapzoom04/drivers/media/video/isp/ispcsi2.c
@@ -112,6 +112,11 @@ int isp_csi2_complexio_lanes_config(stru
currlanes_u->data[i] = true;
update_complexio_cfg1 = true;
}
+   /* If the lane position is non zero then we can assume that
+* the initial lane state is on.
+*/
+   if (currlanes->data[i].pos)
+   currlanes->data[i].state = ISP_CSI2_LANE_ON;
}
 
if (currlanes->clk.pos != reqcfg->clk.pos) {
@@ -158,9 +163,10 @@ int isp_csi2_complexio_lanes_update(bool
1));
reg |= (currlanes->data[i].pol <<
ISPCSI2_COMPLEXIO_CFG1_DATA_POL_SHIFT(i + 1));
-   reg |= (currlanes->data[i].pos <<
+   if (currlanes->data[i].state == ISP_CSI2_LANE_ON)
+   reg |= (currlanes->data[i].pos <<
ISPCSI2_COMPLEXIO_CFG1_DATA_POSITION_SHIFT(i +
-   1));
+1));
currlanes_u->data[i] = false;
}
}
@@ -181,6 +187,29 @@ int isp_csi2_complexio_lanes_update(bool
 }
 
 /**
+ * isp_csi2_complexio_lanes_count - Turn data lanes on/off dynamically.
+ * @ cnt: Number of data lanes to enable.
+ *
+ * Always returns 0.
+ **/
+int isp_csi2_complexio_lanes_count(int cnt)
+{
+   struct isp_csi2_lanes_cfg *currlanes = ¤t_csi2_cfg.lanes;
+   int i;
+
+   for (i = 0; i < 4; i++) {
+   if (i < cnt)
+   currlanes->data[i].state = ISP_CSI2_LANE_ON;
+   else
+   currlanes->data[i].state = ISP_CSI2_LANE_OFF;
+   }
+
+   isp_csi2_complexio_lanes_update(true);
+   return 0;
+}
+EXPORT_SYMBOL(isp_csi2_complexio_lanes_count);
+
+/**
  * isp_csi2_complexio_lanes_get - Gets CSI2 ComplexIO lanes configuration.
  *
  * Gets settings from HW registers and fills in the internal driver memory
Index: omapzoom04/drivers/media/video/isp/ispcsi2.h
===
--- omapzoom04.orig/drivers/media/video/isp/ispcsi2.h
+++ omapzoom04/drivers/media/video/isp/ispcsi2.h
@@ -20,6 +20,9 @@
 #define OMAP_ISP_CSI2_API_H
 #include 
 
+#define ISP_CSI2_LANE_OFF  0
+#define ISP_CSI2_LANE_ON   1
+
 enum isp_csi2_irqevents {
OCP_ERR_IRQ = 0x4000,
SHORT_PACKET_IRQ = 0x2000,
@@ -63,6 +66,7 @@ enum isp_csi2_frame_mode {
 struct csi2_lanecfg {
u8 pos;
u8 pol;
+   u8 state;   /*Current state - 1-Used  0-Unused */
 };
 
 struct isp_csi2_lanes_cfg {
@@ -175,6 +179,7 @@ struct isp_csi2_cfg_update {
 
 int isp_csi2_complexio_lanes_config(struct isp_csi2_lanes_cfg *reqcfg);
 int isp_csi2_complexio_lanes_update(bool force_update);
+int isp_csi2_complexio_lanes_count(int cnt);
 int isp_csi2_complexio_lanes_get(void);
 int isp_csi2_complexio_power_autoswitch(bool enable);
 int isp_csi2_complexio_power(enum isp_csi2_power_cmds power_cmd);
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[OMAPZOOM][PATCH 0/6] Add support for Sony imx046 sensor.

2009-01-29 Thread Dominic Curran
From: Dominic Curran 
Subject: [OMAPZOOM][PATCH 0/6] Add support for Sony imx046 sensor.

This set of patches adds support for the Sony IMX046 camera.

Driver supports:
 - Sensor output format RAW10 (YUV conversion through CCDC)
 - Base output resolutions:
- 3280x2464 @ 7.5fps  (8MP)
- 3280x616  @ 7.5fps
- 820x616   @ 30fps
 - Exposure & Gain control
 - Platforms: SDP3430 & Zoom2

thanks
dom
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[OMAPZOOM][PATCH] Set the dcsub value for the OV3640 sensor.

2009-01-07 Thread Dominic Curran
From: Dominic Curran 
Subject: [OMAPZOOM][PATCH] Set the dcsub value for the OV3640 sensor.

Explicitly set the dcsub (black level subtraction) value for the OV3640 sensor.
For the OV3640 sensor the manufacturer recommends a BLC of 16 (for 10-bit data).
This is a constant value that can be read from the sensors BLC9[3:0] register. 
The reg value (0x4) is for 8-bit data, so for 10-bit data this value should be 
left shifted by 2 (0x10).

Signed-off-by: Dominic Curran 
---
 arch/arm/mach-omap2/board-3430sdp.c |1 +
 arch/arm/mach-omap2/board-ldp.c |1 +
 drivers/media/video/ov3640.h|2 ++
 3 files changed, 4 insertions(+)

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
@@ -756,6 +756,7 @@ static struct isp_interface_config ov364
.prev_sph = 2,
.prev_slv = 1,
.wenlog = ISPCCDC_CFG_WENLOG_AND,
+   .dcsub = OV3640_BLACK_LEVEL_10BIT,
.u.csi.crc = 0x0,
.u.csi.mode = 0x0,
.u.csi.edge = 0x0,
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
@@ -625,6 +625,7 @@ static struct isp_interface_config ov364
.prev_sph = 2,
.prev_slv = 1,
.wenlog = ISPCCDC_CFG_WENLOG_AND,
+   .dcsub = OV3640_BLACK_LEVEL_10BIT,
.u.csi.crc = 0x0,
.u.csi.mode = 0x0,
.u.csi.edge = 0x0,
Index: omapzoom04/drivers/media/video/ov3640.h
===
--- omapzoom04.orig/drivers/media/video/ov3640.h
+++ omapzoom04/drivers/media/video/ov3640.h
@@ -62,6 +62,8 @@
 #define OV3640_MAX_COLOR   2
 #define OV3640_COLOR_STEP  1
 
+#define OV3640_BLACK_LEVEL_10BIT   16
+
 #define SENSOR_DETECTED1
 #define SENSOR_NOT_DETECTED0
 
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[OMAPZOOM][PATCH] ISP: Set dcsub in omap board file.

2008-12-15 Thread Dominic Curran
From: Dominic Curran 
Subject: [OMAPZOOM][PATCH] ISP: Set dcsub in omap board file.

The dcsub (black level) is currently hardcoded to the MT9P012
sensors value in the ISP CCDC module.
This patch removes the hardcode and moves the setup of this 
value to the camera section of the board file.
Other sensor currently use a dcsub value of 0 (default).

Signed-off-by: Dominic Curran 
---
 arch/arm/mach-omap2/board-3430sdp.c |1 +
 drivers/media/video/isp/isp.c   |1 +
 drivers/media/video/isp/isp.h   |1 +
 drivers/media/video/isp/ispccdc.c   |   16 ++--
 drivers/media/video/isp/ispccdc.h   |2 ++
 5 files changed, 19 insertions(+), 2 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
@@ -632,6 +632,7 @@ static struct isp_interface_config mt9p0
.prev_sph = 2,
.prev_slv = 0,
.wenlog = ISPCCDC_CFG_WENLOG_OR,
+   .dcsub = 42,
.u.par.par_bridge = 0x0,
.u.par.par_clk_pol = 0x0,
 };
Index: omapzoom04/drivers/media/video/isp/isp.c
===
--- omapzoom04.orig/drivers/media/video/isp/isp.c
+++ omapzoom04/drivers/media/video/isp/isp.c
@@ -951,6 +951,7 @@ int isp_configure_interface(struct isp_i
/* Set sensor specific fields in CCDC and Previewer module.*/
isppreview_set_skip(config->prev_sph, config->prev_slv);
ispccdc_set_wenlog(config->wenlog);
+   ispccdc_set_dcsub(config->dcsub);
 
return 0;
 }
Index: omapzoom04/drivers/media/video/isp/isp.h
===
--- omapzoom04.orig/drivers/media/video/isp/isp.h
+++ omapzoom04/drivers/media/video/isp/isp.h
@@ -195,6 +195,7 @@ struct isp_interface_config {
u32 prev_sph;
u32 prev_slv;
u32 wenlog;
+   u32 dcsub;
union {
struct par {
unsigned par_bridge:2;
Index: omapzoom04/drivers/media/video/isp/ispccdc.c
===
--- omapzoom04.orig/drivers/media/video/isp/ispccdc.c
+++ omapzoom04/drivers/media/video/isp/ispccdc.c
@@ -83,6 +83,7 @@ static struct isp_ccdc {
u8 lsc_en;
struct mutex mutexlock; /* For checking/modifying ccdc_inuse */
u32 wenlog;
+   u32 dcsub;
 } ispccdc_obj;
 
 static struct ispccdc_lsc_config lsc_config;
@@ -327,6 +328,16 @@ void ispccdc_set_wenlog(u32 wenlog)
 EXPORT_SYMBOL(ispccdc_set_wenlog);
 
 /**
+ * Set the value to be used for ISPCCDC_DCSUB.
+ *  dcsub - Value of black level.
+ */
+void ispccdc_set_dcsub(u32 dcsub)
+{
+   ispccdc_obj.dcsub = dcsub;
+}
+EXPORT_SYMBOL(ispccdc_set_dcsub);
+
+/**
  * ispccdc_request - Reserves the CCDC module.
  *
  * Reserves the CCDC module and assures that is used only once at a time.
@@ -626,7 +637,7 @@ int ispccdc_config_datapath(enum ccdc_in
syncif.vdpol = 0;
ispccdc_config_sync_if(syncif);
ispccdc_config_imgattr(colptn);
-   blkcfg.dcsubval = 42;
+   blkcfg.dcsubval = ispccdc_obj.dcsub;
ispccdc_config_black_clamp(blkcfg);
if (is_isplsc_activated()) {
ispccdc_config_lsc(&lsc_config);
@@ -673,7 +684,7 @@ int ispccdc_config_datapath(enum ccdc_in
ispccdc_config_sync_if(syncif);
ispccdc_config_imgattr(colptn);
/* Config DC sub */
-   blkcfg.dcsubval = 42;
+   blkcfg.dcsubval = ispccdc_obj.dcsub;
ispccdc_config_black_clamp(blkcfg);
break;
case CCDC_YUV_BT:
@@ -1577,6 +1588,7 @@ EXPORT_SYMBOL(ispccdc_print_status);
 int __init isp_ccdc_init(void)
 {
ispccdc_obj.ccdc_inuse = 0;
+   ispccdc_obj.dcsub = 0;
ispccdc_config_crop(0, 0, 0, 0);
mutex_init(&ispccdc_obj.mutexlock);
 
Index: omapzoom04/drivers/media/video/isp/ispccdc.h
===
--- omapzoom04.orig/drivers/media/video/isp/ispccdc.h
+++ omapzoom04/drivers/media/video/isp/ispccdc.h
@@ -211,4 +211,6 @@ int omap34xx_isp_ccdc_config(void *users
 
 void ispccdc_set_wenlog(u32 wenlog);
 
+void ispccdc_set_dcsub(u32 dcsub);
+
 #endif /* OMAP_ISP_CCDC_H */
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/3] [OMAPZOOM] Lower i2c speed on bus 1 for LDP.

2008-11-12 Thread Dominic Curran
Resending patch with more descriptive comment.

Lower i2c bus 1 speed to 400KHz for LDP.
At 2600KHz i2c reads from twl4030 keypad driver are returning 
incorrect data. Reason unknown. Lowering bus speed as temporary 
fix to get LDP keypad working.

Signed-off-by: Dominic Curran <[EMAIL PROTECTED]>
---
 arch/arm/mach-omap2/board-ldp.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index d889ce8..b2e8c9c 100755
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -797,7 +797,7 @@ static struct i2c_board_info __initdata 
ldp_i2c_boardinfo_2[] = {
 
 static int __init omap_i2c_init(void)
 {
-   omap_register_i2c_bus(1, 2600, ldp_i2c_boardinfo,
+   omap_register_i2c_bus(1, 400, ldp_i2c_boardinfo,
ARRAY_SIZE(ldp_i2c_boardinfo));
omap_register_i2c_bus(2, 100, ldp_i2c_boardinfo_2,
ARRAY_SIZE(ldp_i2c_boardinfo_2));
-- 
1.5.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/3] [OMAPZOOM] Fix persistent TWL4030 keypress in LDP board file.

2008-11-12 Thread Dominic Curran
Removes ZOOM specific code from TWL4030 keypad driver.
Adds generic code to deal with persistent TWL4030 keypress.
Code originally submitted by Stanley Miao to linux-omap tree.

Signed-off-by: Dominic Curran <[EMAIL PROTECTED]>
cc: Stanley.Miao <[EMAIL PROTECTED]>
---
 arch/arm/mach-omap2/board-ldp.c |1 +
 arch/arm/plat-omap/include/mach/keypad.h|5 +
 drivers/input/keyboard/omap-twl4030keypad.c |   21 ++---
 3 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index b2e8c9c..6cdccf3 100755
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -263,6 +263,7 @@ static int ldp_twl4030_keymap[] = {
KEY(0, 3, KEY_F7),
KEY(1, 3, KEY_0),
KEY(2, 3, KEY_F8),
+   PERSISTENT_KEY(4, 5),
KEY(5, 4, KEY_MUTE),
KEY(4, 4, KEY_VOLUMEUP),
KEY(5, 5, KEY_VOLUMEDOWN),
diff --git a/arch/arm/plat-omap/include/mach/keypad.h 
b/arch/arm/plat-omap/include/mach/keypad.h
index ba1c95c..b7f270a 100644
--- a/arch/arm/plat-omap/include/mach/keypad.h
+++ b/arch/arm/plat-omap/include/mach/keypad.h
@@ -34,7 +34,12 @@ struct omap_kp_platform_data {
 #define GROUP_3(3 << 16)
 #define GROUP_MASK GROUP_3
 
+#define ROWCOL_MASK0xFF00
+#define KEY_PERSISTENT 0x0080
+#define KEYNUM_MASK0x00EF
 #define KEY(col, row, val) (((col) << 28) | ((row) << 24) | (val))
+#define PERSISTENT_KEY(col, row) (((col) << 28) | ((row) << 24) | \
+   KEY_PERSISTENT)
 
 #endif
 
diff --git a/drivers/input/keyboard/omap-twl4030keypad.c 
b/drivers/input/keyboard/omap-twl4030keypad.c
index e8fd21c..40ee869 100644
--- a/drivers/input/keyboard/omap-twl4030keypad.c
+++ b/drivers/input/keyboard/omap-twl4030keypad.c
@@ -40,14 +40,12 @@
 #include 
 #include 
 #include 
+
 #include "twl4030-keypad.h"
 
 #define PTV_PRESCALER  4
 
 #define MAX_ROWS   8 /* TWL4030 hardlimit */
-#define ROWCOL_MASK0xFF00
-#define KEYNUM_MASK0x00FF
-#define KEY(col, row, val) (((col) << 28) | ((row) << 24) | (val))
 
 /* Global variables */
 
@@ -103,7 +101,7 @@ static int omap_kp_find_key(struct omap_keypad *kp, int 
col, int row)
rc = KEY(col, row, 0);
for (i = 0; i < kp->keymapsize; i++)
if ((kp->keymap[i] & ROWCOL_MASK) == rc)
-   return kp->keymap[i] & KEYNUM_MASK;
+   return kp->keymap[i] & (KEYNUM_MASK | KEY_PERSISTENT);
 
return -EINVAL;
 }
@@ -187,20 +185,13 @@ static void twl4030_kp_scan(struct omap_keypad *kp, int 
release_all)
"press" : "release");
 
key = omap_kp_find_key(kp, col, row);
-   if (key < 0) {
-#if defined(CONFIG_MACH_OMAP_LDP) || defined(CONFIG_MACH_OMAP_ZOOM2)
-   /* OMAP LDP has a TWL4030 GPIO
-* (KBR5/KBC4) that is set to a persistent
-* state and should be ignored.
-*/
-   if (row == 5 && col == 4)
-   continue;
-#endif
-
+   if (key < 0)
dev_warn(kp->dbg_dev,
"Spurious key event %d-%d\n",
 col, row);
-   } else
+   else if (key & KEY_PERSISTENT)
+   continue;
+   else
input_report_key(kp->omap_twl4030kp, key,
 new_state[row] & (1 << col));
}
-- 
1.5.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/3] [OMAPZOOM] INPUT: Fix twl4030 keypad bug.

2008-11-12 Thread Dominic Curran
Fixes a bug in TWL4030 keypad where too many columns were being checked.
Code originally submitted by Stanley Miao to linux-omap tree.

Signed-off-by: Dominic Curran <[EMAIL PROTECTED]>
cc: Stanley.Miao <[EMAIL PROTECTED]>
---
 drivers/input/keyboard/omap-twl4030keypad.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/input/keyboard/omap-twl4030keypad.c 
b/drivers/input/keyboard/omap-twl4030keypad.c
index 965b6a0..e8fd21c 100644
--- a/drivers/input/keyboard/omap-twl4030keypad.c
+++ b/drivers/input/keyboard/omap-twl4030keypad.c
@@ -176,7 +176,7 @@ static void twl4030_kp_scan(struct omap_keypad *kp, int 
release_all)
if (!changed)
continue;
 
-   for (col = 0; col < kp->n_cols + 1; col++) {
+   for (col = 0; col < kp->n_cols; col++) {
int key;
 
if (!(changed & (1 << col)))
-- 
1.5.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/3] [OMAPZOOM] Lower i2c speed on bus 1 for LDP.

2008-11-12 Thread Dominic Curran
Lower i2c bus 1 speed to 400KHz for LDP.

Signed-off-by: Dominic Curran <[EMAIL PROTECTED]>
---
 arch/arm/mach-omap2/board-ldp.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index d889ce8..b2e8c9c 100755
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -797,7 +797,7 @@ static struct i2c_board_info __initdata 
ldp_i2c_boardinfo_2[] = {
 
 static int __init omap_i2c_init(void)
 {
-   omap_register_i2c_bus(1, 2600, ldp_i2c_boardinfo,
+   omap_register_i2c_bus(1, 400, ldp_i2c_boardinfo,
ARRAY_SIZE(ldp_i2c_boardinfo));
omap_register_i2c_bus(2, 100, ldp_i2c_boardinfo_2,
ARRAY_SIZE(ldp_i2c_boardinfo_2));
-- 
1.5.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/3] [OMAPZOOM] INPUT: Switch LDP to use both TWL4030 and GPIO keypad drivers

2008-10-20 Thread Dominic Curran
The LDP uses both TWL4030 and GPIO's for its keypad inputs.
This patch changes the LDP board file to make use of both the TWL4030
and GPIO keypad drivers. 

Signed-off-by: Dominic Curran <[EMAIL PROTECTED]>
---
 arch/arm/mach-omap2/board-ldp.c |  131 +--
 1 files changed, 84 insertions(+), 47 deletions(-)

diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index 47a0ba2..290d469 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -226,15 +227,10 @@ static int ldp_twl4030_keymap[] = {
KEY(0, 0, KEY_1),
KEY(1, 0, KEY_2),
KEY(2, 0, KEY_3),
-   KEY(3, 0, KEY_ENTER),
-   KEY(4, 0, KEY_F1),
-   KEY(5, 0, KEY_F2),
KEY(0, 1, KEY_4),
KEY(1, 1, KEY_5),
KEY(2, 1, KEY_6),
KEY(3, 1, KEY_F5),
-   KEY(4, 1, KEY_F3),
-   KEY(5, 1, KEY_F4),
KEY(0, 2, KEY_7),
KEY(1, 2, KEY_8),
KEY(2, 2, KEY_9),
@@ -242,62 +238,103 @@ static int ldp_twl4030_keymap[] = {
KEY(0, 3, KEY_F7),
KEY(1, 3, KEY_0),
KEY(2, 3, KEY_F8),
-   KEY(0, 4, KEY_RIGHT),
-   KEY(1, 4, KEY_UP),
-   KEY(2, 4, KEY_DOWN),
-   KEY(3, 4, KEY_LEFT),
KEY(5, 4, KEY_MUTE),
KEY(4, 4, KEY_VOLUMEUP),
KEY(5, 5, KEY_VOLUMEDOWN),
0
 };
 
-#define GPIO_KEY(gpio, key)  ((gpio<<16) | (key))
-
-static unsigned int ldp_omap_gpio_keymap[] = {
-   GPIO_KEY(101, KEY_ENTER), /*select*/
-   GPIO_KEY(102, KEY_F1),/*S7*/
-   GPIO_KEY(103, KEY_F2),/*S3*/
-   GPIO_KEY(104, KEY_F3),/*S1*/
-   GPIO_KEY(105, KEY_F4),/*S2*/
-   GPIO_KEY(106, KEY_LEFT),  /*left*/
-   GPIO_KEY(107, KEY_RIGHT), /*right*/
-   GPIO_KEY(108, KEY_UP),/*up*/
-   GPIO_KEY(109, KEY_DOWN),  /*down*/
-   0
-};
-
-/* OMAP3430 LDP Keymaps:
- * OMAP LDP uses both TWL4030 GPIO's and OMAP GPIO's to get key presses.
- * This is why there are two keymaps:
- *  - ldp_twl4030_keymap (TWL4030)
- *  - ldp_omap_gpio_keymap (OMAP GPIO's)
- * Unfortunately the input subsystem requires all the keymaps to be
- * listed in one place (.keymap) in order for a key to be a valid input.
- * This is why some keys appear in both keymaps.
- * If a key does appear in both keymaps then its entry in
- * ldp_twl4030_keymap is purely to keep the input subsystem happy and
- * its row/col values have no meaning.
- */
-static struct omap_kp_platform_data ldp_kp_data = {
+static struct twl4030_keypad_data ldp_kp_twl4030_data = {
.rows   = 6,
.cols   = 6,
-   .keymap = ldp_twl4030_keymap,
-   .keymapsize = ARRAY_SIZE(ldp_twl4030_keymap),
+   .keymap = ldp_twl4030_keymap,
+   .keymapsize = ARRAY_SIZE(ldp_twl4030_keymap),
.rep= 1,
.irq= TWL4030_MODIRQ_KEYPAD,
-   /* Use row_gpios as a way to pass the OMAP GPIO keymap pointer */
-   .row_gpios  = ldp_omap_gpio_keymap,
 };
 
-static struct platform_device ldp_kp_device = {
-   .name   = "omap_twl4030keypad",
-   .id = -1,
+
+static struct gpio_keys_button ldp_gpio_keys_buttons[] = {
+   [0] = {
+   .code   = KEY_ENTER,
+   .gpio   = 101,
+   .desc   = "enter sw",
+   .active_low = 1,
+   .debounce_interval = 30,
+   },
+   [1] = {
+   .code   = KEY_F1,
+   .gpio   = 102,
+   .desc   = "func 1",
+   .active_low = 1,
+   .debounce_interval = 30,
+   },
+   [2] = {
+   .code   = KEY_F2,
+   .gpio   = 103,
+   .desc   = "func 2",
+   .active_low = 1,
+   .debounce_interval = 30,
+   },
+   [3] = {
+   .code   = KEY_F3,
+   .gpio   = 104,
+   .desc   = "func 3",
+   .active_low = 1,
+   .debounce_interval = 30,
+   },
+   [4] = {
+   .code   = KEY_F4,
+   .gpio   = 105,
+   .desc   = "func 4",
+   .active_low = 1,
+   .debounce_interval = 30,
+   },
+   [5] = {
+   .code   = KEY_LEFT,
+   .gpio   = 106,
+   .desc   = "left sw",
+   .active_low = 1,
+   .debounce_interval = 30,
+   },
+   [6] = {
+   .code   = KEY_RIGHT,
+   .gpio   = 107,
+   .desc   = "right sw",
+   .active_low = 1,
+   .debounce_interval 

[PATCH 2/3] [OMAPZOOM] INPUT: Remove LDP gpio key hack from TWL4030 keyboard driver.

2008-10-20 Thread Dominic Curran
A keypad hack was initially added when bringing up LDP.
This patch removes that hack from the TWL4030 keypad driver.

Signed-off-by: Dominic Curran <[EMAIL PROTECTED]>
---
 drivers/input/keyboard/omap-twl4030keypad.c |  145 ---
 1 files changed, 0 insertions(+), 145 deletions(-)

diff --git a/drivers/input/keyboard/omap-twl4030keypad.c 
b/drivers/input/keyboard/omap-twl4030keypad.c
index f1903c9..42b26bc 100644
--- a/drivers/input/keyboard/omap-twl4030keypad.c
+++ b/drivers/input/keyboard/omap-twl4030keypad.c
@@ -49,16 +49,6 @@
 #define KEYNUM_MASK0x00FF
 #define KEY(col, row, val) (((col) << 28) | ((row) << 24) | (val))
 
-#ifdef CONFIG_MACH_OMAP_LDP
-static unsigned int *omap_gpios;
-static unsigned int cur_gpios[9];
-struct timer_list  gpio_timer;
-
-#define GET_GPIO(val)  (val >> 16) & 0x
-#define GET_KEY(val)   (val & 0x)
-
-#endif
-
 /* Global variables */
 
 struct omap_keypad {
@@ -250,133 +240,6 @@ static irqreturn_t do_kp_irq(int irq, void *_kp)
return IRQ_HANDLED;
 }
 
-#ifdef CONFIG_MACH_OMAP_LDP
-static void omap_gpio_kp_scan(struct omap_keypad *kp)
-{
-   unsigned int new_gpio;
-   int idx = 0, chg = 0, key, state;
-   bool key_down = 0;
-
-   while (omap_gpios[idx] != 0) {
-   new_gpio = omap_get_gpio_datain(GET_GPIO(omap_gpios[idx]));
-   chg = new_gpio ^ cur_gpios[idx];
-
-   if (chg) {
-   key = GET_KEY(omap_gpios[idx]);
-   state = (new_gpio == 0);
-   input_report_key(kp->omap_twl4030kp, key, state);
-   }
-
-   if (!new_gpio)
-   key_down = 1;
-
-   /* Store the keys current value. */
-   cur_gpios[idx] = new_gpio;
-   idx++;
-   }
-
-   /* Decide whether to kick off timer. */
-   if (key_down) {
-   int delay;
-
-   delay = HZ / 20;
-   /* A key is pressed - use timer to poll the keypad */
-   mod_timer(&gpio_timer, jiffies + delay);
-   }
-
-   return;
-}
-
-
-/*
- * Keypad interrupt handler for OMAP GPIO's.
- */
-static irqreturn_t do_kp_gpio_irq(int irq, void *_kp)
-{
-   struct omap_keypad *kp = _kp;
-
-   /* Scan keypad for any changes in GPIO keys. */
-   omap_gpio_kp_scan(kp);
-
-   return IRQ_HANDLED;
-}
-
-
-static void omap_gpio_kp_timer(unsigned long arg)
-{
-   struct omap_keypad *kp = (struct omap_keypad*)arg;
-   omap_gpio_kp_scan(kp);
-}
-
-static int
-omap_gpio_kp_probe(struct omap_keypad *kp, unsigned int *gpio_keymap)
-{
-   int i, idx = 0, irq_idx = 0;
-
-   /* set the global to the GPIO keymap data*/
-   omap_gpios = gpio_keymap;
-
-   while (omap_gpios[idx] != 0) {
-   /* initial values for current key state array. (1=Up,0=Down) */
-   cur_gpios[idx] = 1;
-
-   if (omap_request_gpio(GET_GPIO(omap_gpios[idx])) < 0) {
-   printk(KERN_ERR "Failed to request GPIO%d for keypad\n",
-   GET_GPIO(omap_gpios[idx]));
-   goto err1;
-   }
-
-   /* GPIO direction is 'Input' */
-   omap_set_gpio_direction(GET_GPIO(omap_gpios[idx]), 1);
-   idx++;
-   }
-
-   /* enable GPIO interrupts */
-   while (omap_gpios[irq_idx] != 0) {
-   if (request_irq(OMAP_GPIO_IRQ(GET_GPIO(omap_gpios[irq_idx])),
-   do_kp_gpio_irq, IRQF_TRIGGER_FALLING,
-   "omap-keypad", kp) < 0)
-   goto err2;
-   irq_idx++;
-   }
-
-   /* Initialize GPIO timer */
-   gpio_timer.function = omap_gpio_kp_timer;
-   gpio_timer.data = (unsigned long)kp;
-   init_timer(&gpio_timer);
-
-   /* scan current key state */
-   omap_gpio_kp_scan(kp);
-
-   return 0;
-
-err2:
-   for (i = irq_idx - 1; i >= 0; i--)
-   free_irq(GET_GPIO(omap_gpios[i]), 0);
-err1:
-   for (i = idx - 1; i >= 0; i--)
-   omap_free_gpio(GET_GPIO(omap_gpios[i]));
-
-   return -EINVAL;
-}
-
-int omap_gpio_kp_remove(void)
-{
-   int idx = 0;
-
-   del_timer_sync(&gpio_timer);
-
-   while (omap_gpios[idx] != 0) {
-   free_irq(GET_GPIO(omap_gpios[idx]), 0);
-   omap_free_gpio(GET_GPIO(omap_gpios[idx]));
-   idx++;
-   }
-
-   return 0;
-}
-
-#endif /*CONFIG_MACH_OMAP_LDP*/
-
 
 /*
  * Registers keypad device with input sub system
@@ -515,10 +378,6 @@ static int __init omap_kp_probe(struct platform_device 
*pdev)
if (ret < 0)
goto err4;
 
-#ifdef CONFIG_MACH_OMAP_LDP
-   omap_gpio_kp_probe(kp, pdata->row_gpios);
-#endif
-
return ret;
 err5:
/* mask all events - we don&#x

[PATCH 1/3] [OMAPZOOM] INPUT: Add flag to allow gpio-key input auto repeat.

2008-10-20 Thread Dominic Curran
Adds a flag to the gpio-keys driver to enable the input subsystems
auto repeat function. Feature is turned on in board file.

Signed-off-by: Dominic Curran <[EMAIL PROTECTED]>
---
 drivers/input/keyboard/gpio_keys.c |4 
 include/linux/gpio_keys.h  |1 +
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/input/keyboard/gpio_keys.c 
b/drivers/input/keyboard/gpio_keys.c
index ec96b36..935d2e3 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -108,6 +108,10 @@ static int __devinit gpio_keys_probe(struct 
platform_device *pdev)
input->id.product = 0x0001;
input->id.version = 0x0100;
 
+   /* Enable auto repeat feature of Linux input subsystem */
+   if (pdata->rep)
+   set_bit(EV_REP, input->evbit);
+
ddata->input = input;
 
for (i = 0; i < pdata->nbuttons; i++) {
diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
index ec6ecd7..1289fa7 100644
--- a/include/linux/gpio_keys.h
+++ b/include/linux/gpio_keys.h
@@ -15,6 +15,7 @@ struct gpio_keys_button {
 struct gpio_keys_platform_data {
struct gpio_keys_button *buttons;
int nbuttons;
+   unsigned int rep:1; /* enable input subsystem auto repeat */
 };
 
 #endif
-- 
1.5.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html