aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/sh/boards/board-ap325rxa.c43
1 files changed, 32 insertions, 11 deletions
diff --git a/arch/sh/boards/board-ap325rxa.c b/arch/sh/boards/board-ap325rxa.c
index 327d47c25a57..7e2d2de0384d 100644
--- a/arch/sh/boards/board-ap325rxa.c
+++ b/arch/sh/boards/board-ap325rxa.c
@@ -310,6 +310,9 @@ static int camera_set_capture(struct soc_camera_platform_info *info,
310 return ret; 310 return ret;
311} 311}
312 312
313static int ap325rxa_camera_add(struct soc_camera_link *icl, struct device *dev);
314static void ap325rxa_camera_del(struct soc_camera_link *icl);
315
313static struct soc_camera_platform_info camera_info = { 316static struct soc_camera_platform_info camera_info = {
314 .iface = 0, 317 .iface = 0,
315 .format_name = "UYVY", 318 .format_name = "UYVY",
@@ -323,6 +326,10 @@ static struct soc_camera_platform_info camera_info = {
323 .bus_param = SOCAM_PCLK_SAMPLE_RISING | SOCAM_HSYNC_ACTIVE_HIGH | 326 .bus_param = SOCAM_PCLK_SAMPLE_RISING | SOCAM_HSYNC_ACTIVE_HIGH |
324 SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_MASTER | SOCAM_DATAWIDTH_8, 327 SOCAM_VSYNC_ACTIVE_HIGH | SOCAM_MASTER | SOCAM_DATAWIDTH_8,
325 .set_capture = camera_set_capture, 328 .set_capture = camera_set_capture,
329 .link = {
330 .add_device = ap325rxa_camera_add,
331 .del_device = ap325rxa_camera_del,
332 },
326}; 333};
327 334
328static struct platform_device camera_device = { 335static struct platform_device camera_device = {
@@ -332,15 +339,20 @@ static struct platform_device camera_device = {
332 }, 339 },
333}; 340};
334 341
335static int __init camera_setup(void) 342static int ap325rxa_camera_add(struct soc_camera_link *icl,
343 struct device *dev)
336{ 344{
337 if (camera_probe() > 0) 345 if (icl != &camera_info.link || camera_probe() <= 0)
338 platform_device_register(&camera_device); 346 return -ENODEV;
339 347
340 return 0; 348 return platform_device_register(&camera_device);
341} 349}
342late_initcall(camera_setup);
343 350
351static void ap325rxa_camera_del(struct soc_camera_link *icl)
352{
353 if (icl == &camera_info.link)
354 platform_device_unregister(&camera_device);
355}
344#endif /* CONFIG_I2C */ 356#endif /* CONFIG_I2C */
345 357
346static int ov7725_power(struct device *dev, int mode) 358static int ov7725_power(struct device *dev, int mode)
@@ -423,11 +435,19 @@ static struct ov772x_camera_info ov7725_info = {
423 }, 435 },
424}; 436};
425 437
426static struct platform_device ap325rxa_camera = { 438static struct platform_device ap325rxa_camera[] = {
427 .name = "soc-camera-pdrv", 439 {
428 .id = 0, 440 .name = "soc-camera-pdrv",
429 .dev = { 441 .id = 0,
430 .platform_data = &ov7725_info.link, 442 .dev = {
443 .platform_data = &ov7725_info.link,
444 },
445 }, {
446 .name = "soc-camera-pdrv",
447 .id = 1,
448 .dev = {
449 .platform_data = &camera_info.link,
450 },
431 }, 451 },
432}; 452};
433 453
@@ -438,7 +458,8 @@ static struct platform_device *ap325rxa_devices[] __initdata = {
438 &ceu_device, 458 &ceu_device,
439 &nand_flash_device, 459 &nand_flash_device,
440 &sdcard_cn3_device, 460 &sdcard_cn3_device,
441 &ap325rxa_camera, 461 &ap325rxa_camera[0],
462 &ap325rxa_camera[1],
442}; 463};
443 464
444static struct spi_board_info ap325rxa_spi_devices[] = { 465static struct spi_board_info ap325rxa_spi_devices[] = {