Commit 2e13c755 authored by hersen wu's avatar hersen wu Committed by Alex Deucher

drm/amd/powerplay: notify smu with active display count

when dc update clocks via smu, smu needs to know how many
displays active. this interface is for dc notify number
of active displays to smu.
Signed-off-by: default avatarhersen wu <hersenxs.wu@amd.com>
Reviewed-by: default avatarHuang Rui <ray.huang@amd.com>
Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 382fb778
...@@ -802,7 +802,7 @@ static int smu_smc_table_hw_init(struct smu_context *smu, ...@@ -802,7 +802,7 @@ static int smu_smc_table_hw_init(struct smu_context *smu,
return 0; return 0;
} }
ret = smu_init_display(smu); ret = smu_init_display_count(smu, 0);
if (ret) if (ret)
return ret; return ret;
...@@ -1470,6 +1470,17 @@ int smu_force_performance_level(struct smu_context *smu, enum amd_dpm_forced_lev ...@@ -1470,6 +1470,17 @@ int smu_force_performance_level(struct smu_context *smu, enum amd_dpm_forced_lev
return ret; return ret;
} }
int smu_set_display_count(struct smu_context *smu, uint32_t count)
{
int ret = 0;
mutex_lock(&smu->mutex);
ret = smu_init_display_count(smu, count);
mutex_unlock(&smu->mutex);
return ret;
}
const struct amd_ip_funcs smu_ip_funcs = { const struct amd_ip_funcs smu_ip_funcs = {
.name = "smu", .name = "smu",
.early_init = smu_early_init, .early_init = smu_early_init,
......
...@@ -638,7 +638,7 @@ struct smu_funcs ...@@ -638,7 +638,7 @@ struct smu_funcs
int (*send_smc_msg)(struct smu_context *smu, uint16_t msg); int (*send_smc_msg)(struct smu_context *smu, uint16_t msg);
int (*send_smc_msg_with_param)(struct smu_context *smu, uint16_t msg, uint32_t param); int (*send_smc_msg_with_param)(struct smu_context *smu, uint16_t msg, uint32_t param);
int (*read_smc_arg)(struct smu_context *smu, uint32_t *arg); int (*read_smc_arg)(struct smu_context *smu, uint32_t *arg);
int (*init_display)(struct smu_context *smu); int (*init_display_count)(struct smu_context *smu, uint32_t count);
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);
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);
...@@ -752,8 +752,8 @@ struct smu_funcs ...@@ -752,8 +752,8 @@ struct smu_funcs
((smu)->funcs->read_smc_arg? (smu)->funcs->read_smc_arg((smu), (arg)) : 0) ((smu)->funcs->read_smc_arg? (smu)->funcs->read_smc_arg((smu), (arg)) : 0)
#define smu_alloc_dpm_context(smu) \ #define smu_alloc_dpm_context(smu) \
((smu)->ppt_funcs->alloc_dpm_context ? (smu)->ppt_funcs->alloc_dpm_context((smu)) : 0) ((smu)->ppt_funcs->alloc_dpm_context ? (smu)->ppt_funcs->alloc_dpm_context((smu)) : 0)
#define smu_init_display(smu) \ #define smu_init_display_count(smu, count) \
((smu)->funcs->init_display ? (smu)->funcs->init_display((smu)) : 0) ((smu)->funcs->init_display_count ? (smu)->funcs->init_display_count((smu), (count)) : 0)
#define smu_feature_set_allowed_mask(smu) \ #define smu_feature_set_allowed_mask(smu) \
((smu)->funcs->set_allowed_mask? (smu)->funcs->set_allowed_mask((smu)) : 0) ((smu)->funcs->set_allowed_mask? (smu)->funcs->set_allowed_mask((smu)) : 0)
#define smu_feature_get_enabled_mask(smu, mask, num) \ #define smu_feature_get_enabled_mask(smu, mask, num) \
...@@ -947,4 +947,6 @@ int smu_set_hard_freq_range(struct smu_context *smu, enum smu_clk_type clk_type, ...@@ -947,4 +947,6 @@ int smu_set_hard_freq_range(struct smu_context *smu, enum smu_clk_type clk_type,
uint32_t min, uint32_t max); uint32_t min, uint32_t max);
enum amd_dpm_forced_level smu_get_performance_level(struct smu_context *smu); enum amd_dpm_forced_level smu_get_performance_level(struct smu_context *smu);
int smu_force_performance_level(struct smu_context *smu, enum amd_dpm_forced_level level); int smu_force_performance_level(struct smu_context *smu, enum amd_dpm_forced_level level);
int smu_set_display_count(struct smu_context *smu, uint32_t count);
#endif #endif
...@@ -765,13 +765,13 @@ static int smu_v11_0_set_tool_table_location(struct smu_context *smu) ...@@ -765,13 +765,13 @@ static int smu_v11_0_set_tool_table_location(struct smu_context *smu)
return ret; return ret;
} }
static int smu_v11_0_init_display(struct smu_context *smu) static int smu_v11_0_init_display_count(struct smu_context *smu, uint32_t count)
{ {
int ret = 0; int ret = 0;
if (!smu->pm_enabled) if (!smu->pm_enabled)
return ret; return ret;
ret = smu_send_smc_msg_with_param(smu, SMU_MSG_NumOfDisplays, 0); ret = smu_send_smc_msg_with_param(smu, SMU_MSG_NumOfDisplays, count);
return ret; return ret;
} }
...@@ -1686,7 +1686,7 @@ static const struct smu_funcs smu_v11_0_funcs = { ...@@ -1686,7 +1686,7 @@ static const struct smu_funcs smu_v11_0_funcs = {
.write_watermarks_table = smu_v11_0_write_watermarks_table, .write_watermarks_table = smu_v11_0_write_watermarks_table,
.set_min_dcef_deep_sleep = smu_v11_0_set_min_dcef_deep_sleep, .set_min_dcef_deep_sleep = smu_v11_0_set_min_dcef_deep_sleep,
.set_tool_table_location = smu_v11_0_set_tool_table_location, .set_tool_table_location = smu_v11_0_set_tool_table_location,
.init_display = smu_v11_0_init_display, .init_display_count = smu_v11_0_init_display_count,
.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,
.system_features_control = smu_v11_0_system_features_control, .system_features_control = smu_v11_0_system_features_control,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment