]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drm/amd/powerplay: bypass fan table setup if no fan connected
authorHawking Zhang <Hawking.Zhang@amd.com>
Thu, 1 Dec 2016 09:14:45 +0000 (17:14 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 6 Dec 2016 23:08:33 +0000 (18:08 -0500)
If vBIOS noFan bit is set, the fan table parameters in thermal controller
will not get initialized. The driver should avoid to use these uninitialized
parameter to do calculation. Otherwise, it may trigger divide 0 error.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
drivers/gpu/drm/amd/powerplay/smumgr/fiji_smc.c
drivers/gpu/drm/amd/powerplay/smumgr/iceland_smc.c
drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smc.c
drivers/gpu/drm/amd/powerplay/smumgr/tonga_smc.c

index 34523fe6ed6fc25c17900f9e537df494e400340a..6aeb1d20cc3b2b806f49e7e72aaafe238431a2e1 100644 (file)
@@ -1958,6 +1958,12 @@ int fiji_thermal_setup_fan_table(struct pp_hwmgr *hwmgr)
        int res;
        uint64_t tmp64;
 
+       if (hwmgr->thermal_controller.fanInfo.bNoFan) {
+               phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
+                       PHM_PlatformCaps_MicrocodeFanControl);
+               return 0;
+       }
+
        if (smu_data->smu7_data.fan_table_start == 0) {
                phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
                                PHM_PlatformCaps_MicrocodeFanControl);
index b579f0c175e69af1848f1395dd5124241f1acc47..a24971a33bfdc19e43c8214f6b661c1dd2624eb3 100644 (file)
@@ -2006,6 +2006,12 @@ int iceland_thermal_setup_fan_table(struct pp_hwmgr *hwmgr)
        if (!phm_cap_enabled(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_MicrocodeFanControl))
                return 0;
 
+       if (hwmgr->thermal_controller.fanInfo.bNoFan) {
+               phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
+                       PHM_PlatformCaps_MicrocodeFanControl);
+               return 0;
+       }
+
        if (0 == smu7_data->fan_table_start) {
                phm_cap_unset(hwmgr->platform_descriptor.platformCaps, PHM_PlatformCaps_MicrocodeFanControl);
                return 0;
index 8db8e209d915e3fd43fbb0a04112d9c9c763ffe8..5190e821200cba6de72b3dbff9849df435420dcc 100644 (file)
@@ -1885,6 +1885,12 @@ int polaris10_thermal_setup_fan_table(struct pp_hwmgr *hwmgr)
        int res;
        uint64_t tmp64;
 
+       if (hwmgr->thermal_controller.fanInfo.bNoFan) {
+               phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
+                       PHM_PlatformCaps_MicrocodeFanControl);
+               return 0;
+       }
+
        if (smu_data->smu7_data.fan_table_start == 0) {
                phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
                                PHM_PlatformCaps_MicrocodeFanControl);
index d08f6f19b4541c236195f4ef8b782477d818ea22..2e1493ce1bb5020239ed6223ec4e7349f8c6be9e 100644 (file)
@@ -2496,6 +2496,12 @@ int tonga_thermal_setup_fan_table(struct pp_hwmgr *hwmgr)
                                        PHM_PlatformCaps_MicrocodeFanControl))
                return 0;
 
+       if (hwmgr->thermal_controller.fanInfo.bNoFan) {
+               phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
+                       PHM_PlatformCaps_MicrocodeFanControl);
+               return 0;
+       }
+
        if (0 == smu_data->smu7_data.fan_table_start) {
                phm_cap_unset(hwmgr->platform_descriptor.platformCaps,
                                        PHM_PlatformCaps_MicrocodeFanControl);