Skip to content

Commit 51f3343

Browse files
committed
platform/x86: hfi: Add power management callback
JIRA: https://issues.redhat.com/browse/RHEL-107081 commit 263e66f Author: Perry Yuan <Perry.Yuan@amd.com> Date: Mon Jun 9 15:05:13 2025 -0500 platform/x86: hfi: Add power management callback Introduce power management callbacks for the `amd_hfi` driver. Specifically, add the `suspend` and `resume` callbacks to handle the necessary operations during system low power states and wake-up. Signed-off-by: Perry Yuan <Perry.Yuan@amd.com> Co-developed-by: Mario Limonciello <mario.limonciello@amd.com> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com> Acked-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/20250609200518.3616080-9-superm1@kernel.org Signed-off-by: Steve Best <sbest@redhat.com>
1 parent 4b05d16 commit 51f3343

File tree

1 file changed

+33
-0
lines changed
  • drivers/platform/x86/amd/hfi

1 file changed

+33
-0
lines changed

drivers/platform/x86/amd/hfi/hfi.c

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,38 @@ static int amd_hfi_metadata_parser(struct platform_device *pdev,
385385
return ret;
386386
}
387387

388+
static int amd_hfi_pm_resume(struct device *dev)
389+
{
390+
int ret, cpu;
391+
392+
for_each_online_cpu(cpu) {
393+
ret = amd_hfi_set_state(cpu, true);
394+
if (ret < 0) {
395+
dev_err(dev, "failed to enable workload class config: %d\n", ret);
396+
return ret;
397+
}
398+
}
399+
400+
return 0;
401+
}
402+
403+
static int amd_hfi_pm_suspend(struct device *dev)
404+
{
405+
int ret, cpu;
406+
407+
for_each_online_cpu(cpu) {
408+
ret = amd_hfi_set_state(cpu, false);
409+
if (ret < 0) {
410+
dev_err(dev, "failed to disable workload class config: %d\n", ret);
411+
return ret;
412+
}
413+
}
414+
415+
return 0;
416+
}
417+
418+
static DEFINE_SIMPLE_DEV_PM_OPS(amd_hfi_pm_ops, amd_hfi_pm_suspend, amd_hfi_pm_resume);
419+
388420
static const struct acpi_device_id amd_hfi_platform_match[] = {
389421
{"AMDI0104", 0},
390422
{ }
@@ -434,6 +466,7 @@ static struct platform_driver amd_hfi_driver = {
434466
.driver = {
435467
.name = AMD_HFI_DRIVER,
436468
.owner = THIS_MODULE,
469+
.pm = &amd_hfi_pm_ops,
437470
.acpi_match_table = ACPI_PTR(amd_hfi_platform_match),
438471
},
439472
.probe = amd_hfi_probe,

0 commit comments

Comments
 (0)