* [PATCH 15/15] OMAP3 camera driver: OMAP34XXCAM: Add Sensors Support.
@ 2008-08-29 23:34 Aguirre Rodriguez, Sergio Alberto
2008-09-11 0:17 ` Tony Lindgren
0 siblings, 1 reply; 8+ messages in thread
From: Aguirre Rodriguez, Sergio Alberto @ 2008-08-29 23:34 UTC (permalink / raw)
To: linux-omap@vger.kernel.org
From: Sergio Aguirre <saaguirre@ti.com>
OMAP34XX: CAM: Add Sensors Support
This adds support in OMAP34xx SDP board file for Sensor and Lens
driver.
Signed-off-by: Sergio Aguirre <saaguirre@ti.com>
---
arch/arm/mach-omap2/board-3430sdp.c | 228 ++++++++++++++++++++++++++++++++++++
1 file changed, 228 insertions(+)
Index: linux-omap-2.6/arch/arm/mach-omap2/board-3430sdp.c
===================================================================
--- linux-omap-2.6.orig/arch/arm/mach-omap2/board-3430sdp.c 2008-08-25 11:00:18.000000000 -0500
+++ linux-omap-2.6/arch/arm/mach-omap2/board-3430sdp.c 2008-08-25 12:16:46.000000000 -0500
@@ -42,6 +42,19 @@
#include <mach/gpmc.h>
#include <linux/i2c/twl4030-rtc.h>
+#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_MT9P012) || defined(CONFIG_VIDEO_MT9P012_MODULE)
+#include <../drivers/media/video/mt9p012.h>
+#endif
+#endif
+
+#ifdef CONFIG_VIDEO_DW9710
+#include <../drivers/media/video/dw9710.h>
+#endif
+
#include <asm/io.h>
#include <asm/delay.h>
#include <mach/control.h>
@@ -266,6 +279,216 @@
},
};
+#ifdef CONFIG_VIDEO_DW9710
+static int dw9710_lens_power_set(enum v4l2_power power)
+{
+
+ return 0;
+}
+
+static int dw9710_lens_set_prv_data(void *priv)
+{
+ struct omap34xxcam_hw_config *hwc = priv;
+
+ hwc->dev_index = 0;
+ hwc->dev_minor = 0;
+ hwc->dev_type = OMAP34XXCAM_SLAVE_LENS;
+
+ return 0;
+}
+
+static struct dw9710_platform_data sdp3430_dw9710_platform_data = {
+ .power_set = dw9710_lens_power_set,
+ .priv_data_set = dw9710_lens_set_prv_data,
+};
+#endif
+
+#if defined(CONFIG_VIDEO_MT9P012) || defined(CONFIG_VIDEO_MT9P012_MODULE)
+static void __iomem *fpga_map_addr;
+
+static struct omap34xxcam_sensor_config cam_hwc = {
+ .sensor_isp = 0,
+ .xclk = OMAP34XXCAM_XCLK_A,
+};
+
+static void enable_fpga_vio_1v8(u8 enable)
+{
+ u16 reg_val;
+
+ fpga_map_addr = ioremap(DEBUG_BASE, 4096);
+ reg_val = readw(fpga_map_addr + REG_SDP3430_FPGA_GPIO_2);
+
+ /* Ensure that the SPR_GPIO1_3v3 is 0 - powered off.. 1 is on */
+ if (reg_val & FPGA_SPR_GPIO1_3v3) {
+ reg_val |= FPGA_SPR_GPIO1_3v3;
+ reg_val |= FPGA_GPIO6_DIR_CTRL; /* output mode */
+ writew(reg_val, fpga_map_addr + REG_SDP3430_FPGA_GPIO_2);
+ /* give a few milli sec to settle down
+ * Let the sensor also settle down.. if required..
+ */
+ if (enable)
+ mdelay(10);
+ }
+
+ if (enable) {
+ reg_val |= FPGA_SPR_GPIO1_3v3 | FPGA_GPIO6_DIR_CTRL;
+ writew(reg_val, fpga_map_addr + REG_SDP3430_FPGA_GPIO_2);
+ }
+ /* Vrise time for the voltage - should be less than 1 ms */
+ mdelay(1);
+}
+
+static int mt9p012_sensor_set_prv_data(void *priv)
+{
+ struct omap34xxcam_hw_config *hwc = priv;
+
+ hwc->u.sensor.xclk = cam_hwc.xclk;
+ hwc->u.sensor.sensor_isp = cam_hwc.sensor_isp;
+ hwc->dev_index = 0;
+ hwc->dev_minor = 0;
+ hwc->dev_type = OMAP34XXCAM_SLAVE_SENSOR;
+ return 0;
+}
+
+static struct isp_interface_config mt9p012_if_config = {
+ .ccdc_par_ser = ISP_PARLL,
+ .dataline_shift = 0x1,
+ .hsvs_syncdetect = ISPCTRL_SYNC_DETECT_VSRISE,
+ .vdint0_timing = 0x0,
+ .vdint1_timing = 0x0,
+ .strobe = 0x0,
+ .prestrobe = 0x0,
+ .shutter = 0x0,
+ .u.par.par_bridge = 0x0,
+ .u.par.par_clk_pol = 0x0,
+};
+
+static int mt9p012_sensor_power_set(enum v4l2_power power)
+{
+ 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);
+ iounmap(fpga_map_addr);
+ omap_free_gpio(MT9P012_STANDBY_GPIO);
+ break;
+ case V4L2_POWER_ON:
+ /* Power Up Sequence */
+ isp_configure_interface(&mt9p012_if_config);
+
+ /* Request and configure gpio pins */
+ if (omap_request_gpio(MT9P012_STANDBY_GPIO) != 0) {
+ printk(KERN_WARNING "Could not request GPIO %d for "
+ "AF D88\n", MT9P012_STANDBY_GPIO);
+ return -EIO;
+ }
+
+ /* Request and configure gpio pins */
+ if (omap_request_gpio(MT9P012_RESET_GPIO) != 0)
+ return -EIO;
+
+ /* set to output mode */
+ omap_set_gpio_direction(MT9P012_STANDBY_GPIO, 0);
+ /* set to output mode */
+ omap_set_gpio_direction(MT9P012_RESET_GPIO, 0);
+
+ /* STANDBY_GPIO is active HIGH for set LOW to release */
+ omap_set_gpio_dataout(MT9P012_STANDBY_GPIO, 1);
+
+ /* nRESET is active LOW. set HIGH to release reset */
+ omap_set_gpio_dataout(MT9P012_RESET_GPIO, 1);
+
+ /* turn on digital power */
+ enable_fpga_vio_1v8(1);
+#ifdef CONFIG_TWL4030_CORE
+ /* turn on analog power */
+ twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
+ 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
+
+ omap_set_gpio_dataout(MT9P012_STANDBY_GPIO, 0);
+
+ udelay(1000);
+
+ /* have to put sensor to reset to guarantee detection */
+ omap_set_gpio_dataout(MT9P012_RESET_GPIO, 0);
+
+ udelay(1500);
+
+ /* nRESET is active LOW. set HIGH to release reset */
+ omap_set_gpio_dataout(MT9P012_RESET_GPIO, 1);
+ /* give sensor sometime to get out of the reset. Datasheet says
+ 2400 xclks. At 6 MHz, 400 usec are enough */
+ udelay(300);
+ break;
+ case V4L2_POWER_STANDBY:
+ /* stand by */
+ omap_set_gpio_dataout(MT9P012_STANDBY_GPIO, 1);
+ break;
+ case V4L2_POWER_RESUME:
+ /* out of standby */
+ omap_set_gpio_dataout(MT9P012_STANDBY_GPIO, 0);
+ udelay(1000);
+ break;
+ }
+
+ return 0;
+}
+
+static struct v4l2_ifparm ifparm = {
+ .if_type = V4L2_IF_TYPE_BT656,
+ .u = {
+ .bt656 = {
+ .frame_start_on_rising_vs = 1,
+ .latch_clk_inv = 0,
+ .mode = V4L2_IF_TYPE_BT656_MODE_NOBT_10BIT,
+ .clock_min = MT9P012_XCLK_MIN,
+ .clock_max = MT9P012_XCLK_MAX,
+ },
+ },
+};
+
+static int mt9p012_ifparm(struct v4l2_ifparm *p)
+{
+ *p = ifparm;
+ return 0;
+}
+
+static struct mt9p012_platform_data sdp3430_mt9p012_platform_data = {
+ .power_set = mt9p012_sensor_power_set,
+ .priv_data_set = mt9p012_sensor_set_prv_data,
+ .default_regs = NULL,
+ .ifparm = mt9p012_ifparm,
+};
+
+
+static struct i2c_board_info __initdata sdp3430_i2c_board_info[] = {
+#ifdef CONFIG_VIDEO_DW9710
+ {
+ I2C_BOARD_INFO(DW9710_NAME, DW9710_AF_I2C_ADDR),
+ .platform_data = &sdp3430_dw9710_platform_data,
+ },
+#endif
+ {
+ I2C_BOARD_INFO("mt9p012", MT9P012_I2C_ADDR),
+ .platform_data = &sdp3430_mt9p012_platform_data,
+ },
+};
+
+#endif
+
+
static struct platform_device sdp3430_lcd_device = {
.name = "sdp2430_lcd",
.id = -1,
@@ -344,7 +567,12 @@
static int __init omap3430_i2c_init(void)
{
omap_register_i2c_bus(1, 2600, NULL, 0);
+#if defined(CONFIG_VIDEO_MT9P012) || defined(CONFIG_VIDEO_MT9P012_MODULE)
+ omap_register_i2c_bus(2, 400, sdp3430_i2c_board_info,
+ ARRAY_SIZE(sdp3430_i2c_board_info));
+#else
omap_register_i2c_bus(2, 400, NULL, 0);
+#endif
omap_register_i2c_bus(3, 400, NULL, 0);
return 0;
}
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 15/15] OMAP3 camera driver: OMAP34XXCAM: Add Sensors Support.
@ 2008-08-29 23:44 Aguirre Rodriguez, Sergio Alberto
2008-09-02 6:23 ` Hans Verkuil
0 siblings, 1 reply; 8+ messages in thread
From: Aguirre Rodriguez, Sergio Alberto @ 2008-08-29 23:44 UTC (permalink / raw)
To: video4linux-list@redhat.com
From: Sergio Aguirre <saaguirre@ti.com>
OMAP34XX: CAM: Add Sensors Support
This adds support in OMAP34xx SDP board file for Sensor and Lens
driver.
Signed-off-by: Sergio Aguirre <saaguirre@ti.com>
---
arch/arm/mach-omap2/board-3430sdp.c | 228 ++++++++++++++++++++++++++++++++++++
1 file changed, 228 insertions(+)
Index: linux-omap-2.6/arch/arm/mach-omap2/board-3430sdp.c
===================================================================
--- linux-omap-2.6.orig/arch/arm/mach-omap2/board-3430sdp.c 2008-08-25 11:00:18.000000000 -0500
+++ linux-omap-2.6/arch/arm/mach-omap2/board-3430sdp.c 2008-08-25 12:16:46.000000000 -0500
@@ -42,6 +42,19 @@
#include <mach/gpmc.h>
#include <linux/i2c/twl4030-rtc.h>
+#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_MT9P012) || defined(CONFIG_VIDEO_MT9P012_MODULE)
+#include <../drivers/media/video/mt9p012.h>
+#endif
+#endif
+
+#ifdef CONFIG_VIDEO_DW9710
+#include <../drivers/media/video/dw9710.h>
+#endif
+
#include <asm/io.h>
#include <asm/delay.h>
#include <mach/control.h>
@@ -266,6 +279,216 @@
},
};
+#ifdef CONFIG_VIDEO_DW9710
+static int dw9710_lens_power_set(enum v4l2_power power)
+{
+
+ return 0;
+}
+
+static int dw9710_lens_set_prv_data(void *priv)
+{
+ struct omap34xxcam_hw_config *hwc = priv;
+
+ hwc->dev_index = 0;
+ hwc->dev_minor = 0;
+ hwc->dev_type = OMAP34XXCAM_SLAVE_LENS;
+
+ return 0;
+}
+
+static struct dw9710_platform_data sdp3430_dw9710_platform_data = {
+ .power_set = dw9710_lens_power_set,
+ .priv_data_set = dw9710_lens_set_prv_data,
+};
+#endif
+
+#if defined(CONFIG_VIDEO_MT9P012) || defined(CONFIG_VIDEO_MT9P012_MODULE)
+static void __iomem *fpga_map_addr;
+
+static struct omap34xxcam_sensor_config cam_hwc = {
+ .sensor_isp = 0,
+ .xclk = OMAP34XXCAM_XCLK_A,
+};
+
+static void enable_fpga_vio_1v8(u8 enable)
+{
+ u16 reg_val;
+
+ fpga_map_addr = ioremap(DEBUG_BASE, 4096);
+ reg_val = readw(fpga_map_addr + REG_SDP3430_FPGA_GPIO_2);
+
+ /* Ensure that the SPR_GPIO1_3v3 is 0 - powered off.. 1 is on */
+ if (reg_val & FPGA_SPR_GPIO1_3v3) {
+ reg_val |= FPGA_SPR_GPIO1_3v3;
+ reg_val |= FPGA_GPIO6_DIR_CTRL; /* output mode */
+ writew(reg_val, fpga_map_addr + REG_SDP3430_FPGA_GPIO_2);
+ /* give a few milli sec to settle down
+ * Let the sensor also settle down.. if required..
+ */
+ if (enable)
+ mdelay(10);
+ }
+
+ if (enable) {
+ reg_val |= FPGA_SPR_GPIO1_3v3 | FPGA_GPIO6_DIR_CTRL;
+ writew(reg_val, fpga_map_addr + REG_SDP3430_FPGA_GPIO_2);
+ }
+ /* Vrise time for the voltage - should be less than 1 ms */
+ mdelay(1);
+}
+
+static int mt9p012_sensor_set_prv_data(void *priv)
+{
+ struct omap34xxcam_hw_config *hwc = priv;
+
+ hwc->u.sensor.xclk = cam_hwc.xclk;
+ hwc->u.sensor.sensor_isp = cam_hwc.sensor_isp;
+ hwc->dev_index = 0;
+ hwc->dev_minor = 0;
+ hwc->dev_type = OMAP34XXCAM_SLAVE_SENSOR;
+ return 0;
+}
+
+static struct isp_interface_config mt9p012_if_config = {
+ .ccdc_par_ser = ISP_PARLL,
+ .dataline_shift = 0x1,
+ .hsvs_syncdetect = ISPCTRL_SYNC_DETECT_VSRISE,
+ .vdint0_timing = 0x0,
+ .vdint1_timing = 0x0,
+ .strobe = 0x0,
+ .prestrobe = 0x0,
+ .shutter = 0x0,
+ .u.par.par_bridge = 0x0,
+ .u.par.par_clk_pol = 0x0,
+};
+
+static int mt9p012_sensor_power_set(enum v4l2_power power)
+{
+ 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);
+ iounmap(fpga_map_addr);
+ omap_free_gpio(MT9P012_STANDBY_GPIO);
+ break;
+ case V4L2_POWER_ON:
+ /* Power Up Sequence */
+ isp_configure_interface(&mt9p012_if_config);
+
+ /* Request and configure gpio pins */
+ if (omap_request_gpio(MT9P012_STANDBY_GPIO) != 0) {
+ printk(KERN_WARNING "Could not request GPIO %d for "
+ "AF D88\n", MT9P012_STANDBY_GPIO);
+ return -EIO;
+ }
+
+ /* Request and configure gpio pins */
+ if (omap_request_gpio(MT9P012_RESET_GPIO) != 0)
+ return -EIO;
+
+ /* set to output mode */
+ omap_set_gpio_direction(MT9P012_STANDBY_GPIO, 0);
+ /* set to output mode */
+ omap_set_gpio_direction(MT9P012_RESET_GPIO, 0);
+
+ /* STANDBY_GPIO is active HIGH for set LOW to release */
+ omap_set_gpio_dataout(MT9P012_STANDBY_GPIO, 1);
+
+ /* nRESET is active LOW. set HIGH to release reset */
+ omap_set_gpio_dataout(MT9P012_RESET_GPIO, 1);
+
+ /* turn on digital power */
+ enable_fpga_vio_1v8(1);
+#ifdef CONFIG_TWL4030_CORE
+ /* turn on analog power */
+ twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
+ 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
+
+ omap_set_gpio_dataout(MT9P012_STANDBY_GPIO, 0);
+
+ udelay(1000);
+
+ /* have to put sensor to reset to guarantee detection */
+ omap_set_gpio_dataout(MT9P012_RESET_GPIO, 0);
+
+ udelay(1500);
+
+ /* nRESET is active LOW. set HIGH to release reset */
+ omap_set_gpio_dataout(MT9P012_RESET_GPIO, 1);
+ /* give sensor sometime to get out of the reset. Datasheet says
+ 2400 xclks. At 6 MHz, 400 usec are enough */
+ udelay(300);
+ break;
+ case V4L2_POWER_STANDBY:
+ /* stand by */
+ omap_set_gpio_dataout(MT9P012_STANDBY_GPIO, 1);
+ break;
+ case V4L2_POWER_RESUME:
+ /* out of standby */
+ omap_set_gpio_dataout(MT9P012_STANDBY_GPIO, 0);
+ udelay(1000);
+ break;
+ }
+
+ return 0;
+}
+
+static struct v4l2_ifparm ifparm = {
+ .if_type = V4L2_IF_TYPE_BT656,
+ .u = {
+ .bt656 = {
+ .frame_start_on_rising_vs = 1,
+ .latch_clk_inv = 0,
+ .mode = V4L2_IF_TYPE_BT656_MODE_NOBT_10BIT,
+ .clock_min = MT9P012_XCLK_MIN,
+ .clock_max = MT9P012_XCLK_MAX,
+ },
+ },
+};
+
+static int mt9p012_ifparm(struct v4l2_ifparm *p)
+{
+ *p = ifparm;
+ return 0;
+}
+
+static struct mt9p012_platform_data sdp3430_mt9p012_platform_data = {
+ .power_set = mt9p012_sensor_power_set,
+ .priv_data_set = mt9p012_sensor_set_prv_data,
+ .default_regs = NULL,
+ .ifparm = mt9p012_ifparm,
+};
+
+
+static struct i2c_board_info __initdata sdp3430_i2c_board_info[] = {
+#ifdef CONFIG_VIDEO_DW9710
+ {
+ I2C_BOARD_INFO(DW9710_NAME, DW9710_AF_I2C_ADDR),
+ .platform_data = &sdp3430_dw9710_platform_data,
+ },
+#endif
+ {
+ I2C_BOARD_INFO("mt9p012", MT9P012_I2C_ADDR),
+ .platform_data = &sdp3430_mt9p012_platform_data,
+ },
+};
+
+#endif
+
+
static struct platform_device sdp3430_lcd_device = {
.name = "sdp2430_lcd",
.id = -1,
@@ -344,7 +567,12 @@
static int __init omap3430_i2c_init(void)
{
omap_register_i2c_bus(1, 2600, NULL, 0);
+#if defined(CONFIG_VIDEO_MT9P012) || defined(CONFIG_VIDEO_MT9P012_MODULE)
+ omap_register_i2c_bus(2, 400, sdp3430_i2c_board_info,
+ ARRAY_SIZE(sdp3430_i2c_board_info));
+#else
omap_register_i2c_bus(2, 400, NULL, 0);
+#endif
omap_register_i2c_bus(3, 400, NULL, 0);
return 0;
}
--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 15/15] OMAP3 camera driver: OMAP34XXCAM: Add Sensors Support.
2008-08-29 23:44 Aguirre Rodriguez, Sergio Alberto
@ 2008-09-02 6:23 ` Hans Verkuil
2008-09-03 16:49 ` Aguirre Rodriguez, Sergio Alberto
0 siblings, 1 reply; 8+ messages in thread
From: Hans Verkuil @ 2008-09-02 6:23 UTC (permalink / raw)
To: video4linux-list
On Saturday 30 August 2008 01:44:27 Aguirre Rodriguez, Sergio Alberto
wrote:
> From: Sergio Aguirre <saaguirre@ti.com>
>
> OMAP34XX: CAM: Add Sensors Support
>
> This adds support in OMAP34xx SDP board file for Sensor and Lens
> driver.
>
> Signed-off-by: Sergio Aguirre <saaguirre@ti.com>
> ---
> arch/arm/mach-omap2/board-3430sdp.c | 228
++++++++++++++++++++++++++++++++++++
> 1 file changed, 228 insertions(+)
Can you mail the original board-3430sdp.c file? I cannot find this file
in the linux kernel (looked in the latest git tree from Linus).
Regards,
Hans
--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH 15/15] OMAP3 camera driver: OMAP34XXCAM: Add Sensors Support.
2008-09-02 6:23 ` Hans Verkuil
@ 2008-09-03 16:49 ` Aguirre Rodriguez, Sergio Alberto
2008-09-03 19:58 ` Hans Verkuil
0 siblings, 1 reply; 8+ messages in thread
From: Aguirre Rodriguez, Sergio Alberto @ 2008-09-03 16:49 UTC (permalink / raw)
To: Hans Verkuil, video4linux-list@redhat.com
Hans,
This file hasn't yet been merged into Linus tree, these patches are made for applying on top of linux-omap tree, that's why you don't find it there.
We came up to the conclusion that we will only send you all the needed (and reworked with all the comments, of course) v4l2 changes for omap3 camera operation, and send the remaining ones, which are omap-specific, to the linux-omap list.
We'll keep you updated on this between this week and next one.
I appreciate your time. Thanks.
Regards,
Sergio
-----Original Message-----
From: Hans Verkuil [mailto:hverkuil@xs4all.nl]
Sent: Tuesday, September 02, 2008 1:24 AM
To: video4linux-list@redhat.com
Cc: Aguirre Rodriguez, Sergio Alberto
Subject: Re: [PATCH 15/15] OMAP3 camera driver: OMAP34XXCAM: Add Sensors Support.
On Saturday 30 August 2008 01:44:27 Aguirre Rodriguez, Sergio Alberto
wrote:
> From: Sergio Aguirre <saaguirre@ti.com>
>
> OMAP34XX: CAM: Add Sensors Support
>
> This adds support in OMAP34xx SDP board file for Sensor and Lens
> driver.
>
> Signed-off-by: Sergio Aguirre <saaguirre@ti.com>
> ---
> arch/arm/mach-omap2/board-3430sdp.c | 228
++++++++++++++++++++++++++++++++++++
> 1 file changed, 228 insertions(+)
Can you mail the original board-3430sdp.c file? I cannot find this file
in the linux kernel (looked in the latest git tree from Linus).
Regards,
Hans
--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 15/15] OMAP3 camera driver: OMAP34XXCAM: Add Sensors Support.
2008-09-03 16:49 ` Aguirre Rodriguez, Sergio Alberto
@ 2008-09-03 19:58 ` Hans Verkuil
2008-09-03 20:17 ` Jalori, Mohit
0 siblings, 1 reply; 8+ messages in thread
From: Hans Verkuil @ 2008-09-03 19:58 UTC (permalink / raw)
To: Aguirre Rodriguez, Sergio Alberto; +Cc: video4linux-list@redhat.com
On Wednesday 03 September 2008 18:49:32 Aguirre Rodriguez, Sergio
Alberto wrote:
> Hans,
>
> This file hasn't yet been merged into Linus tree, these patches are
> made for applying on top of linux-omap tree, that's why you don't
> find it there.
>
> We came up to the conclusion that we will only send you all the
> needed (and reworked with all the comments, of course) v4l2 changes
> for omap3 camera operation, and send the remaining ones, which are
> omap-specific, to the linux-omap list.
OK, clear.
> We'll keep you updated on this between this week and next one.
>
> I appreciate your time. Thanks.
FYI: I'm on vacation from September 10-29, so I will not be able to do
any reviewing during that time. During my vacation I'll also be at the
Linux conference in Portland and I hope to discuss some extensions to
the v4l API there that could well have an impact on the
previewer/resizer devices that you created.
It would really help me to have a description of what and how those
devices are currently used for so that I can decide whether that will
fit well with my ideas.
See this link for the RFC I wrote:
http://lists-archives.org/video4linux/23652-rfc-add-support-to-query-and-change-connections-inside-a-media-device.html
I think that most of the driver internals are no doubt OK, it's the
public API that I will pay close attention to when I review.
Regards,
Hans
>
> Regards,
> Sergio
>
> -----Original Message-----
> From: Hans Verkuil [mailto:hverkuil@xs4all.nl]
> Sent: Tuesday, September 02, 2008 1:24 AM
> To: video4linux-list@redhat.com
> Cc: Aguirre Rodriguez, Sergio Alberto
> Subject: Re: [PATCH 15/15] OMAP3 camera driver: OMAP34XXCAM: Add
> Sensors Support.
>
> On Saturday 30 August 2008 01:44:27 Aguirre Rodriguez, Sergio Alberto
>
> wrote:
> > From: Sergio Aguirre <saaguirre@ti.com>
> >
> > OMAP34XX: CAM: Add Sensors Support
> >
> > This adds support in OMAP34xx SDP board file for Sensor and Lens
> > driver.
> >
> > Signed-off-by: Sergio Aguirre <saaguirre@ti.com>
> > ---
> > arch/arm/mach-omap2/board-3430sdp.c | 228
>
> ++++++++++++++++++++++++++++++++++++
>
> > 1 file changed, 228 insertions(+)
>
> Can you mail the original board-3430sdp.c file? I cannot find this
> file in the linux kernel (looked in the latest git tree from Linus).
>
> Regards,
>
> Hans
--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH 15/15] OMAP3 camera driver: OMAP34XXCAM: Add Sensors Support.
2008-09-03 19:58 ` Hans Verkuil
@ 2008-09-03 20:17 ` Jalori, Mohit
0 siblings, 0 replies; 8+ messages in thread
From: Jalori, Mohit @ 2008-09-03 20:17 UTC (permalink / raw)
To: Hans Verkuil, Aguirre Rodriguez, Sergio Alberto
Cc: video4linux-list@redhat.com
> -----Original Message-----
> From: video4linux-list-bounces@redhat.com [mailto:video4linux-list-
> bounces@redhat.com] On Behalf Of Hans Verkuil
> Sent: Wednesday, September 03, 2008 2:58 PM
> To: Aguirre Rodriguez, Sergio Alberto
> Cc: video4linux-list@redhat.com
> Subject: Re: [PATCH 15/15] OMAP3 camera driver: OMAP34XXCAM: Add
> Sensors Support.
>
> On Wednesday 03 September 2008 18:49:32 Aguirre Rodriguez, Sergio
> Alberto wrote:
> > Hans,
> >
> > This file hasn't yet been merged into Linus tree, these patches are
> > made for applying on top of linux-omap tree, that's why you don't
> > find it there.
> >
> > We came up to the conclusion that we will only send you all the
> > needed (and reworked with all the comments, of course) v4l2 changes
> > for omap3 camera operation, and send the remaining ones, which are
> > omap-specific, to the linux-omap list.
>
> OK, clear.
>
> > We'll keep you updated on this between this week and next one.
> >
> > I appreciate your time. Thanks.
>
> FYI: I'm on vacation from September 10-29, so I will not be able to do
> any reviewing during that time. During my vacation I'll also be at the
> Linux conference in Portland and I hope to discuss some extensions to
> the v4l API there that could well have an impact on the
> previewer/resizer devices that you created.
>
> It would really help me to have a description of what and how those
> devices are currently used for so that I can decide whether that will
> fit well with my ideas.
>
OMAP Previewer:
It is used for color conversion. It takes in RAW images and generated YUV data. The intent for this is to be able to take RAW image, tune the image pipe parameters and generate the YUV images. If you use the OMAP3 camera driver the default values are good for certain light conditions and can be changed by the private IOCTLs implemented in the camera driver. However for good quality images there is an option of just using the previewer with the tuned coefficients for all HW blocks in the OMAP3 ISP.
It takes in RAW image, you can set the size, you can configure which HW blocks you want to enable for processing and you can select what the parameters will be for these HW blocks. For eg you can select whether you want to use the noise filter or not, If used you can specify the threshold and strength for this filter. It will generate the YUV image. It is possible to link it to the resizer wrapper (which is currently being implemented).
OMAP Resizer:
We use this for stand alone image scaling. It takes in YUV data and rescales (upscale/downscale) to the user requested size. User has the option to specify the resizer coefficients to be used since the default coefficients work well for certain rescaling ratios. Can use used for image view application or even for snapshot/thumbnail generation.
About the interface we implemented them to be custom for the following reasons
1. These blocks are anyway very OMAP HW specific so the ioctls and parameters accepted were kept close to what the HW accepted.
2. Lots of existing customers using older chipsets are using this interface and we wanted to maintain the same interface
3. If we moved to V4L2 based I/f we could have reused format, buffer management related ioctls but still most of the controls are very specific to HW and would not be generic.
We will go through the RFC and let you know our comments.
Regards,
Mohit
> See this link for the RFC I wrote:
>
> http://lists-archives.org/video4linux/23652-rfc-add-support-to-query-
> and-change-connections-inside-a-media-device.html
>
> I think that most of the driver internals are no doubt OK, it's the
> public API that I will pay close attention to when I review.
>
> Regards,
>
> Hans
>
> >
> > Regards,
> > Sergio
> >
> > -----Original Message-----
> > From: Hans Verkuil [mailto:hverkuil@xs4all.nl]
> > Sent: Tuesday, September 02, 2008 1:24 AM
> > To: video4linux-list@redhat.com
> > Cc: Aguirre Rodriguez, Sergio Alberto
> > Subject: Re: [PATCH 15/15] OMAP3 camera driver: OMAP34XXCAM: Add
> > Sensors Support.
> >
> > On Saturday 30 August 2008 01:44:27 Aguirre Rodriguez, Sergio
> Alberto
> >
> > wrote:
> > > From: Sergio Aguirre <saaguirre@ti.com>
> > >
> > > OMAP34XX: CAM: Add Sensors Support
> > >
> > > This adds support in OMAP34xx SDP board file for Sensor and Lens
> > > driver.
> > >
> > > Signed-off-by: Sergio Aguirre <saaguirre@ti.com>
> > > ---
> > > arch/arm/mach-omap2/board-3430sdp.c | 228
> >
> > ++++++++++++++++++++++++++++++++++++
> >
> > > 1 file changed, 228 insertions(+)
> >
> > Can you mail the original board-3430sdp.c file? I cannot find this
> > file in the linux kernel (looked in the latest git tree from Linus).
> >
> > Regards,
> >
> > Hans
>
>
> --
> video4linux-list mailing list
> Unsubscribe mailto:video4linux-list-
> request@redhat.com?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/video4linux-list
--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 15/15] OMAP3 camera driver: OMAP34XXCAM: Add Sensors Support.
2008-08-29 23:34 [PATCH 15/15] OMAP3 camera driver: OMAP34XXCAM: Add Sensors Support Aguirre Rodriguez, Sergio Alberto
@ 2008-09-11 0:17 ` Tony Lindgren
2008-09-12 0:53 ` Aguirre Rodriguez, Sergio Alberto
0 siblings, 1 reply; 8+ messages in thread
From: Tony Lindgren @ 2008-09-11 0:17 UTC (permalink / raw)
To: Aguirre Rodriguez, Sergio Alberto; +Cc: linux-omap@vger.kernel.org
* Aguirre Rodriguez, Sergio Alberto <saaguirre@ti.com> [080829 16:35]:
> From: Sergio Aguirre <saaguirre@ti.com>
>
> OMAP34XX: CAM: Add Sensors Support
>
> This adds support in OMAP34xx SDP board file for Sensor and Lens
> driver.
Should this be in board-3430sdp-camera.c or something like that?
Tony
>
> Signed-off-by: Sergio Aguirre <saaguirre@ti.com>
> ---
> arch/arm/mach-omap2/board-3430sdp.c | 228 ++++++++++++++++++++++++++++++++++++
> 1 file changed, 228 insertions(+)
>
> Index: linux-omap-2.6/arch/arm/mach-omap2/board-3430sdp.c
> ===================================================================
> --- linux-omap-2.6.orig/arch/arm/mach-omap2/board-3430sdp.c 2008-08-25 11:00:18.000000000 -0500
> +++ linux-omap-2.6/arch/arm/mach-omap2/board-3430sdp.c 2008-08-25 12:16:46.000000000 -0500
> @@ -42,6 +42,19 @@
> #include <mach/gpmc.h>
> #include <linux/i2c/twl4030-rtc.h>
>
> +#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_MT9P012) || defined(CONFIG_VIDEO_MT9P012_MODULE)
> +#include <../drivers/media/video/mt9p012.h>
> +#endif
> +#endif
> +
> +#ifdef CONFIG_VIDEO_DW9710
> +#include <../drivers/media/video/dw9710.h>
> +#endif
> +
> #include <asm/io.h>
> #include <asm/delay.h>
> #include <mach/control.h>
> @@ -266,6 +279,216 @@
> },
> };
>
> +#ifdef CONFIG_VIDEO_DW9710
> +static int dw9710_lens_power_set(enum v4l2_power power)
> +{
> +
> + return 0;
> +}
> +
> +static int dw9710_lens_set_prv_data(void *priv)
> +{
> + struct omap34xxcam_hw_config *hwc = priv;
> +
> + hwc->dev_index = 0;
> + hwc->dev_minor = 0;
> + hwc->dev_type = OMAP34XXCAM_SLAVE_LENS;
> +
> + return 0;
> +}
> +
> +static struct dw9710_platform_data sdp3430_dw9710_platform_data = {
> + .power_set = dw9710_lens_power_set,
> + .priv_data_set = dw9710_lens_set_prv_data,
> +};
> +#endif
> +
> +#if defined(CONFIG_VIDEO_MT9P012) || defined(CONFIG_VIDEO_MT9P012_MODULE)
> +static void __iomem *fpga_map_addr;
> +
> +static struct omap34xxcam_sensor_config cam_hwc = {
> + .sensor_isp = 0,
> + .xclk = OMAP34XXCAM_XCLK_A,
> +};
> +
> +static void enable_fpga_vio_1v8(u8 enable)
> +{
> + u16 reg_val;
> +
> + fpga_map_addr = ioremap(DEBUG_BASE, 4096);
> + reg_val = readw(fpga_map_addr + REG_SDP3430_FPGA_GPIO_2);
> +
> + /* Ensure that the SPR_GPIO1_3v3 is 0 - powered off.. 1 is on */
> + if (reg_val & FPGA_SPR_GPIO1_3v3) {
> + reg_val |= FPGA_SPR_GPIO1_3v3;
> + reg_val |= FPGA_GPIO6_DIR_CTRL; /* output mode */
> + writew(reg_val, fpga_map_addr + REG_SDP3430_FPGA_GPIO_2);
> + /* give a few milli sec to settle down
> + * Let the sensor also settle down.. if required..
> + */
> + if (enable)
> + mdelay(10);
> + }
> +
> + if (enable) {
> + reg_val |= FPGA_SPR_GPIO1_3v3 | FPGA_GPIO6_DIR_CTRL;
> + writew(reg_val, fpga_map_addr + REG_SDP3430_FPGA_GPIO_2);
> + }
> + /* Vrise time for the voltage - should be less than 1 ms */
> + mdelay(1);
> +}
> +
> +static int mt9p012_sensor_set_prv_data(void *priv)
> +{
> + struct omap34xxcam_hw_config *hwc = priv;
> +
> + hwc->u.sensor.xclk = cam_hwc.xclk;
> + hwc->u.sensor.sensor_isp = cam_hwc.sensor_isp;
> + hwc->dev_index = 0;
> + hwc->dev_minor = 0;
> + hwc->dev_type = OMAP34XXCAM_SLAVE_SENSOR;
> + return 0;
> +}
> +
> +static struct isp_interface_config mt9p012_if_config = {
> + .ccdc_par_ser = ISP_PARLL,
> + .dataline_shift = 0x1,
> + .hsvs_syncdetect = ISPCTRL_SYNC_DETECT_VSRISE,
> + .vdint0_timing = 0x0,
> + .vdint1_timing = 0x0,
> + .strobe = 0x0,
> + .prestrobe = 0x0,
> + .shutter = 0x0,
> + .u.par.par_bridge = 0x0,
> + .u.par.par_clk_pol = 0x0,
> +};
> +
> +static int mt9p012_sensor_power_set(enum v4l2_power power)
> +{
> + 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);
> + iounmap(fpga_map_addr);
> + omap_free_gpio(MT9P012_STANDBY_GPIO);
> + break;
> + case V4L2_POWER_ON:
> + /* Power Up Sequence */
> + isp_configure_interface(&mt9p012_if_config);
> +
> + /* Request and configure gpio pins */
> + if (omap_request_gpio(MT9P012_STANDBY_GPIO) != 0) {
> + printk(KERN_WARNING "Could not request GPIO %d for "
> + "AF D88\n", MT9P012_STANDBY_GPIO);
> + return -EIO;
> + }
> +
> + /* Request and configure gpio pins */
> + if (omap_request_gpio(MT9P012_RESET_GPIO) != 0)
> + return -EIO;
> +
> + /* set to output mode */
> + omap_set_gpio_direction(MT9P012_STANDBY_GPIO, 0);
> + /* set to output mode */
> + omap_set_gpio_direction(MT9P012_RESET_GPIO, 0);
> +
> + /* STANDBY_GPIO is active HIGH for set LOW to release */
> + omap_set_gpio_dataout(MT9P012_STANDBY_GPIO, 1);
> +
> + /* nRESET is active LOW. set HIGH to release reset */
> + omap_set_gpio_dataout(MT9P012_RESET_GPIO, 1);
> +
> + /* turn on digital power */
> + enable_fpga_vio_1v8(1);
> +#ifdef CONFIG_TWL4030_CORE
> + /* turn on analog power */
> + twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
> + 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
> +
> + omap_set_gpio_dataout(MT9P012_STANDBY_GPIO, 0);
> +
> + udelay(1000);
> +
> + /* have to put sensor to reset to guarantee detection */
> + omap_set_gpio_dataout(MT9P012_RESET_GPIO, 0);
> +
> + udelay(1500);
> +
> + /* nRESET is active LOW. set HIGH to release reset */
> + omap_set_gpio_dataout(MT9P012_RESET_GPIO, 1);
> + /* give sensor sometime to get out of the reset. Datasheet says
> + 2400 xclks. At 6 MHz, 400 usec are enough */
> + udelay(300);
> + break;
> + case V4L2_POWER_STANDBY:
> + /* stand by */
> + omap_set_gpio_dataout(MT9P012_STANDBY_GPIO, 1);
> + break;
> + case V4L2_POWER_RESUME:
> + /* out of standby */
> + omap_set_gpio_dataout(MT9P012_STANDBY_GPIO, 0);
> + udelay(1000);
> + break;
> + }
> +
> + return 0;
> +}
> +
> +static struct v4l2_ifparm ifparm = {
> + .if_type = V4L2_IF_TYPE_BT656,
> + .u = {
> + .bt656 = {
> + .frame_start_on_rising_vs = 1,
> + .latch_clk_inv = 0,
> + .mode = V4L2_IF_TYPE_BT656_MODE_NOBT_10BIT,
> + .clock_min = MT9P012_XCLK_MIN,
> + .clock_max = MT9P012_XCLK_MAX,
> + },
> + },
> +};
> +
> +static int mt9p012_ifparm(struct v4l2_ifparm *p)
> +{
> + *p = ifparm;
> + return 0;
> +}
> +
> +static struct mt9p012_platform_data sdp3430_mt9p012_platform_data = {
> + .power_set = mt9p012_sensor_power_set,
> + .priv_data_set = mt9p012_sensor_set_prv_data,
> + .default_regs = NULL,
> + .ifparm = mt9p012_ifparm,
> +};
> +
> +
> +static struct i2c_board_info __initdata sdp3430_i2c_board_info[] = {
> +#ifdef CONFIG_VIDEO_DW9710
> + {
> + I2C_BOARD_INFO(DW9710_NAME, DW9710_AF_I2C_ADDR),
> + .platform_data = &sdp3430_dw9710_platform_data,
> + },
> +#endif
> + {
> + I2C_BOARD_INFO("mt9p012", MT9P012_I2C_ADDR),
> + .platform_data = &sdp3430_mt9p012_platform_data,
> + },
> +};
> +
> +#endif
> +
> +
> static struct platform_device sdp3430_lcd_device = {
> .name = "sdp2430_lcd",
> .id = -1,
> @@ -344,7 +567,12 @@
> static int __init omap3430_i2c_init(void)
> {
> omap_register_i2c_bus(1, 2600, NULL, 0);
> +#if defined(CONFIG_VIDEO_MT9P012) || defined(CONFIG_VIDEO_MT9P012_MODULE)
> + omap_register_i2c_bus(2, 400, sdp3430_i2c_board_info,
> + ARRAY_SIZE(sdp3430_i2c_board_info));
> +#else
> omap_register_i2c_bus(2, 400, NULL, 0);
> +#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 majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [PATCH 15/15] OMAP3 camera driver: OMAP34XXCAM: Add Sensors Support.
2008-09-11 0:17 ` Tony Lindgren
@ 2008-09-12 0:53 ` Aguirre Rodriguez, Sergio Alberto
0 siblings, 0 replies; 8+ messages in thread
From: Aguirre Rodriguez, Sergio Alberto @ 2008-09-12 0:53 UTC (permalink / raw)
To: Tony Lindgren; +Cc: linux-omap@vger.kernel.org
Not by the moment, perhaps later. We'll leave it there by now.
Please hold this patch, as it is going to change.
Thanks for your time.
Regards,
Sergio
-----Original Message-----
From: Tony Lindgren [mailto:tony@atomide.com]
Sent: Wednesday, September 10, 2008 7:18 PM
To: Aguirre Rodriguez, Sergio Alberto
Cc: linux-omap@vger.kernel.org
Subject: Re: [PATCH 15/15] OMAP3 camera driver: OMAP34XXCAM: Add Sensors Support.
* Aguirre Rodriguez, Sergio Alberto <saaguirre@ti.com> [080829 16:35]:
> From: Sergio Aguirre <saaguirre@ti.com>
>
> OMAP34XX: CAM: Add Sensors Support
>
> This adds support in OMAP34xx SDP board file for Sensor and Lens
> driver.
Should this be in board-3430sdp-camera.c or something like that?
Tony
>
> Signed-off-by: Sergio Aguirre <saaguirre@ti.com>
> ---
> arch/arm/mach-omap2/board-3430sdp.c | 228 ++++++++++++++++++++++++++++++++++++
> 1 file changed, 228 insertions(+)
>
> Index: linux-omap-2.6/arch/arm/mach-omap2/board-3430sdp.c
> ===================================================================
> --- linux-omap-2.6.orig/arch/arm/mach-omap2/board-3430sdp.c 2008-08-25 11:00:18.000000000 -0500
> +++ linux-omap-2.6/arch/arm/mach-omap2/board-3430sdp.c 2008-08-25 12:16:46.000000000 -0500
> @@ -42,6 +42,19 @@
> #include <mach/gpmc.h>
> #include <linux/i2c/twl4030-rtc.h>
>
> +#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_MT9P012) || defined(CONFIG_VIDEO_MT9P012_MODULE)
> +#include <../drivers/media/video/mt9p012.h>
> +#endif
> +#endif
> +
> +#ifdef CONFIG_VIDEO_DW9710
> +#include <../drivers/media/video/dw9710.h>
> +#endif
> +
> #include <asm/io.h>
> #include <asm/delay.h>
> #include <mach/control.h>
> @@ -266,6 +279,216 @@
> },
> };
>
> +#ifdef CONFIG_VIDEO_DW9710
> +static int dw9710_lens_power_set(enum v4l2_power power)
> +{
> +
> + return 0;
> +}
> +
> +static int dw9710_lens_set_prv_data(void *priv)
> +{
> + struct omap34xxcam_hw_config *hwc = priv;
> +
> + hwc->dev_index = 0;
> + hwc->dev_minor = 0;
> + hwc->dev_type = OMAP34XXCAM_SLAVE_LENS;
> +
> + return 0;
> +}
> +
> +static struct dw9710_platform_data sdp3430_dw9710_platform_data = {
> + .power_set = dw9710_lens_power_set,
> + .priv_data_set = dw9710_lens_set_prv_data,
> +};
> +#endif
> +
> +#if defined(CONFIG_VIDEO_MT9P012) || defined(CONFIG_VIDEO_MT9P012_MODULE)
> +static void __iomem *fpga_map_addr;
> +
> +static struct omap34xxcam_sensor_config cam_hwc = {
> + .sensor_isp = 0,
> + .xclk = OMAP34XXCAM_XCLK_A,
> +};
> +
> +static void enable_fpga_vio_1v8(u8 enable)
> +{
> + u16 reg_val;
> +
> + fpga_map_addr = ioremap(DEBUG_BASE, 4096);
> + reg_val = readw(fpga_map_addr + REG_SDP3430_FPGA_GPIO_2);
> +
> + /* Ensure that the SPR_GPIO1_3v3 is 0 - powered off.. 1 is on */
> + if (reg_val & FPGA_SPR_GPIO1_3v3) {
> + reg_val |= FPGA_SPR_GPIO1_3v3;
> + reg_val |= FPGA_GPIO6_DIR_CTRL; /* output mode */
> + writew(reg_val, fpga_map_addr + REG_SDP3430_FPGA_GPIO_2);
> + /* give a few milli sec to settle down
> + * Let the sensor also settle down.. if required..
> + */
> + if (enable)
> + mdelay(10);
> + }
> +
> + if (enable) {
> + reg_val |= FPGA_SPR_GPIO1_3v3 | FPGA_GPIO6_DIR_CTRL;
> + writew(reg_val, fpga_map_addr + REG_SDP3430_FPGA_GPIO_2);
> + }
> + /* Vrise time for the voltage - should be less than 1 ms */
> + mdelay(1);
> +}
> +
> +static int mt9p012_sensor_set_prv_data(void *priv)
> +{
> + struct omap34xxcam_hw_config *hwc = priv;
> +
> + hwc->u.sensor.xclk = cam_hwc.xclk;
> + hwc->u.sensor.sensor_isp = cam_hwc.sensor_isp;
> + hwc->dev_index = 0;
> + hwc->dev_minor = 0;
> + hwc->dev_type = OMAP34XXCAM_SLAVE_SENSOR;
> + return 0;
> +}
> +
> +static struct isp_interface_config mt9p012_if_config = {
> + .ccdc_par_ser = ISP_PARLL,
> + .dataline_shift = 0x1,
> + .hsvs_syncdetect = ISPCTRL_SYNC_DETECT_VSRISE,
> + .vdint0_timing = 0x0,
> + .vdint1_timing = 0x0,
> + .strobe = 0x0,
> + .prestrobe = 0x0,
> + .shutter = 0x0,
> + .u.par.par_bridge = 0x0,
> + .u.par.par_clk_pol = 0x0,
> +};
> +
> +static int mt9p012_sensor_power_set(enum v4l2_power power)
> +{
> + 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);
> + iounmap(fpga_map_addr);
> + omap_free_gpio(MT9P012_STANDBY_GPIO);
> + break;
> + case V4L2_POWER_ON:
> + /* Power Up Sequence */
> + isp_configure_interface(&mt9p012_if_config);
> +
> + /* Request and configure gpio pins */
> + if (omap_request_gpio(MT9P012_STANDBY_GPIO) != 0) {
> + printk(KERN_WARNING "Could not request GPIO %d for "
> + "AF D88\n", MT9P012_STANDBY_GPIO);
> + return -EIO;
> + }
> +
> + /* Request and configure gpio pins */
> + if (omap_request_gpio(MT9P012_RESET_GPIO) != 0)
> + return -EIO;
> +
> + /* set to output mode */
> + omap_set_gpio_direction(MT9P012_STANDBY_GPIO, 0);
> + /* set to output mode */
> + omap_set_gpio_direction(MT9P012_RESET_GPIO, 0);
> +
> + /* STANDBY_GPIO is active HIGH for set LOW to release */
> + omap_set_gpio_dataout(MT9P012_STANDBY_GPIO, 1);
> +
> + /* nRESET is active LOW. set HIGH to release reset */
> + omap_set_gpio_dataout(MT9P012_RESET_GPIO, 1);
> +
> + /* turn on digital power */
> + enable_fpga_vio_1v8(1);
> +#ifdef CONFIG_TWL4030_CORE
> + /* turn on analog power */
> + twl4030_i2c_write_u8(TWL4030_MODULE_PM_RECEIVER,
> + 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
> +
> + omap_set_gpio_dataout(MT9P012_STANDBY_GPIO, 0);
> +
> + udelay(1000);
> +
> + /* have to put sensor to reset to guarantee detection */
> + omap_set_gpio_dataout(MT9P012_RESET_GPIO, 0);
> +
> + udelay(1500);
> +
> + /* nRESET is active LOW. set HIGH to release reset */
> + omap_set_gpio_dataout(MT9P012_RESET_GPIO, 1);
> + /* give sensor sometime to get out of the reset. Datasheet says
> + 2400 xclks. At 6 MHz, 400 usec are enough */
> + udelay(300);
> + break;
> + case V4L2_POWER_STANDBY:
> + /* stand by */
> + omap_set_gpio_dataout(MT9P012_STANDBY_GPIO, 1);
> + break;
> + case V4L2_POWER_RESUME:
> + /* out of standby */
> + omap_set_gpio_dataout(MT9P012_STANDBY_GPIO, 0);
> + udelay(1000);
> + break;
> + }
> +
> + return 0;
> +}
> +
> +static struct v4l2_ifparm ifparm = {
> + .if_type = V4L2_IF_TYPE_BT656,
> + .u = {
> + .bt656 = {
> + .frame_start_on_rising_vs = 1,
> + .latch_clk_inv = 0,
> + .mode = V4L2_IF_TYPE_BT656_MODE_NOBT_10BIT,
> + .clock_min = MT9P012_XCLK_MIN,
> + .clock_max = MT9P012_XCLK_MAX,
> + },
> + },
> +};
> +
> +static int mt9p012_ifparm(struct v4l2_ifparm *p)
> +{
> + *p = ifparm;
> + return 0;
> +}
> +
> +static struct mt9p012_platform_data sdp3430_mt9p012_platform_data = {
> + .power_set = mt9p012_sensor_power_set,
> + .priv_data_set = mt9p012_sensor_set_prv_data,
> + .default_regs = NULL,
> + .ifparm = mt9p012_ifparm,
> +};
> +
> +
> +static struct i2c_board_info __initdata sdp3430_i2c_board_info[] = {
> +#ifdef CONFIG_VIDEO_DW9710
> + {
> + I2C_BOARD_INFO(DW9710_NAME, DW9710_AF_I2C_ADDR),
> + .platform_data = &sdp3430_dw9710_platform_data,
> + },
> +#endif
> + {
> + I2C_BOARD_INFO("mt9p012", MT9P012_I2C_ADDR),
> + .platform_data = &sdp3430_mt9p012_platform_data,
> + },
> +};
> +
> +#endif
> +
> +
> static struct platform_device sdp3430_lcd_device = {
> .name = "sdp2430_lcd",
> .id = -1,
> @@ -344,7 +567,12 @@
> static int __init omap3430_i2c_init(void)
> {
> omap_register_i2c_bus(1, 2600, NULL, 0);
> +#if defined(CONFIG_VIDEO_MT9P012) || defined(CONFIG_VIDEO_MT9P012_MODULE)
> + omap_register_i2c_bus(2, 400, sdp3430_i2c_board_info,
> + ARRAY_SIZE(sdp3430_i2c_board_info));
> +#else
> omap_register_i2c_bus(2, 400, NULL, 0);
> +#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 majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-09-12 0:53 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-29 23:34 [PATCH 15/15] OMAP3 camera driver: OMAP34XXCAM: Add Sensors Support Aguirre Rodriguez, Sergio Alberto
2008-09-11 0:17 ` Tony Lindgren
2008-09-12 0:53 ` Aguirre Rodriguez, Sergio Alberto
-- strict thread matches above, loose matches on Subject: below --
2008-08-29 23:44 Aguirre Rodriguez, Sergio Alberto
2008-09-02 6:23 ` Hans Verkuil
2008-09-03 16:49 ` Aguirre Rodriguez, Sergio Alberto
2008-09-03 19:58 ` Hans Verkuil
2008-09-03 20:17 ` Jalori, Mohit
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.