Skip to content

Commit 2889fc7

Browse files
author
Lijo Lazar
committed
drm/amd/pm: Restrict phase detect to SMUv13.0.6
Phase detect controls are only available for SMUv13.0.6 dGPUs. Create control object only on those. Signed-off-by: Lijo Lazar <[email protected]> Reviewed-by: Feifei Xu <[email protected]> Reviewed-by: Hawking Zhang <[email protected]>
1 parent 74fda16 commit 2889fc7

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

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

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -568,17 +568,22 @@ static int smu_v13_0_6_allocate_dpm_context(struct smu_context *smu)
568568
return -ENOMEM;
569569
}
570570

571-
smu_dpm->pd_ctl = kzalloc(sizeof(struct smu_phase_det_ctl), GFP_KERNEL);
572-
if (!smu_dpm->pd_ctl) {
573-
kfree(smu_dpm->dpm_policies);
574-
kfree(smu_dpm->dpm_context);
575-
return -ENOMEM;
576-
}
577-
smu_dpm->pd_ctl->ops = &smu_v13_0_6_pd_ops;
578-
smu_dpm->pd_ctl->status = SMU_PHASE_DET_OFF;
579-
/* Init to 0xFF to indicate that present values are unknown */
580-
memset(&smu_dpm->pd_ctl->params, 0xFF, sizeof(struct smu_phase_det_params));
571+
if (amdgpu_ip_version(smu->adev, MP1_HWIP, 0) == IP_VERSION(13, 0, 6) &&
572+
!(smu->adev->flags & AMD_IS_APU)) {
573+
smu_dpm->pd_ctl =
574+
kzalloc(sizeof(struct smu_phase_det_ctl), GFP_KERNEL);
575+
if (!smu_dpm->pd_ctl) {
576+
kfree(smu_dpm->dpm_policies);
577+
kfree(smu_dpm->dpm_context);
578+
return -ENOMEM;
579+
}
581580

581+
smu_dpm->pd_ctl->ops = &smu_v13_0_6_pd_ops;
582+
smu_dpm->pd_ctl->status = SMU_PHASE_DET_OFF;
583+
/* Init to 0xFF to indicate that present values are unknown */
584+
memset(&smu_dpm->pd_ctl->params, 0xFF,
585+
sizeof(struct smu_phase_det_params));
586+
}
582587
if (!(smu->adev->flags & AMD_IS_APU)) {
583588
policy = &(smu_dpm->dpm_policies->policies[0]);
584589

@@ -910,8 +915,7 @@ static int smu_v13_0_6_set_default_dpm_table(struct smu_context *smu)
910915
~BIT(PP_PM_POLICY_SOC_PSTATE);
911916
}
912917

913-
if (smu_dpm->pd_ctl && !(smu->adev->flags & AMD_IS_APU) &&
914-
(smu->smc_fw_version < 0x00556E00)) {
918+
if (smu_dpm->pd_ctl && (smu->smc_fw_version < 0x00556E00)) {
915919
kfree(smu_dpm->pd_ctl);
916920
smu_dpm->pd_ctl = NULL;
917921
}

0 commit comments

Comments
 (0)