drm/tegra: Set nvjpg 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: I6df0f13d1c58402cb78e4e05ff6cd6cd21ef2c4b
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2965505
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:35:45 +00:00
committed by mobile promotions
parent d6a45460a5
commit 1dcfd26f70

View File

@@ -73,9 +73,8 @@ static inline void nvjpg_writel(struct nvjpg *nvjpg, u32 value, unsigned int off
static int nvjpg_set_rate(struct nvjpg *nvjpg, unsigned long rate) static int nvjpg_set_rate(struct nvjpg *nvjpg, unsigned long rate)
{ {
struct host1x_client *client = &nvjpg->client.base;
unsigned long dev_rate; unsigned long dev_rate;
u32 weight, emc_kbps; u32 emc_kbps;
int err; int err;
err = clk_set_rate(nvjpg->clk, rate); err = clk_set_rate(nvjpg->clk, rate);
@@ -87,11 +86,6 @@ static int nvjpg_set_rate(struct nvjpg *nvjpg, unsigned long rate)
dev_rate = clk_get_rate(nvjpg->clk); dev_rate = clk_get_rate(nvjpg->clk);
host1x_actmon_update_client_rate(client, dev_rate, &weight);
if (weight)
nvjpg_writel(nvjpg, weight, NVJPG_TFBIF_ACTMON_ACTIVE_WEIGHT);
if (nvjpg->icc_write) { if (nvjpg->icc_write) {
emc_kbps = dev_rate * NVJPG_AXI_RW_BANDWIDTH / 1024; emc_kbps = dev_rate * NVJPG_AXI_RW_BANDWIDTH / 1024;
err = icc_set_bw(nvjpg->icc_write, kbps_to_icc(emc_kbps), 0); err = icc_set_bw(nvjpg->icc_write, kbps_to_icc(emc_kbps), 0);
@@ -447,6 +441,17 @@ static void nvjpg_actmon_reg_init(struct nvjpg *nvjpg)
NVJPG_TFBIF_ACTMON_ACTIVE_BORPS); NVJPG_TFBIF_ACTMON_ACTIVE_BORPS);
} }
static void nvjpg_count_weight_init(struct nvjpg *nvjpg, unsigned long rate)
{
struct host1x_client *client = &nvjpg->client.base;
u32 weight = 0;
host1x_actmon_update_client_rate(client, rate, &weight);
if (weight)
nvjpg_writel(nvjpg, weight, NVJPG_TFBIF_ACTMON_ACTIVE_WEIGHT);
}
static __maybe_unused int nvjpg_runtime_resume(struct device *dev) static __maybe_unused int nvjpg_runtime_resume(struct device *dev)
{ {
struct nvjpg *nvjpg = dev_get_drvdata(dev); struct nvjpg *nvjpg = dev_get_drvdata(dev);
@@ -472,6 +477,8 @@ static __maybe_unused int nvjpg_runtime_resume(struct device *dev)
nvjpg_actmon_reg_init(nvjpg); nvjpg_actmon_reg_init(nvjpg);
nvjpg_count_weight_init(nvjpg, nvjpg->devfreq->resume_freq);
host1x_actmon_enable(&nvjpg->client.base); host1x_actmon_enable(&nvjpg->client.base);
return 0; return 0;