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

Commit b46d4b01 authored by Ravikishore Pampana's avatar Ravikishore Pampana Committed by Rishabh Jain
Browse files

msm: camera: tfe: check cdm hang in the tfe config timeout



TFE driver submit the config packet to cdm and wait for call back.
If call back has not received with in 60ms, then tfe return failure which
cause tfe stream on failure. Some time cdm call back is not coming
due to cdm worker thread execution delay. So add mechanism to check if
cdm worker thread delay happened then wait for some more time
and check it again.

CRs-Fixed: 2664317
Change-Id: I2eb975a2c70b5889238e9cf706c703022f1bf2f5
Signed-off-by: default avatarRavikishore Pampana <rpampana@codeaurora.org>
parent aa560639
Loading
Loading
Loading
Loading
+75 −49
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@

#define CAM_TFE_HW_ENTRIES_MAX  20
#define CAM_TFE_HW_CONFIG_TIMEOUT 60
#define CAM_TFE_HW_CONFIG_WAIT_MAX_TRY  3

#define TZ_SVC_SMMU_PROGRAM 0x15
#define TZ_SAFE_SYSCALL_ID  0x3
@@ -2387,7 +2388,14 @@ static int cam_tfe_mgr_config_hw(void *hw_mgr_priv,
		"Enter ctx id:%d num_hw_upd_entries %d request id: %llu",
		ctx->ctx_index, cfg->num_hw_update_entries, cfg->request_id);

	if (cfg->num_hw_update_entries > 0) {
	if (cfg->num_hw_update_entries <= 0) {
		CAM_ERR(CAM_ISP,
			"Enter ctx id:%d no valid hw entries:%d request id: %llu",
			ctx->ctx_index, cfg->num_hw_update_entries,
			cfg->request_id);
		goto end;
	}

	cdm_cmd = ctx->cdm_cmd;
	cdm_cmd->cmd_arrary_count = cfg->num_hw_update_entries;
	cdm_cmd->type = CAM_CDM_BL_CMD_TYPE_MEM_HANDLE;
@@ -2426,26 +2434,44 @@ static int cam_tfe_mgr_config_hw(void *hw_mgr_priv,
		return rc;
	}

		if (cfg->init_packet) {
	if (!cfg->init_packet)
		goto end;

	for (i = 0; i < CAM_TFE_HW_CONFIG_WAIT_MAX_TRY; i++) {
		rc = wait_for_completion_timeout(
			&ctx->config_done_complete,
				msecs_to_jiffies(CAM_TFE_HW_CONFIG_TIMEOUT));
			msecs_to_jiffies(
			CAM_TFE_HW_CONFIG_TIMEOUT));
		if (rc <= 0) {
			if (!cam_cdm_detect_hang_error(ctx->cdm_handle)) {
				CAM_ERR(CAM_ISP,
					"CDM workqueue delay detected, wait for some more time req_id=%llu rc=%d ctx_index %d",
					cfg->request_id, rc,
					ctx->ctx_index);
				continue;
			}

			CAM_ERR(CAM_ISP,
				"config done completion timeout for req_id=%llu rc=%d ctx_index %d",
					cfg->request_id, rc, ctx->ctx_index);
				cfg->request_id, rc,
				ctx->ctx_index);
			if (rc == 0)
				rc = -ETIMEDOUT;

			goto end;
		} else {
			rc = 0;
			CAM_DBG(CAM_ISP,
				"config done Success for req_id=%llu ctx_index %d",
				cfg->request_id, ctx->ctx_index);
			break;
		}
	}
	} else {
		CAM_ERR(CAM_ISP, "No commands to config");
	}

	if ((i == CAM_TFE_HW_CONFIG_WAIT_MAX_TRY) && (rc == 0))
		rc = -ETIMEDOUT;

end:
	CAM_DBG(CAM_ISP, "Exit: Config Done: %llu",  cfg->request_id);

	return rc;