]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/amd/powerplay: simplify the interface of get_gpu_power
authorKevin Wang <kevin1.wang@amd.com>
Fri, 21 Jun 2019 16:26:18 +0000 (11:26 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 21 Jun 2019 23:59:30 +0000 (18:59 -0500)
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 <kevin1.wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
drivers/gpu/drm/amd/powerplay/navi10_ppt.c
drivers/gpu/drm/amd/powerplay/smu_v11_0.c
drivers/gpu/drm/amd/powerplay/vega20_ppt.c

index 635837b79d94246e3afe858fe7a2680f1ee5bb6a..69c33d707d8f6c54ff6677b2016995ccddad180c 100644 (file)
@@ -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)
 
index 376ea528964667b481b469f6247fd2f9b239a98a..f9bfcaa73f7e5a81fa9c4204efd37f8819bed5cb 100644 (file)
@@ -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,
index c37fcd5eb45b828ed819e657656293736465e22a..297cd1bce4fe9d93ad8a0ecf36ce818411f30b19 100644 (file)
@@ -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;
index 93c6545ec4e89d3b5ee400c0738089cddbb17ca6..472fe87d73f4b33e5bb46074e1148297343d6210 100644 (file)
@@ -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,
 };