From: Kevin Wang Date: Fri, 21 Jun 2019 16:26:18 +0000 (-0500) Subject: drm/amd/powerplay: simplify the interface of get_gpu_power X-Git-Tag: v5.15~5932^2~10^2~224 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=564c4c7f00266a92fd3521983164b1014e6bc7e9;p=mirror_ubuntu-kernels.git drm/amd/powerplay: simplify the interface of get_gpu_power this callback function is only call in read_sensor in smu_v11_0.c, so move this code to {asic}_ppt.c to implement as asic related function. Signed-off-by: Kevin Wang Reviewed-by: Huang Rui Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h index 635837b79d94..69c33d707d8f 100644 --- a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +++ b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h @@ -594,7 +594,6 @@ struct pptable_funcs { void (*tables_init)(struct smu_context *smu, struct smu_table *tables); int (*set_thermal_fan_table)(struct smu_context *smu); int (*get_fan_speed_percent)(struct smu_context *smu, uint32_t *speed); - int (*get_gpu_power)(struct smu_context *smu, uint32_t *value); int (*set_watermarks_table)(struct smu_context *smu, void *watermarks, struct dm_pp_wm_sets_with_clock_ranges_soc15 *clock_ranges); int (*get_current_clk_freq_by_table)(struct smu_context *smu, @@ -825,8 +824,6 @@ struct smu_funcs ((smu)->funcs->set_fan_control_mode ? (smu)->funcs->set_fan_control_mode((smu), (value)) : 0) #define smu_get_fan_speed_percent(smu, speed) \ ((smu)->ppt_funcs->get_fan_speed_percent ? (smu)->ppt_funcs->get_fan_speed_percent((smu), (speed)) : 0) -#define smu_get_gpu_power(smu, val) \ - ((smu)->ppt_funcs->get_gpu_power ? (smu)->ppt_funcs->get_gpu_power((smu), (val)) : 0) #define smu_set_fan_speed_percent(smu, speed) \ ((smu)->funcs->set_fan_speed_percent ? (smu)->funcs->set_fan_speed_percent((smu), (speed)) : 0) diff --git a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c index 376ea5289646..f9bfcaa73f7e 100644 --- a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c +++ b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c @@ -1195,6 +1195,10 @@ static int navi10_read_sensor(struct smu_context *smu, ret = navi10_get_current_activity_percent(smu, (uint32_t *)data); *size = 4; break; + case AMDGPU_PP_SENSOR_GPU_POWER: + ret = navi10_get_gpu_power(smu, (uint32_t *)data); + *size = 4; + break; default: return -EINVAL; } @@ -1227,7 +1231,6 @@ static const struct pptable_funcs navi10_ppt_funcs = { .notify_smc_dispaly_config = navi10_notify_smc_dispaly_config, .force_dpm_limit_value = navi10_force_dpm_limit_value, .unforce_dpm_levels = navi10_unforce_dpm_levels, - .get_gpu_power = navi10_get_gpu_power, .is_dpm_running = navi10_is_dpm_running, .set_thermal_fan_table = navi10_set_thermal_fan_table, .get_fan_speed_percent = navi10_get_fan_speed_percent, diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c index c37fcd5eb45b..297cd1bce4fe 100644 --- a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c +++ b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c @@ -1334,10 +1334,6 @@ static int smu_v11_0_read_sensor(struct smu_context *smu, ret = smu_v11_0_thermal_get_temperature(smu, sensor, (uint32_t *)data); *size = 4; break; - case AMDGPU_PP_SENSOR_GPU_POWER: - ret = smu_get_gpu_power(smu, (uint32_t *)data); - *size = 4; - break; case AMDGPU_PP_SENSOR_VDDGFX: ret = smu_v11_0_get_gfx_vdd(smu, (uint32_t *)data); *size = 4; diff --git a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c index 93c6545ec4e8..472fe87d73f4 100644 --- a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c +++ b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c @@ -3033,6 +3033,10 @@ static int vega20_read_sensor(struct smu_context *smu, (uint32_t *)data); *size = 4; break; + case AMDGPU_PP_SENSOR_GPU_POWER: + ret = vega20_get_gpu_power(smu, (uint32_t *)data); + *size = 4; + break; default: return -EINVAL; } @@ -3145,7 +3149,6 @@ static const struct pptable_funcs vega20_ppt_funcs = { .is_dpm_running = vega20_is_dpm_running, .set_thermal_fan_table = vega20_set_thermal_fan_table, .get_fan_speed_percent = vega20_get_fan_speed_percent, - .get_gpu_power = vega20_get_gpu_power, .set_watermarks_table = vega20_set_watermarks_table, };