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

Commit 93e2ec03 authored by Da Hoon Pyun's avatar Da Hoon Pyun Committed by Gerrit - the friendly Code Review server
Browse files

msm: npu: Don't poll status register if watchdog is triggered



Once NPU watchdog is triggered, polling status register must
time out. So it's not needed to keep polling status register in
this scenario.

Change-Id: Id0513c47d0a0812e3e82c2dd03b5ce5075b3f183
Signed-off-by: default avatarDa Hoon Pyun <dpyun@codeaurora.org>
parent 652771c4
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -104,6 +104,7 @@ static int wait_npu_cpc_power_off(struct npu_device *npu_dev)
{
	uint32_t reg_val = NPU_CPC_PWR_ON;
	uint32_t wait_cnt = 0, max_wait_ms;
	struct npu_host_ctx *host_ctx = &npu_dev->host_ctx;

	max_wait_ms = NPU_FW_TIMEOUT_MS;

@@ -114,6 +115,12 @@ static int wait_npu_cpc_power_off(struct npu_device *npu_dev)
			break;
		}

		if ((host_ctx->wdg_irq_sts != 0) ||
			(host_ctx->err_irq_sts != 0)) {
			NPU_WARN("fw is in bad state, skip wait\n");
			return -EIO;
		}

		wait_cnt += NPU_FW_TIMEOUT_POLL_INTERVAL_MS;
		if (wait_cnt > max_wait_ms) {
			NPU_ERR("timeout wait for cpc power off\n");
@@ -887,6 +894,9 @@ static int host_error_hdlr(struct npu_device *npu_dev, bool force)
		goto fw_start_done;
	}

	host_ctx->wdg_irq_sts = 0;
	host_ctx->err_irq_sts = 0;

	/* Keep reading ctrl status until NPU is ready */
	if (wait_for_status_ready(npu_dev, REG_NPU_FW_CTRL_STATUS,
		FW_CTRL_STATUS_MAIN_THREAD_READY_VAL, false)) {
@@ -913,8 +923,6 @@ static int host_error_hdlr(struct npu_device *npu_dev, bool force)
	}

	complete(&host_ctx->fw_deinit_done);
	host_ctx->wdg_irq_sts = 0;
	host_ctx->err_irq_sts = 0;

	/* flush all pending npu cmds */
	for (i = 0; i < MAX_LOADED_NETWORK; i++) {
@@ -1125,6 +1133,12 @@ static int wait_for_status_ready(struct npu_device *npu_dev,
			return -EPERM;
		}

		if ((host_ctx->wdg_irq_sts != 0) ||
			(host_ctx->err_irq_sts != 0)) {
			NPU_WARN("fw is in bad state, skip wait\n");
			return -EIO;
		}

		if (poll)
			udelay(100);
		else