提交 b521be9b 编写于 作者: E Evan Quan 提交者: Alex Deucher

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: NEvan Quan <evan.quan@amd.com>
Reviewed-by: NLijo Lazar <lijo.lazar@amd.com>
Signed-off-by: NAlex Deucher <alexander.deucher@amd.com>
上级 92cf0508
...@@ -1954,18 +1954,29 @@ static int sienna_cichlid_set_default_od_settings(struct smu_context *smu) ...@@ -1954,18 +1954,29 @@ static int sienna_cichlid_set_default_od_settings(struct smu_context *smu)
(OverDriveTable_t *)smu->smu_table.overdrive_table; (OverDriveTable_t *)smu->smu_table.overdrive_table;
OverDriveTable_t *boot_od_table = OverDriveTable_t *boot_od_table =
(OverDriveTable_t *)smu->smu_table.boot_overdrive_table; (OverDriveTable_t *)smu->smu_table.boot_overdrive_table;
OverDriveTable_t *user_od_table =
(OverDriveTable_t *)smu->smu_table.user_overdrive_table;
int ret = 0; int ret = 0;
/*
* For S3/S4/Runpm resume, no need to setup those overdrive tables again as
* - either they already have the default OD settings got during cold bootup
* - or they have some user customized OD settings which cannot be overwritten
*/
if (smu->adev->in_suspend)
return 0;
ret = smu_cmn_update_table(smu, SMU_TABLE_OVERDRIVE, ret = smu_cmn_update_table(smu, SMU_TABLE_OVERDRIVE,
0, (void *)od_table, false); 0, (void *)boot_od_table, false);
if (ret) { if (ret) {
dev_err(smu->adev->dev, "Failed to get overdrive table!\n"); dev_err(smu->adev->dev, "Failed to get overdrive table!\n");
return ret; return ret;
} }
memcpy(boot_od_table, od_table, sizeof(OverDriveTable_t)); sienna_cichlid_dump_od_table(smu, boot_od_table);
sienna_cichlid_dump_od_table(smu, od_table); memcpy(od_table, boot_od_table, sizeof(OverDriveTable_t));
memcpy(user_od_table, boot_od_table, sizeof(OverDriveTable_t));
return 0; return 0;
} }
...@@ -2128,13 +2139,20 @@ static int sienna_cichlid_od_edit_dpm_table(struct smu_context *smu, ...@@ -2128,13 +2139,20 @@ static int sienna_cichlid_od_edit_dpm_table(struct smu_context *smu,
fallthrough; fallthrough;
case PP_OD_COMMIT_DPM_TABLE: case PP_OD_COMMIT_DPM_TABLE:
sienna_cichlid_dump_od_table(smu, od_table); if (memcmp(od_table, table_context->user_overdrive_table, sizeof(OverDriveTable_t))) {
sienna_cichlid_dump_od_table(smu, od_table);
ret = smu_cmn_update_table(smu, SMU_TABLE_OVERDRIVE, 0, (void *)od_table, true);
if (ret) {
dev_err(smu->adev->dev, "Failed to import overdrive table!\n");
return ret;
}
memcpy(table_context->user_overdrive_table, od_table, sizeof(OverDriveTable_t));
smu->user_dpm_profile.user_od = true;
ret = smu_cmn_update_table(smu, SMU_TABLE_OVERDRIVE, if (!memcmp(table_context->user_overdrive_table,
0, (void *)od_table, true); table_context->boot_overdrive_table,
if (ret) { sizeof(OverDriveTable_t)))
dev_err(smu->adev->dev, "Failed to import overdrive table!\n"); smu->user_dpm_profile.user_od = false;
return ret;
} }
break; break;
...@@ -3902,6 +3920,7 @@ static const struct pptable_funcs sienna_cichlid_ppt_funcs = { ...@@ -3902,6 +3920,7 @@ static const struct pptable_funcs sienna_cichlid_ppt_funcs = {
.set_soft_freq_limited_range = smu_v11_0_set_soft_freq_limited_range, .set_soft_freq_limited_range = smu_v11_0_set_soft_freq_limited_range,
.set_default_od_settings = sienna_cichlid_set_default_od_settings, .set_default_od_settings = sienna_cichlid_set_default_od_settings,
.od_edit_dpm_table = sienna_cichlid_od_edit_dpm_table, .od_edit_dpm_table = sienna_cichlid_od_edit_dpm_table,
.restore_user_od_settings = smu_v11_0_restore_user_od_settings,
.run_btc = sienna_cichlid_run_btc, .run_btc = sienna_cichlid_run_btc,
.set_power_source = smu_v11_0_set_power_source, .set_power_source = smu_v11_0_set_power_source,
.get_pp_feature_mask = smu_cmn_get_pp_feature_mask, .get_pp_feature_mask = smu_cmn_get_pp_feature_mask,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册