static int smu_smc_table_hw_init(struct smu_context *smu,
bool initialize)
{
+ struct amdgpu_device *adev = smu->adev;
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);
if (ret)
return ret;
if (ret)
return ret;
- ret = smu_feature_enable_all(smu);
+ ret = smu_system_features_control(smu, true);
if (ret)
return ret;
if (!is_support_sw_smu(adev))
return -EINVAL;
- ret = smu_feature_disable_all(smu);
+ ret = smu_system_features_control(smu, false);
if (ret)
return ret;
int (*set_allowed_mask)(struct smu_context *smu);
int (*get_enabled_mask)(struct smu_context *smu, uint32_t *feature_mask, uint32_t num);
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 (*notify_display_change)(struct smu_context *smu);
int (*get_power_limit)(struct smu_context *smu, uint32_t *limit, bool def);
((smu)->funcs->get_enabled_mask? (smu)->funcs->get_enabled_mask((smu), (mask), (num)) : 0)
#define smu_is_dpm_running(smu) \
((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) \
((smu)->funcs->update_feature_enable_state? (smu)->funcs->update_feature_enable_state((smu), (feature_id), (enabled)) : 0)
#define smu_notify_display_change(smu) \
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;
uint32_t feature_mask[2];
int ret = 0;
- ret = smu_send_smc_msg(smu, SMU_MSG_EnableAllSmuFeatures);
- if (ret)
- 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);
+ ret = smu_send_smc_msg(smu, (en ? SMU_MSG_EnableAllSmuFeatures :
+ SMU_MSG_DisableAllSmuFeatures));
if (ret)
return ret;
ret = smu_feature_get_enabled_mask(smu, feature_mask, 2);
.set_allowed_mask = smu_v11_0_set_allowed_mask,
.get_enabled_mask = smu_v11_0_get_enabled_mask,
.is_dpm_running = smu_v11_0_is_dpm_running,
- .enable_all_mask = smu_v11_0_enable_all_mask,
- .disable_all_mask = smu_v11_0_disable_all_mask,
+ .system_features_control = smu_v11_0_system_features_control,
.update_feature_enable_state = smu_v11_0_update_feature_enable_state,
.notify_display_change = smu_v11_0_notify_display_change,
.get_power_limit = smu_v11_0_get_power_limit,