Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

authored by

Perry Yuan and committed by
Borislav Petkov (AMD)
263e66f9 bb20421c

+33
+33
drivers/platform/x86/amd/hfi/hfi.c
··· 385 385 return ret; 386 386 } 387 387 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 + 388 420 static const struct acpi_device_id amd_hfi_platform_match[] = { 389 421 {"AMDI0104", 0}, 390 422 { } ··· 466 434 .driver = { 467 435 .name = AMD_HFI_DRIVER, 468 436 .owner = THIS_MODULE, 437 + .pm = &amd_hfi_pm_ops, 469 438 .acpi_match_table = ACPI_PTR(amd_hfi_platform_match), 470 439 }, 471 440 .probe = amd_hfi_probe,