Skip to content

Commit

Permalink
drm/amd/pm: Support board calibration on aldebaran
Browse files Browse the repository at this point in the history
Add support for board power calibration on Aldebaran.
Board calibration is done after DC offset calibration.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
  • Loading branch information
Lijo Lazar authored and kentrussell committed Jul 22, 2021
1 parent 54a388c commit c09ec36
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 2 deletions.
3 changes: 2 additions & 1 deletion drivers/gpu/drm/amd/pm/inc/aldebaran_ppsmc.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@
#define PPSMC_MSG_SetSystemVirtualSTBtoDramAddrLow 0x41

#define PPSMC_MSG_GfxDriverResetRecovery 0x42
#define PPSMC_Message_Count 0x43
#define PPSMC_MSG_BoardPowerCalibration 0x43
#define PPSMC_Message_Count 0x44

//PPSMC Reset Types
#define PPSMC_RESET_TYPE_WARM_RESET 0x00
Expand Down
3 changes: 2 additions & 1 deletion drivers/gpu/drm/amd/pm/inc/smu_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@
__SMU_DUMMY_MAP(DisableDeterminism), \
__SMU_DUMMY_MAP(SetUclkDpmMode), \
__SMU_DUMMY_MAP(LightSBR), \
__SMU_DUMMY_MAP(GfxDriverResetRecovery),
__SMU_DUMMY_MAP(GfxDriverResetRecovery), \
__SMU_DUMMY_MAP(BoardPowerCalibration),

#undef __SMU_DUMMY_MAP
#define __SMU_DUMMY_MAP(type) SMU_MSG_##type
Expand Down
36 changes: 36 additions & 0 deletions drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ static const struct cmn2asic_msg_mapping aldebaran_message_map[SMU_MSG_MAX_COUNT
MSG_MAP(DisableDeterminism, PPSMC_MSG_DisableDeterminism, 0),
MSG_MAP(SetUclkDpmMode, PPSMC_MSG_SetUclkDpmMode, 0),
MSG_MAP(GfxDriverResetRecovery, PPSMC_MSG_GfxDriverResetRecovery, 0),
MSG_MAP(BoardPowerCalibration, PPSMC_MSG_BoardPowerCalibration, 0),
};

static const struct cmn2asic_mapping aldebaran_clk_map[SMU_CLK_COUNT] = {
Expand Down Expand Up @@ -427,13 +428,48 @@ static int aldebaran_setup_pptable(struct smu_context *smu)
return ret;
}

static bool aldebaran_is_primary(struct smu_context *smu)
{
struct amdgpu_device *adev = smu->adev;

if (adev->smuio.funcs && adev->smuio.funcs->get_die_id)
return adev->smuio.funcs->get_die_id(adev) == 0;

return true;
}

static int aldebaran_run_board_btc(struct smu_context *smu)
{
u32 smu_version;
int ret;

if (!aldebaran_is_primary(smu))
return 0;

ret = smu_cmn_get_smc_version(smu, NULL, &smu_version);
if (ret) {
dev_err(smu->adev->dev, "Failed to get smu version!\n");
return ret;
}
if (smu_version <= 0x00441d00)
return 0;

ret = smu_cmn_send_smc_msg(smu, SMU_MSG_BoardPowerCalibration, NULL);
if (ret)
dev_err(smu->adev->dev, "Board power calibration failed!\n");

return ret;
}

static int aldebaran_run_btc(struct smu_context *smu)
{
int ret;

ret = smu_cmn_send_smc_msg(smu, SMU_MSG_RunDcBtc, NULL);
if (ret)
dev_err(smu->adev->dev, "RunDcBtc failed!\n");
else
ret = aldebaran_run_board_btc(smu);

return ret;
}
Expand Down

0 comments on commit c09ec36

Please sign in to comment.