drm/tegra: Set nvenc actmon count weight once

Change the implementation to set count weight values for both actmon and
the engine once in runtime resume cycle to align the implementation as
nvdec for kernel upstream.

Bug 4251915

Signed-off-by: Johnny Liu <johnliu@nvidia.com>
Change-Id: Ie2df685e990a4ebcd5a83db23db3c3bc8ab2af37
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2965502
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Johnny Liu
2023-08-22 03:30:30 +00:00
committed by mobile promotions
parent f279ce0dfc
commit d6a45460a5

View File

@@ -74,9 +74,8 @@ static inline void nvenc_writel(struct nvenc *nvenc, u32 value, unsigned int off
static int nvenc_set_rate(struct nvenc *nvenc, unsigned long rate)
{
struct host1x_client *client = &nvenc->client.base;
unsigned long dev_rate;
u32 weight, emc_kbps;
u32 emc_kbps;
int err;
err = clk_set_rate(nvenc->clk, rate);
@@ -88,11 +87,6 @@ static int nvenc_set_rate(struct nvenc *nvenc, unsigned long rate)
dev_rate = clk_get_rate(nvenc->clk);
host1x_actmon_update_client_rate(client, dev_rate, &weight);
if (weight)
nvenc_writel(nvenc, weight, NVENC_TFBIF_ACTMON_ACTIVE_WEIGHT);
if (nvenc->icc_write) {
emc_kbps = dev_rate * NVENC_AXI_RW_BANDWIDTH / 1024;
err = icc_set_bw(nvenc->icc_write, kbps_to_icc(emc_kbps), 0);
@@ -448,6 +442,17 @@ static void nvenc_actmon_reg_init(struct nvenc *nvenc)
NVENC_TFBIF_ACTMON_ACTIVE_BORPS);
}
static void nvenc_count_weight_init(struct nvenc *nvenc, unsigned long rate)
{
struct host1x_client *client = &nvenc->client.base;
u32 weight = 0;
host1x_actmon_update_client_rate(client, rate, &weight);
if (weight)
nvenc_writel(nvenc, weight, NVENC_TFBIF_ACTMON_ACTIVE_WEIGHT);
}
static __maybe_unused int nvenc_runtime_resume(struct device *dev)
{
struct nvenc *nvenc = dev_get_drvdata(dev);
@@ -473,6 +478,8 @@ static __maybe_unused int nvenc_runtime_resume(struct device *dev)
nvenc_actmon_reg_init(nvenc);
nvenc_count_weight_init(nvenc, nvenc->devfreq->resume_freq);
host1x_actmon_enable(&nvenc->client.base);
return 0;