]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
ARM: tegra: macallan: bringup e1625 camera board
authorCharlie Huang <chahuang@nvidia.com>
Fri, 8 Feb 2013 04:58:41 +0000 (04:58 +0000)
committerDan Willemsen <dwillemsen@nvidia.com>
Sat, 14 Sep 2013 20:05:42 +0000 (13:05 -0700)
bug 1228759

Reviewed-on: http://git-master/r/199782
(cherry picked from commit 66b0f1626a81eec195862d560bebe37df4632a6a)

Change-Id: I4fe9f8f22938b11061335c43c7fa86a7c0b4796c
Signed-off-by: Charlie Huang <chahuang@nvidia.com>
Reviewed-on: http://git-master/r/213436
Reviewed-by: Simone Willett <swillett@nvidia.com>
Tested-by: Simone Willett <swillett@nvidia.com>
arch/arm/mach-tegra/board-macallan-power.c
arch/arm/mach-tegra/board-macallan-sensors.c

index 6fd550b2f1f301f0783805ac3a8da0e5524ead63..c9f5ad3444e8a797dc4b2dbb3d687df37f4eaffb 100644 (file)
@@ -165,17 +165,27 @@ static struct regulator_consumer_supply palmas_ldo3_supply[] = {
 };
 
 static struct regulator_consumer_supply palmas_ldo4_supply[] = {
+       REGULATOR_SUPPLY("vdd_1v2_cam", NULL),
+       REGULATOR_SUPPLY("dvdd", "2-0010"),
+       REGULATOR_SUPPLY("vdig", "2-0036"),
 };
 
 static struct regulator_consumer_supply palmas_ldo5_supply[] = {
+       REGULATOR_SUPPLY("avdd_cam2", NULL),
+       REGULATOR_SUPPLY("avdd", "2-0010"),
 };
 
 static struct regulator_consumer_supply palmas_ldo6_supply[] = {
 };
 
 static struct regulator_consumer_supply palmas_ldo7_supply[] = {
+       REGULATOR_SUPPLY("avdd_2v8_cam_af", NULL),
        REGULATOR_SUPPLY("vdd_af_cam1", NULL),
+       REGULATOR_SUPPLY("avdd_cam1", NULL),
+       REGULATOR_SUPPLY("vana", "2-0036"),
+       REGULATOR_SUPPLY("vdd", "2-000e"),
 };
+
 static struct regulator_consumer_supply palmas_ldo8_supply[] = {
        REGULATOR_SUPPLY("vdd_rtc", NULL),
 };
@@ -240,7 +250,7 @@ PALMAS_PDATA_INIT(ldo6, 2850,  2850, palmas_rails(smps9), 1, 1, 1);
 PALMAS_PDATA_INIT(ldo7, 2700,  2700, palmas_rails(smps9), 0, 0, 1);
 PALMAS_PDATA_INIT(ldo8, 1100,  1100, NULL, 1, 1, 1);
 PALMAS_PDATA_INIT(ldo9, 1800,  2900, palmas_rails(smps9), 0, 0, 1);
-PALMAS_PDATA_INIT(ldoln, 3300, 3300, NULL, 0, 0, 1);
+PALMAS_PDATA_INIT(ldoln, 3300,   3300, NULL, 0, 0, 1);
 PALMAS_PDATA_INIT(ldousb, 3300,  3300, NULL, 0, 0, 1);
 PALMAS_PDATA_INIT(regen1, 4200,  4200, NULL, 0, 0, 0);
 PALMAS_PDATA_INIT(regen2, 4200,  4200, palmas_rails(smps8), 0, 0, 0);
@@ -379,6 +389,13 @@ static struct regulator_consumer_supply fixed_reg_vddio_sd_slot_supply[] = {
        REGULATOR_SUPPLY("vddio_sd_slot", "sdhci-tegra.2"),
 };
 
+static struct regulator_consumer_supply fixed_reg_vd_cam_1v8_supply[] = {
+       REGULATOR_SUPPLY("vdd_cam_1v8", NULL),
+       REGULATOR_SUPPLY("vi2c", "2-0030"),
+       REGULATOR_SUPPLY("vif", "2-0036"),
+       REGULATOR_SUPPLY("dovdd", "2-0010"),
+       REGULATOR_SUPPLY("vdd_i2c", "2-000e"),
+};
 
 /* Macro for defining fixed regulator sub device data */
 #define FIXED_SUPPLY(_name) "fixed_reg_"#_name
@@ -442,6 +459,10 @@ FIXED_REG(5,       vddio_sd_slot,  vddio_sd_slot,
        palmas_rails(smps9),    0,      0,
        TEGRA_GPIO_PK1, false,  true,   0,      2900);
 
+FIXED_REG(6,   vd_cam_1v8,     vd_cam_1v8,
+       palmas_rails(smps8),    0,      0,
+       PALMAS_TEGRA_GPIO_BASE + PALMAS_GPIO6,  false,  true,   0,      1800);
+
 #define ADD_FIXED_REG(_name)   (&fixed_reg_##_name##_dev)
 
 /* Gpio switch regulator platform data for Macallan E1545 */
@@ -451,6 +472,7 @@ static struct platform_device *fixed_reg_devs[] = {
        ADD_FIXED_REG(dvdd_ts),
        ADD_FIXED_REG(vdd_hdmi_5v0),
        ADD_FIXED_REG(vddio_sd_slot),
+       ADD_FIXED_REG(vd_cam_1v8),
 };
 
 
index c85aa0afd8ba390c6b45c722d889d44e85349dc9..ea6240ab30f231215de53fced5cfe9decc3ec000 100644 (file)
@@ -60,7 +60,6 @@
 static struct nvc_gpio_pdata imx091_gpio_pdata[] = {
        {IMX091_GPIO_RESET, CAM_RSTN, true, false},
        {IMX091_GPIO_PWDN, CAM1_POWER_DWN_GPIO, true, false},
-       {IMX091_GPIO_GP1, CAM_GPIO1, true, false}
 };
 
 static struct board_info board_info;
@@ -228,27 +227,6 @@ static struct tegra_pingroup_config pbb0_disable =
 static struct tegra_pingroup_config pbb0_enable =
        VI_PINMUX(GPIO_PBB0, VI_ALT3, NORMAL, NORMAL, OUTPUT, DEFAULT, DEFAULT);
 
-/*
- * As a workaround, macallan_vcmvdd need to be allocated to activate the
- * sensor devices. This is due to the focuser device(AD5816) will hook up
- * the i2c bus if it is not powered up.
-*/
-static struct regulator *macallan_vcmvdd;
-
-static int macallan_get_vcmvdd(void)
-{
-       if (!macallan_vcmvdd) {
-               macallan_vcmvdd = regulator_get(NULL, "vdd_af_cam1");
-               if (unlikely(WARN_ON(IS_ERR(macallan_vcmvdd)))) {
-                       pr_err("%s: can't get regulator vcmvdd: %ld\n",
-                               __func__, PTR_ERR(macallan_vcmvdd));
-                       macallan_vcmvdd = NULL;
-                       return -ENODEV;
-               }
-       }
-       return 0;
-}
-
 static int macallan_imx091_power_on(struct nvc_regulator *vreg)
 {
        int err;
@@ -256,9 +234,6 @@ static int macallan_imx091_power_on(struct nvc_regulator *vreg)
        if (unlikely(WARN_ON(!vreg)))
                return -EFAULT;
 
-       if (macallan_get_vcmvdd())
-               goto imx091_poweron_fail;
-
        gpio_set_value(CAM1_POWER_DWN_GPIO, 0);
        usleep_range(10, 20);
 
@@ -273,25 +248,17 @@ static int macallan_imx091_power_on(struct nvc_regulator *vreg)
        usleep_range(1, 2);
        gpio_set_value(CAM1_POWER_DWN_GPIO, 1);
 
-       err = regulator_enable(macallan_vcmvdd);
-       if (unlikely(err))
-               goto imx091_vcmvdd_fail;
-
        tegra_pinmux_config_table(&mclk_enable, 1);
        usleep_range(300, 310);
 
        return 1;
 
-imx091_vcmvdd_fail:
-       regulator_disable(vreg[IMX091_VREG_IOVDD].vreg);
-
 imx091_iovdd_fail:
        regulator_disable(vreg[IMX091_VREG_AVDD].vreg);
 
 imx091_avdd_fail:
        gpio_set_value(CAM1_POWER_DWN_GPIO, 0);
 
-imx091_poweron_fail:
        pr_err("%s FAILED\n", __func__);
        return -ENODEV;
 }
@@ -306,7 +273,6 @@ static int macallan_imx091_power_off(struct nvc_regulator *vreg)
        gpio_set_value(CAM1_POWER_DWN_GPIO, 0);
        usleep_range(1, 2);
 
-       regulator_disable(macallan_vcmvdd);
        regulator_disable(vreg[IMX091_VREG_IOVDD].vreg);
        regulator_disable(vreg[IMX091_VREG_AVDD].vreg);
 
@@ -371,9 +337,6 @@ static int macallan_ov9772_power_on(struct ov9772_power_rail *pw)
        if (unlikely(!pw || !pw->avdd || !pw->dovdd))
                return -EFAULT;
 
-       if (macallan_get_vcmvdd())
-               goto ov9772_get_vcmvdd_fail;
-
        gpio_set_value(CAM2_POWER_DWN_GPIO, 0);
        gpio_set_value(CAM_RSTN, 0);
 
@@ -388,19 +351,12 @@ static int macallan_ov9772_power_on(struct ov9772_power_rail *pw)
        gpio_set_value(CAM_RSTN, 1);
        gpio_set_value(CAM2_POWER_DWN_GPIO, 1);
 
-       err = regulator_enable(macallan_vcmvdd);
-       if (unlikely(err))
-               goto ov9772_vcmvdd_fail;
-
        tegra_pinmux_config_table(&pbb0_enable, 1);
        usleep_range(340, 380);
 
        /* return 1 to skip the in-driver power_on sequence */
        return 1;
 
-ov9772_vcmvdd_fail:
-       regulator_disable(pw->dovdd);
-
 ov9772_dovdd_fail:
        regulator_disable(pw->avdd);
 
@@ -408,14 +364,13 @@ ov9772_avdd_fail:
        gpio_set_value(CAM_RSTN, 0);
        gpio_set_value(CAM2_POWER_DWN_GPIO, 0);
 
-ov9772_get_vcmvdd_fail:
        pr_err("%s FAILED\n", __func__);
        return -ENODEV;
 }
 
 static int macallan_ov9772_power_off(struct ov9772_power_rail *pw)
 {
-       if (unlikely(!pw || !macallan_vcmvdd || !pw->avdd || !pw->dovdd))
+       if (unlikely(!pw || !pw->avdd || !pw->dovdd))
                return -EFAULT;
 
        usleep_range(21, 25);
@@ -424,7 +379,6 @@ static int macallan_ov9772_power_off(struct ov9772_power_rail *pw)
        gpio_set_value(CAM2_POWER_DWN_GPIO, 0);
        gpio_set_value(CAM_RSTN, 0);
 
-       regulator_disable(macallan_vcmvdd);
        regulator_disable(pw->dovdd);
        regulator_disable(pw->avdd);
 
@@ -446,24 +400,6 @@ static struct ov9772_platform_data macallan_ov9772_pdata = {
        .power_off      = macallan_ov9772_power_off,
 };
 
-static int macallan_as3648_power_on(struct as364x_power_rail *pw)
-{
-       int err = macallan_get_vcmvdd();
-
-       if (err)
-               return err;
-
-       return regulator_enable(macallan_vcmvdd);
-}
-
-static int macallan_as3648_power_off(struct as364x_power_rail *pw)
-{
-       if (!macallan_vcmvdd)
-               return -ENODEV;
-
-       return regulator_disable(macallan_vcmvdd);
-}
-
 static struct as364x_platform_data macallan_as3648_pdata = {
        .config         = {
                .led_mask       = 3,
@@ -479,9 +415,6 @@ static struct as364x_platform_data macallan_as3648_pdata = {
        .dev_name       = "torch",
        .type           = AS3648,
        .gpio_strobe    = CAM_FLASH_STROBE,
-
-       .power_on_callback = macallan_as3648_power_on,
-       .power_off_callback = macallan_as3648_power_off,
 };
 
 static struct ad5816_platform_data macallan_ad5816_pdata = {