From: Antheas Kapenekakis <lkml@antheas.dev>
To: mario.limonciello@amd.com, mpearson-lenovo@squebb.ca
Cc: ilpo.jarvinen@linux.intel.com, lenb@kernel.org,
linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
platform-driver-x86@vger.kernel.org, rafael@kernel.org,
hdegoede@redhat.com, me@kylegospodneti.ch, luke@ljones.dev,
Antheas Kapenekakis <lkml@antheas.dev>
Subject: [PATCH v2 2/2] ACPI: platform_profile: make amd-pmf a secondary handler
Date: Thu, 27 Feb 2025 16:36:03 +0100 [thread overview]
Message-ID: <20250227153603.131046-3-lkml@antheas.dev> (raw)
In-Reply-To: <20250227153603.131046-1-lkml@antheas.dev>
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@antheas.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
next prev parent reply other threads:[~2025-02-27 15:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-27 15:36 [PATCH v2 0/2] ACPI: platform_profile: fix legacy sysfs with multiple handlers Antheas Kapenekakis
2025-02-27 15:36 ` [PATCH v2 1/2] ACPI: platform_profile: Add handlers that do not occlude power options Antheas Kapenekakis
2025-02-27 15:36 ` Antheas Kapenekakis [this message]
2025-02-27 16:45 ` [PATCH v2 2/2] ACPI: platform_profile: make amd-pmf a secondary handler Mario Limonciello
2025-02-27 17:04 ` Antheas Kapenekakis
2025-02-27 17:10 ` Mario Limonciello
2025-02-27 17:18 ` Antheas Kapenekakis
2025-02-27 17:23 ` Mario Limonciello
2025-02-27 17:28 ` Antheas Kapenekakis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250227153603.131046-3-lkml@antheas.dev \
--to=lkml@antheas.dev \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luke@ljones.dev \
--cc=mario.limonciello@amd.com \
--cc=me@kylegospodneti.ch \
--cc=mpearson-lenovo@squebb.ca \
--cc=platform-driver-x86@vger.kernel.org \
--cc=rafael@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox