[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250227153603.131046-3-lkml@antheas.dev>
Date: Thu, 27 Feb 2025 16:36:03 +0100
From: Antheas Kapenekakis <lkml@...heas.dev>
To: mario.limonciello@....com,
mpearson-lenovo@...ebb.ca
Cc: ilpo.jarvinen@...ux.intel.com,
lenb@...nel.org,
linux-acpi@...r.kernel.org,
linux-kernel@...r.kernel.org,
platform-driver-x86@...r.kernel.org,
rafael@...nel.org,
hdegoede@...hat.com,
me@...egospodneti.ch,
luke@...nes.dev,
Antheas Kapenekakis <lkml@...heas.dev>
Subject: [PATCH v2 2/2] ACPI: platform_profile: make amd-pmf a secondary
handler
Since amd-pmf is expected to run alongside other platform handlers, it
should be able to accept all platform profiles. Therefore, mark it as
secondary and in the case of a custom profile, make it NOOP without an
error to allow primary handlers to receive a custom profile.
The sysfs endpoint will still report custom, after all.
Signed-off-by: Antheas Kapenekakis <lkml@...heas.dev>
---
drivers/platform/x86/amd/pmf/spc.c | 3 +++
drivers/platform/x86/amd/pmf/sps.c | 8 ++++++++
2 files changed, 11 insertions(+)
diff --git a/drivers/platform/x86/amd/pmf/spc.c b/drivers/platform/x86/amd/pmf/spc.c
index f34f3130c330..99c48378f943 100644
--- a/drivers/platform/x86/amd/pmf/spc.c
+++ b/drivers/platform/x86/amd/pmf/spc.c
@@ -219,12 +219,15 @@ static int amd_pmf_get_slider_info(struct amd_pmf_dev *dev, struct ta_pmf_enact_
switch (dev->current_profile) {
case PLATFORM_PROFILE_PERFORMANCE:
+ case PLATFORM_PROFILE_BALANCED_PERFORMANCE:
val = TA_BEST_PERFORMANCE;
break;
case PLATFORM_PROFILE_BALANCED:
val = TA_BETTER_PERFORMANCE;
break;
case PLATFORM_PROFILE_LOW_POWER:
+ case PLATFORM_PROFILE_COOL:
+ case PLATFORM_PROFILE_QUIET:
val = TA_BEST_BATTERY;
break;
default:
diff --git a/drivers/platform/x86/amd/pmf/sps.c b/drivers/platform/x86/amd/pmf/sps.c
index e6cf0b22dac3..a2a8511768ce 100644
--- a/drivers/platform/x86/amd/pmf/sps.c
+++ b/drivers/platform/x86/amd/pmf/sps.c
@@ -297,12 +297,15 @@ int amd_pmf_get_pprof_modes(struct amd_pmf_dev *pmf)
switch (pmf->current_profile) {
case PLATFORM_PROFILE_PERFORMANCE:
+ case PLATFORM_PROFILE_BALANCED_PERFORMANCE:
mode = POWER_MODE_PERFORMANCE;
break;
case PLATFORM_PROFILE_BALANCED:
mode = POWER_MODE_BALANCED_POWER;
break;
case PLATFORM_PROFILE_LOW_POWER:
+ case PLATFORM_PROFILE_COOL:
+ case PLATFORM_PROFILE_QUIET:
mode = POWER_MODE_POWER_SAVER;
break;
default:
@@ -369,6 +372,10 @@ static int amd_pmf_profile_set(struct device *dev,
struct amd_pmf_dev *pmf = dev_get_drvdata(dev);
int ret = 0;
+ /* If the profile is custom, bail without an error. */
+ if (profile == PLATFORM_PROFILE_CUSTOM)
+ return 0;
+
pmf->current_profile = profile;
/* Notify EC about the slider position change */
@@ -400,6 +407,7 @@ static const struct platform_profile_ops amd_pmf_profile_ops = {
.probe = amd_pmf_profile_probe,
.profile_get = amd_pmf_profile_get,
.profile_set = amd_pmf_profile_set,
+ .secondary = true,
};
int amd_pmf_init_sps(struct amd_pmf_dev *dev)
--
2.48.1
Powered by blists - more mailing lists