gpu: nvgpu: add unified path of GPU devfreq dev

Add a symbolic link: /sys/devices/gpu.0/devfreq_dev which
pointed to GPU devfreq device: /sys/devices/gpu.0/devfreq/
devfreq<N>. The unified path won't be changed when the
number devfreq<N> is changed.

Bug 200588449

Change-Id: If00c9f9517a13a952d54a2963f31db81fd52e6fb
Signed-off-by: Aaron Tian <atian@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2298606
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Leon Yu <leoyu@nvidia.com>
Reviewed-by: Seshendra Gadagottu <sgadagottu@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Aaron Tian
2020-02-18 14:54:57 +08:00
committed by Alex Waterman
parent 74ae8bb20b
commit ef69bbc92b

View File

@@ -361,6 +361,7 @@ void gk20a_scale_init(struct device *dev)
if (platform->devfreq_governor) {
struct devfreq *devfreq;
int error = 0;
profile->devfreq_profile.initial_freq =
profile->devfreq_profile.freq_table[0];
@@ -378,6 +379,18 @@ void gk20a_scale_init(struct device *dev)
devfreq = NULL;
l->devfreq = devfreq;
/* create symlink /sys/devices/gpu.0/devfreq_dev */
if (devfreq != NULL) {
error = sysfs_create_link(&dev->kobj,
&devfreq->dev.kobj, "devfreq_dev");
if (error) {
nvgpu_err(g,
"Failed to create devfreq_dev: %d",
error);
}
}
}
#ifdef CONFIG_GK20A_PM_QOS
@@ -416,6 +429,8 @@ void gk20a_scale_exit(struct device *dev)
#endif
if (platform->devfreq_governor) {
sysfs_remove_link(&dev->kobj, "devfreq_dev");
err = devfreq_remove_device(l->devfreq);
l->devfreq = NULL;
}