summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorgaryz <garyz@nvidia.com>2011-06-01 18:41:35 -0700
committerVarun Colbert <vcolbert@nvidia.com>2011-08-03 15:42:05 -0700
commit66051ec398b7f5cc1010cb58b7cef0ce5a3c79bf (patch)
treeda76a5b0be538a733348823a247401e55f6c9829 /arch
parent5e2cbca1e50c0dc9218a75c159039b4f3b442843 (diff)
arm: tegra: sensors: pair sh532u focuser to right camera
The sh532u focuser is added to pair with the stereo right camera with the required power control configurations. Bug #827897 Change-Id: I5ca836a51b03cb9550eb468270af5bbf350aa957 Reviewed-on: http://git-master/r/34820 Reviewed-by: Varun Colbert <vcolbert@nvidia.com> Tested-by: Varun Colbert <vcolbert@nvidia.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-tegra/board-cardhu-sensors.c59
1 files changed, 40 insertions, 19 deletions
diff --git a/arch/arm/mach-tegra/board-cardhu-sensors.c b/arch/arm/mach-tegra/board-cardhu-sensors.c
index 4fa85fef6715..b8c5890436be 100644
--- a/arch/arm/mach-tegra/board-cardhu-sensors.c
+++ b/arch/arm/mach-tegra/board-cardhu-sensors.c
@@ -269,6 +269,7 @@ static int cardhu_right_ov5650_power_off(void)
(board_info.board_id == BOARD_E1291)) {
gpio_direction_output(CAM1_POWER_DWN_GPIO, 1);
gpio_direction_output(CAM2_POWER_DWN_GPIO, 1);
+ gpio_direction_output(CAM3_POWER_DWN_GPIO, 1);
}
if (cardhu_1v8_cam2)
@@ -391,37 +392,54 @@ static const struct i2c_board_info cardhu_i2c3_board_info[] = {
},
};
-static int sh532u_power_control(void *cdata, int is_enable) {
+static int sh532u_power_control(void *cdata, int is_enable, int which) {
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));
+ static struct regulator *vdd_2v8_cam2_af = NULL;
+
+ struct regulator *vdd_2v8_camx_af = (1 == which) ? vdd_2v8_cam1_af : vdd_2v8_cam2_af;
+ char *vdd_2v8_camx_tag = (1 == which) ? "vdd_2v8_cam1_af" : "vdd_2v8_cam2_af";
- vdd_2v8_cam1_af = NULL;
+ if (vdd_2v8_camx_af == NULL) {
+ vdd_2v8_camx_af = regulator_get(NULL, vdd_2v8_camx_tag);
+ if (WARN_ON(IS_ERR_OR_NULL(vdd_2v8_camx_af))) {
+ pr_err("%s: couldn't get regulator %s:"
+ " %ld\n", __func__, vdd_2v8_camx_tag, PTR_ERR(vdd_2v8_camx_af));
+ vdd_2v8_camx_af = NULL;
return -ENODEV;
}
}
if (is_enable) {
- regulator_enable(vdd_2v8_cam1_af);
+ regulator_enable(vdd_2v8_camx_af);
mdelay(20);
} else
- regulator_disable(vdd_2v8_cam1_af);
+ regulator_disable(vdd_2v8_camx_af);
+
return 0;
}
-static int sh532u_init(void *cdata) {
- return sh532u_power_control(cdata, true);
+
+static int sh532u_left_init(void *cdata) {
+ return sh532u_power_control(cdata, true, 1);
}
-static int sh532u_deinit(void *cdata) {
- return sh532u_power_control(cdata, false);
+static int sh532u_left_deinit(void *cdata) {
+ return sh532u_power_control(cdata, false, 1);
}
-struct sh532u_platform_data sh532u_pdata = {
- .board_init = sh532u_init,
- .board_deinit = sh532u_deinit,
+static int sh532u_right_init(void *cdata) {
+ return sh532u_power_control(cdata, true, 2);
+}
+static int sh532u_right_deinit(void *cdata) {
+ return sh532u_power_control(cdata, false, 2);
+}
+
+struct sh532u_platform_data sh532u_left_pdata = {
+ .board_init = sh532u_left_init,
+ .board_deinit = sh532u_left_deinit,
};
+struct sh532u_platform_data sh532u_right_pdata = {
+ .board_init = sh532u_right_init,
+ .board_deinit = sh532u_right_deinit,
+};
static bool cardhu_tps61050_pm_flag = 0;
@@ -486,15 +504,14 @@ static const struct i2c_board_info cardhu_i2c_board_info_tps61050[] = {
},
};
-
static struct i2c_board_info cardhu_i2c6_board_info[] = {
{
I2C_BOARD_INFO("ov5650L", 0x36),
.platform_data = &cardhu_left_ov5650_data,
},
{
- I2C_BOARD_INFO("sh532u", 0x72),
- .platform_data = &sh532u_pdata,
+ I2C_BOARD_INFO("sh532uL", 0x72),
+ .platform_data = &sh532u_left_pdata,
},
};
@@ -503,6 +520,10 @@ static struct i2c_board_info cardhu_i2c7_board_info[] = {
I2C_BOARD_INFO("ov5650R", 0x36),
.platform_data = &cardhu_right_ov5650_data,
},
+ {
+ I2C_BOARD_INFO("sh532uR", 0x72),
+ .platform_data = &sh532u_right_pdata,
+ },
};
static struct i2c_board_info cardhu_i2c8_board_info[] = {