mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-23 19:06:23 +07:00
drm/amd/powerplay: implement get_current_clk_freq for smu11
This patch implements get_current_clk_freq for smu11 future use. Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com> Reviewed-by: Huang Rui <ray.huang@amd.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
e66adb1eea
commit
bed3b3a1e1
@ -251,6 +251,7 @@ struct smu_funcs
|
||||
int (*disable_all_mask)(struct smu_context *smu);
|
||||
int (*notify_display_change)(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) \
|
||||
@ -327,6 +328,8 @@ struct smu_funcs
|
||||
((smu)->ppt_funcs->populate_umd_state_clk ? (smu)->ppt_funcs->populate_umd_state_clk((smu)) : 0)
|
||||
#define smu_get_power_limit(smu) \
|
||||
((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) \
|
||||
((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)
|
||||
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 = {
|
||||
.init_microcode = smu_v11_0_init_microcode,
|
||||
.load_microcode = smu_v11_0_load_microcode,
|
||||
@ -786,6 +809,7 @@ static const struct smu_funcs smu_v11_0_funcs = {
|
||||
.disable_all_mask = smu_v11_0_disable_all_mask,
|
||||
.notify_display_change = smu_v11_0_notify_display_change,
|
||||
.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)
|
||||
|
Loading…
Reference in New Issue
Block a user