mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
drm/amd/powerplay: add condition for smc table hw init
Smc table hw init should be skipped for suspend/resume when dpm running. Unified feature enable and disable function into smu_system_features_control. Signed-off-by: Likun Gao <Likun.Gao@amd.com> Reviewed-by: Kenneth Feng <kenneth.feng@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
4733cc7244
commit
f067499b48
3 changed files with 13 additions and 33 deletions
|
@ -532,8 +532,14 @@ static int smu_fini_fb_allocations(struct smu_context *smu)
|
||||||
static int smu_smc_table_hw_init(struct smu_context *smu,
|
static int smu_smc_table_hw_init(struct smu_context *smu,
|
||||||
bool initialize)
|
bool initialize)
|
||||||
{
|
{
|
||||||
|
struct amdgpu_device *adev = smu->adev;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
if (smu_is_dpm_running(smu) && adev->in_suspend) {
|
||||||
|
pr_info("dpm has been enabled\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
ret = smu_init_display(smu);
|
ret = smu_init_display(smu);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -606,7 +612,7 @@ static int smu_smc_table_hw_init(struct smu_context *smu,
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
ret = smu_feature_enable_all(smu);
|
ret = smu_system_features_control(smu, true);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
@ -849,7 +855,7 @@ static int smu_suspend(void *handle)
|
||||||
if (!is_support_sw_smu(adev))
|
if (!is_support_sw_smu(adev))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
ret = smu_feature_disable_all(smu);
|
ret = smu_system_features_control(smu, false);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|
|
@ -484,8 +484,6 @@ struct smu_funcs
|
||||||
int (*set_allowed_mask)(struct smu_context *smu);
|
int (*set_allowed_mask)(struct smu_context *smu);
|
||||||
int (*get_enabled_mask)(struct smu_context *smu, uint32_t *feature_mask, uint32_t num);
|
int (*get_enabled_mask)(struct smu_context *smu, uint32_t *feature_mask, uint32_t num);
|
||||||
bool (*is_dpm_running)(struct smu_context *smu);
|
bool (*is_dpm_running)(struct smu_context *smu);
|
||||||
int (*enable_all_mask)(struct smu_context *smu);
|
|
||||||
int (*disable_all_mask)(struct smu_context *smu);
|
|
||||||
int (*update_feature_enable_state)(struct smu_context *smu, uint32_t feature_id, bool enabled);
|
int (*update_feature_enable_state)(struct smu_context *smu, uint32_t feature_id, bool enabled);
|
||||||
int (*notify_display_change)(struct smu_context *smu);
|
int (*notify_display_change)(struct smu_context *smu);
|
||||||
int (*get_power_limit)(struct smu_context *smu, uint32_t *limit, bool def);
|
int (*get_power_limit)(struct smu_context *smu, uint32_t *limit, bool def);
|
||||||
|
@ -612,10 +610,6 @@ struct smu_funcs
|
||||||
((smu)->funcs->get_enabled_mask? (smu)->funcs->get_enabled_mask((smu), (mask), (num)) : 0)
|
((smu)->funcs->get_enabled_mask? (smu)->funcs->get_enabled_mask((smu), (mask), (num)) : 0)
|
||||||
#define smu_is_dpm_running(smu) \
|
#define smu_is_dpm_running(smu) \
|
||||||
((smu)->funcs->is_dpm_running ? (smu)->funcs->is_dpm_running((smu)) : 0)
|
((smu)->funcs->is_dpm_running ? (smu)->funcs->is_dpm_running((smu)) : 0)
|
||||||
#define smu_feature_enable_all(smu) \
|
|
||||||
((smu)->funcs->enable_all_mask? (smu)->funcs->enable_all_mask((smu)) : 0)
|
|
||||||
#define smu_feature_disable_all(smu) \
|
|
||||||
((smu)->funcs->disable_all_mask? (smu)->funcs->disable_all_mask((smu)) : 0)
|
|
||||||
#define smu_feature_update_enable_state(smu, feature_id, enabled) \
|
#define smu_feature_update_enable_state(smu, feature_id, enabled) \
|
||||||
((smu)->funcs->update_feature_enable_state? (smu)->funcs->update_feature_enable_state((smu), (feature_id), (enabled)) : 0)
|
((smu)->funcs->update_feature_enable_state? (smu)->funcs->update_feature_enable_state((smu), (feature_id), (enabled)) : 0)
|
||||||
#define smu_notify_display_change(smu) \
|
#define smu_notify_display_change(smu) \
|
||||||
|
|
|
@ -771,34 +771,15 @@ static bool smu_v11_0_is_dpm_running(struct smu_context *smu)
|
||||||
return !!(feature_enabled & SMC_DPM_FEATURE);
|
return !!(feature_enabled & SMC_DPM_FEATURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int smu_v11_0_enable_all_mask(struct smu_context *smu)
|
static int smu_v11_0_system_features_control(struct smu_context *smu,
|
||||||
|
bool en)
|
||||||
{
|
{
|
||||||
struct smu_feature *feature = &smu->smu_feature;
|
struct smu_feature *feature = &smu->smu_feature;
|
||||||
uint32_t feature_mask[2];
|
uint32_t feature_mask[2];
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
ret = smu_send_smc_msg(smu, SMU_MSG_EnableAllSmuFeatures);
|
ret = smu_send_smc_msg(smu, (en ? SMU_MSG_EnableAllSmuFeatures :
|
||||||
if (ret)
|
SMU_MSG_DisableAllSmuFeatures));
|
||||||
return ret;
|
|
||||||
ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
bitmap_copy(feature->enabled, (unsigned long *)&feature_mask,
|
|
||||||
feature->feature_num);
|
|
||||||
bitmap_copy(feature->supported, (unsigned long *)&feature_mask,
|
|
||||||
feature->feature_num);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int smu_v11_0_disable_all_mask(struct smu_context *smu)
|
|
||||||
{
|
|
||||||
struct smu_feature *feature = &smu->smu_feature;
|
|
||||||
uint32_t feature_mask[2];
|
|
||||||
int ret = 0;
|
|
||||||
|
|
||||||
ret = smu_send_smc_msg(smu, SMU_MSG_DisableAllSmuFeatures);
|
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);
|
ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);
|
||||||
|
@ -1987,8 +1968,7 @@ static const struct smu_funcs smu_v11_0_funcs = {
|
||||||
.set_allowed_mask = smu_v11_0_set_allowed_mask,
|
.set_allowed_mask = smu_v11_0_set_allowed_mask,
|
||||||
.get_enabled_mask = smu_v11_0_get_enabled_mask,
|
.get_enabled_mask = smu_v11_0_get_enabled_mask,
|
||||||
.is_dpm_running = smu_v11_0_is_dpm_running,
|
.is_dpm_running = smu_v11_0_is_dpm_running,
|
||||||
.enable_all_mask = smu_v11_0_enable_all_mask,
|
.system_features_control = smu_v11_0_system_features_control,
|
||||||
.disable_all_mask = smu_v11_0_disable_all_mask,
|
|
||||||
.update_feature_enable_state = smu_v11_0_update_feature_enable_state,
|
.update_feature_enable_state = smu_v11_0_update_feature_enable_state,
|
||||||
.notify_display_change = smu_v11_0_notify_display_change,
|
.notify_display_change = smu_v11_0_notify_display_change,
|
||||||
.get_power_limit = smu_v11_0_get_power_limit,
|
.get_power_limit = smu_v11_0_get_power_limit,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue