]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
acpi: platform_profile - Add max-power profile option
authorDerek J. Clark <derekjohn.clark@gmail.com>
Thu, 27 Nov 2025 15:16:03 +0000 (07:16 -0800)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Fri, 28 Nov 2025 10:03:22 +0000 (12:03 +0200)
Some devices, namely Lenovo Legion devices, have an "extreme" mode where
power draw is at the maximum limit of the cooling hardware. Add a new
"max-power" platform profile to properly reflect this operating mode.

Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org>
Acked-by: Rafael J. Wysocki (Intel) <rafael@kernel.org>
Signed-off-by: Derek J. Clark <derekjohn.clark@gmail.com>
Reviewed-by: Armin Wolf <W_Armin@gmx.de>
Reviewed-by: Mark Pearson <mpearson-lenovo@squebb.ca>
Link: https://patch.msgid.link/20251127151605.1018026-2-derekjohn.clark@gmail.com
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Documentation/ABI/testing/sysfs-class-platform-profile
drivers/acpi/platform_profile.c
include/linux/platform_profile.h

index dc72adfb830a4f0b4ccbeeb87cf83ed31693f5a5..fcab26894ec33449e1c71fdbd1ba840992fcba7d 100644 (file)
@@ -23,6 +23,8 @@ Description:  This file contains a space-separated list of profiles supported
                                        power consumption with a slight bias
                                        towards performance
                performance             High performance operation
+               max-power               Higher performance operation that may exceed
+                                       internal battery draw limits when on AC power
                custom                  Driver defined custom profile
                ====================    ========================================
 
index b43f4459a4f61e67e27a2564712118134bf447f6..ea04a8c6921546ab1326fbf22a812c3dbb6a60e0 100644 (file)
@@ -37,6 +37,7 @@ static const char * const profile_names[] = {
        [PLATFORM_PROFILE_BALANCED] = "balanced",
        [PLATFORM_PROFILE_BALANCED_PERFORMANCE] = "balanced-performance",
        [PLATFORM_PROFILE_PERFORMANCE] = "performance",
+       [PLATFORM_PROFILE_MAX_POWER] = "max-power",
        [PLATFORM_PROFILE_CUSTOM] = "custom",
 };
 static_assert(ARRAY_SIZE(profile_names) == PLATFORM_PROFILE_LAST);
@@ -506,7 +507,8 @@ int platform_profile_cycle(void)
                if (err)
                        return err;
 
-               if (profile == PLATFORM_PROFILE_CUSTOM ||
+               if (profile == PLATFORM_PROFILE_MAX_POWER ||
+                   profile == PLATFORM_PROFILE_CUSTOM ||
                    profile == PLATFORM_PROFILE_LAST)
                        return -EINVAL;
 
@@ -515,7 +517,8 @@ int platform_profile_cycle(void)
                if (err)
                        return err;
 
-               /* never iterate into a custom if all drivers supported it */
+               /* never iterate into a custom or max power if all drivers supported it */
+               clear_bit(PLATFORM_PROFILE_MAX_POWER, data.aggregate);
                clear_bit(PLATFORM_PROFILE_CUSTOM, data.aggregate);
 
                next = find_next_bit_wrap(data.aggregate,
index a299225ab92e78ce2e978b1774cdfc95cc688e8f..855b28340e95150c632d40c75f0b9f22d3f4b6ab 100644 (file)
@@ -24,6 +24,7 @@ enum platform_profile_option {
        PLATFORM_PROFILE_BALANCED,
        PLATFORM_PROFILE_BALANCED_PERFORMANCE,
        PLATFORM_PROFILE_PERFORMANCE,
+       PLATFORM_PROFILE_MAX_POWER,
        PLATFORM_PROFILE_CUSTOM,
        PLATFORM_PROFILE_LAST, /*must always be last */
 };