Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ee7f610b authored by Depeng Shao's avatar Depeng Shao Committed by Gerrit - the friendly Code Review server
Browse files

msm: camera: reqmgr: Reset sync link initial sync req



Reset sync link initial sync req when current link
enter non-sync mode as CRM has no chance to reset it
when sync link no req is applied, and hold the link
if sync link process request slowly.

Change-Id: I861fa6162bc97e830e6daed39c4e2903f2b91ba7
Signed-off-by: default avatarDepeng Shao <depengs@codeaurora.org>
parent 3b3e314b
Loading
Loading
Loading
Loading
+20 −2
Original line number Original line Diff line number Diff line
@@ -637,7 +637,7 @@ static int __cam_req_mgr_check_sync_for_mslave(
{
{
	struct cam_req_mgr_core_link *sync_link = NULL;
	struct cam_req_mgr_core_link *sync_link = NULL;
	struct cam_req_mgr_slot      *sync_slot = NULL;
	struct cam_req_mgr_slot      *sync_slot = NULL;
	int sync_slot_idx = 0, prev_idx, next_idx, rd_idx, rc = 0;
	int sync_slot_idx = 0, prev_idx, next_idx, rd_idx, sync_rd_idx, rc = 0;
	int64_t req_id = 0, sync_req_id = 0;
	int64_t req_id = 0, sync_req_id = 0;


	if (!link->sync_link) {
	if (!link->sync_link) {
@@ -647,6 +647,7 @@ static int __cam_req_mgr_check_sync_for_mslave(


	sync_link = link->sync_link;
	sync_link = link->sync_link;
	req_id = slot->req_id;
	req_id = slot->req_id;
	sync_rd_idx = sync_link->req.in_q->rd_idx;


	CAM_DBG(CAM_CRM,
	CAM_DBG(CAM_CRM,
		"link_hdl %x req %lld frame_skip_flag %d open_req_cnt:%d initial_sync_req [%lld,%lld] is_master:%d",
		"link_hdl %x req %lld frame_skip_flag %d open_req_cnt:%d initial_sync_req [%lld,%lld] is_master:%d",
@@ -663,6 +664,19 @@ static int __cam_req_mgr_check_sync_for_mslave(
		return -EAGAIN;
		return -EAGAIN;
	}
	}


	if (link->in_msync_mode &&
		sync_link->in_msync_mode &&
		(req_id - sync_link->req.in_q->slot[sync_rd_idx].req_id >
		link->max_delay - sync_link->max_delay)) {
		CAM_DBG(CAM_CRM,
			"Req: %lld on link:%x need to hold for link: %x req:%d",
			req_id,
			link->link_hdl,
			sync_link->link_hdl,
			sync_link->req.in_q->slot[sync_rd_idx].req_id);
		return -EINVAL;
	}

	if (link->is_master) {
	if (link->is_master) {
		rc = __cam_req_mgr_inject_delay(link->req.l_tbl, slot->idx);
		rc = __cam_req_mgr_inject_delay(link->req.l_tbl, slot->idx);
		if (rc) {
		if (rc) {
@@ -1001,8 +1015,10 @@ static int __cam_req_mgr_process_req(struct cam_req_mgr_core_link *link,
					link->link_hdl);
					link->link_hdl);
				link->in_msync_mode = false;
				link->in_msync_mode = false;
				link->initial_sync_req = -1;
				link->initial_sync_req = -1;
				if (link->sync_link)
				if (link->sync_link) {
					link->sync_link->initial_sync_req = -1;
					link->sync_link->initial_sync_req = -1;
					link->sync_link->in_msync_mode = false;
				}
			}
			}


			rc = __cam_req_mgr_inject_delay(link->req.l_tbl,
			rc = __cam_req_mgr_inject_delay(link->req.l_tbl,
@@ -1755,6 +1771,8 @@ int cam_req_mgr_process_sched_req(void *priv, void *data)
			link->initial_sync_req = slot->req_id;
			link->initial_sync_req = slot->req_id;
	} else {
	} else {
		link->initial_sync_req = -1;
		link->initial_sync_req = -1;
		if (link->sync_link)
			link->sync_link->initial_sync_req = -1;
	}
	}


	mutex_unlock(&link->req.lock);
	mutex_unlock(&link->req.lock);