فهرست منبع

msm: camera: sensor: Power down in case of cci init failure

Currently power down is not happening in case of cci_init failure.
This can lead to corruption for the next power up, as power down
did not happen for the previous session. This change does power down
in case of cci failure and as a part of that it can power up resources
correctly in next session.

CRs-Fixed: 2797857
Change-Id: I9089222cb45834ae895903a4a3e21dd799beb3ed
Signed-off-by: Jigarkumar Zala <[email protected]>
Jigarkumar Zala 4 سال پیش
والد
کامیت
33899faa8b

+ 8 - 1
drivers/cam_sensor_module/cam_actuator/cam_actuator_core.c

@@ -106,8 +106,15 @@ static int32_t cam_actuator_power_up(struct cam_actuator_ctrl_t *a_ctrl)
 	}
 
 	rc = camera_io_init(&a_ctrl->io_master_info);
-	if (rc < 0)
+	if (rc < 0) {
 		CAM_ERR(CAM_ACTUATOR, "cci init failed: rc: %d", rc);
+		goto cci_failure;
+	}
+
+	return rc;
+cci_failure:
+	if (cam_sensor_util_power_down(power_info, soc_info))
+		CAM_ERR(CAM_ACTUATOR, "Power down failure");
 
 	return rc;
 }

+ 6 - 1
drivers/cam_sensor_module/cam_eeprom/cam_eeprom_core.c

@@ -185,10 +185,15 @@ static int cam_eeprom_power_up(struct cam_eeprom_ctrl_t *e_ctrl,
 		rc = camera_io_init(&(e_ctrl->io_master_info));
 		if (rc) {
 			CAM_ERR(CAM_EEPROM, "cci_init failed");
-			return -EINVAL;
+			goto cci_failure;
 		}
 	}
 	return rc;
+cci_failure:
+	if (cam_sensor_util_power_down(power_info, soc_info))
+		CAM_ERR(CAM_EEPROM, "Power down failure");
+
+	return rc;
 }
 
 /**

+ 8 - 1
drivers/cam_sensor_module/cam_ois/cam_ois_core.c

@@ -153,8 +153,15 @@ static int cam_ois_power_up(struct cam_ois_ctrl_t *o_ctrl)
 	}
 
 	rc = camera_io_init(&o_ctrl->io_master_info);
-	if (rc)
+	if (rc) {
 		CAM_ERR(CAM_OIS, "cci_init failed: rc: %d", rc);
+		goto cci_failure;
+	}
+
+	return rc;
+cci_failure:
+	if (cam_sensor_util_power_down(power_info, soc_info))
+		CAM_ERR(CAM_OIS, "Power Down failed");
 
 	return rc;
 }

+ 2 - 2
drivers/cam_sensor_module/cam_res_mgr/cam_res_mgr.c

@@ -462,8 +462,8 @@ int cam_res_mgr_gpio_request(struct device *dev, uint gpio,
 		CAM_DBG(CAM_RES, "gpio: %u not found in gpio_res list", gpio);
 		rc = gpio_request_one(gpio, flags, label);
 		if (rc) {
-			CAM_ERR(CAM_RES, "gpio %d:%s request fails",
-				gpio, label);
+			CAM_ERR(CAM_RES, "gpio %d:%s request fails rc = %d",
+				gpio, label, rc);
 			goto end;
 		}
 	}

+ 9 - 1
drivers/cam_sensor_module/cam_sensor/cam_sensor_core.c

@@ -1197,10 +1197,18 @@ int cam_sensor_power_up(struct cam_sensor_ctrl_t *s_ctrl)
 	}
 
 	rc = camera_io_init(&(s_ctrl->io_master_info));
-	if (rc < 0)
+	if (rc < 0) {
 		CAM_ERR(CAM_SENSOR, "cci_init failed: rc: %d", rc);
+		goto cci_failure;
+	}
 
 	return rc;
+cci_failure:
+	if (cam_sensor_util_power_down(power_info, soc_info))
+		CAM_ERR(CAM_SENSOR, "power down failure");
+
+	return rc;
+
 }
 
 int cam_sensor_power_down(struct cam_sensor_ctrl_t *s_ctrl)