Blob Blame History Raw
From: Alex Deucher <alexander.deucher@amd.com>
Date: Thu, 4 Jan 2018 16:33:38 -0500
Subject: drm/amd/powerplay: export thermal range through temp sysfs
Git-commit: 77f208d91ba4cb947688d834dc90dcf1a37da068
Patch-mainline: v4.17-rc1
References: FATE#326289 FATE#326079 FATE#326049 FATE#322398 FATE#326166

Populate the hwmon temp range as part of thermal controller setup.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Petr Tesarik <ptesarik@suse.com>
---
 drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

--- a/drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/hardwaremanager.c
@@ -227,14 +227,21 @@ int phm_register_thermal_interrupt(struc
 */
 int phm_start_thermal_controller(struct pp_hwmgr *hwmgr)
 {
+	int ret = 0;
 	struct PP_TemperatureRange range = {TEMP_RANGE_MIN, TEMP_RANGE_MAX};
 
+	if (hwmgr->hwmgr_func->get_thermal_temperature_range)
+		hwmgr->hwmgr_func->get_thermal_temperature_range(
+				hwmgr, &range);
+
 	if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
 			PHM_PlatformCaps_ThermalController)
 			&& hwmgr->hwmgr_func->start_thermal_controller != NULL)
-		return hwmgr->hwmgr_func->start_thermal_controller(hwmgr, &range);
+		ret = hwmgr->hwmgr_func->start_thermal_controller(hwmgr, &range);
+
+	cgs_set_temperature_range(hwmgr->device, range.min, range.max);
 
-	return 0;
+	return ret;
 }