Skip to contentSkip to conversation

platform/x86: panasonic-laptop: add platform_profile support

PATCH In review Alex Yeo 2 participants 5 messages Dec 3 – Dec 4

Subsystems (3)
lore
Share & tools
lore

Alex Yeo

author
#0 lore raw

v5 cover platform/x86: panasonic-laptop: add platform_profile support

Add platform_profile support for Panasonic Let's Note laptops.

Patch 1 maps the firmware fan mode and TDP limit onto platform_profile for the models tested here. Patch 2, from Wu, adds the CF-SV1-2 quirk.

Tested on CF-RZ6 (2016), CF-SV8 (2019), CF-QV9 (2020) and CF-SR4 (2024). CF-SV1-2 was tested by Wu.

This patch series adds support for mapping firmware thermal and CPU power operating policy to platform_profile for Panasonic Let's Note laptops. This originally started as a hwmon and thermal patch, but further analysis had revealed that these are firmware power and thermal policies as opposed to fan control.

Panasonic firmware exposes firmware operating policy through two methods:
- Fan cooling policy (active/passive)
- Processor TDP limit (capped/uncapped)

At boot, firmware defaults to an active cooling policy with the CPU TDP capped. Vendor drivers / DPTF normally unlocks this on Windows.

These 2 methods map to 4 possible distinct states. Only states that correspond to the platform_profile ABI are mapped and exposed as choices. Unmapped states will be returned as "custom" by the driver.

State to platform_profile mapping:

Profile | Fan Mode | TDP

+--------------------------------+-----------+------------+
 PLATFORM_PROFILE_COOL (SR4/SV1) | Active    | Locked
 PLATFORM_PROFILE_BALANCED       | Active    | Locked
 PLATFORM_PROFILE_QUIET          | Passive   | Locked
 PLATFORM_PROFILE_PERFORMANCE    | Active    | Unlocked
 CUSTOM (unmapped on all)        | Passive   | Unlocked

Across all of them, the fan and TDP modes are toggled by the same ACPI methods. However, there is a slight variation in its interpretation based on testing results.

These methods are normally called by the DPTF/IPF _OSC handshake. Depending on the capability bits, the firmware will alter its thermal and power policy.

\_SB.IETM Implementation A:
- CF-RZ6 (2016)
- CF-SV8 (2019)

\_SB.IETM Implementation B:
- CF-QV9 (2020)
- CF-SR4 (2024)

Models belonging to the same group share what appears to be identical AML code for the _OSC.

This patch only exposes the ability to read and set these firmware toggles. The get() callback queries current firmware state and returns the mapped platform_profile. The set() callback sets the target state regardless of current state.

Mappings in this patch are defined in the quirks struct. Activation of platform_profile is gated by DMI checks.

By default, only balanced and performance profiles are defined. This is because the aggressive fan paired with the locked TDP on the SV1 and SR4 more appropriately correspond to the cool profile.

Test results for the mappings are below.

Test results:
================
(CPU PkgWatt: peak / sustained)
(Sysbench CPU: all available threads)

CF-RZ6: (i5-7Y57, Startup default: Balanced)

Platform Profile | CPU PkgWatt | Sysbench CPU | Stress Temp (CPU)

+-----------------+-----------------+----------------+-------------------+
 BALANCED         |  10.0W / 9.0W   |    19712       |   57C
 PERFORMANCE      |  18.9W / 14.9W  |    29132       |   72C

CF-SV8: (i5-8365U, Startup default: Balanced)

Platform Profile | CPU PkgWatt | Sysbench CPU | Stress Temp (CPU)

+-----------------+------------------+----------------+-------------------+
 BALANCED         |  9.9W  / 9.9W    |    44695       |   58C
 PERFORMANCE      |  29.0W / 19.9W   |    71747       |   81C

CF-QV9: (i5-10310U, Startup default: Balanced)

Platform Profile | CPU PkgWatt | Sysbench CPU | Stress Temp (CPU)

+-----------------+------------------+----------------+-------------------+
 BALANCED         |  10.0W / 9.9W    |    46545       |   59C
 PERFORMANCE      |  18.9W / 14.9W   |    57416       |   70C

CF-SR4: (i5-1345U, Startup default: Cool)

Platform Profile | CPU PkgWatt | Sysbench CPU | Stress Temp (CPU)

+-----------------+------------------+----------------+-------------------+
 COOL             |  12.0W / 12.0W   |    177139      |   66C
 QUIET            |  12.0W / 12.0W   |    176315      |   73C-75C
 PERFORMANCE      |  29.6W / 21.3W   |    247602      |   98C-100C

CF-SR4 Notes:
- QUIET: downclock/throttle at 75C, no increase in package_throttle_count
- PERFORMANCE: stable boost clock, package_throttle_count increase

Other notes:
===============

Additional notes about thermald:
During testing, I have observed that running thermald for the first time since boot will trigger an _OSC negotiation that will unlock CPU TDP for new models (IETM Implementation B). Once thermald is running, exits or runs again, these bits were not observed to change again during testing.

Running thermald on older models (IETM Implementation A) does not touch the fan curve or TDP mode setting.

Suspend: observed to not alter the values set prior to suspend

The SV1 (CF-SV1-2) was tested by Wu. More details and data:
https://github.com/numuly/cf-sv1-2-platform-profile-evidence

Alex Yeo (1):
platform/x86: panasonic-laptop: add platform_profile support

Wu Zhipeng (1):
platform/x86: panasonic-laptop: add CF-SV1-2 platform_profile entry

---
v5:
- rewritten as a series
- commit message reformatted
- rebased onto platform-drivers-x86/for-next
- dropped RFC
- CF-SV1-2 added as a separate patch

v4: https://lore.kernel.org/platform-driver-x86/[email protected]/
- Consolidated separate quirk structs for the RZ6, QV9 and SV8 into a quirk_default struct.

v3: https://lore.kernel.org/platform-driver-x86/[email protected]/
- Removed sysfs.h import
- Refactored platform profile probe function to use a different pattern (check warn_on, continue on double unset, then set)

v2: https://lore.kernel.org/platform-driver-x86/[email protected]/
- Refactored code to use its own platform_driver
- Removed DEFINE_FREE and its corresponding __free as its addition
in this module is inappropriate
- Removed pr_fmt line as its addition to this patch is inappropriate
- Added DMI check during __init to prevent attempt of platform profile
device loading on unsupported hardware
- Fixed use of enums as truth values by adding explicit comparisons
- Added *profile_pdev to keep track of new platform_driver
- Removed extra spaces in the quirk definitions
- Added helper function for calling EC methods for simplicity
- Use ARRAY_SIZE() for for loops and added include for array_size.h
- Refactored pcc_profile to be a pointer in platform profile set
function
- Use WARN_ON() when a malformed quirk is detected in the platform
profile probe function
- Avoid use of status as variable name if not acpi_status
- Added Kconfig line for ACPI_PLATFORM_PROFILE
- Removed bool .use_platform_profiles from the quirks struct as it is
no longer needed as a result of the platform_driver being separate.
- Moved DMI quirk matching in probe function before devm_kzalloc of
driver struct

v1: https://lore.kernel.org/platform-driver-x86/[email protected]/

 drivers/platform/x86/Kconfig            |   1 +
 drivers/platform/x86/panasonic-laptop.c | 381 +++++++++++++++++++++++-
 2 files changed, 381 insertions(+), 1 deletion(-)
Signature · 1 line
2.56.1
author
#1 lore raw

PATCH v5 1/2 platform/x86: panasonic-laptop: add platform_profile support

Query the firmware for current fan and TDP mode for every get(). Custom is returned when the combination is not a mapped state. The set() function writes the requested state to firmware regardless of current state.

platform_profile support is implemented via a separate platform_driver. When TDP is raised, fan mode is changed first. When TDP is capped, the limit is applied first before changing the fan mode. The EC handle is used because the path differs slightly between models. A failure to register the profile device is logged and does not fail hotkey registration. Models that share the same fan and power settings use one quirk table.

Supported and tested models: CF-RZ6 (2016), CF-SV8 (2019), CF-QV9 (2020), CF-SR4 (2024).

---
 drivers/platform/x86/Kconfig            |   1 +
 drivers/platform/x86/panasonic-laptop.c | 373 +++++++++++++++++++++++-
 2 files changed, 373 insertions(+), 1 deletion(-)
drivers/platform/x86/Kconfig +1 -0
index 78e39cafea91..2208b632112d 100644
@@ -678,6 +678,7 @@ config PANASONIC_LAPTOP
 	depends on ACPI_VIDEO=n || ACPI_VIDEO
 	depends on SERIO_I8042 || SERIO_I8042 = n
 	select INPUT_SPARSEKMAP
+	select ACPI_PLATFORM_PROFILE
 	help
 	  This driver adds support for access to backlight control and hotkeys
 	  on Panasonic Let's Note laptops.
drivers/platform/x86/panasonic-laptop.c +372 -1

407 lines not on this page · raw message

Signature · 1 line
2.56.1
author
#2 lore raw

PATCH v5 2/2 platform/x86: panasonic-laptop: add CF-SV1-2 platform_profile entry

In reply to Alex Yeo

From: Wu Zhipeng <[email protected]>

The CF-SV1-2 exposes the same CEFM/EPLE fan/TDP policy pair as the CF-SR4, with the same boolean mapping (cool = active + locked, quiet = passive + locked, performance = active + unlocked), so reuse quirk_cf_sr4 and add only a DMI entry. The remaining combination (passive + unlocked) is reported as CUSTOM by get().

Measured on the unit (BIOS V2.00L24, i5-1145G7, EPP=performance, turbo on, no userspace fan governor): the TDP toggle is the power lever (~10 W locked vs ~26 W unlocked) and the fan toggle is a temperature lever at essentially equal package power (active+locked 9.96 W / 50 C, passive+locked 9.95 W / 60 C, active+unlocked 26.32 W / 84 C).

Notes for this model, because they do not generalise: the SEFM curve bytes behind the boolean differ from CF-SR4 (0x00 cool / 0x05 quiet / 0x02 in S0i3), EPLE/SEPL select an IETM table PL rather than a fixed TDP cap, _FST[1] is a fan setpoint and not RPM, a nonzero TFN1._FSL override masks a profile change until released, and the EC boots at CEFM=0 / EPLE=1 (active + locked / COOL).

Alex Yeo confirmed the cool/quiet/performance mapping for this model on 2026-10-26.

---
 drivers/platform/x86/panasonic-laptop.c | 8 ++++++++
 1 file changed, 8 insertions(+)
drivers/platform/x86/panasonic-laptop.c +8 -0
index 06b45043d81e..cb0b9bd49e38 100644
@@ -332,6 +332,14 @@ static const struct dmi_system_id pcc_profile_quirks[] = {
 		},
 		.driver_data = &quirk_cf_sr4,
 	},
+	{
+		.ident = "Panasonic Corporation CFSV1-2",
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Panasonic Corporation"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "CFSV1-2"),
+		},
+		.driver_data = &quirk_cf_sr4,
+	},
 	{
 		.ident = "Panasonic Corporation CFQV9-1",
 		.matches = {
Signature · 1 line
2.56.1
Tested-by on the v5 series
#3 lore raw
In reply to Alex Yeo

Hi Alex,

Tested v5 on the CF-SV1-2 (BIOS V2.00L24, i5-1145G7), on AC power with no userspace governor running. Both blob hashes match the posted series (06b45043d81e -> cb0b9bd49e38) and the built .c is byte-identical to patch 2/2.

  $ cat /sys/firmware/acpi/platform_profile_choices
  cool quiet performance
  target        CEFM   EPLE   read back
  cool          0x0    0x1    cool
  quiet         0x1    0x1    quiet
  performance   0x0    0x0    performance

Both write frontends behave the same. The passive+unlocked combination, written straight to the EC, reads back as custom; the ABI rejects custom (EINVAL on the legacy node, EOPNOTSUPP on the class node) and max-power. Two s2idle cycles kept the profile across resume, and a write after resume still reached the EC. No module, ACPI or resume errors in dmesg.

The 3x4 AC campaign on the same code reproduces the lever: about 10.1/9.9 W locked versus 24.2/25.2 W unlocked, with the fan toggle moving temperature at equal package power.

Evidence: tag v5-test-20261204 (v5-ac-4state-20261204 for the campaign) in
https://github.com/numuly/cf-sv1-2-platform-profile-evidence

Tested-by
#4 lore raw

Hi Alex,

A correction to my Tested-by: the numbers and the tag stand, but a few statements were imprecise.

Test environment: Debian 13, 7.3.4+deb13-amd64, built out-of-tree against that kernel's headers, on AC. sv off, power-profiles-daemon stopped and masked, thermald not running.

Source identity: pre-image ef2ada1b, post-1/2 06b45043, post-2/2 and the built .c cb0b9bd4 -- the built file matches the post-2/2 blob.

Mapping (CEFM/EPLE): cool 0x0/0x1, quiet 0x1/0x1, performance 0x0/0x0; SEFM 1 + SEPL 0 reads back as custom.

Both nodes -- /sys/firmware/acpi/platform_profile and /sys/class/platform-profile/platform-profile-0/profile -- accept and read back cool/quiet/performance; they differ only in the errno when rejecting a value the driver does not support. custom is read-only (EINVAL on the legacy node, EOPNOTSUPP on the class node); max-power is a valid platform_profile value but this driver does not expose it, so writing it returns EOPNOTSUPP on both.

Two scripted s2idle checks (cool and quiet) kept the profile across resume, and a write after resume still reached the EC; no module, ACPI or resume errors in dmesg.

The 3x4 AC campaign used direct EC writes (SEFM/SEPL via acpi_call); the module was loaded only to report platform_profile. Medians of 3 rounds:
cool 10.09 W / 47 C, quiet 9.92 W / 54 C, performance 24.22 W / 74 C, custom 25.16 W / 84 C -- the fan toggle moves temperature at essentially equal package power.

Evidence: tag v5-test-20261204 (v5-ac-4state-20261204 for the campaign) in
https://github.com/numuly/cf-sv1-2-platform-profile-evidence