[RFC PATCH v2] platform/x86: panasonic-laptop: add fan speed mode for newer models

From: Alex Yeo

Date: Tue Jun 09 2026 - 23:20:11 EST


I have a CF-SR4 and Linux works out of the box. Compared to
previous models, this one seems to have the fans running at high speed
by default when the computer starts.

When Windows 11 is booted up, the high fan speeds persist just until the
login screen. Once the login screen shows up, the fan spins down.

I had suspected that this might be the laptop ramping down the fans when
the OS declares that it is Windows but this does not seem to be the
case.

After analyzing the DSDT and SSDT of the computer, I have found the
following:

File ssdt10.dsl under \_SB.PC00.LPCB.EC0:

Name (CEFM, Zero)
Method (SEFM, 1, Serialized)
{
CEFM = Arg0
REFM ()
}

Method (REFM, 0, Serialized)
{
If ((\S0IX == 0x03))
{
Local0 = 0x05
}
ElseIf ((CEFM == Zero))
{
Local0 = Zero
}
Else
{
Local0 = 0x02
}

\_SB.PC00.LPCB.EC0.EC88 (0xB5, 0x79, Local0, Zero)
}

\_SB.PC00.LPCB.EC0.CEFM would seem be the current value
for the fan profile. On startup, this is set to 0.

Based on the code SEFM seems the be the method to set the fan
profile and REFM is executed right after.

I don't have access to information as to what the argument officially
means but based on testing, any number above zero makes the fans spin
down and behave like the older models where it stops or runs at low
speed when its cool and ramps up when the processor gets hot.

The only relevant values for CEFM seem to be just 0 and any number above
that just gets treated the same. I personally use just 0 and 1.
0 seems to be the high fan speed mode and 1 makes it behave like
Windows.

Giving 0 as an argument reverts the fan back to the way it was during
startup where the lowest fan speed is quite high and when load is
applied, it seems to ramp up to an even higher speed which I think would
be its 100%.

A value of 1 seems to have its max speed capped lower than 0.

For both modes, fan management is still automatic.

fan_mode only shows up in sysfs only if \_SB.PC00.LPCB.EC0.CEFM and
\_SB.PC00.LPCB.EC0.SEFM are both present which should mean it should not
show up on unsupported models. I have tried not hiding it and it just
outputs a generic error when the value is read.

I also saw that variables such as eco_mode are kept in memory, however
for fan_mode I rely on getting and setting the value via ACPI.

Signed-off-by: Alex Yeo <alexyeo362@xxxxxxxxx>
---
Thank you for taking the time to read the patch and give feedback.

I have revised the patch according to the comments.

However, for some parts I would like to clarify the following:

>Include for pr_err() is missing it seems.
>This file seems to be lacking sysfs.h, please add the include now.

For both pr_err() and sysfs.h they should be included as both are
referenced/used multiple times within the same file.

>kstrtouint()?

It takes in input via sysfs
something like:
$ echo 1 | sudo tee "/sys/devices/LNXSYSTM:00/LNXSYBUS:00/MAT0019:00/fan_mode"
and based on the other functions within the same file, the input
is expected to be a string which is converted into an int via kstrtouint()
as CEFM is an int

>But I'm unsure whether sysfs is right place for this interface. acer-wmi
>driver seems to have fan mode auto/turbo selection using hwmon interface
>but this driver doesn't have hwmon as is...

I do get what you mean. My personal goal is to have this work smoothly
with software like thermald as the vendor appears to use Intel Dynamic
Tuning Technology with non-standard ACPI methods to control the fan.
I will take a look into that and see if exposing the control via a
different way works better.

To summarize, it appears the OS calls SEFM to let the EC know the OS
has taken control of the fan. The fan then spins down until
it stops completely (level 0). This then allows the OS to set
the fan level from 0 to 100. If the processor gets too hot,
the EC intervenes and ramps up the fan.
>From what I can gather, when running Windows, the vendor's driver
together with Intel DTT work together to control the fan.

Given this, I would like to ask what is the most appropriate
place in the kernel to expose this functionality?
I understand that hwmon was mentioned but I also see that
interacting with /sys/class/thermal may also be an option.

Thank you for your time.

drivers/platform/x86/panasonic-laptop.c | 99 +++++++++++++++++++++++++
1 file changed, 99 insertions(+)

diff --git a/drivers/platform/x86/panasonic-laptop.c b/drivers/platform/x86/panasonic-laptop.c
index b83113c26f88..b05f11c223f9 100644
--- a/drivers/platform/x86/panasonic-laptop.c
+++ b/drivers/platform/x86/panasonic-laptop.c
@@ -507,6 +507,72 @@ static int set_optd_power_state(int new_state)
return result;
}

+/* on newer models (ex: CF-SR4), fan mode can be set */
+/* check if this is available */
+
+static acpi_status check_fan_mode_present(void)
+{
+ acpi_handle handle;
+
+ /* check if read (CEFM) and set (SEFM) are available */
+ status = acpi_get_handle(NULL, "\\_SB.PC00.LPCB.EC0.CEFM", &handle);
+ if (ACPI_FAILURE(status))
+ return -ENOENT;
+ status = acpi_get_handle(NULL, "\\_SB.PC00.LPCB.EC0.SEFM", &handle);
+ if (ACPI_FAILURE(status))
+ return -ENOENT;
+
+ return 0;
+}
+
+/* get fan mode state */
+
+static int get_fan_mode_state(void)
+{
+ unsigned long long state;
+ acpi_status status;
+
+ /* BIOS default is zero which seems to be some sort of performance mode */
+ status = acpi_evaluate_integer(NULL, "\\_SB.PC00.LPCB.EC0.CEFM", NULL, &state);
+ if (ACPI_FAILURE(status)) {
+ pr_err("evaluation error _SB.PC00.LPCB.EC0.CEFM\n");
+ return -EIO;
+ }
+
+ return (int)state;
+}
+
+/* set fan mode */
+
+static int set_fan_mode_state(int new_state)
+{
+ acpi_status status;
+ int result;
+
+ result = get_fan_mode_state();
+ if (result < 0)
+ return result;
+ if (new_state == result)
+ return result;
+
+ union acpi_object param[1];
+ struct acpi_object_list input;
+
+ param[0].type = ACPI_TYPE_INTEGER;
+ param[0].integer.value = new_state;
+ input.count = 1; /* takes one arg */
+ input.pointer = param;
+
+ status = acpi_evaluate_object(NULL, "\\_SB.PC00.LPCB.EC0.SEFM",
+ &input, NULL);
+ if (ACPI_FAILURE(status)) {
+ pr_err("Setting of fan mode via _SB.PC00.LPCB.EC0.SEFM evaluation failed. You may have an unsupported model.\n");
+ return -EINVAL;
+ }
+
+ return result;
+}
+

/* sysfs user interface functions */

@@ -778,6 +844,34 @@ static ssize_t cdpower_store(struct device *dev, struct device_attribute *attr,
return count;
}

+static ssize_t fan_mode_show(struct device *dev, struct device_attribute *attr,
+ char *buf)
+{
+ int state;
+
+ state = get_fan_mode_state();
+ if (state < 0)
+ return state;
+
+ return sysfs_emit(buf, "%d\n", state);
+}
+
+static ssize_t fan_mode_store(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ int status;
+ int err;
+ int val;
+
+ err = kstrtoint(buf, 10, &val);
+ if (err)
+ return err;
+
+ status = set_fan_mode_state(val);
+
+ return status;
+}
+
static DEVICE_ATTR_RO(numbatt);
static DEVICE_ATTR_RO(lcdtype);
static DEVICE_ATTR_RW(mute);
@@ -787,6 +881,7 @@ static DEVICE_ATTR_RW(ac_brightness);
static DEVICE_ATTR_RW(dc_brightness);
static DEVICE_ATTR_RW(current_brightness);
static DEVICE_ATTR_RW(cdpower);
+static DEVICE_ATTR_RW(fan_mode);

static umode_t pcc_sysfs_is_visible(struct kobject *kobj, struct attribute *attr, int idx)
{
@@ -803,6 +898,9 @@ static umode_t pcc_sysfs_is_visible(struct kobject *kobj, struct attribute *attr
if (attr == &dev_attr_current_brightness.attr)
return (pcc->num_sifr > SINF_CUR_BRIGHT) ? attr->mode : 0;

+ if (attr == &dev_attr_fan_mode.attr) /* mostly present on newer models */
+ return (ACPI_SUCCESS(check_fan_mode_present())) ? attr->mode : 0;
+
return attr->mode;
}

@@ -816,6 +914,7 @@ static struct attribute *pcc_sysfs_entries[] = {
&dev_attr_dc_brightness.attr,
&dev_attr_current_brightness.attr,
&dev_attr_cdpower.attr,
+ &dev_attr_fan_mode.attr,
NULL,
};

--
2.54.0