]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/amd/pm: correct the gpo control for sienna cichlid
authorEvan Quan <evan.quan@amd.com>
Tue, 8 Dec 2020 03:59:52 +0000 (11:59 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 10 Dec 2020 21:41:49 +0000 (16:41 -0500)
New SMC message was introduced for gpo control on sienna cichlid.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/pm/inc/smu_types.h
drivers/gpu/drm/amd/pm/inc/smu_v11_0_7_ppsmc.h
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c

index 4a6d1381df16a2143fc3d45624bd2410146678f8..1251dd4115160e9b9dff789def61d95bc583c345 100644 (file)
        __SMU_DUMMY_MAP(SetSoftMinCclk),                     \
        __SMU_DUMMY_MAP(SetSoftMaxCclk),                     \
        __SMU_DUMMY_MAP(SetGpoFeaturePMask),             \
+       __SMU_DUMMY_MAP(DisallowGpo),                    \
 
 #undef __SMU_DUMMY_MAP
 #define __SMU_DUMMY_MAP(type)  SMU_MSG_##type
index 35dd6072cc456fabc025fe29a7af2f49a7bb13c7..dad2832ff3b1995cc86b88b3b9ae56585be22669 100644 (file)
 #define PPSMC_MSG_SetGpoFeaturePMask             0x45
 #define PPSMC_MSG_SetSMBUSInterrupt              0x46
 
-#define PPSMC_Message_Count                      0x47
+#define PPSMC_MSG_DisallowGpo                    0x56
+
+#define PPSMC_Message_Count                      0x58
 
 #endif
index 1ce13944721b8890f010b84fdf57e31b54ceb6e7..d88361554d94fe8a441b5a88562342dc29da6206 100644 (file)
@@ -128,6 +128,7 @@ static struct cmn2asic_msg_mapping sienna_cichlid_message_map[SMU_MSG_MAX_COUNT]
        MSG_MAP(Mode1Reset,                     PPSMC_MSG_Mode1Reset,                  0),
        MSG_MAP(SetMGpuFanBoostLimitRpm,        PPSMC_MSG_SetMGpuFanBoostLimitRpm,     0),
        MSG_MAP(SetGpoFeaturePMask,             PPSMC_MSG_SetGpoFeaturePMask,          0),
+       MSG_MAP(DisallowGpo,                    PPSMC_MSG_DisallowGpo,                 0),
 };
 
 static struct cmn2asic_mapping sienna_cichlid_clk_map[SMU_CLK_COUNT] = {
@@ -2653,19 +2654,40 @@ static int sienna_cichlid_enable_mgpu_fan_boost(struct smu_context *smu)
 static int sienna_cichlid_gpo_control(struct smu_context *smu,
                                      bool enablement)
 {
+       uint32_t smu_version;
        int ret = 0;
 
+
        if (smu_cmn_feature_is_supported(smu, SMU_FEATURE_DPM_GFX_GPO_BIT)) {
-               if (enablement)
-                       ret = smu_cmn_send_smc_msg_with_param(smu,
-                                                       SMU_MSG_SetGpoFeaturePMask,
-                                                       GFX_GPO_PACE_MASK | GFX_GPO_DEM_MASK,
-                                                       NULL);
-               else
-                       ret = smu_cmn_send_smc_msg_with_param(smu,
-                                                       SMU_MSG_SetGpoFeaturePMask,
-                                                       0,
-                                                       NULL);
+               ret = smu_cmn_get_smc_version(smu, NULL, &smu_version);
+               if (ret)
+                       return ret;
+
+               if (enablement) {
+                       if (smu_version < 0x003a2500) {
+                               ret = smu_cmn_send_smc_msg_with_param(smu,
+                                                                     SMU_MSG_SetGpoFeaturePMask,
+                                                                     GFX_GPO_PACE_MASK | GFX_GPO_DEM_MASK,
+                                                                     NULL);
+                       } else {
+                               ret = smu_cmn_send_smc_msg_with_param(smu,
+                                                                     SMU_MSG_DisallowGpo,
+                                                                     0,
+                                                                     NULL);
+                       }
+               } else {
+                       if (smu_version < 0x003a2500) {
+                               ret = smu_cmn_send_smc_msg_with_param(smu,
+                                                                     SMU_MSG_SetGpoFeaturePMask,
+                                                                     0,
+                                                                     NULL);
+                       } else {
+                               ret = smu_cmn_send_smc_msg_with_param(smu,
+                                                                     SMU_MSG_DisallowGpo,
+                                                                     1,
+                                                                     NULL);
+                       }
+               }
        }
 
        return ret;