Преглед на файлове

Merge "msm: camera: reqmgr: Pause the timer before sensor stream on" into camera-kernel.lnx.5.0

Haritha Chintalapati преди 4 години
родител
ревизия
3198ac75e2
променени са 2 файла, в които са добавени 32 реда и са изтрити 3 реда
  1. 16 3
      drivers/cam_req_mgr/cam_req_mgr_core.c
  2. 16 0
      drivers/cam_sensor_module/cam_sensor/cam_sensor_core.c

+ 16 - 3
drivers/cam_req_mgr/cam_req_mgr_core.c

@@ -2078,7 +2078,9 @@ static int __cam_req_mgr_process_sof_freeze(void *priv, void *data)
 
 	spin_lock_bh(&link->link_state_spin_lock);
 	if ((link->watchdog) && (link->watchdog->pause_timer)) {
-		CAM_INFO(CAM_CRM, "Watchdog Paused");
+		CAM_INFO(CAM_CRM,
+			"link:%x watchdog paused, maybe stream on/off is delayed",
+			link->link_hdl);
 		spin_unlock_bh(&link->link_state_spin_lock);
 		return rc;
 	}
@@ -3190,8 +3192,16 @@ static int cam_req_mgr_cb_notify_timer(
 		rc = -EPERM;
 		goto end;
 	}
-	if ((link->watchdog) && (!timer_data->state))
-		link->watchdog->pause_timer = true;
+	if (link->watchdog) {
+		if (!timer_data->state)
+			link->watchdog->pause_timer = true;
+		else
+			link->watchdog->pause_timer = false;
+		crm_timer_reset(link->watchdog);
+		CAM_DBG(CAM_CRM, "link %x pause_timer %d",
+			link->link_hdl, link->watchdog->pause_timer);
+	}
+
 	spin_unlock_bh(&link->link_state_spin_lock);
 
 end:
@@ -3238,6 +3248,7 @@ static int cam_req_mgr_cb_notify_stop(
 		goto end;
 	}
 	crm_timer_reset(link->watchdog);
+	link->watchdog->pause_timer = true;
 	spin_unlock_bh(&link->link_state_spin_lock);
 
 	task = cam_req_mgr_workq_get_task(link->workq);
@@ -4286,6 +4297,8 @@ int cam_req_mgr_link_control(struct cam_req_mgr_link_control *control)
 					link->link_hdl);
 				rc = -EFAULT;
 			}
+			/* Pause the timer before sensor stream on */
+			link->watchdog->pause_timer = true;
 			/* notify nodes */
 			for (j = 0; j < link->num_devs; j++) {
 				dev = &link->l_dev[j];

+ 16 - 0
drivers/cam_sensor_module/cam_sensor/cam_sensor_core.c

@@ -1001,6 +1001,7 @@ int32_t cam_sensor_driver_cmd(struct cam_sensor_ctrl_t *s_ctrl,
 		break;
 	}
 	case CAM_START_DEV: {
+		struct cam_req_mgr_timer_notify timer;
 		if ((s_ctrl->sensor_state == CAM_SENSOR_INIT) ||
 			(s_ctrl->sensor_state == CAM_SENSOR_START)) {
 			rc = -EINVAL;
@@ -1023,6 +1024,21 @@ int32_t cam_sensor_driver_cmd(struct cam_sensor_ctrl_t *s_ctrl,
 			}
 		}
 		s_ctrl->sensor_state = CAM_SENSOR_START;
+
+		if (s_ctrl->bridge_intf.crm_cb &&
+			s_ctrl->bridge_intf.crm_cb->notify_timer) {
+			timer.link_hdl = s_ctrl->bridge_intf.link_hdl;
+			timer.dev_hdl = s_ctrl->bridge_intf.device_hdl;
+			timer.state = true;
+			rc = s_ctrl->bridge_intf.crm_cb->notify_timer(&timer);
+			if (rc) {
+				CAM_ERR(CAM_SENSOR,
+					"Enable CRM SOF freeze timer failed rc: %d",
+					rc);
+				return rc;
+			}
+		}
+
 		CAM_INFO(CAM_SENSOR,
 			"CAM_START_DEV Success for %s sensor_id:0x%x,sensor_slave_addr:0x%x",
 			s_ctrl->sensor_name,