mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-01-23 02:09:31 +07:00
drm/amd/powerplay: simplify the interface of get_current_activity_percent
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>
This commit is contained in:
parent
e36182490d
commit
d573bb214d
@ -595,9 +595,6 @@ struct pptable_funcs {
|
|||||||
int (*set_thermal_fan_table)(struct smu_context *smu);
|
int (*set_thermal_fan_table)(struct smu_context *smu);
|
||||||
int (*get_fan_speed_percent)(struct smu_context *smu, uint32_t *speed);
|
int (*get_fan_speed_percent)(struct smu_context *smu, uint32_t *speed);
|
||||||
int (*get_gpu_power)(struct smu_context *smu, uint32_t *value);
|
int (*get_gpu_power)(struct smu_context *smu, uint32_t *value);
|
||||||
int (*get_current_activity_percent)(struct smu_context *smu,
|
|
||||||
enum amd_pp_sensors sensor,
|
|
||||||
uint32_t *value);
|
|
||||||
int (*set_watermarks_table)(struct smu_context *smu, void *watermarks,
|
int (*set_watermarks_table)(struct smu_context *smu, void *watermarks,
|
||||||
struct dm_pp_wm_sets_with_clock_ranges_soc15 *clock_ranges);
|
struct dm_pp_wm_sets_with_clock_ranges_soc15 *clock_ranges);
|
||||||
int (*get_current_clk_freq_by_table)(struct smu_context *smu,
|
int (*get_current_clk_freq_by_table)(struct smu_context *smu,
|
||||||
@ -830,8 +827,6 @@ struct smu_funcs
|
|||||||
((smu)->ppt_funcs->get_fan_speed_percent ? (smu)->ppt_funcs->get_fan_speed_percent((smu), (speed)) : 0)
|
((smu)->ppt_funcs->get_fan_speed_percent ? (smu)->ppt_funcs->get_fan_speed_percent((smu), (speed)) : 0)
|
||||||
#define smu_get_gpu_power(smu, val) \
|
#define smu_get_gpu_power(smu, val) \
|
||||||
((smu)->ppt_funcs->get_gpu_power ? (smu)->ppt_funcs->get_gpu_power((smu), (val)) : 0)
|
((smu)->ppt_funcs->get_gpu_power ? (smu)->ppt_funcs->get_gpu_power((smu), (val)) : 0)
|
||||||
#define smu_get_current_activity_percent(smu, val) \
|
|
||||||
((smu)->ppt_funcs->get_current_activity_percent ? (smu)->ppt_funcs->get_current_activity_percent((smu), (sensor), (val)) : 0)
|
|
||||||
#define smu_set_fan_speed_percent(smu, speed) \
|
#define smu_set_fan_speed_percent(smu, speed) \
|
||||||
((smu)->funcs->set_fan_speed_percent ? (smu)->funcs->set_fan_speed_percent((smu), (speed)) : 0)
|
((smu)->funcs->set_fan_speed_percent ? (smu)->funcs->set_fan_speed_percent((smu), (speed)) : 0)
|
||||||
|
|
||||||
|
@ -1191,6 +1191,10 @@ static int navi10_read_sensor(struct smu_context *smu,
|
|||||||
*(uint32_t *)data = pptable->FanMaximumRpm;
|
*(uint32_t *)data = pptable->FanMaximumRpm;
|
||||||
*size = 4;
|
*size = 4;
|
||||||
break;
|
break;
|
||||||
|
case AMDGPU_PP_SENSOR_GPU_LOAD:
|
||||||
|
ret = navi10_get_current_activity_percent(smu, (uint32_t *)data);
|
||||||
|
*size = 4;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
@ -1224,7 +1228,6 @@ static const struct pptable_funcs navi10_ppt_funcs = {
|
|||||||
.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,
|
.get_gpu_power = navi10_get_gpu_power,
|
||||||
.get_current_activity_percent = navi10_get_current_activity_percent,
|
|
||||||
.is_dpm_running = navi10_is_dpm_running,
|
.is_dpm_running = navi10_is_dpm_running,
|
||||||
.set_thermal_fan_table = navi10_set_thermal_fan_table,
|
.set_thermal_fan_table = navi10_set_thermal_fan_table,
|
||||||
.get_fan_speed_percent = navi10_get_fan_speed_percent,
|
.get_fan_speed_percent = navi10_get_fan_speed_percent,
|
||||||
|
@ -1320,13 +1320,6 @@ static int smu_v11_0_read_sensor(struct smu_context *smu,
|
|||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
switch (sensor) {
|
switch (sensor) {
|
||||||
case AMDGPU_PP_SENSOR_GPU_LOAD:
|
|
||||||
case AMDGPU_PP_SENSOR_MEM_LOAD:
|
|
||||||
ret = smu_get_current_activity_percent(smu,
|
|
||||||
sensor,
|
|
||||||
(uint32_t *)data);
|
|
||||||
*size = 4;
|
|
||||||
break;
|
|
||||||
case AMDGPU_PP_SENSOR_GFX_MCLK:
|
case AMDGPU_PP_SENSOR_GFX_MCLK:
|
||||||
ret = smu_get_current_clk_freq(smu, SMU_UCLK, (uint32_t *)data);
|
ret = smu_get_current_clk_freq(smu, SMU_UCLK, (uint32_t *)data);
|
||||||
*size = 4;
|
*size = 4;
|
||||||
|
@ -2927,26 +2927,6 @@ static int vega20_set_ppfeature_status(struct smu_context *smu, uint64_t new_ppf
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vega20_read_sensor(struct smu_context *smu,
|
|
||||||
enum amd_pp_sensors sensor,
|
|
||||||
void *data, uint32_t *size)
|
|
||||||
{
|
|
||||||
int ret = 0;
|
|
||||||
struct smu_table_context *table_context = &smu->smu_table;
|
|
||||||
PPTable_t *pptable = table_context->driver_pptable;
|
|
||||||
|
|
||||||
switch (sensor) {
|
|
||||||
case AMDGPU_PP_SENSOR_MAX_FAN_RPM:
|
|
||||||
*(uint32_t *)data = pptable->FanMaximumRpm;
|
|
||||||
*size = 4;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool vega20_is_dpm_running(struct smu_context *smu)
|
static bool vega20_is_dpm_running(struct smu_context *smu)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
@ -3033,6 +3013,33 @@ static int vega20_get_current_activity_percent(struct smu_context *smu,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int vega20_read_sensor(struct smu_context *smu,
|
||||||
|
enum amd_pp_sensors sensor,
|
||||||
|
void *data, uint32_t *size)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
struct smu_table_context *table_context = &smu->smu_table;
|
||||||
|
PPTable_t *pptable = table_context->driver_pptable;
|
||||||
|
|
||||||
|
switch (sensor) {
|
||||||
|
case AMDGPU_PP_SENSOR_MAX_FAN_RPM:
|
||||||
|
*(uint32_t *)data = pptable->FanMaximumRpm;
|
||||||
|
*size = 4;
|
||||||
|
break;
|
||||||
|
case AMDGPU_PP_SENSOR_MEM_LOAD:
|
||||||
|
case AMDGPU_PP_SENSOR_GPU_LOAD:
|
||||||
|
ret = vega20_get_current_activity_percent(smu,
|
||||||
|
sensor,
|
||||||
|
(uint32_t *)data);
|
||||||
|
*size = 4;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static int vega20_set_watermarks_table(struct smu_context *smu,
|
static int vega20_set_watermarks_table(struct smu_context *smu,
|
||||||
void *watermarks, struct
|
void *watermarks, struct
|
||||||
dm_pp_wm_sets_with_clock_ranges_soc15
|
dm_pp_wm_sets_with_clock_ranges_soc15
|
||||||
@ -3139,7 +3146,6 @@ static const struct pptable_funcs vega20_ppt_funcs = {
|
|||||||
.set_thermal_fan_table = vega20_set_thermal_fan_table,
|
.set_thermal_fan_table = vega20_set_thermal_fan_table,
|
||||||
.get_fan_speed_percent = vega20_get_fan_speed_percent,
|
.get_fan_speed_percent = vega20_get_fan_speed_percent,
|
||||||
.get_gpu_power = vega20_get_gpu_power,
|
.get_gpu_power = vega20_get_gpu_power,
|
||||||
.get_current_activity_percent = vega20_get_current_activity_percent,
|
|
||||||
.set_watermarks_table = vega20_set_watermarks_table,
|
.set_watermarks_table = vega20_set_watermarks_table,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user