[RESPONDED] Changing the fan temperture points with ectool

After listen to annoying fan noises for way too long I figured that I could dig into the framework EmbeddedController source code to see if it could be fixed.

Well, I found that the temperature points for the fan can be adjusted! And that’s all I wanted.

WARNING: running your laptop at higher temperatures might shorten its lifetime. This might not be covered by warranty. Misconfiguring a “halt” temperature could result in a long recovery session.

Prerequisite

Get a ectool version with frame.work support (see e.g. the fw-ectool tool (link removed due to spam restrictions)) and build it with make utils.

Relevant commands

List the RPM target of all fans

$ sudo ./build/bds/util/ectool pwmgetfanrpm all
Fan 0 RPM: 1953

List all temperature readings

$ sudo ./build/bds/util/ectool temps all
0: 317 K
1: 323 K
2: 319 K
3: 309 K
4: 324 K

List the temperature thresholds

$ sudo ./build/bds/util/ectool thermalget 
sensor  warn  high  halt   fan_off fan_max   name
  0        0   361    371    313     335     F75303_Local
  1        0   361    371    313     342     F75303_CPU
  2        0   360    370    313     335     F75303_DDR
  3        0   323    333    313     323     Battery
  4      368   376    378    377     378     PECI
EC returned error result code 3
(all temps in degrees Kelvin)

Here is a temperature translation:

sensor  warn   high   halt  fan_off fan_max   name
  0        0   88°C   98°C     40°C    62°C   F75303_Local
  1        0   88°C   98°C     40°C    69°C   F75303_CPU
  2        0   87°C   97°C     40°C    62°C   F75303_DDR
  3        0   50°C   60°C     40°C    50°C   Battery
  4     95°C  103°C  105°C    104°C   105°C   PECI

Setting new tipping points

Let’s set the CPU fan_off point to 60°C (~333K) and the maximum speed to 80°C (~353K) via thermalset

# thermalset <sensor id> <warn> <halt> <fan_off> <fan_max>
sudo ./build/bds/util/ectool thermalset 1 0 361 371 333 353

Set the Local and DDR points to 47°C-70°C (320-343K)

sudo ./build/bds/util/ectool thermalset 0 0 361 371 320 343
sudo ./build/bds/util/ectool thermalset 2 0 360 370 320 343

Verify that the new tables, temperatures and fan RPMs

sudo ./build/bds/util/ectool thermalget ; sudo ./build/bds/util/ectool temps all ; sudo ./build/bds/util/ectool pwmgetfanrpm all
sensor  warn  high  halt   fan_off fan_max   name
  0        0   361    371    320     343     F75303_Local
  1        0   361    371    333     353     F75303_CPU
  2        0   360    370    320     343     F75303_DDR
  3        0   323    333    313     323     Battery
  4      368   376    378    377     378     PECI
0: 317 K
1: 322 K
2: 319 K
3: 309 K
4: 325 K
Fan 0 RPM: 0

Enjoy a way more silent Laptop!

20 Likes

Nice find and write-up.

This gets me one step closer to my “fan before CPU throttle while on full strength external power, but throttle before fan on battery and weak external power” automagic mode setting goals…

Is this persistent between multiple power cycles / reboots?

Psst:

2 Likes

(post deleted by author)

fw-fanctrl was the reason I looked into the code, it’s a great tool. But I was concerned about what might happen if userspace crashes / hibernates / … so I wanted to see if the embedded controller could handle it.

The corresponding ec code would be this function that translates low/high/current temperature into fan %.
I don’t think a linear function is great for this, so fw-fanctrl does have an advantage here, but the simplicity and stability of an ec managed fan were key for me.

4 Likes

@Rene_Treffer Thanks for the info! I was looking for a way to improve the fan noise. After you changed the setting, how was your fan now? Have you seen the noise was improved?

The corresponding ec code would be this function that translates low/high/current temperature into fan % .

Maybe Framework is not using the main branch, and it is only used to synchronize the code from the upstream project. Maybe Framework uses the hx20 (For Intel 11 gen main board?), and hx30(for Intel 12gen mainboard?) branches. But the function is the same on these branches too.

I created an updated version of TamtamHeros fw-fanctrl which enables automatic switching between two fan curves depending on if the laptop is charging or discharging. I created a pull request for this. Until its merged into the original fw-fanctrl version mabye try the updated version.

The current charging status of the laptop is read from the following file:
/sys/class/hwmon/hwmon2/device/status
On my Framework Laptop running Pop OS 22.04 this works. I don’t know yet if this path works for all Framework Laptops on all Linux distributions. So any feedback is appreciated.

That is a valid path on EndeavourOS (arch derivative) as well. The same status variable/file is also at
/sys/class/power_supply/BAT1/status

I am not sure which path is more stable and least likely to change. Consider having a hard-coded default path for charging status read, that is also can be overridden by config file?

1 Like

Good idea, just committed that change. By default the charging status is now read from /sys/class/power_supply/BAT1/status. It can be overwritten by providing a path inside the config file.

1 Like

I took a minute to look at your code. I am wondering, instead of separate system service, could the two separate fan speed maps be triggered by tlp’s sensing of “on AC” vs “on batt” instead? Might be more complexity than the overhead savings is worth, but I thought I would mention the idea.

I would have to take a look at how tlp works. Right now the service accesses the file once per second. The CPU time compared to the rest of the system should be almost unmeasurable. I guess the reason for the existence of the system service is primarily the convenient automatic load of the python script at start up.

@junaruga yeah, the machine is way more silent now. It still depends on workloads on how it behaves in detail. But normal browsing can be silent.

It’s such a pity that undervolting is locked on the 11th gen even with unlocked BIOS.

For the fan curve this is just a linear one. I would have preferred a non-linear one, e.g. the square of the value, like 100 * (cur - low) * (cur - low) / ((high - low) * (high - low)). Or a mix with the current one.

The downside is always that the machine will run hotter. Keep that in mind.

1 Like

@Rene_Treffer thanks for sharing it! I’m happy to see your machine is more silent.

May I ask if you are using the 11th gen or 12th gen model? Looking to install on my Framework Laptop running PopOS too.

I use a 11th Gen Mainboard.

You can check the thread below. My CPU temperature is always less than 60 degrees by setting it up.

1 Like

I wonder if there are any long-time experiences. @Rene_Treffer Are you still using this? Have you experienced any issues?

@real_or_random been using it all the time. No complications, laptop runs hotter but more silent. Only annoyance is that I sometimes need to manually reapply this.

2 Likes

I am running the fw-fanctrl service on 12th gen FW and in deaf mode but sometimes it tells me I don’t have any battery left and shuts down not long afterwards.

I keep on using it though