aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPerry Yuan <[email protected]>2025-06-09 20:05:13 +0000
committerBorislav Petkov (AMD) <[email protected]>2025-07-07 20:26:37 +0000
commit263e66f9c35922d0cfd961df6d7a492820143792 (patch)
treeaf74f1638ca048c02c4117ecd3d2ee9cb177ffaf
parentplatform/x86: hfi: Add online and offline callback support (diff)
downloadkernel-263e66f9c35922d0cfd961df6d7a492820143792.tar.gz
kernel-263e66f9c35922d0cfd961df6d7a492820143792.zip
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]
-rw-r--r--drivers/platform/x86/amd/hfi/hfi.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/platform/x86/amd/hfi/hfi.c b/drivers/platform/x86/amd/hfi/hfi.c
index 28ef7212d339..b0a5840b2598 100644
--- a/drivers/platform/x86/amd/hfi/hfi.c
+++ b/drivers/platform/x86/amd/hfi/hfi.c
@@ -385,6 +385,38 @@ static int amd_hfi_metadata_parser(struct platform_device *pdev,
return ret;
}
+static int amd_hfi_pm_resume(struct device *dev)
+{
+ int ret, cpu;
+
+ for_each_online_cpu(cpu) {
+ ret = amd_hfi_set_state(cpu, true);
+ if (ret < 0) {
+ dev_err(dev, "failed to enable workload class config: %d\n", ret);
+ return ret;
+ }
+ }
+
+ return 0;
+}
+
+static int amd_hfi_pm_suspend(struct device *dev)
+{
+ int ret, cpu;
+
+ for_each_online_cpu(cpu) {
+ ret = amd_hfi_set_state(cpu, false);
+ if (ret < 0) {
+ dev_err(dev, "failed to disable workload class config: %d\n", ret);
+ return ret;
+ }
+ }
+
+ return 0;
+}
+
+static DEFINE_SIMPLE_DEV_PM_OPS(amd_hfi_pm_ops, amd_hfi_pm_suspend, amd_hfi_pm_resume);
+
static const struct acpi_device_id amd_hfi_platform_match[] = {
{"AMDI0104", 0},
{ }
@@ -434,6 +466,7 @@ static struct platform_driver amd_hfi_driver = {
.driver = {
.name = AMD_HFI_DRIVER,
.owner = THIS_MODULE,
+ .pm = &amd_hfi_pm_ops,
.acpi_match_table = ACPI_PTR(amd_hfi_platform_match),
},
.probe = amd_hfi_probe,