[v2,5/6] OMAP1: Amstrad Delta: add support for camera

Message ID 201009110327.31407.jkrzyszt@tis.icnet.pl (mailing list archive)
State Superseded, archived
Headers

Commit Message

Janusz Krzysztofik Sept. 11, 2010, 1:27 a.m. UTC
  This patch adds configuration data and initialization code required for camera 
support to the Amstrad Delta board.

Three devices are declared: SoC camera, OMAP1 camera interface and OV6650 
sensor.

Default 12MHz clock has been selected for driving the sensor. Pixel clock has 
been limited to get reasonable frame rates, not exceeding the board 
capabilities. Since both devices (interface and sensor) support both pixel 
clock polarities, decision on polarity selection has been left to drivers.
Interface GPIO line has been found not functional, thus not configured.

Created and tested against linux-2.6.36-rc3.

Works on top of previous patches from the series, at least 1/6, 2/6 and 3/6.

Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
---
v1->v2 changes:
- no functional changes,
- refreshed against linux-2.6.36-rc3


 arch/arm/mach-omap1/board-ams-delta.c |   45 ++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)


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

Comments

Tony Lindgren Sept. 23, 2010, 11:14 p.m. UTC | #1
* Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> [100910 18:20]:
> This patch adds configuration data and initialization code required for camera 
> support to the Amstrad Delta board.
> 
> Three devices are declared: SoC camera, OMAP1 camera interface and OV6650 
> sensor.
> 
> Default 12MHz clock has been selected for driving the sensor. Pixel clock has 
> been limited to get reasonable frame rates, not exceeding the board 
> capabilities. Since both devices (interface and sensor) support both pixel 
> clock polarities, decision on polarity selection has been left to drivers.
> Interface GPIO line has been found not functional, thus not configured.
> 
> Created and tested against linux-2.6.36-rc3.
> 
> Works on top of previous patches from the series, at least 1/6, 2/6 and 3/6.

Queuing these last two patches of the series (5/6 and 6/6) for the upcoming
merge window.

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  
Tony Lindgren Sept. 23, 2010, 11:26 p.m. UTC | #2
* Tony Lindgren <tony@atomide.com> [100923 16:06]:
> * Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> [100910 18:20]:
> > This patch adds configuration data and initialization code required for camera 
> > support to the Amstrad Delta board.
> > 
> > Three devices are declared: SoC camera, OMAP1 camera interface and OV6650 
> > sensor.
> > 
> > Default 12MHz clock has been selected for driving the sensor. Pixel clock has 
> > been limited to get reasonable frame rates, not exceeding the board 
> > capabilities. Since both devices (interface and sensor) support both pixel 
> > clock polarities, decision on polarity selection has been left to drivers.
> > Interface GPIO line has been found not functional, thus not configured.
> > 
> > Created and tested against linux-2.6.36-rc3.
> > 
> > Works on top of previous patches from the series, at least 1/6, 2/6 and 3/6.
> 
> Queuing these last two patches of the series (5/6 and 6/6) for the upcoming
> merge window.

BTW, these still depend on updated 2/6 to make compile happy.

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  
Janusz Krzysztofik Sept. 24, 2010, midnight UTC | #3
Friday 24 September 2010 01:26:17 Tony Lindgren napisa?(a):
> * Tony Lindgren <tony@atomide.com> [100923 16:06]:
> > * Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> [100910 18:20]:
> > > This patch adds configuration data and initialization code required for
> > > camera support to the Amstrad Delta board.
> > >
> > > Three devices are declared: SoC camera, OMAP1 camera interface and
> > > OV6650 sensor.
> > >
> > > Default 12MHz clock has been selected for driving the sensor. Pixel
> > > clock has been limited to get reasonable frame rates, not exceeding the
> > > board capabilities. Since both devices (interface and sensor) support
> > > both pixel clock polarities, decision on polarity selection has been
> > > left to drivers. Interface GPIO line has been found not functional,
> > > thus not configured.
> > >
> > > Created and tested against linux-2.6.36-rc3.
> > >
> > > Works on top of previous patches from the series, at least 1/6, 2/6 and
> > > 3/6.
> >
> > Queuing these last two patches of the series (5/6 and 6/6) for the
> > upcoming merge window.
>
> BTW, these still depend on updated 2/6 to make compile happy.

Not so simple: still depends on struct omap1_cam_platform_data definition from 
<media/omap1_camera.h>, included from <mach/camera.h>. Are you ready to 
accept another temporary workaround?

Thanks,
Janusz


>
> Tony
> --
> 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


--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  
Tony Lindgren Sept. 24, 2010, 12:49 a.m. UTC | #4
* Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> [100923 16:52]:
> Friday 24 September 2010 01:26:17 Tony Lindgren napisa?(a):
> > * Tony Lindgren <tony@atomide.com> [100923 16:06]:
> > > * Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> [100910 18:20]:
> > > > This patch adds configuration data and initialization code required for
> > > > camera support to the Amstrad Delta board.
> > > >
> > > > Three devices are declared: SoC camera, OMAP1 camera interface and
> > > > OV6650 sensor.
> > > >
> > > > Default 12MHz clock has been selected for driving the sensor. Pixel
> > > > clock has been limited to get reasonable frame rates, not exceeding the
> > > > board capabilities. Since both devices (interface and sensor) support
> > > > both pixel clock polarities, decision on polarity selection has been
> > > > left to drivers. Interface GPIO line has been found not functional,
> > > > thus not configured.
> > > >
> > > > Created and tested against linux-2.6.36-rc3.
> > > >
> > > > Works on top of previous patches from the series, at least 1/6, 2/6 and
> > > > 3/6.
> > >
> > > Queuing these last two patches of the series (5/6 and 6/6) for the
> > > upcoming merge window.
> >
> > BTW, these still depend on updated 2/6 to make compile happy.
> 
> Not so simple: still depends on struct omap1_cam_platform_data definition from 
> <media/omap1_camera.h>, included from <mach/camera.h>. Are you ready to 
> accept another temporary workaround?

Heh I guess so. Or do you want to queue everything via linux-media?

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  
Guennadi Liakhovetski Sept. 24, 2010, 6:57 a.m. UTC | #5
On Thu, 23 Sep 2010, Tony Lindgren wrote:

> * Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> [100923 16:52]:
> > Friday 24 September 2010 01:26:17 Tony Lindgren napisa?(a):
> > > * Tony Lindgren <tony@atomide.com> [100923 16:06]:
> > > > * Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> [100910 18:20]:
> > > > > This patch adds configuration data and initialization code required for
> > > > > camera support to the Amstrad Delta board.
> > > > >
> > > > > Three devices are declared: SoC camera, OMAP1 camera interface and
> > > > > OV6650 sensor.
> > > > >
> > > > > Default 12MHz clock has been selected for driving the sensor. Pixel
> > > > > clock has been limited to get reasonable frame rates, not exceeding the
> > > > > board capabilities. Since both devices (interface and sensor) support
> > > > > both pixel clock polarities, decision on polarity selection has been
> > > > > left to drivers. Interface GPIO line has been found not functional,
> > > > > thus not configured.
> > > > >
> > > > > Created and tested against linux-2.6.36-rc3.
> > > > >
> > > > > Works on top of previous patches from the series, at least 1/6, 2/6 and
> > > > > 3/6.
> > > >
> > > > Queuing these last two patches of the series (5/6 and 6/6) for the
> > > > upcoming merge window.
> > >
> > > BTW, these still depend on updated 2/6 to make compile happy.
> > 
> > Not so simple: still depends on struct omap1_cam_platform_data definition from 
> > <media/omap1_camera.h>, included from <mach/camera.h>. Are you ready to 
> > accept another temporary workaround?
> 
> Heh I guess so. Or do you want to queue everything via linux-media?

Yes, we often have to select via which tree to go, then the maintainer of 
the other tree just acks the patches. Sometimes we push them via different 
trees and try to enforce a specific merge order...

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  
Janusz Krzysztofik Sept. 24, 2010, 11:08 a.m. UTC | #6
Friday 24 September 2010 08:57:06 Guennadi Liakhovetski napisa?(a):
> On Thu, 23 Sep 2010, Tony Lindgren wrote:
> > * Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> [100923 16:52]:
> > > Friday 24 September 2010 01:26:17 Tony Lindgren napisa?(a):
> > > > * Tony Lindgren <tony@atomide.com> [100923 16:06]:
> > > > > * Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> [100910 18:20]:
> > > > > > This patch adds configuration data and initialization code
> > > > > > required for camera support to the Amstrad Delta board.
> > > > > >
> > > > > > Three devices are declared: SoC camera, OMAP1 camera interface
> > > > > > and OV6650 sensor.
> > > > > >
> > > > > > Default 12MHz clock has been selected for driving the sensor.
> > > > > > Pixel clock has been limited to get reasonable frame rates, not
> > > > > > exceeding the board capabilities. Since both devices (interface
> > > > > > and sensor) support both pixel clock polarities, decision on
> > > > > > polarity selection has been left to drivers. Interface GPIO line
> > > > > > has been found not functional, thus not configured.
> > > > > >
> > > > > > Created and tested against linux-2.6.36-rc3.
> > > > > >
> > > > > > Works on top of previous patches from the series, at least 1/6,
> > > > > > 2/6 and 3/6.
> > > > >
> > > > > Queuing these last two patches of the series (5/6 and 6/6) for the
> > > > > upcoming merge window.
> > > >
> > > > BTW, these still depend on updated 2/6 to make compile happy.
> > >
> > > Not so simple: still depends on struct omap1_cam_platform_data
> > > definition from <media/omap1_camera.h>, included from <mach/camera.h>.
> > > Are you ready to accept another temporary workaround?
> >
> > Heh I guess so. Or do you want to queue everything via linux-media?

AFAIK we can expect my arch/arm/mach-omap1/devices.c changes already resulting 
in a confilct with some ASoC OMAP related changes going via the sound tree, 
so the 2/6 should be better queued via the OMAP tree for Tony to keep control 
over it, with the rest of the seriers going either way.

> Yes, we often have to select via which tree to go, then the maintainer of
> the other tree just acks the patches. Sometimes we push them via different
> trees and try to enforce a specific merge order...

What about

+ void omap1_set_camera_info(struct omap1_cam_platform_data *);

put temporarily into to the arch/arm/mach-omap1/board-ams-delta.c instead of 
including <mach/camera.h>, that could be replaced with <media/omap1_camera.h> 
then? May sound better than redefining struct omap1_cam_platform_data there, 
and should be safe to push everything except 2/6 via the media tree.

Then, replace the above hack back with #include <mach/camera.h> as a fix after 
both are merged.

Thanks,
Janusz
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  

Patch

diff -upr linux-2.6.36-rc3.orig/arch/arm/mach-omap1/board-ams-delta.c 
linux-2.6.36-rc3/arch/arm/mach-omap1/board-ams-delta.c
--- linux-2.6.36-rc3.orig/arch/arm/mach-omap1/board-ams-delta.c	2010-09-03 22:29:00.000000000 +0200
+++ linux-2.6.36-rc3/arch/arm/mach-omap1/board-ams-delta.c	2010-09-10 22:01:24.000000000 +0200
@@ -19,6 +19,8 @@ 
 #include <linux/platform_device.h>
 #include <linux/serial_8250.h>
 
+#include <media/soc_camera.h>
+
 #include <asm/serial.h>
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
@@ -32,6 +34,7 @@ 
 #include <plat/usb.h>
 #include <plat/board.h>
 #include <plat/common.h>
+#include <mach/camera.h>
 
 #include <mach/ams-delta-fiq.h>
 
@@ -213,10 +216,37 @@  static struct platform_device ams_delta_
 	.id	= -1
 };
 
+static struct i2c_board_info ams_delta_camera_board_info[] = {
+	{
+		I2C_BOARD_INFO("ov6650", 0x60),
+	},
+};
+
+static struct soc_camera_link __initdata ams_delta_iclink = {
+	.bus_id         = 0,	/* OMAP1 SoC camera bus */
+	.i2c_adapter_id = 1,
+	.board_info     = &ams_delta_camera_board_info[0],
+	.module_name    = "ov6650",
+};
+
+static struct platform_device ams_delta_camera_device = {
+	.name   = "soc-camera-pdrv",
+	.id     = 0,
+	.dev    = {
+		.platform_data = &ams_delta_iclink,
+	},
+};
+
+static struct omap1_cam_platform_data ams_delta_camera_platform_data = {
+	.camexclk_khz	= 12000,	/* default 12MHz clock, no extra DPLL */
+	.lclk_khz_max	= 1334,		/* results in 5fps CIF, 10fps QCIF */
+};
+
 static struct platform_device *ams_delta_devices[] __initdata = {
 	&ams_delta_kp_device,
 	&ams_delta_lcd_device,
 	&ams_delta_led_device,
+	&ams_delta_camera_device,
 };
 
 static void __init ams_delta_init(void)
@@ -225,6 +255,20 @@  static void __init ams_delta_init(void)
 	omap_cfg_reg(UART1_TX);
 	omap_cfg_reg(UART1_RTS);
 
+	/* parallel camera interface */
+	omap_cfg_reg(H19_1610_CAM_EXCLK);
+	omap_cfg_reg(J15_1610_CAM_LCLK);
+	omap_cfg_reg(L18_1610_CAM_VS);
+	omap_cfg_reg(L15_1610_CAM_HS);
+	omap_cfg_reg(L19_1610_CAM_D0);
+	omap_cfg_reg(K14_1610_CAM_D1);
+	omap_cfg_reg(K15_1610_CAM_D2);
+	omap_cfg_reg(K19_1610_CAM_D3);
+	omap_cfg_reg(K18_1610_CAM_D4);
+	omap_cfg_reg(J14_1610_CAM_D5);
+	omap_cfg_reg(J19_1610_CAM_D6);
+	omap_cfg_reg(J18_1610_CAM_D7);
+
 	iotable_init(ams_delta_io_desc, ARRAY_SIZE(ams_delta_io_desc));
 
 	omap_board_config = ams_delta_config;
@@ -236,6 +280,7 @@  static void __init ams_delta_init(void)
 	ams_delta_latch2_write(~0, 0);
 
 	omap1_usb_init(&ams_delta_usb_config);
+	omap1_set_camera_info(&ams_delta_camera_platform_data);
 	platform_add_devices(ams_delta_devices, ARRAY_SIZE(ams_delta_devices));
 
 #ifdef CONFIG_AMS_DELTA_FIQ