drm/amd/powerplay: change smu_read_sensor sequence in smu
change the smu_read_sensor sequence to: asic specific sensor read -> smu v11 specific sensor read -> smu v11 common sensor read Signed-off-by: Kenneth Feng <kenneth.feng@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
bee7b51ac9
commit
9b4e63f451
@ -413,6 +413,9 @@ int smu_common_read_sensor(struct smu_context *smu, enum amd_pp_sensors sensor,
|
||||
struct smu_power_gate *power_gate = &smu_power->power_gate;
|
||||
int ret = 0;
|
||||
|
||||
if(!data || !size)
|
||||
return -EINVAL;
|
||||
|
||||
switch (sensor) {
|
||||
case AMDGPU_PP_SENSOR_STABLE_PSTATE_SCLK:
|
||||
*((uint32_t *)data) = smu->pstate_sclk;
|
||||
|
@ -634,9 +634,9 @@ struct smu_funcs
|
||||
#define smu_start_thermal_control(smu) \
|
||||
((smu)->funcs->start_thermal_control? (smu)->funcs->start_thermal_control((smu)) : 0)
|
||||
#define smu_read_sensor(smu, sensor, data, size) \
|
||||
((smu)->funcs->read_sensor? (smu)->funcs->read_sensor((smu), (sensor), (data), (size)) : 0)
|
||||
#define smu_asic_read_sensor(smu, sensor, data, size) \
|
||||
((smu)->ppt_funcs->read_sensor? (smu)->ppt_funcs->read_sensor((smu), (sensor), (data), (size)) : 0)
|
||||
#define smu_smc_read_sensor(smu, sensor, data, size) \
|
||||
((smu)->funcs->read_sensor? (smu)->funcs->read_sensor((smu), (sensor), (data), (size)) : -EINVAL)
|
||||
#define smu_get_power_profile_mode(smu, buf) \
|
||||
((smu)->ppt_funcs->get_power_profile_mode ? (smu)->ppt_funcs->get_power_profile_mode((smu), buf) : 0)
|
||||
#define smu_set_power_profile_mode(smu, param, param_size) \
|
||||
|
@ -1386,6 +1386,9 @@ static int navi10_read_sensor(struct smu_context *smu,
|
||||
struct smu_table_context *table_context = &smu->smu_table;
|
||||
PPTable_t *pptable = table_context->driver_pptable;
|
||||
|
||||
if(!data || !size)
|
||||
return -EINVAL;
|
||||
|
||||
switch (sensor) {
|
||||
case AMDGPU_PP_SENSOR_MAX_FAN_RPM:
|
||||
*(uint32_t *)data = pptable->FanMaximumRpm;
|
||||
@ -1407,7 +1410,7 @@ static int navi10_read_sensor(struct smu_context *smu,
|
||||
*size = 4;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
ret = smu_smc_read_sensor(smu, sensor, data, size);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
@ -1230,6 +1230,10 @@ static int smu_v11_0_read_sensor(struct smu_context *smu,
|
||||
void *data, uint32_t *size)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if(!data || !size)
|
||||
return -EINVAL;
|
||||
|
||||
switch (sensor) {
|
||||
case AMDGPU_PP_SENSOR_GFX_MCLK:
|
||||
ret = smu_get_current_clk_freq(smu, SMU_UCLK, (uint32_t *)data);
|
||||
@ -1252,10 +1256,6 @@ static int smu_v11_0_read_sensor(struct smu_context *smu,
|
||||
break;
|
||||
}
|
||||
|
||||
/* try get sensor data by asic */
|
||||
if (ret)
|
||||
ret = smu_asic_read_sensor(smu, sensor, data, size);
|
||||
|
||||
if (ret)
|
||||
*size = 0;
|
||||
|
||||
|
@ -3011,6 +3011,9 @@ static int vega20_read_sensor(struct smu_context *smu,
|
||||
struct smu_table_context *table_context = &smu->smu_table;
|
||||
PPTable_t *pptable = table_context->driver_pptable;
|
||||
|
||||
if(!data || !size)
|
||||
return -EINVAL;
|
||||
|
||||
switch (sensor) {
|
||||
case AMDGPU_PP_SENSOR_MAX_FAN_RPM:
|
||||
*(uint32_t *)data = pptable->FanMaximumRpm;
|
||||
@ -3034,7 +3037,7 @@ static int vega20_read_sensor(struct smu_context *smu,
|
||||
*size = 4;
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
ret = smu_smc_read_sensor(smu, sensor, data, size);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
Loading…
Reference in New Issue
Block a user