Commit c5895273 authored by Huang Rui's avatar Huang Rui Committed by Alex Deucher

drm/amd/powerplay: add append_powerplay_table function

It needs to add append_powerplay_table function to program the smc_dpm_table for
PPTable_t.
Signed-off-by: default avatarHuang Rui <ray.huang@amd.com>
Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Reviewed-by: default avatarKevin Wang <Kevin1.Wang@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 0914f1c6
...@@ -192,6 +192,7 @@ struct smu_context ...@@ -192,6 +192,7 @@ struct smu_context
struct pptable_funcs { struct pptable_funcs {
int (*store_powerplay_table)(struct smu_context *smu); int (*store_powerplay_table)(struct smu_context *smu);
int (*check_powerplay_table)(struct smu_context *smu); int (*check_powerplay_table)(struct smu_context *smu);
int (*append_powerplay_table)(struct smu_context *smu);
int (*get_smu_msg_index)(struct smu_context *smu, uint32_t index); int (*get_smu_msg_index)(struct smu_context *smu, uint32_t index);
}; };
...@@ -273,6 +274,8 @@ struct smu_funcs ...@@ -273,6 +274,8 @@ struct smu_funcs
((smu)->ppt_funcs->store_powerplay_table ? (smu)->ppt_funcs->store_powerplay_table((smu)) : 0) ((smu)->ppt_funcs->store_powerplay_table ? (smu)->ppt_funcs->store_powerplay_table((smu)) : 0)
#define smu_check_powerplay_table(smu) \ #define smu_check_powerplay_table(smu) \
((smu)->ppt_funcs->check_powerplay_table ? (smu)->ppt_funcs->check_powerplay_table((smu)) : 0) ((smu)->ppt_funcs->check_powerplay_table ? (smu)->ppt_funcs->check_powerplay_table((smu)) : 0)
#define smu_append_powerplay_table(smu) \
((smu)->ppt_funcs->append_powerplay_table ? (smu)->ppt_funcs->append_powerplay_table((smu)) : 0)
#define smu_msg_get_index(smu, msg) \ #define smu_msg_get_index(smu, msg) \
((smu)->ppt_funcs? ((smu)->ppt_funcs->get_smu_msg_index? (smu)->ppt_funcs->get_smu_msg_index((smu), (msg)) : -EINVAL) : -EINVAL) ((smu)->ppt_funcs? ((smu)->ppt_funcs->get_smu_msg_index? (smu)->ppt_funcs->get_smu_msg_index((smu), (msg)) : -EINVAL) : -EINVAL)
......
...@@ -520,6 +520,10 @@ static int smu_v11_0_parse_pptable(struct smu_context *smu) ...@@ -520,6 +520,10 @@ static int smu_v11_0_parse_pptable(struct smu_context *smu)
return -ENOMEM; return -ENOMEM;
ret = smu_store_powerplay_table(smu); ret = smu_store_powerplay_table(smu);
if (ret)
return -EINVAL;
ret = smu_append_powerplay_table(smu);
return ret; return ret;
} }
......
...@@ -148,6 +148,97 @@ static int vega20_store_powerplay_table(struct smu_context *smu) ...@@ -148,6 +148,97 @@ static int vega20_store_powerplay_table(struct smu_context *smu)
return 0; return 0;
} }
static int vega20_append_powerplay_table(struct smu_context *smu)
{
struct smu_table_context *table_context = &smu->smu_table;
PPTable_t *smc_pptable = table_context->driver_pptable;
struct atom_smc_dpm_info_v4_4 *smc_dpm_table;
int index, i, ret;
index = get_index_into_master_table(atom_master_list_of_data_tables_v2_1,
smc_dpm_info);
ret = smu_get_atom_data_table(smu, index, NULL, NULL, NULL,
(uint8_t **)&smc_dpm_table);
if (ret)
return ret;
smc_pptable->MaxVoltageStepGfx = smc_dpm_table->maxvoltagestepgfx;
smc_pptable->MaxVoltageStepSoc = smc_dpm_table->maxvoltagestepsoc;
smc_pptable->VddGfxVrMapping = smc_dpm_table->vddgfxvrmapping;
smc_pptable->VddSocVrMapping = smc_dpm_table->vddsocvrmapping;
smc_pptable->VddMem0VrMapping = smc_dpm_table->vddmem0vrmapping;
smc_pptable->VddMem1VrMapping = smc_dpm_table->vddmem1vrmapping;
smc_pptable->GfxUlvPhaseSheddingMask = smc_dpm_table->gfxulvphasesheddingmask;
smc_pptable->SocUlvPhaseSheddingMask = smc_dpm_table->soculvphasesheddingmask;
smc_pptable->ExternalSensorPresent = smc_dpm_table->externalsensorpresent;
smc_pptable->GfxMaxCurrent = smc_dpm_table->gfxmaxcurrent;
smc_pptable->GfxOffset = smc_dpm_table->gfxoffset;
smc_pptable->Padding_TelemetryGfx = smc_dpm_table->padding_telemetrygfx;
smc_pptable->SocMaxCurrent = smc_dpm_table->socmaxcurrent;
smc_pptable->SocOffset = smc_dpm_table->socoffset;
smc_pptable->Padding_TelemetrySoc = smc_dpm_table->padding_telemetrysoc;
smc_pptable->Mem0MaxCurrent = smc_dpm_table->mem0maxcurrent;
smc_pptable->Mem0Offset = smc_dpm_table->mem0offset;
smc_pptable->Padding_TelemetryMem0 = smc_dpm_table->padding_telemetrymem0;
smc_pptable->Mem1MaxCurrent = smc_dpm_table->mem1maxcurrent;
smc_pptable->Mem1Offset = smc_dpm_table->mem1offset;
smc_pptable->Padding_TelemetryMem1 = smc_dpm_table->padding_telemetrymem1;
smc_pptable->AcDcGpio = smc_dpm_table->acdcgpio;
smc_pptable->AcDcPolarity = smc_dpm_table->acdcpolarity;
smc_pptable->VR0HotGpio = smc_dpm_table->vr0hotgpio;
smc_pptable->VR0HotPolarity = smc_dpm_table->vr0hotpolarity;
smc_pptable->VR1HotGpio = smc_dpm_table->vr1hotgpio;
smc_pptable->VR1HotPolarity = smc_dpm_table->vr1hotpolarity;
smc_pptable->Padding1 = smc_dpm_table->padding1;
smc_pptable->Padding2 = smc_dpm_table->padding2;
smc_pptable->LedPin0 = smc_dpm_table->ledpin0;
smc_pptable->LedPin1 = smc_dpm_table->ledpin1;
smc_pptable->LedPin2 = smc_dpm_table->ledpin2;
smc_pptable->PllGfxclkSpreadEnabled = smc_dpm_table->pllgfxclkspreadenabled;
smc_pptable->PllGfxclkSpreadPercent = smc_dpm_table->pllgfxclkspreadpercent;
smc_pptable->PllGfxclkSpreadFreq = smc_dpm_table->pllgfxclkspreadfreq;
smc_pptable->UclkSpreadEnabled = 0;
smc_pptable->UclkSpreadPercent = smc_dpm_table->uclkspreadpercent;
smc_pptable->UclkSpreadFreq = smc_dpm_table->uclkspreadfreq;
smc_pptable->FclkSpreadEnabled = smc_dpm_table->fclkspreadenabled;
smc_pptable->FclkSpreadPercent = smc_dpm_table->fclkspreadpercent;
smc_pptable->FclkSpreadFreq = smc_dpm_table->fclkspreadfreq;
smc_pptable->FllGfxclkSpreadEnabled = smc_dpm_table->fllgfxclkspreadenabled;
smc_pptable->FllGfxclkSpreadPercent = smc_dpm_table->fllgfxclkspreadpercent;
smc_pptable->FllGfxclkSpreadFreq = smc_dpm_table->fllgfxclkspreadfreq;
for (i = 0; i < I2C_CONTROLLER_NAME_COUNT; i++) {
smc_pptable->I2cControllers[i].Enabled =
smc_dpm_table->i2ccontrollers[i].enabled;
smc_pptable->I2cControllers[i].SlaveAddress =
smc_dpm_table->i2ccontrollers[i].slaveaddress;
smc_pptable->I2cControllers[i].ControllerPort =
smc_dpm_table->i2ccontrollers[i].controllerport;
smc_pptable->I2cControllers[i].ThermalThrottler =
smc_dpm_table->i2ccontrollers[i].thermalthrottler;
smc_pptable->I2cControllers[i].I2cProtocol =
smc_dpm_table->i2ccontrollers[i].i2cprotocol;
smc_pptable->I2cControllers[i].I2cSpeed =
smc_dpm_table->i2ccontrollers[i].i2cspeed;
}
return 0;
}
static int vega20_check_powerplay_table(struct smu_context *smu) static int vega20_check_powerplay_table(struct smu_context *smu)
{ {
ATOM_Vega20_POWERPLAYTABLE *powerplay_table = NULL; ATOM_Vega20_POWERPLAYTABLE *powerplay_table = NULL;
...@@ -171,6 +262,7 @@ static int vega20_check_powerplay_table(struct smu_context *smu) ...@@ -171,6 +262,7 @@ static int vega20_check_powerplay_table(struct smu_context *smu)
static const struct pptable_funcs vega20_ppt_funcs = { static const struct pptable_funcs vega20_ppt_funcs = {
.store_powerplay_table = vega20_store_powerplay_table, .store_powerplay_table = vega20_store_powerplay_table,
.check_powerplay_table = vega20_check_powerplay_table, .check_powerplay_table = vega20_check_powerplay_table,
.append_powerplay_table = vega20_append_powerplay_table,
.get_smu_msg_index = vega20_get_smu_msg_index, .get_smu_msg_index = vega20_get_smu_msg_index,
}; };
......
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