From 1a32649b75f10f26cbb70bfac0f39efedb256b8e Mon Sep 17 00:00:00 2001 From: Johnny Liu Date: Thu, 19 Oct 2023 07:29:38 +0000 Subject: [PATCH] drm/tegra: Support client get_rate for OFA When actmon reports the client usage information, it will call the get_rate callback provided by the client, and divide the number of sampled active clock cycles from the actmon counter register with the current client rate to determine the client usage value. Bug 4338396 Signed-off-by: Johnny Liu Change-Id: I5e3f69b8ed1d90407fe0b8202e7c9cde75a0dd30 Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3000330 Reviewed-by: Mikko Perttunen GVS: Gerrit_Virtual_Submit --- drivers/gpu/drm/tegra/ofa.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/gpu/drm/tegra/ofa.c b/drivers/gpu/drm/tegra/ofa.c index 86220a5f..054165ac 100644 --- a/drivers/gpu/drm/tegra/ofa.c +++ b/drivers/gpu/drm/tegra/ofa.c @@ -164,9 +164,17 @@ static int ofa_exit(struct host1x_client *client) return 0; } +static unsigned long ofa_get_rate(struct host1x_client *client) +{ + struct ofa *ofa = dev_get_drvdata(client->dev); + + return clk_get_rate(ofa->clk); +} + static const struct host1x_client_ops ofa_client_ops = { .init = ofa_init, .exit = ofa_exit, + .get_rate = ofa_get_rate, }; static int ofa_load_firmware(struct ofa *ofa)