From 69fbe4cf55e5463926744e26fab3c6b2ff55bc1d Mon Sep 17 00:00:00 2001 From: chengxue Date: Fri, 16 Oct 2020 17:44:36 +0800 Subject: [PATCH] msm: camera: reqmgr: check applied req id for sync mode While links out of sync, one link faster than another. the early link reset its slot while receive trigger from isp, and the slow link will check ready always fail on sync link, and stuck happens. CRs-Fixed: 2800759 Change-Id: If615828304947d79ecbb2c87f03af29824598be0 Signed-off-by: chengxue --- drivers/cam_req_mgr/cam_req_mgr_core.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/cam_req_mgr/cam_req_mgr_core.c b/drivers/cam_req_mgr/cam_req_mgr_core.c index fdbd9565ab49..2b37fc1a7e1a 100644 --- a/drivers/cam_req_mgr/cam_req_mgr_core.c +++ b/drivers/cam_req_mgr/cam_req_mgr_core.c @@ -950,7 +950,7 @@ static int __cam_req_mgr_send_req(struct cam_req_mgr_core_link *link, apply_req.trigger_point = trigger; CAM_DBG(CAM_REQ, - "SEND: %d link_hdl: %x pd %d req_id %lld", + "SEND: link_hdl: %x pd %d req_id %lld", link->link_hdl, pd, apply_req.request_id); if (dev->ops && dev->ops->apply_req) { rc = dev->ops->apply_req(&apply_req); @@ -1334,6 +1334,7 @@ static int __cam_req_mgr_check_sync_req_is_ready( uint64_t sof_timestamp_delta = 0; uint64_t master_slave_diff = 0; bool ready = true, sync_ready = true; + int slot_idx_diff = 0; if (!sync_link || !link) { CAM_ERR(CAM_CRM, "Sync link null"); @@ -1439,12 +1440,14 @@ static int __cam_req_mgr_check_sync_req_is_ready( return -EAGAIN; } + slot_idx_diff = (sync_slot_idx - sync_rd_idx + sync_num_slots) % + sync_num_slots; if ((sync_link->req.in_q->slot[sync_slot_idx].status != CRM_SLOT_STATUS_REQ_APPLIED) && - (((sync_slot_idx - sync_rd_idx + sync_num_slots) % - sync_num_slots) >= 1) && + ((slot_idx_diff > 1) || + ((slot_idx_diff == 1) && (sync_rd_slot->status != - CRM_SLOT_STATUS_REQ_APPLIED)) { + CRM_SLOT_STATUS_REQ_APPLIED)))) { CAM_DBG(CAM_CRM, "Req: %lld [other link] not next req to be applied on link: %x", req_id, sync_link->link_hdl);