summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/pm
diff options
context:
space:
mode:
authorEvan Quan <evan.quan@amd.com>2020-09-11 10:21:34 +0200
committerAlex Deucher <alexander.deucher@amd.com>2020-10-27 16:58:39 +0100
commit9610a3bfde4100c67ecc3367ed34d43d918be88f (patch)
tree5859b85bd0d493043ef9bdf831d74785e57f4104 /drivers/gpu/drm/amd/pm
parentdrm/amd/pm: correct polaris10 clock stretcher data table setting (diff)
downloadlinux-9610a3bfde4100c67ecc3367ed34d43d918be88f.tar.xz
linux-9610a3bfde4100c67ecc3367ed34d43d918be88f.zip
drm/amd/pm: setup zero rpm parameters for polaris10
Only if the ZeroRPM feature is supported. Signed-off-by: Evan Quan <evan.quan@amd.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/pm')
-rw-r--r--drivers/gpu/drm/amd/pm/inc/smu7_ppsmc.h1
-rw-r--r--drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_thermal.c11
-rw-r--r--drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c17
3 files changed, 29 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/pm/inc/smu7_ppsmc.h b/drivers/gpu/drm/amd/pm/inc/smu7_ppsmc.h
index 6e19f4c7cf8f..0454ec990a5e 100644
--- a/drivers/gpu/drm/amd/pm/inc/smu7_ppsmc.h
+++ b/drivers/gpu/drm/amd/pm/inc/smu7_ppsmc.h
@@ -394,6 +394,7 @@ typedef uint16_t PPSMC_Result;
#define PPSMC_MSG_SetGpuPllDfsForSclk ((uint16_t) 0x300)
#define PPSMC_MSG_Didt_Block_Function ((uint16_t) 0x301)
+#define PPSMC_MSG_EnableZeroRpm ((uint16_t) 0x302)
#define PPSMC_MSG_SetVBITimeout ((uint16_t) 0x306)
diff --git a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_thermal.c b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_thermal.c
index 0b30f73649a8..e3d9d969d86a 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_thermal.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/hwmgr/smu7_thermal.c
@@ -175,6 +175,17 @@ int smu7_fan_ctrl_start_smc_fan_control(struct pp_hwmgr *hwmgr)
hwmgr->thermal_controller.
advanceFanControlParameters.ucTargetTemperature,
NULL);
+
+ if (!result &&
+ (hwmgr->chip_id == CHIP_POLARIS10 ||
+ hwmgr->chip_id == CHIP_POLARIS11 ||
+ hwmgr->chip_id == CHIP_POLARIS12) &&
+ hwmgr->thermal_controller.advanceFanControlParameters.ucEnableZeroRPM &&
+ !PP_CAP(PHM_PlatformCaps_customThermalManagement))
+ result = smum_send_msg_to_smc(hwmgr,
+ PPSMC_MSG_EnableZeroRpm,
+ NULL);
+
hwmgr->fan_ctrl_enabled = true;
return result;
diff --git a/drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c b/drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c
index 9b7e9ddc5a1e..fad6ffb470ba 100644
--- a/drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c
+++ b/drivers/gpu/drm/amd/pm/powerplay/smumgr/polaris10_smumgr.c
@@ -470,6 +470,21 @@ static int polaris10_populate_bapm_parameters_in_dpm_table(struct pp_hwmgr *hwmg
return 0;
}
+static void polaris10_populate_zero_rpm_parameters(struct pp_hwmgr *hwmgr)
+{
+ struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend);
+ SMU74_Discrete_DpmTable *table = &(smu_data->smc_state_table);
+ uint16_t fan_stop_temp =
+ ((uint16_t)hwmgr->thermal_controller.advanceFanControlParameters.ucFanStopTemperature) << 8;
+ uint16_t fan_start_temp =
+ ((uint16_t)hwmgr->thermal_controller.advanceFanControlParameters.ucFanStartTemperature) << 8;
+
+ if (hwmgr->thermal_controller.advanceFanControlParameters.ucEnableZeroRPM) {
+ table->FanStartTemperature = PP_HOST_TO_SMC_US(fan_start_temp);
+ table->FanStopTemperature = PP_HOST_TO_SMC_US(fan_stop_temp);
+ }
+}
+
static int polaris10_populate_svi_load_line(struct pp_hwmgr *hwmgr)
{
struct polaris10_smumgr *smu_data = (struct polaris10_smumgr *)(hwmgr->smu_backend);
@@ -1949,6 +1964,8 @@ static int polaris10_init_smc_table(struct pp_hwmgr *hwmgr)
PP_ASSERT_WITH_CODE(0 == result,
"Failed to populate BAPM Parameters!", return result);
+ polaris10_populate_zero_rpm_parameters(hwmgr);
+
if (phm_cap_enabled(hwmgr->platform_descriptor.platformCaps,
PHM_PlatformCaps_ClockStretcher)) {
result = polaris10_populate_clock_stretcher_data_table(hwmgr);