mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
drm/tegra: Register actmon for the vic client
Register vic actmon to export the engine utilization information in the debugfs. Bug 3788919 Signed-off-by: Johnny Liu <johnliu@nvidia.com> Change-Id: I3bde644a7708d0b59f6e3a24fc40f4b95b6a6789 Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2887424 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:
committed by
mobile promotions
parent
fa8cf02e87
commit
f826f7efc3
@@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2015, NVIDIA Corporation.
|
||||
* Copyright (C) 2015-2023 NVIDIA CORPORATION. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/clk.h>
|
||||
@@ -101,6 +101,28 @@ static int vic_boot(struct vic *vic)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vic_set_rate(struct vic *vic, unsigned long rate)
|
||||
{
|
||||
struct host1x_client *client = &vic->client.base;
|
||||
unsigned long dev_rate;
|
||||
u32 weight;
|
||||
int err;
|
||||
|
||||
err = clk_set_rate(vic->clk, rate);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
dev_rate = clk_get_rate(vic->clk);
|
||||
|
||||
host1x_actmon_update_client_rate(client, dev_rate, &weight);
|
||||
|
||||
if (weight)
|
||||
vic_writel(vic, weight, NV_PVIC_TFBIF_ACTMON_ACTIVE_WEIGHT);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int vic_init(struct host1x_client *client)
|
||||
{
|
||||
struct tegra_drm_client *drm = host1x_to_drm_client(client);
|
||||
@@ -188,9 +210,18 @@ static int vic_exit(struct host1x_client *client)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static unsigned long vic_get_rate(struct host1x_client *client)
|
||||
{
|
||||
struct platform_device *pdev = to_platform_device(client->dev);
|
||||
struct vic *vic = platform_get_drvdata(pdev);
|
||||
|
||||
return clk_get_rate(vic->clk);
|
||||
}
|
||||
|
||||
static const struct host1x_client_ops vic_client_ops = {
|
||||
.init = vic_init,
|
||||
.exit = vic_exit,
|
||||
.get_rate = vic_get_rate,
|
||||
};
|
||||
|
||||
static int vic_load_firmware(struct vic *vic)
|
||||
@@ -465,12 +496,6 @@ static int vic_probe(struct platform_device *pdev)
|
||||
return PTR_ERR(vic->clk);
|
||||
}
|
||||
|
||||
err = clk_set_rate(vic->clk, ULONG_MAX);
|
||||
if (err < 0) {
|
||||
dev_err(&pdev->dev, "failed to set clock rate\n");
|
||||
return err;
|
||||
}
|
||||
|
||||
if (!dev->pm_domain) {
|
||||
vic->rst = devm_reset_control_get(dev, "vic");
|
||||
if (IS_ERR(vic->rst)) {
|
||||
@@ -506,6 +531,17 @@ static int vic_probe(struct platform_device *pdev)
|
||||
goto exit_falcon;
|
||||
}
|
||||
|
||||
err = host1x_actmon_register(&vic->client.base);
|
||||
if (err < 0)
|
||||
dev_info(dev, "failed to register host1x actmon: %d\n", err);
|
||||
|
||||
/* Set default clock rate for vic and update count weight register */
|
||||
err = vic_set_rate(vic, ULONG_MAX);
|
||||
if (err < 0) {
|
||||
dev_err(&pdev->dev, "failed to set clock rate\n");
|
||||
return err;
|
||||
}
|
||||
|
||||
pm_runtime_enable(dev);
|
||||
pm_runtime_use_autosuspend(dev);
|
||||
pm_runtime_set_autosuspend_delay(dev, 500);
|
||||
@@ -525,6 +561,11 @@ static int vic_remove(struct platform_device *pdev)
|
||||
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
|
||||
err = host1x_actmon_unregister(&vic->client.base);
|
||||
if (err < 0)
|
||||
dev_info(&pdev->dev, "failed to unregister host1x actmon: %d\n",
|
||||
err);
|
||||
|
||||
err = host1x_client_unregister(&vic->client.base);
|
||||
if (err < 0) {
|
||||
dev_err(&pdev->dev, "failed to unregister host1x client: %d\n",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
* Copyright (c) 2015, NVIDIA Corporation.
|
||||
* Copyright (c) 2015-2023, NVIDIA Corporation. All rights reserved.
|
||||
*/
|
||||
|
||||
#ifndef TEGRA_VIC_H
|
||||
@@ -18,6 +18,8 @@
|
||||
#define CG_IDLE_CG_EN (1 << 6)
|
||||
#define CG_WAKEUP_DLY_CNT(val) ((val & 0xf) << 16)
|
||||
|
||||
#define NV_PVIC_TFBIF_ACTMON_ACTIVE_WEIGHT 0x00002054
|
||||
|
||||
#define VIC_TFBIF_TRANSCFG 0x00002044
|
||||
|
||||
/* Firmware offsets */
|
||||
|
||||
Reference in New Issue
Block a user