Skip to content

Commit 5aefbf5

Browse files
pastaqij-intel
authored andcommitted
acpi: platform_profile - Add max-power profile option
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>
1 parent 0b39ce8 commit 5aefbf5

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

Documentation/ABI/testing/sysfs-class-platform-profile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Description: This file contains a space-separated list of profiles supported
2323
power consumption with a slight bias
2424
towards performance
2525
performance High performance operation
26+
max-power Higher performance operation that may exceed
27+
internal battery draw limits when on AC power
2628
custom Driver defined custom profile
2729
==================== ========================================
2830

drivers/acpi/platform_profile.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ static const char * const profile_names[] = {
3737
[PLATFORM_PROFILE_BALANCED] = "balanced",
3838
[PLATFORM_PROFILE_BALANCED_PERFORMANCE] = "balanced-performance",
3939
[PLATFORM_PROFILE_PERFORMANCE] = "performance",
40+
[PLATFORM_PROFILE_MAX_POWER] = "max-power",
4041
[PLATFORM_PROFILE_CUSTOM] = "custom",
4142
};
4243
static_assert(ARRAY_SIZE(profile_names) == PLATFORM_PROFILE_LAST);
@@ -506,7 +507,8 @@ int platform_profile_cycle(void)
506507
if (err)
507508
return err;
508509

509-
if (profile == PLATFORM_PROFILE_CUSTOM ||
510+
if (profile == PLATFORM_PROFILE_MAX_POWER ||
511+
profile == PLATFORM_PROFILE_CUSTOM ||
510512
profile == PLATFORM_PROFILE_LAST)
511513
return -EINVAL;
512514

@@ -515,7 +517,8 @@ int platform_profile_cycle(void)
515517
if (err)
516518
return err;
517519

518-
/* never iterate into a custom if all drivers supported it */
520+
/* never iterate into a custom or max power if all drivers supported it */
521+
clear_bit(PLATFORM_PROFILE_MAX_POWER, data.aggregate);
519522
clear_bit(PLATFORM_PROFILE_CUSTOM, data.aggregate);
520523

521524
next = find_next_bit_wrap(data.aggregate,

include/linux/platform_profile.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ enum platform_profile_option {
2424
PLATFORM_PROFILE_BALANCED,
2525
PLATFORM_PROFILE_BALANCED_PERFORMANCE,
2626
PLATFORM_PROFILE_PERFORMANCE,
27+
PLATFORM_PROFILE_MAX_POWER,
2728
PLATFORM_PROFILE_CUSTOM,
2829
PLATFORM_PROFILE_LAST, /*must always be last */
2930
};

0 commit comments

Comments
 (0)