diff mbox series

[RFC,1/2] ACPI: Add support for a 'custom' profile

Message ID 20240926025955.1728766-2-superm1@kernel.org (mailing list archive)
State RFC, archived
Headers show
Series "custom" ACPI platform profile support | expand

Commit Message

Mario Limonciello Sept. 26, 2024, 2:59 a.m. UTC
From: Mario Limonciello <mario.limonciello@amd.com>

Introduce a new profile type called 'custom' that can be set to allow
changing settings outside of the standard profile settings.

The idea behind this is to enforce a state machine so that a user
can't set 'balanced' then manually change one APU setting and confuse
userspace because the system is no longer really behaving in balanced.

In practice the intention is that userspace would first set "custom"
followed by modifying any settings. If userspace wants to go back to
one of the predefined profiles then those profiles can be written to
/sys/firmware/acpi/platform_profile.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 Documentation/ABI/testing/sysfs-platform_profile | 1 +
 drivers/acpi/platform_profile.c                  | 1 +
 include/linux/platform_profile.h                 | 1 +
 3 files changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/Documentation/ABI/testing/sysfs-platform_profile b/Documentation/ABI/testing/sysfs-platform_profile
index baf1d125f9f8..13dfe8aadbe2 100644
--- a/Documentation/ABI/testing/sysfs-platform_profile
+++ b/Documentation/ABI/testing/sysfs-platform_profile
@@ -15,6 +15,7 @@  Description:	This file contains a space-separated list of profiles supported for
 					power consumption with a slight bias
 					towards performance
 		performance		High performance operation
+		custom			Custom profile tuned by the user
 		====================	========================================
 
 		Userspace may expect drivers to offer more than one of these
diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c
index d2f7fd7743a1..383f87c8c036 100644
--- a/drivers/acpi/platform_profile.c
+++ b/drivers/acpi/platform_profile.c
@@ -19,6 +19,7 @@  static const char * const profile_names[] = {
 	[PLATFORM_PROFILE_BALANCED] = "balanced",
 	[PLATFORM_PROFILE_BALANCED_PERFORMANCE] = "balanced-performance",
 	[PLATFORM_PROFILE_PERFORMANCE] = "performance",
+	[PLATFORM_PROFILE_CUSTOM] = "custom",
 };
 static_assert(ARRAY_SIZE(profile_names) == PLATFORM_PROFILE_LAST);
 
diff --git a/include/linux/platform_profile.h b/include/linux/platform_profile.h
index f5492ed413f3..61273b615419 100644
--- a/include/linux/platform_profile.h
+++ b/include/linux/platform_profile.h
@@ -23,6 +23,7 @@  enum platform_profile_option {
 	PLATFORM_PROFILE_BALANCED,
 	PLATFORM_PROFILE_BALANCED_PERFORMANCE,
 	PLATFORM_PROFILE_PERFORMANCE,
+	PLATFORM_PROFILE_CUSTOM,
 	PLATFORM_PROFILE_LAST, /*must always be last */
 };