ARM: tegra: cardhu: adjust ov2710 power sequence
Charlie Huang [Fri, 10 Aug 2012 23:26:34 +0000 (16:26 -0700)]
To fix an instability issue, the power sequence is updated to match
the specification for this device.

bug 1031318

Change-Id: I3970af7ae8ed2baa6060f548242b0093040afb53
Signed-off-by: Charlie Huang <chahuang@nvidia.com>
Reviewed-on: http://git-master/r/122867
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Patrick Shehane <pshehane@nvidia.com>
Reviewed-by: Dan Willemsen <dwillemsen@nvidia.com>

arch/arm/mach-tegra/board-cardhu-sensors.c

index bb6a2ae..7e9774f 100644 (file)
@@ -340,7 +340,7 @@ static int cardhu_right_ov5650_power_off(void)
        gpio_direction_output(CAMERA_CSI_MUX_SEL_GPIO, 0);
 
        /* Boards E1198 and E1291 are of Cardhu personality
-        * and donot have TCA6416 exp for camera */
+        * and do not have TCA6416 for camera */
        if ((board_info.board_id == BOARD_E1198) ||
                (board_info.board_id == BOARD_E1291)) {
                gpio_direction_output(CAM1_POWER_DWN_GPIO, 1);
@@ -387,16 +387,21 @@ static int cardhu_ov2710_power_on(void)
        /* CSI-B and front sensor are muxed on cardhu */
        gpio_direction_output(CAMERA_CSI_MUX_SEL_GPIO, 1);
 
+       /* Enable VDD_1V8_Cam3 */
+       if (cardhu_1v8_cam3 == NULL) {
+               cardhu_1v8_cam3 = regulator_get(NULL, "vdd_1v8_cam3");
+               if (WARN_ON(IS_ERR(cardhu_1v8_cam3))) {
+                       pr_err("%s: couldn't get regulator vdd_1v8_cam3: %ld\n",
+                               __func__, PTR_ERR(cardhu_1v8_cam3));
+                       goto reg_alloc_fail;
+               }
+       }
+       regulator_enable(cardhu_1v8_cam3);
+
        /* Boards E1198 and E1291 are of Cardhu personality
-        * and donot have TCA6416 exp for camera */
+        * and do not have TCA6416 for camera */
        if ((board_info.board_id == BOARD_E1198) ||
                (board_info.board_id == BOARD_E1291)) {
-
-               gpio_direction_output(CAM1_POWER_DWN_GPIO, 0);
-               gpio_direction_output(CAM2_POWER_DWN_GPIO, 0);
-               gpio_direction_output(CAM3_POWER_DWN_GPIO, 0);
-               mdelay(10);
-
                if (cardhu_vdd_cam3 == NULL) {
                        cardhu_vdd_cam3 = regulator_get(NULL, "vdd_cam3");
                        if (WARN_ON(IS_ERR(cardhu_vdd_cam3))) {
@@ -406,19 +411,17 @@ static int cardhu_ov2710_power_on(void)
                        }
                }
                regulator_enable(cardhu_vdd_cam3);
-       }
 
-       /* Enable VDD_1V8_Cam3 */
-       if (cardhu_1v8_cam3 == NULL) {
-               cardhu_1v8_cam3 = regulator_get(NULL, "vdd_1v8_cam3");
-               if (WARN_ON(IS_ERR(cardhu_1v8_cam3))) {
-                       pr_err("%s: couldn't get regulator vdd_1v8_cam3: %ld\n",
-                               __func__, PTR_ERR(cardhu_1v8_cam3));
-                       goto reg_alloc_fail;
-               }
+               mdelay(5);
+
+               gpio_direction_output(CAM1_POWER_DWN_GPIO, 0);
+               gpio_direction_output(CAM2_POWER_DWN_GPIO, 0);
+               gpio_direction_output(CAM3_POWER_DWN_GPIO, 0);
+               mdelay(10);
+
        }
-       regulator_enable(cardhu_1v8_cam3);
-       mdelay(5);
+
+       mdelay(20);
 
        return 0;
 
@@ -447,12 +450,12 @@ static int cardhu_ov2710_power_off(void)
                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_vdd_cam3)
+                       regulator_disable(cardhu_vdd_cam3);
        }
 
        if (cardhu_1v8_cam3)
                regulator_disable(cardhu_1v8_cam3);
-       if (cardhu_vdd_cam3)
-               regulator_disable(cardhu_vdd_cam3);
 
        return 0;
 }