X86 platform drivers
 help / color / mirror / Atom feed
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,
	Antheas Kapenekakis <lkml@antheas.dev>
Subject: [PATCH 1/3] ACPI: platform_profile: Add support for secondary handlers
Date: Mon, 24 Feb 2025 20:50:57 +0100	[thread overview]
Message-ID: <20250224195059.10185-2-lkml@antheas.dev> (raw)
In-Reply-To: <20250224195059.10185-1-lkml@antheas.dev>

Currently, only the subset of supported profiles are exposed when
using platform profile. This is a big problem when e.g., asus-wmi
and amd-pmf are loaded together, as they have conflicting low
power options. This causes ppd and tuned to miss the low power
option increasing power consumption.

Therefore, add the secondary variable. Profile handlers with it should
accept all profile options always. Only when they are the sole
handler, their probe function will be used to expose available profiles.

Signed-off-by: Antheas Kapenekakis <lkml@antheas.dev>
---
 drivers/platform/x86/amd/pmf/sps.c | 1 +
 include/linux/platform_profile.h   | 7 +++++++
 2 files changed, 8 insertions(+)

diff --git a/drivers/platform/x86/amd/pmf/sps.c b/drivers/platform/x86/amd/pmf/sps.c
index e6cf0b22dac3..424b146d3574 100644
--- a/drivers/platform/x86/amd/pmf/sps.c
+++ b/drivers/platform/x86/amd/pmf/sps.c
@@ -397,6 +397,7 @@ static int amd_pmf_profile_probe(void *drvdata, unsigned long *choices)
 }
 
 static const struct platform_profile_ops amd_pmf_profile_ops = {
+	.secondary = true,
 	.probe = amd_pmf_profile_probe,
 	.profile_get = amd_pmf_profile_get,
 	.profile_set = amd_pmf_profile_set,
diff --git a/include/linux/platform_profile.h b/include/linux/platform_profile.h
index 8ab5b0e8eb2c..fef5f2404e9f 100644
--- a/include/linux/platform_profile.h
+++ b/include/linux/platform_profile.h
@@ -30,6 +30,12 @@ enum platform_profile_option {
 
 /**
  * struct platform_profile_ops - platform profile operations
+ * @secondary: Set the platform handler as a secondary. Secondary handlers
+ *		 should be able to accept all profile options. This way, they do
+ *		 not obscure the primary handler's profile options (such as amdpmf
+ *		 having cool and asus-wmi having quiet). When a secondary handler
+ *		 is the only handler available, its probe function is still used
+ *		 to avoid showing all profiles.
  * @probe: Callback to setup choices available to the new class device. These
  *	   choices will only be enforced when setting a new profile, not when
  *	   getting the current one.
@@ -39,6 +45,7 @@ enum platform_profile_option {
  *		 profile in sysfs.
  */
 struct platform_profile_ops {
+	bool secondary;
 	int (*probe)(void *drvdata, unsigned long *choices);
 	int (*profile_get)(struct device *dev, enum platform_profile_option *profile);
 	int (*profile_set)(struct device *dev, enum platform_profile_option profile);
-- 
2.48.1


  reply	other threads:[~2025-02-24 19:51 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-24 19:50 [PATCH 0/3] ACPI: platform_profile: fix legacy sysfs with multiple handlers Antheas Kapenekakis
2025-02-24 19:50 ` Antheas Kapenekakis [this message]
2025-02-24 19:50 ` [PATCH 2/3] ACPI: platform_profile: add all options to amd-pmf as a secondary handler Antheas Kapenekakis
2025-02-24 19:50 ` [PATCH 3/3] ACPI: platform_profile: Do not hide options missing in secondary handlers Antheas Kapenekakis
2025-02-27 17:48   ` kernel test robot
2025-02-24 20:27 ` [PATCH 0/3] ACPI: platform_profile: fix legacy sysfs with multiple handlers Mario Limonciello
2025-02-24 20:31   ` Antheas Kapenekakis
2025-02-24 20:52 ` Mark Pearson
2025-02-24 21:08   ` Antheas Kapenekakis
2025-02-24 21:51   ` Luke Jones
2025-02-24 21:58     ` Antheas Kapenekakis
2025-02-24 22:49       ` Armin Wolf
2025-02-24 22:55         ` Antheas Kapenekakis
2025-02-24 22:58           ` Antheas Kapenekakis
2025-02-25 20:22             ` Rafael J. Wysocki
2025-02-25 20:24               ` Antheas Kapenekakis
2025-02-26 20:03                 ` Rafael J. Wysocki
2025-02-26 22:15                   ` Antheas Kapenekakis
2025-02-25  1:34       ` Luke Jones
2025-02-25  2:26         ` Antheas Kapenekakis
2025-02-25 15:56           ` Armin Wolf
2025-02-25 16:27             ` Antheas Kapenekakis
2025-02-24 22:42     ` Armin Wolf

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=20250224195059.10185-2-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=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