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

2009-02-13 Thread Dominic Curran
From: Dominic Curran dcur...@ti.com
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-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[REVIEW][PATCH] LV8093: Add driver for LV8093 lens actuator.

2009-02-04 Thread Dominic Curran

Hi
Below is a new driver for the LV8093 lens actuator.

Of course all comments are welcome, however I have a specific issue that i am 
concerned about...

The lens position cannot be read back from this device, and it
only takes relative positions (it uses V4L2_CID_FOCUS_RELATIVE ctrl ID).

The device has only one read register which contains a single BUSY bit.
For large relative lens movements the device can be busy for sometime and we 
need 
to know when the lens has stopped moving.

My question is what is the most appropriate mechanism to read the BUSY bit ? 

Currently the driver uses the VIDIOC_G_CTRL ioctl + V4L2_CID_FOCUS_RELATIVE 
ctrl 
ID to return the BUSY bit.  Is this acceptable ?

The only other solution I can think of is:
 * Use does VIDIOC_S_CTRL ioctl 
.id = V4L2_CID_FOCUS_RELATIVE
.value = 0
 * If driver detects .value=0 then it reads the BUSY bit and returns either
   0  - Ready
   -EBUSY - lens busy 

A 3rd solution is to read the BUSY bit everytime after a write and not return 
until device is ready.  However this adds extra time to the operation 
(particularly for small lens moves) and I would like the user to be in change 
of 
when the reads of BUSY bit occur.

I hope I have made my question clear.

Any guidance appreciated
thanks
dom

From: Dominic Curran dcur...@ti.com
Subject: [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 kraig.pro...@hp.com
Signed-off-by: Dominic Curran dcur...@ti.com
---
 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 linux/mutex.h
+#include linux/i2c.h
+#include linux/delay.h
+#include linux/platform_device.h
+#include linux/cdev.h
+#include linux/device.h
+
+#include media/v4l2-int-device.h
+#include mach/gpio.h
+
+#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

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

2009-01-30 Thread Dominic Curran
From: Dominic Curran dcur...@ti.com
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-media 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/6] Increase isp workaround buffer size for 8MP sensor.

2009-01-30 Thread Dominic Curran
From: Dominic Curran dcur...@ti.com
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 dcur...@ti.com
---
 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 media/videobuf-dma-sg.h
 #include linux/videodev2.h
+
+#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-media 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 3/6] IMX046: Add support for Sony imx046 sensor.

2009-01-30 Thread Dominic Curran
From: Dominic Curran dcur...@ti.com
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 greg.ho...@hp.com
Signed-off-by: Dominic Curran dcur...@ti.com
---
 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 linux/i2c.h
+#include linux/delay.h
+
+#include media/v4l2-int-device.h
+
+#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
+ * @pdata: access functions and data

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

2009-01-30 Thread Dominic Curran
From: Dominic Curran dcur...@ti.com
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 greg.ho...@hp.com
Signed-off-by: Dominic Curran dcur...@ti.com
---
 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 media/v4l2-int-device.h
 #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

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

2009-01-30 Thread Dominic Curran
From: Dominic Curran dcur...@ti.com
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 greg.ho...@hp.com
Signed-off-by: Dominic Curran dcur...@ti.com
---
 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-media 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 6/6] Add support for Sony imx046 to OMAP zoom2 board.

2009-01-30 Thread Dominic Curran
From: Dominic Curran dcur...@ti.com
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 dcur...@ti.com
---
 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 linux/synaptics_i2c_rmi.h
 #include linux/spi/spi.h
 #include linux/i2c/twl4030.h
+#include linux/mm.h
 
 #include mach/hardware.h
 #include asm/mach-types.h
@@ -50,6 +51,30 @@
 #include mach/prcm_34xx.h
 #endif
 
+#ifdef CONFIG_VIDEO_OMAP3
+#include media/v4l2-int-device.h
+#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