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

Commit 2637dfde authored by Jilai Wang's avatar Jilai Wang
Browse files

msm: npu: Vote minimum bandwidth before unload fw via PIL



Minimum bandwidth voting is required for PIL to unload fw properly.

Change-Id: I109d8fbb33d4ecd424432cc58aaa0ea7c5d95624
Signed-off-by: default avatarJilai Wang <jilaiw@codeaurora.org>
parent a99755a4
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -193,6 +193,7 @@ int load_fw(struct npu_device *npu_dev)
int unload_fw(struct npu_device *npu_dev)
{
	struct npu_host_ctx *host_ctx = &npu_dev->host_ctx;
	int ret = 0;

	if (host_ctx->auto_pil_disable) {
		NPU_WARN("auto pil is disabled\n");
@@ -210,7 +211,16 @@ int unload_fw(struct npu_device *npu_dev)
		return -EBUSY;
	}

	/* vote minimum bandwidth before unload npu fw via PIL */
	ret = npu_set_bw(npu_dev, 100, 100);
	if (ret) {
		NPU_ERR("Can't update bandwidth\n");
		mutex_unlock(&host_ctx->lock);
		return ret;
	}

	subsystem_put_local(host_ctx->subsystem_handle);
	npu_set_bw(npu_dev, 0, 0);
	host_ctx->fw_state = FW_UNLOADED;
	NPU_DBG("fw is unloaded\n");
	mutex_unlock(&host_ctx->lock);