aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/boards/board-ap325rxa.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh/boards/board-ap325rxa.c')
-rw-r--r--arch/sh/boards/board-ap325rxa.c57
1 files changed, 51 insertions, 6 deletions
diff --git a/arch/sh/boards/board-ap325rxa.c b/arch/sh/boards/board-ap325rxa.c
index e27655b8a98d..912458f666eb 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,12 +325,37 @@ 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 = SH_CEU_FLAG_USE_8BIT_BUS,
313 SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_DATA_ACTIVE_HIGH | SOCAM_MASTER |
314 SOCAM_DATAWIDTH_8,
315}; 359};
316 360
317static struct resource ceu_resources[] = { 361static struct resource ceu_resources[] = {
@@ -359,9 +403,6 @@ static struct platform_device *ap325rxa_devices[] __initdata = {
359 &ap325rxa_nor_flash_device, 403 &ap325rxa_nor_flash_device,
360 &lcdc_device, 404 &lcdc_device,
361 &ceu_device, 405 &ceu_device,
362#ifdef CONFIG_I2C
363 &camera_device,
364#endif
365 &nand_flash_device, 406 &nand_flash_device,
366 &sdcard_cn3_device, 407 &sdcard_cn3_device,
367}; 408};
@@ -370,6 +411,10 @@ static struct i2c_board_info __initdata ap325rxa_i2c_devices[] = {
370 { 411 {
371 I2C_BOARD_INFO("pcf8563", 0x51), 412 I2C_BOARD_INFO("pcf8563", 0x51),
372 }, 413 },
414 {
415 I2C_BOARD_INFO("ov772x", 0x21),
416 .platform_data = &ov7725_info,
417 },
373}; 418};
374 419
375static struct spi_board_info ap325rxa_spi_devices[] = { 420static struct spi_board_info ap325rxa_spi_devices[] = {