Commit 263e66f9 authored by Perry Yuan's avatar Perry Yuan Committed by Borislav Petkov (AMD)
Browse files

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: default avatarPerry Yuan <Perry.Yuan@amd.com>
Co-developed-by: default avatarMario Limonciello <mario.limonciello@amd.com>
Signed-off-by: default avatarMario Limonciello <mario.limonciello@amd.com>
Signed-off-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
Reviewed-by: default avatarGautham R. Shenoy <gautham.shenoy@amd.com>
Acked-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/20250609200518.3616080-9-superm1@kernel.org
parent bb20421c
Loading
Loading
Loading
Loading
+33 −0
Original line number Diff line number Diff line
@@ -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,