Skip to content

Commit 263e66f

Browse files
Perry Yuanbp3tk0v
authored andcommitted
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 <[email protected]> Co-developed-by: Mario Limonciello <[email protected]> Signed-off-by: Mario Limonciello <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Reviewed-by: Gautham R. Shenoy <[email protected]> Acked-by: Ilpo Järvinen <[email protected]> Link: https://lore.kernel.org/[email protected]
1 parent bb20421 commit 263e66f

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)