Commit bed3b3a1 authored by Kevin Wang's avatar Kevin Wang Committed by Alex Deucher

drm/amd/powerplay: implement get_current_clk_freq for smu11

This patch implements get_current_clk_freq for smu11 future use.
Signed-off-by: default avatarKevin Wang <Kevin1.Wang@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 e66adb1e
...@@ -251,6 +251,7 @@ struct smu_funcs ...@@ -251,6 +251,7 @@ struct smu_funcs
int (*disable_all_mask)(struct smu_context *smu); int (*disable_all_mask)(struct smu_context *smu);
int (*notify_display_change)(struct smu_context *smu); int (*notify_display_change)(struct smu_context *smu);
int (*get_power_limit)(struct smu_context *smu); int (*get_power_limit)(struct smu_context *smu);
int (*get_current_clk_freq)(struct smu_context *smu, uint32_t clk_id, uint32_t *value);
}; };
#define smu_init_microcode(smu) \ #define smu_init_microcode(smu) \
...@@ -327,6 +328,8 @@ struct smu_funcs ...@@ -327,6 +328,8 @@ struct smu_funcs
((smu)->ppt_funcs->populate_umd_state_clk ? (smu)->ppt_funcs->populate_umd_state_clk((smu)) : 0) ((smu)->ppt_funcs->populate_umd_state_clk ? (smu)->ppt_funcs->populate_umd_state_clk((smu)) : 0)
#define smu_get_power_limit(smu) \ #define smu_get_power_limit(smu) \
((smu)->funcs->get_power_limit? (smu)->funcs->get_power_limit((smu)) : 0) ((smu)->funcs->get_power_limit? (smu)->funcs->get_power_limit((smu)) : 0)
#define smu_get_current_clk_freq(smu, clk_id, value) \
((smu)->funcs->get_current_clk_freq? (smu)->funcs->get_current_clk_freq((smu), (clk_id), (value)) : 0)
#define smu_msg_get_index(smu, msg) \ #define smu_msg_get_index(smu, msg) \
((smu)->ppt_funcs? ((smu)->ppt_funcs->get_smu_msg_index? (smu)->ppt_funcs->get_smu_msg_index((smu), (msg)) : -EINVAL) : -EINVAL) ((smu)->ppt_funcs? ((smu)->ppt_funcs->get_smu_msg_index? (smu)->ppt_funcs->get_smu_msg_index((smu), (msg)) : -EINVAL) : -EINVAL)
......
...@@ -757,6 +757,29 @@ static int smu_v11_0_get_power_limit(struct smu_context *smu) ...@@ -757,6 +757,29 @@ static int smu_v11_0_get_power_limit(struct smu_context *smu)
return 0; return 0;
} }
static int smu_v11_0_get_current_clk_freq(struct smu_context *smu, uint32_t clk_id, uint32_t *value)
{
int ret = 0;
uint32_t freq;
if (clk_id >= PPCLK_COUNT || !value)
return -EINVAL;
ret = smu_send_smc_msg_with_param(smu,
SMU_MSG_GetDpmClockFreq, (clk_id << 16));
if (ret)
return ret;
ret = smu_read_smc_arg(smu, &freq);
if (ret)
return ret;
freq *= 100;
*value = freq;
return ret;
}
static const struct smu_funcs smu_v11_0_funcs = { static const struct smu_funcs smu_v11_0_funcs = {
.init_microcode = smu_v11_0_init_microcode, .init_microcode = smu_v11_0_init_microcode,
.load_microcode = smu_v11_0_load_microcode, .load_microcode = smu_v11_0_load_microcode,
...@@ -786,6 +809,7 @@ static const struct smu_funcs smu_v11_0_funcs = { ...@@ -786,6 +809,7 @@ static const struct smu_funcs smu_v11_0_funcs = {
.disable_all_mask = smu_v11_0_disable_all_mask, .disable_all_mask = smu_v11_0_disable_all_mask,
.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,
.get_current_clk_freq = smu_v11_0_get_current_clk_freq,
}; };
void smu_v11_0_set_smu_funcs(struct smu_context *smu) void smu_v11_0_set_smu_funcs(struct smu_context *smu)
......
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