From 088bb16dd9fb248b6fddc7d237f7242a99953c0a Mon Sep 17 00:00:00 2001 From: Johnny Liu Date: Tue, 25 Jul 2023 05:24:01 +0000 Subject: [PATCH] gpu: nvgpu: Migrate to upstream ICC Transitioning to the Upstream ICC implementation by using devm_of_icc_get() api which get's interconnect path from the interconnect property in DT. Bug 3997304 Signed-off-by: Johnny Liu Change-Id: I84dc43e006ecf84ae3260125367fbd36ba35b38a Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2945210 Reviewed-by: Vaibhav Kachore GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/os/linux/platform_ga10b_tegra.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/nvgpu/os/linux/platform_ga10b_tegra.c b/drivers/gpu/nvgpu/os/linux/platform_ga10b_tegra.c index c21f66287..5530dfc4e 100644 --- a/drivers/gpu/nvgpu/os/linux/platform_ga10b_tegra.c +++ b/drivers/gpu/nvgpu/os/linux/platform_ga10b_tegra.c @@ -249,9 +249,13 @@ void ga10b_tegra_scale_init(struct device *dev) if ((struct icc_path *)profile->private_data) return; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 11, 0) + icc_path_handle = devm_of_icc_get(dev, "write"); +#else icc_path_handle = icc_get(dev, TEGRA_ICC_GPU, TEGRA_ICC_PRIMARY); +#endif if (IS_ERR_OR_NULL(icc_path_handle)) { - dev_err(dev, "%s unable to get icc path (err=%ld)\n", + dev_info(dev, "%s unable to get icc path (err=%ld)\n", __func__, PTR_ERR(icc_path_handle)); return; } @@ -267,7 +271,9 @@ static void ga10b_tegra_scale_exit(struct device *dev) struct gk20a_scale_profile *profile = platform->g->scale_profile; if (profile && profile->private_data) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 11, 0) icc_put((struct icc_path *)profile->private_data); +#endif profile->private_data = NULL; } #endif