浏览代码

msm: camera: reqmgr: Pause the timer before sensor stream on

Sometimes, the cpu load is very high, then the devcies
stream on will be delayed, but the CRM watchdog is already
enabled before streaming on, then we will have a chance to
notify SOF freeze issue.
This change pauses the CRM watchdog timer before streaming
on sensor and after stopping ife, when we can detect the
stream on and stream off delay, but don't notify error,
also can detect the real SOF freeze issue.

CRs-Fixed: 2804587
Change-Id: Iccaee837930ea22290b109eff45b05300d844312
Signed-off-by: Depeng Shao <[email protected]>
Depeng Shao 4 年之前
父节点
当前提交
4591949a37
共有 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,