mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 09:12:24 +03:00
gpu: nvgpu: add thermal cooling support
Add devfeq thermal cooling device for GPU software thermal throttling. Bug 3287074 Change-Id: Ib0b53a58177964dfda3c8993da9c4835e2cb8a6e Signed-off-by: Rajkumar Kasirajan <rkasirajan@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2625659 Reviewed-by: svcacv <svcacv@nvidia.com> Reviewed-by: Seshendra Gadagottu <sgadagottu@nvidia.com> Reviewed-by: Srikar Srimath Tirumala <srikars@nvidia.com> Reviewed-by: Bibek Basu <bbasu@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: Seshendra Gadagottu <sgadagottu@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com> GVS: Gerrit_Virtual_Submit
This commit is contained in:
committed by
mobile promotions
parent
616a885079
commit
71cd434f4f
@@ -74,6 +74,9 @@ struct nvgpu_os_linux {
|
||||
struct device *dev;
|
||||
struct dgpu_thermal_alert thermal_alert;
|
||||
struct nvgpu_interrupts interrupts;
|
||||
#ifdef CONFIG_DEVFREQ_THERMAL
|
||||
struct thermal_cooling_device *cooling;
|
||||
#endif
|
||||
|
||||
struct nvgpu_list_node class_list_head;
|
||||
struct nvgpu_list_node cdev_list_head;
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
*/
|
||||
|
||||
#include <linux/devfreq.h>
|
||||
#ifdef CONFIG_DEVFREQ_THERMAL
|
||||
#include <linux/devfreq_cooling.h>
|
||||
#endif
|
||||
#include <linux/export.h>
|
||||
#include <linux/pm_qos.h>
|
||||
#include <linux/version.h>
|
||||
@@ -384,6 +387,9 @@ void gk20a_scale_init(struct device *dev)
|
||||
struct gk20a *g = platform->g;
|
||||
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
|
||||
struct gk20a_scale_profile *profile;
|
||||
#ifdef CONFIG_DEVFREQ_THERMAL
|
||||
struct thermal_cooling_device *cooling;
|
||||
#endif
|
||||
int err;
|
||||
|
||||
if (g->scale_profile)
|
||||
@@ -434,6 +440,14 @@ void gk20a_scale_init(struct device *dev)
|
||||
|
||||
l->devfreq = devfreq;
|
||||
|
||||
#ifdef CONFIG_DEVFREQ_THERMAL
|
||||
cooling = of_devfreq_cooling_register(dev->of_node, devfreq);
|
||||
if (IS_ERR(cooling))
|
||||
dev_info(dev, "Failed to register cooling device\n");
|
||||
else
|
||||
l->cooling = cooling;
|
||||
#endif
|
||||
|
||||
/* create symlink /sys/devices/gpu.0/devfreq_dev */
|
||||
if (devfreq != NULL) {
|
||||
error = sysfs_create_link(&dev->kobj,
|
||||
@@ -485,6 +499,13 @@ void gk20a_scale_exit(struct device *dev)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DEVFREQ_THERMAL
|
||||
if (l->cooling) {
|
||||
devfreq_cooling_unregister(l->cooling);
|
||||
l->cooling = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (platform->devfreq_governor) {
|
||||
sysfs_remove_link(&dev->kobj, "devfreq_dev");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user