diff options
author | Kuninori Morimoto <morimoto.kuninori@renesas.com> | 2009-01-21 19:38:31 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2009-01-28 21:56:02 -0500 |
commit | 7a65d245fa32d937409e2fc30bb24a85488090de (patch) | |
tree | 611e160a0f21f1261bce9ba37d860b9df59804b8 /arch/sh/boards | |
parent | 86746284e20411c66e25bddac391ba821560522b (diff) |
sh: ap325rxa: Add ov772x support.
This patch add ov772x camera settings to ap325,
Old camera is still supported. And it will be 2nd camera
if you select ov772x and soc_camera_platform in same time.
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.c | 53 |
1 files changed, 50 insertions, 3 deletions
diff --git a/arch/sh/boards/board-ap325rxa.c b/arch/sh/boards/board-ap325rxa.c index 72da416f6162..7c35787d29b4 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_platform.h> | 26 | #include <media/soc_camera_platform.h> |
26 | #include <media/sh_mobile_ceu.h> | 27 | #include <media/sh_mobile_ceu.h> |
27 | #include <video/sh_mobile_lcdc.h> | 28 | #include <video/sh_mobile_lcdc.h> |
@@ -223,6 +224,7 @@ static void camera_power(int val) | |||
223 | } | 224 | } |
224 | 225 | ||
225 | #ifdef CONFIG_I2C | 226 | #ifdef CONFIG_I2C |
227 | /* support for the old ncm03j camera */ | ||
226 | static unsigned char camera_ncm03j_magic[] = | 228 | static unsigned char camera_ncm03j_magic[] = |
227 | { | 229 | { |
228 | 0x87, 0x00, 0x88, 0x08, 0x89, 0x01, 0x8A, 0xE8, | 230 | 0x87, 0x00, 0x88, 0x08, 0x89, 0x01, 0x8A, 0xE8, |
@@ -243,6 +245,23 @@ static unsigned char camera_ncm03j_magic[] = | |||
243 | 0x63, 0xD4, 0x64, 0xEA, 0xD6, 0x0F, | 245 | 0x63, 0xD4, 0x64, 0xEA, 0xD6, 0x0F, |
244 | }; | 246 | }; |
245 | 247 | ||
248 | static int camera_probe(void) | ||
249 | { | ||
250 | struct i2c_adapter *a = i2c_get_adapter(0); | ||
251 | struct i2c_msg msg; | ||
252 | int ret; | ||
253 | |||
254 | camera_power(1); | ||
255 | msg.addr = 0x6e; | ||
256 | msg.buf = camera_ncm03j_magic; | ||
257 | msg.len = 2; | ||
258 | msg.flags = 0; | ||
259 | ret = i2c_transfer(a, &msg, 1); | ||
260 | camera_power(0); | ||
261 | |||
262 | return ret; | ||
263 | } | ||
264 | |||
246 | static int camera_set_capture(struct soc_camera_platform_info *info, | 265 | static int camera_set_capture(struct soc_camera_platform_info *info, |
247 | int enable) | 266 | int enable) |
248 | { | 267 | { |
@@ -294,8 +313,35 @@ static struct platform_device camera_device = { | |||
294 | .platform_data = &camera_info, | 313 | .platform_data = &camera_info, |
295 | }, | 314 | }, |
296 | }; | 315 | }; |
316 | |||
317 | static int __init camera_setup(void) | ||
318 | { | ||
319 | if (camera_probe() > 0) | ||
320 | platform_device_register(&camera_device); | ||
321 | |||
322 | return 0; | ||
323 | } | ||
324 | late_initcall(camera_setup); | ||
325 | |||
297 | #endif /* CONFIG_I2C */ | 326 | #endif /* CONFIG_I2C */ |
298 | 327 | ||
328 | static int ov7725_power(struct device *dev, int mode) | ||
329 | { | ||
330 | camera_power(0); | ||
331 | if (mode) | ||
332 | camera_power(1); | ||
333 | |||
334 | return 0; | ||
335 | } | ||
336 | |||
337 | static struct ov772x_camera_info ov7725_info = { | ||
338 | .buswidth = SOCAM_DATAWIDTH_8, | ||
339 | .flags = OV772X_FLAG_VFLIP | OV772X_FLAG_HFLIP, | ||
340 | .link = { | ||
341 | .power = ov7725_power, | ||
342 | }, | ||
343 | }; | ||
344 | |||
299 | static struct sh_mobile_ceu_info sh_mobile_ceu_info = { | 345 | static struct sh_mobile_ceu_info sh_mobile_ceu_info = { |
300 | .flags = SOCAM_PCLK_SAMPLE_RISING | SOCAM_HSYNC_ACTIVE_HIGH | | 346 | .flags = SOCAM_PCLK_SAMPLE_RISING | SOCAM_HSYNC_ACTIVE_HIGH | |
301 | SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_MASTER | SOCAM_DATAWIDTH_8, | 347 | SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_MASTER | SOCAM_DATAWIDTH_8, |
@@ -346,9 +392,6 @@ static struct platform_device *ap325rxa_devices[] __initdata = { | |||
346 | &ap325rxa_nor_flash_device, | 392 | &ap325rxa_nor_flash_device, |
347 | &lcdc_device, | 393 | &lcdc_device, |
348 | &ceu_device, | 394 | &ceu_device, |
349 | #ifdef CONFIG_I2C | ||
350 | &camera_device, | ||
351 | #endif | ||
352 | &nand_flash_device, | 395 | &nand_flash_device, |
353 | &sdcard_cn3_device, | 396 | &sdcard_cn3_device, |
354 | }; | 397 | }; |
@@ -357,6 +400,10 @@ static struct i2c_board_info __initdata ap325rxa_i2c_devices[] = { | |||
357 | { | 400 | { |
358 | I2C_BOARD_INFO("pcf8563", 0x51), | 401 | I2C_BOARD_INFO("pcf8563", 0x51), |
359 | }, | 402 | }, |
403 | { | ||
404 | I2C_BOARD_INFO("ov772x", 0x21), | ||
405 | .platform_data = &ov7725_info, | ||
406 | }, | ||
360 | }; | 407 | }; |
361 | 408 | ||
362 | static struct spi_board_info ap325rxa_spi_devices[] = { | 409 | static struct spi_board_info ap325rxa_spi_devices[] = { |