Skip to content

Commit 8eb966f

Browse files
Lijo Lazaralexdeucher
authored andcommitted
drm/amd/pm: Initialize power profile mode
Refactor such that individual SMU IP versions can choose the startup power profile mode. If no preference, then use the generic default power profile selection logic. Signed-off-by: Lijo Lazar <[email protected]> Reviewed-by: Yang Wang <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Cc: [email protected] # 6.11.x
1 parent 47f402a commit 8eb966f

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

drivers/gpu/drm/amd/include/kgd_pp_interface.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ enum amd_pp_task {
164164
};
165165

166166
enum PP_SMC_POWER_PROFILE {
167+
PP_SMC_POWER_PROFILE_UNKNOWN = -1,
167168
PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT = 0x0,
168169
PP_SMC_POWER_PROFILE_FULLSCREEN3D = 0x1,
169170
PP_SMC_POWER_PROFILE_POWERSAVING = 0x2,

drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,7 @@ static int smu_early_init(struct amdgpu_ip_block *ip_block)
764764
smu->smu_baco.platform_support = false;
765765
smu->smu_baco.maco_support = false;
766766
smu->user_dpm_profile.fan_mode = -1;
767+
smu->power_profile_mode = PP_SMC_POWER_PROFILE_UNKNOWN;
767768

768769
mutex_init(&smu->message_lock);
769770

@@ -1248,6 +1249,21 @@ static bool smu_is_workload_profile_available(struct smu_context *smu,
12481249
return smu->workload_map && smu->workload_map[profile].valid_mapping;
12491250
}
12501251

1252+
static void smu_init_power_profile(struct smu_context *smu)
1253+
{
1254+
if (smu->power_profile_mode == PP_SMC_POWER_PROFILE_UNKNOWN) {
1255+
if (smu->is_apu ||
1256+
!smu_is_workload_profile_available(
1257+
smu, PP_SMC_POWER_PROFILE_FULLSCREEN3D))
1258+
smu->power_profile_mode =
1259+
PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT;
1260+
else
1261+
smu->power_profile_mode =
1262+
PP_SMC_POWER_PROFILE_FULLSCREEN3D;
1263+
}
1264+
smu_power_profile_mode_get(smu, smu->power_profile_mode);
1265+
}
1266+
12511267
static int smu_sw_init(struct amdgpu_ip_block *ip_block)
12521268
{
12531269
struct amdgpu_device *adev = ip_block->adev;
@@ -1269,13 +1285,7 @@ static int smu_sw_init(struct amdgpu_ip_block *ip_block)
12691285
atomic_set(&smu->smu_power.power_gate.vpe_gated, 1);
12701286
atomic_set(&smu->smu_power.power_gate.umsch_mm_gated, 1);
12711287

1272-
if (smu->is_apu ||
1273-
!smu_is_workload_profile_available(smu, PP_SMC_POWER_PROFILE_FULLSCREEN3D))
1274-
smu->power_profile_mode = PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT;
1275-
else
1276-
smu->power_profile_mode = PP_SMC_POWER_PROFILE_FULLSCREEN3D;
1277-
smu_power_profile_mode_get(smu, smu->power_profile_mode);
1278-
1288+
smu_init_power_profile(smu);
12791289
smu->display_config = &adev->pm.pm_display_cfg;
12801290

12811291
smu->smu_dpm.dpm_level = AMD_DPM_FORCED_LEVEL_AUTO;

0 commit comments

Comments
 (0)