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

Commit 6bc440d8 authored by Tejas Prajapati's avatar Tejas Prajapati Committed by Alok Pandey
Browse files

msm: camera: reqmgr: Reset previous skipped slot if valid request



It makes sure that last applied index also get reset when it is
modified with new index.

Change-Id: I47f717886e8a5287c4488fe9cfd91542fe733386
Signed-off-by: default avatarTejas Prajapati <tpraja@codeaurora.org>
Signed-off-by: default avatarAlok Pandey <akumarpa@codeaurora.org>
parent abcce7e3
Loading
Loading
Loading
Loading
+23 −4
Original line number Diff line number Diff line
@@ -348,7 +348,8 @@ static void __cam_req_mgr_reset_req_slot(struct cam_req_mgr_core_link *link,
	struct cam_req_mgr_req_queue *in_q = link->req.in_q;

	slot = &in_q->slot[idx];
	CAM_DBG(CAM_CRM, "RESET: idx: %d: slot->status %d", idx, slot->status);
	CAM_DBG(CAM_CRM, "RESET: last applied idx %d: idx %d: slot->status %d",
			in_q->last_applied_idx, idx, slot->status);

	/* Check if CSL has already pushed new request*/
	if (slot->status == CRM_SLOT_STATUS_REQ_ADDED ||
@@ -1012,7 +1013,7 @@ static int __cam_req_mgr_check_sync_req_is_ready(
static int __cam_req_mgr_process_req(struct cam_req_mgr_core_link *link,
	uint32_t trigger)
{
	int                                  rc = 0, idx;
	int                                  rc = 0, idx, last_app_idx;
	int                                  reset_step = 0;
	struct cam_req_mgr_slot             *slot = NULL;
	struct cam_req_mgr_req_queue        *in_q;
@@ -1146,8 +1147,7 @@ static int __cam_req_mgr_process_req(struct cam_req_mgr_core_link *link,
				slot->req_id,
				link->link_hdl);
			idx = in_q->rd_idx;
			if (slot->req_id > 0)
				in_q->last_applied_idx = idx;

			reset_step = link->max_delay;
			if (link->sync_link) {
				if ((link->in_msync_mode) &&
@@ -1155,6 +1155,25 @@ static int __cam_req_mgr_process_req(struct cam_req_mgr_core_link *link,
					reset_step =
						link->sync_link->max_delay;
			}

			/* This is to handle a rare scenario of scheduling
			 * issue. If ISP sends multiple sofs due to scheduling
			 * issue, it is required to retain last applied index
			 * to help recover.
			 * In this case, ISP goes into Bubble, asking to reapply
			 * the bubbled request which has already been reset by
			 * CRM. Below code retains the last applied request.
			 */

			if (slot->req_id > 0) {
				last_app_idx = in_q->last_applied_idx;
				in_q->last_applied_idx = idx;
				if (abs(last_app_idx - idx) >=
					reset_step + 1)
					__cam_req_mgr_reset_req_slot(link,
						last_app_idx);
			}

			__cam_req_mgr_dec_idx(
				&idx, reset_step + 1,
				in_q->num_slots);