aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boards
diff options
context:
space:
mode:
authorKuninori Morimoto <morimoto.kuninori@renesas.com>2009-01-21 19:38:31 -0500
committerPaul Mundt <lethal@linux-sh.org>2009-03-30 19:08:47 -0400
commit47131258765e3561475822a7838b7ed90e2f6990 (patch)
tree5252d20514296ca8f5cb04eb4a6ef6bc195de17d /arch/sh/boards
parent3b4df71b364e230fb7b02356d1f8fce64838ddc7 (diff)
sh: ap325rxa: Add ov772x support, again.
Now that the V4L bits have finally settled.. This patch adds support for a secondary ov772x camera on ap325rxa. This is supported in addition to the regular soc_camera_platform camera. Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com> Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/sh/boards')
-rw-r--r--arch/sh/boards/board-ap325rxa.c53
1 files changed, 50 insertions, 3 deletions
diff --git a/arch/sh/boards/board-ap325rxa.c b/arch/sh/boards/board-ap325rxa.c
index e27655b8a98d..ca285f34dc3f 100644
--- a/arch/sh/boards/board-ap325rxa.c
+++ b/arch/sh/boards/board-ap325rxa.c
@@ -22,6 +22,7 @@
22#include <linux/gpio.h> 22#include <linux/gpio.h>
23#include <linux/spi/spi.h> 23#include <linux/spi/spi.h>
24#include <linux/spi/spi_gpio.h> 24#include <linux/spi/spi_gpio.h>
25#include <media/ov772x.h>
25#include <media/soc_camera.h> 26#include <media/soc_camera.h>
26#include <media/soc_camera_platform.h> 27#include <media/soc_camera_platform.h>
27#include <media/sh_mobile_ceu.h> 28#include <media/sh_mobile_ceu.h>
@@ -235,6 +236,7 @@ static void camera_power(int val)
235} 236}
236 237
237#ifdef CONFIG_I2C 238#ifdef CONFIG_I2C
239/* support for the old ncm03j camera */
238static unsigned char camera_ncm03j_magic[] = 240static unsigned char camera_ncm03j_magic[] =
239{ 241{
240 0x87, 0x00, 0x88, 0x08, 0x89, 0x01, 0x8A, 0xE8, 242 0x87, 0x00, 0x88, 0x08, 0x89, 0x01, 0x8A, 0xE8,
@@ -255,6 +257,23 @@ static unsigned char camera_ncm03j_magic[] =
255 0x63, 0xD4, 0x64, 0xEA, 0xD6, 0x0F, 257 0x63, 0xD4, 0x64, 0xEA, 0xD6, 0x0F,
256}; 258};
257 259
260static int camera_probe(void)
261{
262 struct i2c_adapter *a = i2c_get_adapter(0);
263 struct i2c_msg msg;
264 int ret;
265
266 camera_power(1);
267 msg.addr = 0x6e;
268 msg.buf = camera_ncm03j_magic;
269 msg.len = 2;
270 msg.flags = 0;
271 ret = i2c_transfer(a, &msg, 1);
272 camera_power(0);
273
274 return ret;
275}
276
258static int camera_set_capture(struct soc_camera_platform_info *info, 277static int camera_set_capture(struct soc_camera_platform_info *info,
259 int enable) 278 int enable)
260{ 279{
@@ -306,8 +325,35 @@ static struct platform_device camera_device = {
306 .platform_data = &camera_info, 325 .platform_data = &camera_info,
307 }, 326 },
308}; 327};
328
329static int __init camera_setup(void)
330{
331 if (camera_probe() > 0)
332 platform_device_register(&camera_device);
333
334 return 0;
335}
336late_initcall(camera_setup);
337
309#endif /* CONFIG_I2C */ 338#endif /* CONFIG_I2C */
310 339
340static int ov7725_power(struct device *dev, int mode)
341{
342 camera_power(0);
343 if (mode)
344 camera_power(1);
345
346 return 0;
347}
348
349static struct ov772x_camera_info ov7725_info = {
350 .buswidth = SOCAM_DATAWIDTH_8,
351 .flags = OV772X_FLAG_VFLIP | OV772X_FLAG_HFLIP,
352 .link = {
353 .power = ov7725_power,
354 },
355};
356
311static struct sh_mobile_ceu_info sh_mobile_ceu_info = { 357static struct sh_mobile_ceu_info sh_mobile_ceu_info = {
312 .flags = SOCAM_PCLK_SAMPLE_RISING | SOCAM_HSYNC_ACTIVE_HIGH | 358 .flags = SOCAM_PCLK_SAMPLE_RISING | SOCAM_HSYNC_ACTIVE_HIGH |
313 SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_DATA_ACTIVE_HIGH | SOCAM_MASTER | 359 SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_DATA_ACTIVE_HIGH | SOCAM_MASTER |
@@ -359,9 +405,6 @@ static struct platform_device *ap325rxa_devices[] __initdata = {
359 &ap325rxa_nor_flash_device, 405 &ap325rxa_nor_flash_device,
360 &lcdc_device, 406 &lcdc_device,
361 &ceu_device, 407 &ceu_device,
362#ifdef CONFIG_I2C
363 &camera_device,
364#endif
365 &nand_flash_device, 408 &nand_flash_device,
366 &sdcard_cn3_device, 409 &sdcard_cn3_device,
367}; 410};
@@ -370,6 +413,10 @@ static struct i2c_board_info __initdata ap325rxa_i2c_devices[] = {
370 { 413 {
371 I2C_BOARD_INFO("pcf8563", 0x51), 414 I2C_BOARD_INFO("pcf8563", 0x51),
372 }, 415 },
416 {
417 I2C_BOARD_INFO("ov772x", 0x21),
418 .platform_data = &ov7725_info,
419 },
373}; 420};
374 421
375static struct spi_board_info ap325rxa_spi_devices[] = { 422static struct spi_board_info ap325rxa_spi_devices[] = {