Skip to content

Commit 6588b10

Browse files
Lijo Lazaralexdeucher
authored andcommitted
drm/amd/pm: Support board calibration on aldebaran
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> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
1 parent 93b6bd3 commit 6588b10

File tree

3 files changed

+40
-12
lines changed

3 files changed

+40
-12
lines changed

drivers/gpu/drm/amd/pm/inc/aldebaran_ppsmc.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,8 @@
101101
#define PPSMC_MSG_SetSystemVirtualSTBtoDramAddrLow 0x41
102102

103103
#define PPSMC_MSG_GfxDriverResetRecovery 0x42
104-
#define PPSMC_Message_Count 0x43
104+
#define PPSMC_MSG_BoardPowerCalibration 0x43
105+
#define PPSMC_Message_Count 0x44
105106

106107
//PPSMC Reset Types
107108
#define PPSMC_RESET_TYPE_WARM_RESET 0x00

drivers/gpu/drm/amd/pm/inc/smu_types.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,8 @@
225225
__SMU_DUMMY_MAP(DisableDeterminism), \
226226
__SMU_DUMMY_MAP(SetUclkDpmMode), \
227227
__SMU_DUMMY_MAP(LightSBR), \
228-
__SMU_DUMMY_MAP(GfxDriverResetRecovery),
228+
__SMU_DUMMY_MAP(GfxDriverResetRecovery), \
229+
__SMU_DUMMY_MAP(BoardPowerCalibration),
229230

230231
#undef __SMU_DUMMY_MAP
231232
#define __SMU_DUMMY_MAP(type) SMU_MSG_##type

drivers/gpu/drm/amd/pm/swsmu/smu13/aldebaran_ppt.c

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ static const struct cmn2asic_msg_mapping aldebaran_message_map[SMU_MSG_MAX_COUNT
134134
MSG_MAP(DisableDeterminism, PPSMC_MSG_DisableDeterminism, 0),
135135
MSG_MAP(SetUclkDpmMode, PPSMC_MSG_SetUclkDpmMode, 0),
136136
MSG_MAP(GfxDriverResetRecovery, PPSMC_MSG_GfxDriverResetRecovery, 0),
137+
MSG_MAP(BoardPowerCalibration, PPSMC_MSG_BoardPowerCalibration, 0),
137138
};
138139

139140
static const struct cmn2asic_mapping aldebaran_clk_map[SMU_CLK_COUNT] = {
@@ -440,13 +441,48 @@ static int aldebaran_setup_pptable(struct smu_context *smu)
440441
return ret;
441442
}
442443

444+
static bool aldebaran_is_primary(struct smu_context *smu)
445+
{
446+
struct amdgpu_device *adev = smu->adev;
447+
448+
if (adev->smuio.funcs && adev->smuio.funcs->get_die_id)
449+
return adev->smuio.funcs->get_die_id(adev) == 0;
450+
451+
return true;
452+
}
453+
454+
static int aldebaran_run_board_btc(struct smu_context *smu)
455+
{
456+
u32 smu_version;
457+
int ret;
458+
459+
if (!aldebaran_is_primary(smu))
460+
return 0;
461+
462+
ret = smu_cmn_get_smc_version(smu, NULL, &smu_version);
463+
if (ret) {
464+
dev_err(smu->adev->dev, "Failed to get smu version!\n");
465+
return ret;
466+
}
467+
if (smu_version <= 0x00441d00)
468+
return 0;
469+
470+
ret = smu_cmn_send_smc_msg(smu, SMU_MSG_BoardPowerCalibration, NULL);
471+
if (ret)
472+
dev_err(smu->adev->dev, "Board power calibration failed!\n");
473+
474+
return ret;
475+
}
476+
443477
static int aldebaran_run_btc(struct smu_context *smu)
444478
{
445479
int ret;
446480

447481
ret = smu_cmn_send_smc_msg(smu, SMU_MSG_RunDcBtc, NULL);
448482
if (ret)
449483
dev_err(smu->adev->dev, "RunDcBtc failed!\n");
484+
else
485+
ret = aldebaran_run_board_btc(smu);
450486

451487
return ret;
452488
}
@@ -524,16 +560,6 @@ static int aldebaran_freqs_in_same_level(int32_t frequency1,
524560
return (abs(frequency1 - frequency2) <= EPSILON);
525561
}
526562

527-
static bool aldebaran_is_primary(struct smu_context *smu)
528-
{
529-
struct amdgpu_device *adev = smu->adev;
530-
531-
if (adev->smuio.funcs && adev->smuio.funcs->get_die_id)
532-
return adev->smuio.funcs->get_die_id(adev) == 0;
533-
534-
return true;
535-
}
536-
537563
static int aldebaran_get_smu_metrics_data(struct smu_context *smu,
538564
MetricsMember_t member,
539565
uint32_t *value)

0 commit comments

Comments
 (0)