mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-02 02:47:31 -04:00
drm/amd/pm: Add renoir throttler translation
Perform dependent to independent throttle status translation for renoir. Signed-off-by: Graham Sider <Graham.Sider@amd.com> Reviewed-by: Evan Quan <evan.quan@amd.com> Reviewed-by: Lijo Lazar <lijo.lazar@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
committed by
Alex Deucher
parent
7cab3cff86
commit
d4c9b03ff6
@@ -128,6 +128,22 @@ static struct cmn2asic_mapping renoir_workload_map[PP_SMC_POWER_PROFILE_COUNT] =
|
||||
WORKLOAD_MAP(PP_SMC_POWER_PROFILE_CUSTOM, WORKLOAD_PPLIB_CUSTOM_BIT),
|
||||
};
|
||||
|
||||
static const uint8_t renoir_throttler_map[] = {
|
||||
[THROTTLER_STATUS_BIT_SPL] = (SMU_THROTTLER_SPL_BIT),
|
||||
[THROTTLER_STATUS_BIT_FPPT] = (SMU_THROTTLER_FPPT_BIT),
|
||||
[THROTTLER_STATUS_BIT_SPPT] = (SMU_THROTTLER_SPPT_BIT),
|
||||
[THROTTLER_STATUS_BIT_SPPT_APU] = (SMU_THROTTLER_SPPT_APU_BIT),
|
||||
[THROTTLER_STATUS_BIT_THM_CORE] = (SMU_THROTTLER_TEMP_CORE_BIT),
|
||||
[THROTTLER_STATUS_BIT_THM_GFX] = (SMU_THROTTLER_TEMP_GPU_BIT),
|
||||
[THROTTLER_STATUS_BIT_THM_SOC] = (SMU_THROTTLER_TEMP_SOC_BIT),
|
||||
[THROTTLER_STATUS_BIT_TDC_VDD] = (SMU_THROTTLER_TDC_VDD_BIT),
|
||||
[THROTTLER_STATUS_BIT_TDC_SOC] = (SMU_THROTTLER_TDC_SOC_BIT),
|
||||
[THROTTLER_STATUS_BIT_PROCHOT_CPU] = (SMU_THROTTLER_PROCHOT_CPU_BIT),
|
||||
[THROTTLER_STATUS_BIT_PROCHOT_GFX] = (SMU_THROTTLER_PROCHOT_GFX_BIT),
|
||||
[THROTTLER_STATUS_BIT_EDC_CPU] = (SMU_THROTTLER_EDC_CPU_BIT),
|
||||
[THROTTLER_STATUS_BIT_EDC_GFX] = (SMU_THROTTLER_EDC_GFX_BIT),
|
||||
};
|
||||
|
||||
static int renoir_init_smc_tables(struct smu_context *smu)
|
||||
{
|
||||
struct smu_table_context *smu_table = &smu->smu_table;
|
||||
@@ -153,7 +169,7 @@ static int renoir_init_smc_tables(struct smu_context *smu)
|
||||
if (!smu_table->watermarks_table)
|
||||
goto err2_out;
|
||||
|
||||
smu_table->gpu_metrics_table_size = sizeof(struct gpu_metrics_v2_1);
|
||||
smu_table->gpu_metrics_table_size = sizeof(struct gpu_metrics_v2_2);
|
||||
smu_table->gpu_metrics_table = kzalloc(smu_table->gpu_metrics_table_size, GFP_KERNEL);
|
||||
if (!smu_table->gpu_metrics_table)
|
||||
goto err3_out;
|
||||
@@ -1264,8 +1280,8 @@ static ssize_t renoir_get_gpu_metrics(struct smu_context *smu,
|
||||
void **table)
|
||||
{
|
||||
struct smu_table_context *smu_table = &smu->smu_table;
|
||||
struct gpu_metrics_v2_1 *gpu_metrics =
|
||||
(struct gpu_metrics_v2_1 *)smu_table->gpu_metrics_table;
|
||||
struct gpu_metrics_v2_2 *gpu_metrics =
|
||||
(struct gpu_metrics_v2_2 *)smu_table->gpu_metrics_table;
|
||||
SmuMetrics_t metrics;
|
||||
int ret = 0;
|
||||
|
||||
@@ -1273,7 +1289,7 @@ static ssize_t renoir_get_gpu_metrics(struct smu_context *smu,
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
smu_cmn_init_soft_gpu_metrics(gpu_metrics, 2, 1);
|
||||
smu_cmn_init_soft_gpu_metrics(gpu_metrics, 2, 2);
|
||||
|
||||
gpu_metrics->temperature_gfx = metrics.GfxTemperature;
|
||||
gpu_metrics->temperature_soc = metrics.SocTemperature;
|
||||
@@ -1311,6 +1327,9 @@ static ssize_t renoir_get_gpu_metrics(struct smu_context *smu,
|
||||
gpu_metrics->current_l3clk[1] = metrics.L3Frequency[1];
|
||||
|
||||
gpu_metrics->throttle_status = metrics.ThrottlerStatus;
|
||||
gpu_metrics->indep_throttle_status =
|
||||
smu_cmn_get_indep_throttler_status(metrics.ThrottlerStatus,
|
||||
renoir_throttler_map);
|
||||
|
||||
gpu_metrics->fan_pwm = metrics.FanPwm;
|
||||
|
||||
@@ -1318,7 +1337,7 @@ static ssize_t renoir_get_gpu_metrics(struct smu_context *smu,
|
||||
|
||||
*table = (void *)gpu_metrics;
|
||||
|
||||
return sizeof(struct gpu_metrics_v2_1);
|
||||
return sizeof(struct gpu_metrics_v2_2);
|
||||
}
|
||||
|
||||
static int renoir_gfx_state_change_set(struct smu_context *smu, uint32_t state)
|
||||
|
||||
Reference in New Issue
Block a user