Commit 56d9bf62 authored by Graham Sider's avatar Graham Sider Committed by Alex Deucher

drm/amd/pm: Add aldebaran throttler translation

Perform dependent to independent throttle status translation
for aldebaran.
Signed-off-by: default avatarGraham Sider <Graham.Sider@amd.com>
Reviewed-by: default avatarEvan Quan <evan.quan@amd.com>
Reviewed-by: default avatarLijo Lazar <lijo.lazar@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent d4c9b03f
...@@ -191,6 +191,20 @@ static const struct cmn2asic_mapping aldebaran_table_map[SMU_TABLE_COUNT] = { ...@@ -191,6 +191,20 @@ static const struct cmn2asic_mapping aldebaran_table_map[SMU_TABLE_COUNT] = {
TAB_MAP(I2C_COMMANDS), TAB_MAP(I2C_COMMANDS),
}; };
static const uint8_t aldebaran_throttler_map[] = {
[THROTTLER_PPT0_BIT] = (SMU_THROTTLER_PPT0_BIT),
[THROTTLER_PPT1_BIT] = (SMU_THROTTLER_PPT1_BIT),
[THROTTLER_TDC_GFX_BIT] = (SMU_THROTTLER_TDC_GFX_BIT),
[THROTTLER_TDC_SOC_BIT] = (SMU_THROTTLER_TDC_SOC_BIT),
[THROTTLER_TDC_HBM_BIT] = (SMU_THROTTLER_TDC_MEM_BIT),
[THROTTLER_TEMP_GPU_BIT] = (SMU_THROTTLER_TEMP_GPU_BIT),
[THROTTLER_TEMP_MEM_BIT] = (SMU_THROTTLER_TEMP_MEM_BIT),
[THROTTLER_TEMP_VR_GFX_BIT] = (SMU_THROTTLER_TEMP_VR_GFX_BIT),
[THROTTLER_TEMP_VR_SOC_BIT] = (SMU_THROTTLER_TEMP_VR_SOC_BIT),
[THROTTLER_TEMP_VR_MEM_BIT] = (SMU_THROTTLER_TEMP_VR_MEM0_BIT),
[THROTTLER_APCC_BIT] = (SMU_THROTTLER_APCC_BIT),
};
static int aldebaran_tables_init(struct smu_context *smu) static int aldebaran_tables_init(struct smu_context *smu)
{ {
struct smu_table_context *smu_table = &smu->smu_table; struct smu_table_context *smu_table = &smu->smu_table;
...@@ -213,7 +227,7 @@ static int aldebaran_tables_init(struct smu_context *smu) ...@@ -213,7 +227,7 @@ static int aldebaran_tables_init(struct smu_context *smu)
return -ENOMEM; return -ENOMEM;
smu_table->metrics_time = 0; smu_table->metrics_time = 0;
smu_table->gpu_metrics_table_size = sizeof(struct gpu_metrics_v1_2); smu_table->gpu_metrics_table_size = sizeof(struct gpu_metrics_v1_3);
smu_table->gpu_metrics_table = kzalloc(smu_table->gpu_metrics_table_size, GFP_KERNEL); smu_table->gpu_metrics_table = kzalloc(smu_table->gpu_metrics_table_size, GFP_KERNEL);
if (!smu_table->gpu_metrics_table) { if (!smu_table->gpu_metrics_table) {
kfree(smu_table->metrics_table); kfree(smu_table->metrics_table);
...@@ -1706,8 +1720,8 @@ static ssize_t aldebaran_get_gpu_metrics(struct smu_context *smu, ...@@ -1706,8 +1720,8 @@ static ssize_t aldebaran_get_gpu_metrics(struct smu_context *smu,
void **table) void **table)
{ {
struct smu_table_context *smu_table = &smu->smu_table; struct smu_table_context *smu_table = &smu->smu_table;
struct gpu_metrics_v1_2 *gpu_metrics = struct gpu_metrics_v1_3 *gpu_metrics =
(struct gpu_metrics_v1_2 *)smu_table->gpu_metrics_table; (struct gpu_metrics_v1_3 *)smu_table->gpu_metrics_table;
SmuMetrics_t metrics; SmuMetrics_t metrics;
int i, ret = 0; int i, ret = 0;
...@@ -1717,7 +1731,7 @@ static ssize_t aldebaran_get_gpu_metrics(struct smu_context *smu, ...@@ -1717,7 +1731,7 @@ static ssize_t aldebaran_get_gpu_metrics(struct smu_context *smu,
if (ret) if (ret)
return ret; return ret;
smu_cmn_init_soft_gpu_metrics(gpu_metrics, 1, 2); smu_cmn_init_soft_gpu_metrics(gpu_metrics, 1, 3);
gpu_metrics->temperature_edge = metrics.TemperatureEdge; gpu_metrics->temperature_edge = metrics.TemperatureEdge;
gpu_metrics->temperature_hotspot = metrics.TemperatureHotspot; gpu_metrics->temperature_hotspot = metrics.TemperatureHotspot;
...@@ -1748,6 +1762,9 @@ static ssize_t aldebaran_get_gpu_metrics(struct smu_context *smu, ...@@ -1748,6 +1762,9 @@ static ssize_t aldebaran_get_gpu_metrics(struct smu_context *smu,
gpu_metrics->current_dclk0 = metrics.CurrClock[PPCLK_DCLK]; gpu_metrics->current_dclk0 = metrics.CurrClock[PPCLK_DCLK];
gpu_metrics->throttle_status = metrics.ThrottlerStatus; gpu_metrics->throttle_status = metrics.ThrottlerStatus;
gpu_metrics->indep_throttle_status =
smu_cmn_get_indep_throttler_status(metrics.ThrottlerStatus,
aldebaran_throttler_map);
gpu_metrics->current_fan_speed = 0; gpu_metrics->current_fan_speed = 0;
...@@ -1769,7 +1786,7 @@ static ssize_t aldebaran_get_gpu_metrics(struct smu_context *smu, ...@@ -1769,7 +1786,7 @@ static ssize_t aldebaran_get_gpu_metrics(struct smu_context *smu,
*table = (void *)gpu_metrics; *table = (void *)gpu_metrics;
return sizeof(struct gpu_metrics_v1_2); return sizeof(struct gpu_metrics_v1_3);
} }
static int aldebaran_mode2_reset(struct smu_context *smu) static int aldebaran_mode2_reset(struct smu_context *smu)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment