Bladeren bron

msm: camera: ois: Fix stop ois logic

When ois get stop op code and the state is not in start,
we need return directly and don't set state to config.
This change also adds ctrl mutex init when ois i2c
component bind.

CRs-Fixed: 3520698
Change-Id: I0041f9aa3af250d449f7b757791ef684fa1b385f
Signed-off-by: Wang Kan <[email protected]>
Wang Kan 2 jaren geleden
bovenliggende
commit
033efcbed0

+ 3 - 2
drivers/cam_sensor_module/cam_ois/cam_ois_core.c

@@ -1751,8 +1751,9 @@ int cam_ois_driver_cmd(struct cam_ois_ctrl_t *o_ctrl, void *arg)
 		if (o_ctrl->cam_ois_state != CAM_OIS_START) {
 			rc = -EINVAL;
 			CAM_WARN(CAM_OIS,
-			"Not in right state for stop : %d",
-			o_ctrl->cam_ois_state);
+				"Not in right state for stop : %d",
+				o_ctrl->cam_ois_state);
+			goto release_mutex;
 		}
 		o_ctrl->cam_ois_state = CAM_OIS_CONFIG;
 		break;

+ 1 - 0
drivers/cam_sensor_module/cam_ois/cam_ois_dev.c

@@ -235,6 +235,7 @@ static int cam_ois_i2c_component_bind(struct device *dev,
 
 	cam_sensor_module_add_i2c_device((void *) o_ctrl, CAM_SENSOR_OIS);
 
+	mutex_init(&(o_ctrl->ois_mutex));
 	o_ctrl->cam_ois_state = CAM_OIS_INIT;
 
 	return rc;