#include <mach/gpio.h>
#include <media/ov5650.h>
#include <media/ov2710.h>
+#include <media/tps61050.h>
#include <generated/mach-types.h>
#include "gpio-names.h"
#include "board.h"
#include <linux/mpu.h>
#include <media/sh532u.h>
-
+#include <linux/bq27x00.h>
#include <mach/gpio.h>
#include <mach/edp.h>
(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)
},
};
-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";
+
+ 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_left_deinit(void *cdata) {
+ return sh532u_power_control(cdata, false, 1);
}
-static int sh532u_deinit(void *cdata) {
- return sh532u_power_control(cdata, false);
+
+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;
+
+static struct tps61050_pin_state cardhu_tps61050_pinstate = {
+ .mask = 0x0008, /*VGP3*/
+ .values = 0x0008,
+};
+
+static int cardhu_tps61050_pm(int pwr)
+{
+ switch (pwr) {
+ case TPS61050_PWR_OFF:
+ if (cardhu_tps61050_pm_flag && cardhu_1v8_cam1) {
+ regulator_disable(cardhu_1v8_cam1);
+ cardhu_tps61050_pm_flag = 0;
+ }
+ return 0;
+
+ case TPS61050_PWR_STDBY:
+ case TPS61050_PWR_COMM:
+ case TPS61050_PWR_ON:
+ if (!cardhu_tps61050_pm_flag) {
+ if (cardhu_1v8_cam1 == NULL) {
+ cardhu_1v8_cam1 =
+ regulator_get(NULL, "vdd_1v8_cam1");
+ if (WARN_ON(IS_ERR(cardhu_1v8_cam1))) {
+ pr_err("%s: err: %ld\n",
+ __func__,
+ PTR_ERR(cardhu_1v8_cam1));
+ regulator_put(cardhu_1v8_cam1);
+ cardhu_1v8_cam1 = NULL;
+ }
+ }
+ regulator_enable(cardhu_1v8_cam1);
+ cardhu_tps61050_pm_flag = 1;
+ mdelay(5);
+ }
+ return 0;
+
+ default:
+ return -1;
+ }
}
-struct sh532u_platform_data sh532u_pdata = {
- .board_init = sh532u_init,
- .board_deinit = sh532u_deinit,
+static struct tps61050_platform_data cardhu_tps61050_data = {
+ .cfg = 0,
+ .num = 1,
+ .max_amp_torch = CAMERA_FLASH_MAX_TORCH_AMP,
+ .max_amp_flash = CAMERA_FLASH_MAX_FLASH_AMP,
+ .pinstate = &cardhu_tps61050_pinstate,
+ .init = NULL,
+ .exit = NULL,
+ .pm = cardhu_tps61050_pm,
+ .gpio_envm = NULL,
+ .gpio_sync = NULL,
};
+
+static const struct i2c_board_info cardhu_i2c_board_info_tps61050[] = {
+ {
+ I2C_BOARD_INFO("tps61050", 0x33),
+ .platform_data = &cardhu_tps61050_data,
+ },
+};
+
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,
},
};
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[] = {
static struct nct1008_platform_data cardhu_nct1008_pdata = {
.supported_hwrev = true,
- .ext_range = false,
+ .ext_range = true,
.conv_rate = 0x08,
- .offset = 0,
.hysteresis = 5,
- .shutdown_ext_limit = 75,
- .shutdown_local_limit = 75,
- .throttling_ext_limit = 90,
+ .shutdown_ext_limit = 90,
+ .shutdown_local_limit = 90,
+ .throttling_ext_limit = 75,
.alarm_fn = tegra_throttling_enable,
};
+static struct bq27x00_platform_data cardhu_bq27510_pdata = {
+ .ac_persent_gpio = AC_PRESENT_GPIO,
+};
+
static struct i2c_board_info cardhu_i2c4_bq27510_board_info[] = {
{
I2C_BOARD_INFO("bq27510", 0x55),
- .irq = AC_PRESENT_GPIO,
+ .irq = AC_PRESENT_INT,
+ .platform_data = &cardhu_bq27510_pdata,
},
};
}
};
-#ifdef CONFIG_TEGRA_EDP_LIMITS
-extern void cardhu_thermal_zones_info(struct tegra_edp_limits **, int *);
-#endif
static int cardhu_nct1008_init(void)
{
int nct1008_port = -1;
int ret;
+ struct nct1008_platform_data *pdata;
#ifdef CONFIG_TEGRA_EDP_LIMITS
- struct tegra_edp_limits *z;
+ const struct tegra_edp_limits *z;
int zones_sz;
int i;
+ bool throttle_ok = false;
#endif
if ((board_info.board_id == BOARD_E1198) ||
- (board_info.board_id == BOARD_E1291)) {
+ (board_info.board_id == BOARD_E1291) ||
+ (board_info.board_id == BOARD_PM269)) {
nct1008_port = TEGRA_GPIO_PCC2;
} else if ((board_info.board_id == BOARD_E1186) ||
- (board_info.board_id == BOARD_E1187)) {
+ (board_info.board_id == BOARD_E1187) ||
+ (board_info.board_id == BOARD_E1256)) {
/* FIXME: seems to be conflicting with usb3 vbus on E1186 */
/* nct1008_port = TEGRA_GPIO_PH7; */
}
tegra_gpio_enable(nct1008_port);
}
+ /* Temperature guardband: bug 844025 */
+ if (board_info.board_id == BOARD_PM269) {
+ /* T30S DSC */
+ pdata = cardhu_i2c4_nct1008_board_info[0].platform_data;
+ pdata->offset = 41; /* 4 * 10.25C */
+ } else {
+ /* T30 MID */
+ pdata = cardhu_i2c4_nct1008_board_info[0].platform_data;
+ pdata->offset = 43; /* 4 * 10.75C */
+ }
+
#ifdef CONFIG_TEGRA_EDP_LIMITS
- cardhu_thermal_zones_info(&z, &zones_sz);
+ tegra_get_cpu_edp_limits(&z, &zones_sz);
zones_sz = min(zones_sz, MAX_ZONES);
- for (i = 0; i < zones_sz; i++)
+ for (i = 0; i < zones_sz; i++) {
cardhu_nct1008_pdata.thermal_zones[i] = z[i].temperature;
+ if (cardhu_nct1008_pdata.thermal_zones[i] ==
+ cardhu_nct1008_pdata.throttling_ext_limit) {
+ throttle_ok = true;
+ }
+ }
+
+ if (throttle_ok != true)
+ pr_warn("%s: WARNING! Throttling limit %dC would be inaccurate"
+ " as it is NOT one of the EDP points\n",
+ __func__, cardhu_nct1008_pdata.throttling_ext_limit);
+ else
+ pr_info("%s: Throttling limit %dC OK\n",
+ __func__, cardhu_nct1008_pdata.throttling_ext_limit);
cardhu_nct1008_pdata.thermal_zones_sz = zones_sz;
#endif
i2c_register_board_info(2, cardhu_i2c3_board_info,
ARRAY_SIZE(cardhu_i2c3_board_info));
+ i2c_register_board_info(2, cardhu_i2c_board_info_tps61050,
+ ARRAY_SIZE(cardhu_i2c_board_info_tps61050));
+
/* Left camera is on PCA954x's I2C BUS0, Right camera is on BUS1 &
* Front camera is on BUS2 */
i2c_register_board_info(PCA954x_I2C_BUS0, cardhu_i2c6_board_info,
static struct ov5650_gpios ov5650_gpio_keys[] = {
[0] = OV5650_GPIO("cam1_pwdn", CAM1_PWR_DN_GPIO, 0),
[1] = OV5650_GPIO("cam1_rst_lo", CAM1_RST_L_GPIO, 1),
- [2] = OV5650_GPIO("cam1_af_pwdn_lo", CAM1_AF_PWR_DN_L_GPIO, 1),
+ [2] = OV5650_GPIO("cam1_af_pwdn_lo", CAM1_AF_PWR_DN_L_GPIO, 0),
[3] = OV5650_GPIO("cam1_ldo_shdn_lo", CAM1_LDO_SHUTDN_L_GPIO, 1),
[4] = OV5650_GPIO("cam2_pwdn", CAM2_PWR_DN_GPIO, 0),
[5] = OV5650_GPIO("cam2_rst_lo", CAM2_RST_L_GPIO, 1),
- [6] = OV5650_GPIO("cam2_af_pwdn_lo", CAM2_AF_PWR_DN_L_GPIO, 1),
+ [6] = OV5650_GPIO("cam2_af_pwdn_lo", CAM2_AF_PWR_DN_L_GPIO, 0),
[7] = OV5650_GPIO("cam2_ldo_shdn_lo", CAM2_LDO_SHUTDN_L_GPIO, 1),
[8] = OV5650_GPIO("cam3_pwdn", CAM_FRONT_PWR_DN_GPIO, 0),
[9] = OV5650_GPIO("cam3_rst_lo", CAM_FRONT_RST_L_GPIO, 1),
- [10] = OV5650_GPIO("cam3_af_pwdn_lo", CAM_FRONT_AF_PWR_DN_L_GPIO, 1),
+ [10] = OV5650_GPIO("cam3_af_pwdn_lo", CAM_FRONT_AF_PWR_DN_L_GPIO, 0),
[11] = OV5650_GPIO("cam3_ldo_shdn_lo", CAM_FRONT_LDO_SHUTDN_L_GPIO, 1),
[12] = OV5650_GPIO("cam_led_exp", CAM_FRONT_LED_EXP, 1),
[13] = OV5650_GPIO("cam_led_rear_exp", CAM_SNN_LED_REAR_EXP, 1),
int ret;
int i;
+ if ((board_info.board_id == BOARD_E1198) ||
+ (board_info.board_id == BOARD_E1291))
+ return 0;
+
printk("%s: \n", __func__);
for (i = 0; i < ARRAY_SIZE(ov5650_gpio_keys); i++) {
ret = gpio_request(ov5650_gpio_keys[i].gpio,