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

Commit b1cccc0a authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

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

parents 83473cb6 93e2ec03
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");
@@ -913,6 +920,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)) {
@@ -939,8 +949,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++) {
@@ -1151,6 +1159,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