diff options
author | Laxman Dewangan <ldewangan@nvidia.com> | 2011-05-03 14:24:58 +0530 |
---|---|---|
committer | Varun Colbert <vcolbert@nvidia.com> | 2011-05-11 15:48:34 -0700 |
commit | 409f8b29c4c9fccdbd0082b0e32d16b5c76211f4 (patch) | |
tree | 6af7d84939906a9c6f4e85ab59c05edd52dcc71d /arch/arm | |
parent | e27d58d7d3803ba4a29f41b630bd05f26cefb662 (diff) |
arm: tegra: cardhu: Adding platform data for sh532u device
Adding the board init and deinint function to power on/off
rails for the sh532u autofocus driver.
This function is passed as platform data to the driver.
bug 802264
Change-Id: Ib7ef55898dce5f6ae458c922e6b5cbce64740cd0
Reviewed-on: http://git-master/r/30171
Reviewed-by: Varun Colbert <vcolbert@nvidia.com>
Tested-by: Varun Colbert <vcolbert@nvidia.com>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/mach-tegra/board-cardhu-sensors.c | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/arch/arm/mach-tegra/board-cardhu-sensors.c b/arch/arm/mach-tegra/board-cardhu-sensors.c index d5eebab7b3e9..3a2d7d6e2560 100644 --- a/arch/arm/mach-tegra/board-cardhu-sensors.c +++ b/arch/arm/mach-tegra/board-cardhu-sensors.c @@ -32,6 +32,7 @@ #include "gpio-names.h" #include "board.h" #include <linux/mpu.h> +#include <media/sh532u.h> #include <mach/gpio.h> @@ -123,9 +124,6 @@ static int cardhu_left_ov5650_power_on(void) if ((board_info.board_id == BOARD_E1198) || (board_info.board_id == BOARD_E1291)) { - gpio_direction_output(CAM1_POWER_DWN_GPIO, 0); - mdelay(10); - if (cardhu_vdd_2v8_cam1 == NULL) { cardhu_vdd_2v8_cam1 = regulator_get(NULL, "vdd_2v8_cam1"); if (WARN_ON(IS_ERR(cardhu_vdd_2v8_cam1))) { @@ -161,6 +159,14 @@ static int cardhu_left_ov5650_power_on(void) regulator_enable(cardhu_avdd_dsi_csi); mdelay(5); + if ((board_info.board_id == BOARD_E1198) || + (board_info.board_id == BOARD_E1291)) { + gpio_direction_output(CAM1_POWER_DWN_GPIO, 0); + mdelay(20); + gpio_direction_output(OV5650_RESETN_GPIO, 0); + mdelay(100); + gpio_direction_output(OV5650_RESETN_GPIO, 1); + } return 0; reg_alloc_fail: @@ -400,6 +406,35 @@ static const struct i2c_board_info cardhu_i2c3_board_info[] = { .platform_data = &cardhu_pca954x_data, }, }; + +static int sh532u_power_control(void *cdata, int is_enable) { + static struct regulator *vdd_2v8_cam1_af = NULL; + if (vdd_2v8_cam1_af == NULL) { + vdd_2v8_cam1_af = regulator_get(NULL, "vdd_2v8_cam1_af"); + if (WARN_ON(IS_ERR_OR_NULL(vdd_2v8_cam1_af))) { + pr_err("%s: couldn't get regulator vdd_2v8_cam1_af:" + " %ld\n", __func__, PTR_ERR(vdd_2v8_cam1_af)); + return -ENODEV; + } + } + if (is_enable) { + regulator_enable(vdd_2v8_cam1_af); + mdelay(20); + } else + regulator_disable(vdd_2v8_cam1_af); + return 0; +} +static int sh532u_init(void *cdata) { + return sh532u_power_control(cdata, true); +} +static int sh532u_deinit(void *cdata) { + return sh532u_power_control(cdata, false); +} + +struct sh532u_platform_data sh532u_pdata = { + .board_init = sh532u_init, + .board_deinit = sh532u_deinit, +}; static struct i2c_board_info cardhu_i2c6_board_info[] = { { I2C_BOARD_INFO("ov5650L", 0x36), @@ -407,6 +442,7 @@ static struct i2c_board_info cardhu_i2c6_board_info[] = { }, { I2C_BOARD_INFO("sh532u", 0x72), + .platform_data = &sh532u_pdata, }, }; |