drm/amd/powerplay: add function get_gpu_power for navi10

add callback function get_gpu_power for navi10 asic

Signed-off-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
Kevin Wang 2019-04-23 11:07:52 +08:00 committed by Alex Deucher
parent 2f72726b2a
commit 077ca74e3c
1 changed files with 19 additions and 0 deletions

View File

@ -749,6 +749,24 @@ static int navi10_unforce_dpm_levels(struct smu_context *smu) {
return ret; return ret;
} }
static int navi10_get_gpu_power(struct smu_context *smu, uint32_t *value)
{
int ret = 0;
SmuMetrics_t metrics;
if (!value)
return -EINVAL;
ret = smu_update_table(smu, SMU_TABLE_SMU_METRICS, (void *)&metrics,
false);
if (ret)
return ret;
*value = metrics.CurrSocketPower << 8;
return 0;
}
static const struct pptable_funcs navi10_ppt_funcs = { static const struct pptable_funcs navi10_ppt_funcs = {
.tables_init = navi10_tables_init, .tables_init = navi10_tables_init,
.alloc_dpm_context = navi10_allocate_dpm_context, .alloc_dpm_context = navi10_allocate_dpm_context,
@ -772,6 +790,7 @@ static const struct pptable_funcs navi10_ppt_funcs = {
.display_config_changed = navi10_display_config_changed, .display_config_changed = navi10_display_config_changed,
.force_dpm_limit_value = navi10_force_dpm_limit_value, .force_dpm_limit_value = navi10_force_dpm_limit_value,
.unforce_dpm_levels = navi10_unforce_dpm_levels, .unforce_dpm_levels = navi10_unforce_dpm_levels,
.get_gpu_power = navi10_get_gpu_power,
}; };
void navi10_set_ppt_funcs(struct smu_context *smu) void navi10_set_ppt_funcs(struct smu_context *smu)