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

Commit 81f338de authored by Jilai Wang's avatar Jilai Wang
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: Icb60b31b87bf7929bbce9f080ea98befe4462d6a
Signed-off-by: default avatarJilai Wang <jilaiw@codeaurora.org>
parent 2272f29a
Loading
Loading
Loading
Loading
+16 −2
Original line number Diff line number Diff line
@@ -97,6 +97,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;

@@ -107,6 +108,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");
@@ -907,6 +914,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)) {
@@ -933,8 +943,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++) {
@@ -1145,6 +1153,12 @@ static int wait_for_status_ready(struct npu_device *npu_dev,
			return -ETIMEDOUT;
		}

		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