瀏覽代碼

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 年之前
父節點
當前提交
033efcbed0
共有 2 個文件被更改,包括 4 次插入2 次删除
  1. 3 2
      drivers/cam_sensor_module/cam_ois/cam_ois_core.c
  2. 1 0
      drivers/cam_sensor_module/cam_ois/cam_ois_dev.c

+ 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) {
 		if (o_ctrl->cam_ois_state != CAM_OIS_START) {
 			rc = -EINVAL;
 			rc = -EINVAL;
 			CAM_WARN(CAM_OIS,
 			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;
 		o_ctrl->cam_ois_state = CAM_OIS_CONFIG;
 		break;
 		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);
 	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;
 	o_ctrl->cam_ois_state = CAM_OIS_INIT;
 
 
 	return rc;
 	return rc;