Skip to content

Commit b521be9

Browse files
Evan Quanalexdeucher
authored andcommitted
drm/amd/pm: restore user customized OD settings properly for Sienna Cichlid
Properly restore those committed and non-committed user customized OD settings. Signed-off-by: Evan Quan <[email protected]> Reviewed-by: Lijo Lazar <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 92cf050 commit b521be9

File tree

1 file changed

+28
-9
lines changed

1 file changed

+28
-9
lines changed

drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1954,18 +1954,29 @@ static int sienna_cichlid_set_default_od_settings(struct smu_context *smu)
19541954
(OverDriveTable_t *)smu->smu_table.overdrive_table;
19551955
OverDriveTable_t *boot_od_table =
19561956
(OverDriveTable_t *)smu->smu_table.boot_overdrive_table;
1957+
OverDriveTable_t *user_od_table =
1958+
(OverDriveTable_t *)smu->smu_table.user_overdrive_table;
19571959
int ret = 0;
19581960

1961+
/*
1962+
* For S3/S4/Runpm resume, no need to setup those overdrive tables again as
1963+
* - either they already have the default OD settings got during cold bootup
1964+
* - or they have some user customized OD settings which cannot be overwritten
1965+
*/
1966+
if (smu->adev->in_suspend)
1967+
return 0;
1968+
19591969
ret = smu_cmn_update_table(smu, SMU_TABLE_OVERDRIVE,
1960-
0, (void *)od_table, false);
1970+
0, (void *)boot_od_table, false);
19611971
if (ret) {
19621972
dev_err(smu->adev->dev, "Failed to get overdrive table!\n");
19631973
return ret;
19641974
}
19651975

1966-
memcpy(boot_od_table, od_table, sizeof(OverDriveTable_t));
1976+
sienna_cichlid_dump_od_table(smu, boot_od_table);
19671977

1968-
sienna_cichlid_dump_od_table(smu, od_table);
1978+
memcpy(od_table, boot_od_table, sizeof(OverDriveTable_t));
1979+
memcpy(user_od_table, boot_od_table, sizeof(OverDriveTable_t));
19691980

19701981
return 0;
19711982
}
@@ -2128,13 +2139,20 @@ static int sienna_cichlid_od_edit_dpm_table(struct smu_context *smu,
21282139
fallthrough;
21292140

21302141
case PP_OD_COMMIT_DPM_TABLE:
2131-
sienna_cichlid_dump_od_table(smu, od_table);
2142+
if (memcmp(od_table, table_context->user_overdrive_table, sizeof(OverDriveTable_t))) {
2143+
sienna_cichlid_dump_od_table(smu, od_table);
2144+
ret = smu_cmn_update_table(smu, SMU_TABLE_OVERDRIVE, 0, (void *)od_table, true);
2145+
if (ret) {
2146+
dev_err(smu->adev->dev, "Failed to import overdrive table!\n");
2147+
return ret;
2148+
}
2149+
memcpy(table_context->user_overdrive_table, od_table, sizeof(OverDriveTable_t));
2150+
smu->user_dpm_profile.user_od = true;
21322151

2133-
ret = smu_cmn_update_table(smu, SMU_TABLE_OVERDRIVE,
2134-
0, (void *)od_table, true);
2135-
if (ret) {
2136-
dev_err(smu->adev->dev, "Failed to import overdrive table!\n");
2137-
return ret;
2152+
if (!memcmp(table_context->user_overdrive_table,
2153+
table_context->boot_overdrive_table,
2154+
sizeof(OverDriveTable_t)))
2155+
smu->user_dpm_profile.user_od = false;
21382156
}
21392157
break;
21402158

@@ -3902,6 +3920,7 @@ static const struct pptable_funcs sienna_cichlid_ppt_funcs = {
39023920
.set_soft_freq_limited_range = smu_v11_0_set_soft_freq_limited_range,
39033921
.set_default_od_settings = sienna_cichlid_set_default_od_settings,
39043922
.od_edit_dpm_table = sienna_cichlid_od_edit_dpm_table,
3923+
.restore_user_od_settings = smu_v11_0_restore_user_od_settings,
39053924
.run_btc = sienna_cichlid_run_btc,
39063925
.set_power_source = smu_v11_0_set_power_source,
39073926
.get_pp_feature_mask = smu_cmn_get_pp_feature_mask,

0 commit comments

Comments
 (0)