diff options
author | Erik Lilliebjerg <elilliebjerg@nvidia.com> | 2011-03-04 07:46:05 -0700 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2011-11-30 21:46:14 -0800 |
commit | f70b9617fd4849d0c54c7bd012ab894b5364a985 (patch) | |
tree | ed457b01ede3ba87ad13622553ad04c452a38229 /arch/arm/mach-tegra/board-ventana-sensors.c | |
parent | dd94d5d448b63157d6f1c9c6a416a057c14f23d5 (diff) |
ARM: tegra: ventana: Add power management to cameras.
Before this change, the Ventana code was lacking power management support for camera.
bug 782390
(cherry picked from commit 70b959550092afb17da3be33be7daef562b23baa)
Original-Change-Id: I00c4c0a5c4f032c8539de61d43647e512b2aa0e6
Reviewed-on: http://git-master/r/22111
Reviewed-by: Narendra Damahe <ndamahe@nvidia.com>
Tested-by: Joseph Lehrer <jlehrer@nvidia.com>
Reviewed-by: Patrick Shehane <pshehane@nvidia.com>
Reviewed-by: Pritesh Raithatha <praithatha@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Rebase-Id: R3e1e588aed3a9ec4a53f3a037127e0b2632dcee2
Diffstat (limited to 'arch/arm/mach-tegra/board-ventana-sensors.c')
-rw-r--r-- | arch/arm/mach-tegra/board-ventana-sensors.c | 88 |
1 files changed, 74 insertions, 14 deletions
diff --git a/arch/arm/mach-tegra/board-ventana-sensors.c b/arch/arm/mach-tegra/board-ventana-sensors.c index 794068316429..6a56816fce9d 100644 --- a/arch/arm/mach-tegra/board-ventana-sensors.c +++ b/arch/arm/mach-tegra/board-ventana-sensors.c @@ -18,6 +18,7 @@ * */ +#include <linux/delay.h> #include <linux/i2c.h> #include <linux/akm8975.h> #include <linux/i2c/pca954x.h> @@ -61,11 +62,21 @@ static int ventana_camera_init(void) static int ventana_ov5650_power_on(void) { gpio_direction_output(CAMERA_CSI_MUX_SEL_GPIO, 0); + gpio_direction_output(AVDD_DSI_CSI_ENB_GPIO, 1); + gpio_direction_output(CAM2_PWR_DN_GPIO, 0); + msleep(5); + gpio_direction_output(CAM2_RST_L_GPIO, 0); + msleep(1); + gpio_direction_output(CAM2_RST_L_GPIO, 1); + msleep(20); return 0; } static int ventana_ov5650_power_off(void) { + gpio_direction_output(AVDD_DSI_CSI_ENB_GPIO, 0); + gpio_direction_output(CAM2_RST_L_GPIO, 0); + gpio_direction_output(CAM2_PWR_DN_GPIO, 1); return 0; } @@ -74,14 +85,53 @@ struct ov5650_platform_data ventana_ov5650_data = { .power_off = ventana_ov5650_power_off, }; +static int ventana_ov5650s_power_on(void) +{ + ventana_ov5650_power_on(); + gpio_direction_output(CAM1_LDO_SHUTDN_L_GPIO, 1); + msleep(5); + gpio_direction_output(CAM1_PWR_DN_GPIO, 0); + msleep(5); + gpio_direction_output(CAM1_RST_L_GPIO, 0); + msleep(1); + gpio_direction_output(CAM1_RST_L_GPIO, 1); + msleep(20); + return 0; +} + +static int ventana_ov5650s_power_off(void) +{ + gpio_direction_output(CAM1_RST_L_GPIO, 0); + gpio_direction_output(CAM1_PWR_DN_GPIO, 1); + gpio_direction_output(CAM1_LDO_SHUTDN_L_GPIO, 0); + ventana_ov5650_power_off(); + return 0; +} + +struct ov5650_platform_data ventana_ov5650s_data = { + .power_on = ventana_ov5650s_power_on, + .power_off = ventana_ov5650s_power_off, +}; + static int ventana_ov2710_power_on(void) { gpio_direction_output(CAMERA_CSI_MUX_SEL_GPIO, 1); + gpio_direction_output(AVDD_DSI_CSI_ENB_GPIO, 1); + gpio_direction_output(CAM3_PWR_DN_GPIO, 0); + msleep(5); + gpio_direction_output(CAM3_RST_L_GPIO, 0); + msleep(1); + gpio_direction_output(CAM3_RST_L_GPIO, 1); + msleep(20); return 0; } static int ventana_ov2710_power_off(void) { + gpio_direction_output(CAM3_RST_L_GPIO, 0); + gpio_direction_output(CAM3_PWR_DN_GPIO, 1); + gpio_direction_output(AVDD_DSI_CSI_ENB_GPIO, 0); + gpio_direction_output(CAMERA_CSI_MUX_SEL_GPIO, 0); return 0; } @@ -185,6 +235,13 @@ static struct i2c_board_info ventana_i2c4_board_info[] = { }, }; +static struct i2c_board_info ventana_i2c6_board_info[] = { + { + I2C_BOARD_INFO("ov5650s", 0x36), + .platform_data = &ventana_ov5650s_data, + }, +}; + static struct i2c_board_info ventana_i2c7_board_info[] = { { I2C_BOARD_INFO("ov5650", 0x36), @@ -226,6 +283,9 @@ int __init ventana_sensors_init(void) i2c_register_board_info(4, ventana_i2c4_board_info, ARRAY_SIZE(ventana_i2c4_board_info)); + i2c_register_board_info(6, ventana_i2c6_board_info, + ARRAY_SIZE(ventana_i2c6_board_info)); + i2c_register_board_info(7, ventana_i2c7_board_info, ARRAY_SIZE(ventana_i2c7_board_info)); @@ -254,21 +314,20 @@ static struct ov5650_gpios ov5650_gpio_keys[] = { [0] = OV5650_GPIO("en_avdd_csi", AVDD_DSI_CSI_ENB_GPIO, 1), [1] = OV5650_GPIO("cam_i2c_mux_rst_lo", CAM_I2C_MUX_RST_GPIO, 1), - [2] = OV5650_GPIO("cam2_pwdn", CAM2_PWR_DN_GPIO, 0), - [3] = OV5650_GPIO("cam2_rst_lo", CAM2_RST_L_GPIO, 1), - [4] = OV5650_GPIO("cam2_af_pwdn_lo", CAM2_AF_PWR_DN_L_GPIO, 1), - [5] = OV5650_GPIO("cam2_ldo_shdn_lo", CAM2_LDO_SHUTDN_L_GPIO, 1), + [2] = OV5650_GPIO("cam2_ldo_shdn_lo", CAM2_LDO_SHUTDN_L_GPIO, 1), + [3] = OV5650_GPIO("cam2_af_pwdn_lo", CAM2_AF_PWR_DN_L_GPIO, 0), + [4] = OV5650_GPIO("cam2_pwdn", CAM2_PWR_DN_GPIO, 0), + [5] = OV5650_GPIO("cam2_rst_lo", CAM2_RST_L_GPIO, 1), - [6] = OV5650_GPIO("cam1_pwdn", CAM1_PWR_DN_GPIO, 0), - [7] = OV5650_GPIO("cam1_rst_lo", CAM1_RST_L_GPIO, 1), - [8] = OV5650_GPIO("cam1_af_pwdn_lo", CAM1_AF_PWR_DN_L_GPIO, 0), - [9] = OV5650_GPIO("cam1_ldo_shdn_lo", CAM1_LDO_SHUTDN_L_GPIO, 1), - - [10] = OV5650_GPIO("cam3_pwdn", CAM3_PWR_DN_GPIO, 0), - [11] = OV5650_GPIO("cam3_rst_lo", CAM3_RST_L_GPIO, 1), - [12] = OV5650_GPIO("cam3_af_pwdn_lo", CAM3_AF_PWR_DN_L_GPIO, 0), - [13] = OV5650_GPIO("cam3_ldo_shdn_lo", CAM3_LDO_SHUTDN_L_GPIO, 1), + [6] = OV5650_GPIO("cam3_ldo_shdn_lo", CAM3_LDO_SHUTDN_L_GPIO, 1), + [7] = OV5650_GPIO("cam3_af_pwdn_lo", CAM3_AF_PWR_DN_L_GPIO, 0), + [8] = OV5650_GPIO("cam3_pwdn", CAM3_PWR_DN_GPIO, 0), + [9] = OV5650_GPIO("cam3_rst_lo", CAM3_RST_L_GPIO, 1), + [10] = OV5650_GPIO("cam1_ldo_shdn_lo", CAM1_LDO_SHUTDN_L_GPIO, 1), + [11] = OV5650_GPIO("cam1_af_pwdn_lo", CAM1_AF_PWR_DN_L_GPIO, 0), + [12] = OV5650_GPIO("cam1_pwdn", CAM1_PWR_DN_GPIO, 0), + [13] = OV5650_GPIO("cam1_rst_lo", CAM1_RST_L_GPIO, 1), }; int __init ventana_ov5650_late_init(void) @@ -295,7 +354,8 @@ int __init ventana_ov5650_late_init(void) } i2c_new_device(i2c_get_adapter(3), ventana_i2c3_board_info_pca9546); - + ventana_ov2710_power_off(); + ventana_ov5650s_power_off(); return 0; fail: |