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

Commit a240e4e6 authored by Camera Software Integration's avatar Camera Software Integration Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: camera: tfe: check cdm hang in the tfe config timeout" into camera-kernel.lnx.3.1

parents 0a0ebfa0 b46d4b01
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;