diff options
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-pxa/pcm990-baseboard.c | 54 |
1 files changed, 45 insertions, 9 deletions
diff --git a/arch/arm/mach-pxa/pcm990-baseboard.c b/arch/arm/mach-pxa/pcm990-baseboard.c index f46698e20c1f..90a399075ff6 100644 --- a/arch/arm/mach-pxa/pcm990-baseboard.c +++ b/arch/arm/mach-pxa/pcm990-baseboard.c | |||
@@ -380,14 +380,50 @@ static struct pca953x_platform_data pca9536_data = { | |||
380 | .gpio_base = NR_BUILTIN_GPIO + 1, | 380 | .gpio_base = NR_BUILTIN_GPIO + 1, |
381 | }; | 381 | }; |
382 | 382 | ||
383 | static struct soc_camera_link iclink[] = { | 383 | static int gpio_bus_switch; |
384 | { | 384 | |
385 | .bus_id = 0, /* Must match with the camera ID above */ | 385 | static int pcm990_camera_set_bus_param(struct soc_camera_link *link, |
386 | .gpio = NR_BUILTIN_GPIO + 1, | 386 | unsigned long flags) |
387 | }, { | 387 | { |
388 | .bus_id = 0, /* Must match with the camera ID above */ | 388 | if (gpio_bus_switch <= 0) { |
389 | .gpio = -ENXIO, | 389 | if (flags == SOCAM_DATAWIDTH_10) |
390 | return 0; | ||
391 | else | ||
392 | return -EINVAL; | ||
393 | } | ||
394 | |||
395 | if (flags & SOCAM_DATAWIDTH_8) | ||
396 | gpio_set_value(gpio_bus_switch, 1); | ||
397 | else | ||
398 | gpio_set_value(gpio_bus_switch, 0); | ||
399 | |||
400 | return 0; | ||
401 | } | ||
402 | |||
403 | static unsigned long pcm990_camera_query_bus_param(struct soc_camera_link *link) | ||
404 | { | ||
405 | int ret; | ||
406 | |||
407 | if (!gpio_bus_switch) { | ||
408 | ret = gpio_request(NR_BUILTIN_GPIO + 1, "camera"); | ||
409 | if (!ret) { | ||
410 | gpio_bus_switch = NR_BUILTIN_GPIO + 1; | ||
411 | gpio_direction_output(gpio_bus_switch, 0); | ||
412 | } else | ||
413 | gpio_bus_switch = -EINVAL; | ||
390 | } | 414 | } |
415 | |||
416 | if (gpio_bus_switch > 0) | ||
417 | return SOCAM_DATAWIDTH_8 | SOCAM_DATAWIDTH_10; | ||
418 | else | ||
419 | return SOCAM_DATAWIDTH_10; | ||
420 | } | ||
421 | |||
422 | static struct soc_camera_link iclink = { | ||
423 | .bus_id = 0, /* Must match with the camera ID above */ | ||
424 | .gpio = NR_BUILTIN_GPIO + 1, | ||
425 | .query_bus_param = pcm990_camera_query_bus_param, | ||
426 | .set_bus_param = pcm990_camera_set_bus_param, | ||
391 | }; | 427 | }; |
392 | 428 | ||
393 | /* Board I2C devices. */ | 429 | /* Board I2C devices. */ |
@@ -398,10 +434,10 @@ static struct i2c_board_info __initdata pcm990_i2c_devices[] = { | |||
398 | .platform_data = &pca9536_data, | 434 | .platform_data = &pca9536_data, |
399 | }, { | 435 | }, { |
400 | I2C_BOARD_INFO("mt9v022", 0x48), | 436 | I2C_BOARD_INFO("mt9v022", 0x48), |
401 | .platform_data = &iclink[0], /* With extender */ | 437 | .platform_data = &iclink, /* With extender */ |
402 | }, { | 438 | }, { |
403 | I2C_BOARD_INFO("mt9m001", 0x5d), | 439 | I2C_BOARD_INFO("mt9m001", 0x5d), |
404 | .platform_data = &iclink[0], /* With extender */ | 440 | .platform_data = &iclink, /* With extender */ |
405 | }, | 441 | }, |
406 | }; | 442 | }; |
407 | #endif /* CONFIG_VIDEO_PXA27x ||CONFIG_VIDEO_PXA27x_MODULE */ | 443 | #endif /* CONFIG_VIDEO_PXA27x ||CONFIG_VIDEO_PXA27x_MODULE */ |