From 039c989345912a07796de71d90600d3c0df28cde Mon Sep 17 00:00:00 2001 From: Pritesh Raithatha Date: Mon, 22 Nov 2010 15:29:27 +0530 Subject: ventana: camera: request gpio and register i2c board info -request power enable and csi mux gpios. -add tca6416 and pca9546 to I2C3. -pca9546 exports 4 I2C adaptors and out of that first 3 is connected to 3 cameras. -adapter number is given starting from 6. -ov5650 is connected to second adaptor of pca9546 so added it to I2C7. Change-Id: I8a6cb6ce1990b6668ff11ab1a6a94cf6c787a4e8 Reviewed-on: http://git-master/r/11337 Reviewed-by: Bharat Nihalani Tested-by: Bharat Nihalani --- arch/arm/mach-tegra/board-ventana-sensors.c | 78 ++++++++++++++++++++++++++++- 1 file changed, 77 insertions(+), 1 deletion(-) (limited to 'arch/arm/mach-tegra/board-ventana-sensors.c') diff --git a/arch/arm/mach-tegra/board-ventana-sensors.c b/arch/arm/mach-tegra/board-ventana-sensors.c index c2b3ba0d4a64..af5e8fee10a3 100644 --- a/arch/arm/mach-tegra/board-ventana-sensors.c +++ b/arch/arm/mach-tegra/board-ventana-sensors.c @@ -24,10 +24,46 @@ #include #include "gpio-names.h" +#include +#include +#include #define ISL29018_IRQ_GPIO TEGRA_GPIO_PZ2 #define AKM8975_IRQ_GPIO TEGRA_GPIO_PN5 +#define CAMERA_POWER_GPIO TEGRA_GPIO_PV4 +#define CAMERA_CSI_MUX_SEL_GPIO TEGRA_GPIO_PBB4 + +static int ventana_camera_init(void) +{ + tegra_gpio_enable(CAMERA_POWER_GPIO); + gpio_request(CAMERA_POWER_GPIO, "camera_power_en"); + gpio_direction_output(CAMERA_POWER_GPIO, 1); + gpio_export(CAMERA_POWER_GPIO, false); + + tegra_gpio_enable(CAMERA_CSI_MUX_SEL_GPIO); + gpio_request(CAMERA_CSI_MUX_SEL_GPIO, "camera_csi_sel"); + gpio_direction_output(CAMERA_CSI_MUX_SEL_GPIO, 0); + gpio_export(CAMERA_CSI_MUX_SEL_GPIO, false); + + return 0; +} + +static int ventana_ov5650_power_on(void) +{ + return 0; +} + +static int ventana_ov5650_power_off(void) +{ + return 0; +} + +struct ov5650_platform_data ventana_ov5650_data = { + .power_on = ventana_ov5650_power_on, + .power_off = ventana_ov5650_power_off, +}; + static void ventana_isl29018_init(void) { tegra_gpio_enable(ISL29018_IRQ_GPIO); @@ -61,6 +97,32 @@ static const struct i2c_board_info ventana_i2c2_board_info[] = { }, }; +static struct pca953x_platform_data ventana_tca6416_data = { + .gpio_base = TEGRA_NR_GPIOS + 4, /* 4 gpios are already requested by tps6586x */ +}; + +static struct pca954x_platform_mode ventana_pca9546_modes[] = { + { .adap_id = 6, }, /* REAR CAM1 */ + { .adap_id = 7, }, /* REAR CAM2 */ + { .adap_id = 8, }, /* FRONT CAM3 */ +}; + +static struct pca954x_platform_data ventana_pca9546_data = { + .modes = ventana_pca9546_modes, + .num_modes = ARRAY_SIZE(ventana_pca9546_modes), +}; + +static const struct i2c_board_info ventana_i2c3_board_info[] = { + { + I2C_BOARD_INFO("tca6416", 0x20), + .platform_data = &ventana_tca6416_data, + }, + { + I2C_BOARD_INFO("pca9546", 0x70), + .platform_data = &ventana_pca9546_data, + }, +}; + static struct i2c_board_info ventana_i2c4_board_info[] = { { I2C_BOARD_INFO("nct1008", 0x4C), @@ -69,13 +131,21 @@ static struct i2c_board_info ventana_i2c4_board_info[] = { { I2C_BOARD_INFO("akm8975", 0x0C), .irq = TEGRA_GPIO_TO_IRQ(AKM8975_IRQ_GPIO), - } + }, +}; + +static struct i2c_board_info ventana_i2c7_board_info[] = { + { + I2C_BOARD_INFO("ov5650", 0x36), + .platform_data = &ventana_ov5650_data, + }, }; int __init ventana_sensors_init(void) { ventana_isl29018_init(); ventana_akm8975_init(); + ventana_camera_init(); i2c_register_board_info(0, ventana_i2c0_board_info, ARRAY_SIZE(ventana_i2c0_board_info)); @@ -83,8 +153,14 @@ int __init ventana_sensors_init(void) i2c_register_board_info(2, ventana_i2c2_board_info, ARRAY_SIZE(ventana_i2c2_board_info)); + i2c_register_board_info(3, ventana_i2c3_board_info, + ARRAY_SIZE(ventana_i2c3_board_info)); + i2c_register_board_info(4, ventana_i2c4_board_info, ARRAY_SIZE(ventana_i2c4_board_info)); + i2c_register_board_info(7, ventana_i2c7_board_info, + ARRAY_SIZE(ventana_i2c7_board_info)); + return 0; } -- cgit v1.2.3