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

Commit 9b3f91ec authored by Yash Upadhyay's avatar Yash Upadhyay
Browse files

msm: camera: cdm: check irq status on hang detection



Problem:
Check IRQ status on hang detection if the inline IRQ
is set then the cdm has triggered IRQ but there is a
workqueue scheduling delay which is causing the cdm's
config timeout.

Solution:
To prevent the timeout due to
scheduling delay check the work record and irq status
and return true if its delay.

CRs-Fixed: 3433175
Change-Id: Iaa34f8ff9b57e7da9f80677a7da9b4f9a53dad14
Signed-off-by: default avatarYash Upadhyay <quic_yupadhya@quicinc.com>
parent bfe3e9d7
Loading
Loading
Loading
Loading
+19 −21
Original line number Original line Diff line number Diff line
@@ -2648,6 +2648,7 @@ static int cam_tfe_mgr_config_hw(void *hw_mgr_priv,
	struct cam_tfe_hw_mgr_ctx *ctx;
	struct cam_tfe_hw_mgr_ctx *ctx;
	struct cam_isp_prepare_hw_update_data *hw_update_data;
	struct cam_isp_prepare_hw_update_data *hw_update_data;
	bool cdm_hang_detect = false;
	bool cdm_hang_detect = false;
	unsigned long rem_jiffies = 0;


	if (!hw_mgr_priv || !config_hw_args) {
	if (!hw_mgr_priv || !config_hw_args) {
		CAM_ERR(CAM_ISP, "Invalid arguments");
		CAM_ERR(CAM_ISP, "Invalid arguments");
@@ -2814,12 +2815,13 @@ static int cam_tfe_mgr_config_hw(void *hw_mgr_priv,
		goto end;
		goto end;


	for (i = 0; i < CAM_TFE_HW_CONFIG_WAIT_MAX_TRY; i++) {
	for (i = 0; i < CAM_TFE_HW_CONFIG_WAIT_MAX_TRY; i++) {
		rc = wait_for_completion_timeout(
		rem_jiffies = wait_for_completion_timeout(
			&ctx->config_done_complete,
			&ctx->config_done_complete,
			msecs_to_jiffies(
			msecs_to_jiffies(
			CAM_TFE_HW_CONFIG_TIMEOUT));
			CAM_TFE_HW_CONFIG_TIMEOUT));
		if (rc <= 0) {
		if (rem_jiffies <= 0) {
			if (!cam_cdm_detect_hang_error(ctx->cdm_handle)) {
			rc = cam_cdm_detect_hang_error(ctx->cdm_handle);
			if (rc == 0) {
				CAM_ERR(CAM_ISP,
				CAM_ERR(CAM_ISP,
					"CDM workqueue delay detected, wait for some more time req_id=%llu rc=%d ctx_index %d",
					"CDM workqueue delay detected, wait for some more time req_id=%llu rc=%d ctx_index %d",
					cfg->request_id, rc,
					cfg->request_id, rc,
@@ -2831,24 +2833,19 @@ static int cam_tfe_mgr_config_hw(void *hw_mgr_priv,
					CAM_DEFAULT_VALUE,
					CAM_DEFAULT_VALUE,
					CAM_DEFAULT_VALUE, rc);
					CAM_DEFAULT_VALUE, rc);
				continue;
				continue;
			}
			} else {

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

				cam_req_mgr_debug_delay_detect();
				cam_req_mgr_debug_delay_detect();
				trace_cam_delay_detect("ISP",
				trace_cam_delay_detect("ISP",
					"config done completion timeout",
					"config done completion timeout",
					cfg->request_id, ctx->ctx_index,
					cfg->request_id, ctx->ctx_index,
					CAM_DEFAULT_VALUE, CAM_DEFAULT_VALUE,
					CAM_DEFAULT_VALUE, CAM_DEFAULT_VALUE,
					rc);
					rc);

			if (rc == 0)
				rc = -ETIMEDOUT;
				rc = -ETIMEDOUT;

				break;
			goto end;
			}
		} else {
		} else {
			rc = 0;
			rc = 0;
			CAM_DBG(CAM_ISP,
			CAM_DBG(CAM_ISP,
@@ -2859,7 +2856,8 @@ static int cam_tfe_mgr_config_hw(void *hw_mgr_priv,
	}
	}


	if ((i == CAM_TFE_HW_CONFIG_WAIT_MAX_TRY) && (rc == 0))
	if ((i == CAM_TFE_HW_CONFIG_WAIT_MAX_TRY) && (rc == 0))
		rc = -ETIMEDOUT;
		CAM_DBG(CAM_ISP,
			"Wq delayed but IRQ CDM done");


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