diff options
author | Erik Lilliebjerg <elilliebjerg@nvidia.com> | 2011-03-10 01:55:35 -0700 |
---|---|---|
committer | Varun Colbert <vcolbert@nvidia.com> | 2011-04-15 18:33:46 -0700 |
commit | d04319f070daaa532092fa968ba5f63abc878f34 (patch) | |
tree | 1be24ee2ac510bf2d34005b7cccf991aff376032 | |
parent | 3a5c5131203aec7d035c1eead642b984402e3686 (diff) |
ARM: tegra: ventana: SSL3250A board level support.
Add board level support for camera SSL3250A flash.
Bug 778859
Change-Id: I7375757546d7ed54dace9f9cd03adeee84959126
Reviewed-on: http://git-master/r/26903
Reviewed-by: Varun Colbert <vcolbert@nvidia.com>
Tested-by: Varun Colbert <vcolbert@nvidia.com>
-rw-r--r-- | arch/arm/mach-tegra/board-ventana-sensors.c | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/arch/arm/mach-tegra/board-ventana-sensors.c b/arch/arm/mach-tegra/board-ventana-sensors.c index 874009abb568..34e0cf265b6e 100644 --- a/arch/arm/mach-tegra/board-ventana-sensors.c +++ b/arch/arm/mach-tegra/board-ventana-sensors.c @@ -32,6 +32,7 @@ #include <media/ov5650.h> #include <media/ov2710.h> +#include <media/ssl3250a.h> #include <generated/mach-types.h> #include "gpio-names.h" @@ -42,8 +43,14 @@ #define AKM8975_IRQ_GPIO TEGRA_GPIO_PN5 #define CAMERA_POWER_GPIO TEGRA_GPIO_PV4 #define CAMERA_CSI_MUX_SEL_GPIO TEGRA_GPIO_PBB4 +#define CAMERA_FLASH_ACT_GPIO TEGRA_GPIO_PD2 +#define CAMERA_FLASH_STRB_GPIO TEGRA_GPIO_PA0 #define AC_PRESENT_GPIO TEGRA_GPIO_PV3 #define NCT1008_THERM2_GPIO TEGRA_GPIO_PN6 +#define CAMERA_FLASH_OP_MODE 0 /*0=I2C mode, 1=GPIO mode*/ +#define CAMERA_FLASH_MAX_LED_AMP 7 +#define CAMERA_FLASH_MAX_TORCH_AMP 11 +#define CAMERA_FLASH_MAX_FLASH_AMP 31 extern void tegra_throttling_enable(bool enable); @@ -145,6 +152,53 @@ struct ov2710_platform_data ventana_ov2710_data = { .power_off = ventana_ov2710_power_off, }; +static int ventana_ssl3250a_init(void) +{ + gpio_request(CAMERA_FLASH_ACT_GPIO, "torch_gpio_act"); + gpio_direction_output(CAMERA_FLASH_ACT_GPIO, 0); + tegra_gpio_enable(CAMERA_FLASH_ACT_GPIO); + gpio_request(CAMERA_FLASH_STRB_GPIO, "torch_gpio_strb"); + gpio_direction_output(CAMERA_FLASH_STRB_GPIO, 0); + tegra_gpio_enable(CAMERA_FLASH_STRB_GPIO); + gpio_export(CAMERA_FLASH_STRB_GPIO, false); + return 0; +} + +static void ventana_ssl3250a_exit(void) +{ + gpio_set_value(CAMERA_FLASH_STRB_GPIO, 0); + gpio_free(CAMERA_FLASH_STRB_GPIO); + tegra_gpio_disable(CAMERA_FLASH_STRB_GPIO); + gpio_set_value(CAMERA_FLASH_ACT_GPIO, 0); + gpio_free(CAMERA_FLASH_ACT_GPIO); + tegra_gpio_disable(CAMERA_FLASH_ACT_GPIO); +} + +static int ventana_ssl3250a_gpio_strb(int val) +{ + gpio_set_value(CAMERA_FLASH_STRB_GPIO, val); + return 0; +}; + +static int ventana_ssl3250a_gpio_act(int val) +{ + gpio_set_value(CAMERA_FLASH_ACT_GPIO, val); + return 0; +}; + +static struct ssl3250a_platform_data ventana_ssl3250a_data = { + .config = CAMERA_FLASH_OP_MODE, + .max_amp_indic = CAMERA_FLASH_MAX_LED_AMP, + .max_amp_torch = CAMERA_FLASH_MAX_TORCH_AMP, + .max_amp_flash = CAMERA_FLASH_MAX_FLASH_AMP, + .init = ventana_ssl3250a_init, + .exit = ventana_ssl3250a_exit, + .gpio_act = ventana_ssl3250a_gpio_act, + .gpio_en1 = NULL, + .gpio_en2 = NULL, + .gpio_strb = ventana_ssl3250a_gpio_strb, +}; + static void ventana_isl29018_init(void) { tegra_gpio_enable(ISL29018_IRQ_GPIO); @@ -230,6 +284,13 @@ static const struct i2c_board_info ventana_i2c3_board_info_pca9546[] = { }, }; +static const struct i2c_board_info ventana_i2c3_board_info_ssl3250a[] = { + { + I2C_BOARD_INFO("ssl3250a", 0x30), + .platform_data = &ventana_ssl3250a_data, + }, +}; + static struct i2c_board_info ventana_i2c4_board_info[] = { { I2C_BOARD_INFO("nct1008", 0x4C), @@ -347,6 +408,9 @@ int __init ventana_sensors_init(void) ARRAY_SIZE(ventana_i2c2_board_info)); } + i2c_register_board_info(3, ventana_i2c3_board_info_ssl3250a, + ARRAY_SIZE(ventana_i2c3_board_info_ssl3250a)); + i2c_register_board_info(4, ventana_i2c4_board_info, ARRAY_SIZE(ventana_i2c4_board_info)); |