Skip to contentSkip to conversation

drm/amd/powerplay: use hardware fan control if no powerplay fan table

PATCH In review Evan Quan 3 participants 3 messages Jun 28, 2019 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Evan Quan

author
#0 lore raw

PATCH 1/1 drm/amd/powerplay: use hardware fan control if no powerplay fan table

Use SMC default fan table if no external powerplay fan table.

Change-Id Icd7467a7fc5287a92945ba0fcc19699192b1683a
---
 drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c | 4 +++-
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h                   | 1 +
 drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c     | 4 ++++
 3 files changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +3 -1
index ae64ff7153d6..1cd5a8b5cdc1 100644
@@ -916,8 +916,10 @@ static int init_thermal_controller(
 			PHM_PlatformCaps_ThermalController
 		  );
 
-	if (0 == powerplay_table->usFanTableOffset)
+	if (0 == powerplay_table->usFanTableOffset) {
+		hwmgr->thermal_controller.use_hw_fan_control = 1;
 		return 0;
+	}
 
 	fan_table = (const PPTable_Generic_SubTable_Header *)
 		(((unsigned long)powerplay_table) +
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +1 -0
index 2f186fcbdfc5..ec53bf24396e 100644
@@ -697,6 +697,7 @@ struct pp_thermal_controller_info {
 	uint8_t ucType;
 	uint8_t ucI2cLine;
 	uint8_t ucI2cAddress;
+	uint8_t use_hw_fan_control;
 	struct pp_fan_info fanInfo;
 	struct pp_advance_fan_control_parameters advanceFanControlParameters;
 };
drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +4 -0
index fbac2d3326b5..a1a9f6196009 100644
@@ -2092,6 +2092,10 @@ static int polaris10_thermal_setup_fan_table(struct pp_hwmgr *hwmgr)
 		return 0;
 	}
 
+	/* use hardware fan control */
+	if (hwmgr->thermal_controller.use_hw_fan_control)
+		return 0;
+
 	tmp64 = hwmgr->thermal_controller.advanceFanControlParameters.
 			usPWMMin * duty100;
 	do_div(tmp64, 10000);
Signature · 6 lines
2.21.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): [email protected]

Reviewed-by
#2 lore raw
Quoted 2 lines · Evan Quan

Use SMC default fan table if no external powerplay fan table.

Maybe add a line saying you may get errors if the table is empty and you try and use it. With that,

Quoted 55 lines
Change-Id Icd7467a7fc5287a92945ba0fcc19699192b1683a
---
 drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c | 4 +++-
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h                   | 1 +
 drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c     | 4 ++++
 3 files changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +3 -1
index ae64ff7153d6..1cd5a8b5cdc1 100644
@@ -916,8 +916,10 @@ static int init_thermal_controller(
                        PHM_PlatformCaps_ThermalController
                  );
 
-       if (0 == powerplay_table->usFanTableOffset)
+       if (0 == powerplay_table->usFanTableOffset) {
+               hwmgr->thermal_controller.use_hw_fan_control = 1;
                return 0;
+       }
 
        fan_table = (const PPTable_Generic_SubTable_Header *)
                (((unsigned long)powerplay_table) +
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +1 -0
index 2f186fcbdfc5..ec53bf24396e 100644
@@ -697,6 +697,7 @@ struct pp_thermal_controller_info {
        uint8_t ucType;
        uint8_t ucI2cLine;
        uint8_t ucI2cAddress;
+       uint8_t use_hw_fan_control;
        struct pp_fan_info fanInfo;
        struct pp_advance_fan_control_parameters advanceFanControlParameters;
 };
drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +4 -1
index fbac2d3326b5..a1a9f6196009 100644
@@ -2092,6 +2092,10 @@ static int polaris10_thermal_setup_fan_table(struct pp_hwmgr *hwmgr)
                return 0;
        }
 
+       /* use hardware fan control */
+       if (hwmgr->thermal_controller.use_hw_fan_control)
+               return 0;
+
        tmp64 = hwmgr->thermal_controller.advanceFanControlParameters.
                        usPWMMin * duty100;
        do_div(tmp64, 10000);
--

2.21.0

Quoted 4 lines

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Tested-by Acked-by
#3 lore raw
In reply to a message not in the archive

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Evan Quan <[email protected]>
Sent: Thursday, June 27, 2019 11:15:29 PM
To: [email protected]
Cc: Quan, Evan
Subject: [PATCH] drm/amd/powerplay: use hardware fan control if no powerplay fan table

Use SMC default fan table if no external powerplay fan table.

Change-Id Icd7467a7fc5287a92945ba0fcc19699192b1683a
---
 drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c | 4 +++-
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h                   | 1 +
 drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c     | 4 ++++
 3 files changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c +3 -1
index ae64ff7153d6..1cd5a8b5cdc1 100644
@@ -916,8 +916,10 @@ static int init_thermal_controller(
                         PHM_PlatformCaps_ThermalController
                   );
 
-       if (0 == powerplay_table->usFanTableOffset)
+       if (0 == powerplay_table->usFanTableOffset) {
+               hwmgr->thermal_controller.use_hw_fan_control = 1;
                 return 0;
+       }
 
         fan_table = (const PPTable_Generic_SubTable_Header *)
                 (((unsigned long)powerplay_table) +
drivers/gpu/drm/amd/powerplay/inc/hwmgr.h +1 -0
index 2f186fcbdfc5..ec53bf24396e 100644
@@ -697,6 +697,7 @@ struct pp_thermal_controller_info {
         uint8_t ucType;
         uint8_t ucI2cLine;
         uint8_t ucI2cAddress;
+       uint8_t use_hw_fan_control;
         struct pp_fan_info fanInfo;
         struct pp_advance_fan_control_parameters advanceFanControlParameters;
 };
drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c +4 -0
index fbac2d3326b5..a1a9f6196009 100644
@@ -2092,6 +2092,10 @@ static int polaris10_thermal_setup_fan_table(struct pp_hwmgr *hwmgr)
                 return 0;
         }
 
+       /* use hardware fan control */
+       if (hwmgr->thermal_controller.use_hw_fan_control)
+               return 0;
+
         tmp64 = hwmgr->thermal_controller.advanceFanControlParameters.
                         usPWMMin * duty100;
         do_div(tmp64, 10000);

--
2.21.0

_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx