From de7e9b9281ad0d060e8720d0575f5eed38a1fcc8 Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Mon, 12 Oct 2026 13:07:09 -0400 Subject: [PATCH 1/2] platform-profile: Recognize balanced-performance Commit 6b565b0 ("Recognize the custom ACPI platform profile") replaced the first-letter match on the kernel's platform profile with exact string matches, but spelled this one "balanced_performance". The kernel has spelled it "balanced-performance" since it was added in 2021, so since 0.30 a firmware or hotkey switch to it hits g_return_val_if_reached() and is ignored, and ActiveProfile goes stale. Match the kernel's spelling. This affects every driver that offers the profile: acer-wmi, alienware-wmi-wmax, amd-pmf, bitland-mifs-wmi and surface_platform_profile. Link: https://github.com/torvalds/linux/commit/6c0b5e3fc6b536b125a66dfee103f3bc26d386f6 Co-Authored-By: Claude Opus 5.5 --- src/ppd-driver-platform-profile.c | 2 +- tests/integration_test.py | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/ppd-driver-platform-profile.c b/src/ppd-driver-platform-profile.c index 28fc335..5d0b98f 100644 --- a/src/ppd-driver-platform-profile.c +++ b/src/ppd-driver-platform-profile.c @@ -89,7 +89,7 @@ acpi_platform_profile_value_to_profile (const char *str) return PPD_PROFILE_POWER_SAVER; if (g_str_equal (str, "balanced") || - g_str_equal (str, "balanced_performance") || + g_str_equal (str, "balanced-performance") || g_str_equal (str, "cool")) return PPD_PROFILE_BALANCED; diff --git a/tests/integration_test.py b/tests/integration_test.py index 5648c1e..36b0472 100644 --- a/tests/integration_test.py +++ b/tests/integration_test.py @@ -2121,6 +2121,25 @@ class Tests(dbusmock.DBusTestCase): self.read_sysfs_file("sys/firmware/acpi/platform_profile"), b"quiet" ) + def test_balanced_performance(self): + """The kernel spells it balanced-performance""" + acpi_dir = os.path.join(self.testbed.get_root_dir(), "sys/firmware/acpi/") + os.makedirs(acpi_dir) + platform_profile = os.path.join(acpi_dir, "platform_profile") + self.write_file_contents(platform_profile, "low-power\n") + self.write_file_contents( + os.path.join(acpi_dir, "platform_profile_choices"), + "low-power balanced balanced-performance performance\n", + ) + + self.start_daemon() + self.set_dbus_property("ActiveProfile", GLib.Variant.new_string("performance")) + self.assertEqual(self.get_dbus_property("ActiveProfile"), "performance") + + # Firmware or a hotkey picks balanced-performance behind our back + self.write_file_contents(platform_profile, "balanced-performance\n") + self.assert_dbus_property_eventually_is("ActiveProfile", "balanced") + def test_custom_acpi_platform_profile(self): self.create_custom_platform_profile() self.start_daemon() From e969d98db8088a115ec62cf5f0a8707ff55cd798 Mon Sep 17 00:00:00 2001 From: Brandon Williams Date: Tue, 13 Oct 2026 08:05:01 -0400 Subject: [PATCH 2/2] platform-profile: Point to the kernel ABI for profile names The spelling of the values comes from the kernel's sysfs ABI, so link it next to the mapping to make a mismatch like the previous commit easier to catch. Co-Authored-By: Claude Opus 5.5 --- src/ppd-driver-platform-profile.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ppd-driver-platform-profile.c b/src/ppd-driver-platform-profile.c index 5d0b98f..15e909f 100644 --- a/src/ppd-driver-platform-profile.c +++ b/src/ppd-driver-platform-profile.c @@ -75,6 +75,9 @@ profile_to_acpi_platform_profile_value (PpdDriverPlatformProfile *self, g_return_val_if_reached (NULL); } +/* The values and their spelling are defined by the kernel ABI: + * https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-platform_profile + */ static PpdProfile acpi_platform_profile_value_to_profile (const char *str) {