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

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

Merge "msm: npu: Set npu bandwidth during power on/off"

parents 599a1931 a99755a4
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -347,8 +347,15 @@ int npu_enable_core_power(struct npu_device *npu_dev)
		if (ret)
			return ret;

		ret = npu_set_bw(npu_dev, 100, 100);
		if (ret) {
			npu_disable_regulators(npu_dev);
			return ret;
		}

		ret = npu_enable_core_clocks(npu_dev);
		if (ret) {
			npu_set_bw(npu_dev, 0, 0);
			npu_disable_regulators(npu_dev);
			pwr->pwr_vote_num = 0;
			return ret;
@@ -368,6 +375,7 @@ void npu_disable_core_power(struct npu_device *npu_dev)
	pwr->pwr_vote_num--;
	if (!pwr->pwr_vote_num) {
		npu_disable_core_clocks(npu_dev);
		npu_set_bw(npu_dev, 0, 0);
		npu_disable_regulators(npu_dev);
		pwr->active_pwrlevel = pwr->default_pwrlevel;
		pwr->uc_pwrlevel = pwr->max_pwrlevel;
@@ -2079,7 +2087,6 @@ static int npu_hw_info_init(struct npu_device *npu_dev)
{
	int rc = 0;

	npu_set_bw(npu_dev, 100, 100);
	rc = npu_enable_core_power(npu_dev);
	if (rc) {
		NPU_ERR("Failed to enable power\n");
@@ -2089,7 +2096,6 @@ static int npu_hw_info_init(struct npu_device *npu_dev)
	npu_dev->hw_version = REGR(npu_dev, NPU_HW_VERSION);
	NPU_DBG("NPU_HW_VERSION 0x%x\n", npu_dev->hw_version);
	npu_disable_core_power(npu_dev);
	npu_set_bw(npu_dev, 0, 0);

	return rc;
}
+2 −11
Original line number Diff line number Diff line
@@ -79,12 +79,6 @@ static int load_fw_nolock(struct npu_device *npu_dev, bool enable)
		return 0;
	}

	ret = npu_set_bw(npu_dev, 100, 100);
	if (ret) {
		NPU_ERR("Vote bandwidth failed\n");
		return ret;
	}

	/* Boot the NPU subsystem */
	reinit_completion(&host_ctx->npu_power_up_done);
	host_ctx->subsystem_handle = subsystem_get_local("npu");
@@ -155,10 +149,9 @@ static int load_fw_nolock(struct npu_device *npu_dev, bool enable)
	if (!ret) {
		host_ctx->fw_state = FW_LOADED;
	} else {
		if (!IS_ERR_OR_NULL(host_ctx->subsystem_handle)) {
		if (!IS_ERR_OR_NULL(host_ctx->subsystem_handle))
			subsystem_put_local(host_ctx->subsystem_handle);
			npu_set_bw(npu_dev, 0, 0);
		}

		host_ctx->fw_state = FW_UNLOADED;
	}

@@ -218,7 +211,6 @@ int unload_fw(struct npu_device *npu_dev)
	}

	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);
@@ -384,7 +376,6 @@ static void disable_fw_nolock(struct npu_device *npu_dev)
		subsystem_put_local(host_ctx->subsystem_handle);
		host_ctx->fw_state = FW_UNLOADED;
		NPU_DBG("fw is unloaded\n");
		npu_set_bw(npu_dev, 0, 0);
	}
}