This is a note to let you know that I've just added the patch titled cpufreq: amd-pstate: Add resume and suspend callbacks to the 5.18-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: cpufreq-amd-pstate-add-resume-and-suspend-callbacks.patch and it can be found in the queue-5.18 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From b376471fb47d4905e72fe73e9eeed228f8f2f230 Mon Sep 17 00:00:00 2001 From: Jinzhou Su <Jinzhou.Su@xxxxxxx> Date: Thu, 23 Jun 2022 11:15:09 +0800 Subject: cpufreq: amd-pstate: Add resume and suspend callbacks From: Jinzhou Su <Jinzhou.Su@xxxxxxx> commit b376471fb47d4905e72fe73e9eeed228f8f2f230 upstream. When system resumes from S3, the CPPC enable register will be cleared and reset to 0. So enable the CPPC interface by writing 1 to this register on system resume and disable it during system suspend. Signed-off-by: Jinzhou Su <Jinzhou.Su@xxxxxxx> Signed-off-by: Jinzhou Su <Jinzhou.Su@xxxxxxx> Acked-by: Huang Rui <ray.huang@xxxxxxx> [ rjw: Subject and changelog edits ] Cc: All applicable <stable@xxxxxxxxxxxxxxx> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/cpufreq/amd-pstate.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -566,6 +566,28 @@ static int amd_pstate_cpu_exit(struct cp return 0; } +static int amd_pstate_cpu_resume(struct cpufreq_policy *policy) +{ + int ret; + + ret = amd_pstate_enable(true); + if (ret) + pr_err("failed to enable amd-pstate during resume, return %d\n", ret); + + return ret; +} + +static int amd_pstate_cpu_suspend(struct cpufreq_policy *policy) +{ + int ret; + + ret = amd_pstate_enable(false); + if (ret) + pr_err("failed to disable amd-pstate during suspend, return %d\n", ret); + + return ret; +} + /* Sysfs attributes */ /* @@ -636,6 +658,8 @@ static struct cpufreq_driver amd_pstate_ .target = amd_pstate_target, .init = amd_pstate_cpu_init, .exit = amd_pstate_cpu_exit, + .suspend = amd_pstate_cpu_suspend, + .resume = amd_pstate_cpu_resume, .set_boost = amd_pstate_set_boost, .name = "amd-pstate", .attr = amd_pstate_attr, Patches currently in stable-queue which might be from Jinzhou.Su@xxxxxxx are queue-5.18/cpufreq-amd-pstate-add-resume-and-suspend-callbacks.patch