linux-surface / linux-surface

Linux Kernel for Surface Devices
4.71k stars 206 forks source link

Surface Laptop 5 Fan problem #1463

Open sevenzip2 opened 2 weeks ago

sevenzip2 commented 2 weeks ago

[Description of the bug or feature] The fan barely runs until the temperature gets to 90 degrees and then suddenly the fan starts running like crazy. Is there a workaround to get the fan to work properly like in Windows?

and There is a popping sound when I start the computer.

Environment

`dmesg` output ``` ```
sevenzip2 commented 2 weeks ago

In fact, there is no fan sound at all. Please help me.

sevenzip2 commented 2 weeks ago

popping sound problem can solved by add ~/.xinit pactl set-sink-mute 0 0

CiaranWinna commented 2 weeks ago

Similar issue to what I am having on the SLS2. Fans don't start at all. Core temperature reaches critical level and the laptop shuts down as a safety measure. This is happening even when the laptop is at idle.

qzed commented 2 weeks ago

Both SL5 and SLS2 likely have an EC interface via SAM. We currently have support for this on the SP9 and SL6. While we can't control the exact fan speed, it allows setting a fan curve. Specifically, this is tied to the platform profile, so changing that (e.g. with surface profile set performance) should also change the fan curve.

Below are two patches which should hopefully enable that for the SL5 and SLS2 respectively. It would be great if you can test them. If you don't know how to compile a kernel, I can also prepare a branch of the out-of-tree SAM driver, but it might take me some time to get around to it.

For testing, switch the platform profile (surface profile set <x>) a couple of times and check if behavior under load improves. I've also added thermal sensor support, so also run sensors and check if they that shows some new SAM related sensors (maybe post that here if you're not sure). During all of that, keep an eye on the dmesg log to ensure that there are no errors when running the commends (and ideally upload it here).

From 22f5f945498e0d9d0dc35c9ec8295899b8ac32ca Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Mon, 10 Jun 2024 21:47:47 +0200
Subject: [PATCH 1/2] platform/surface: aggregator_registry: Add fan and
 thermal sensor support for Surface Laptop 5

---
 drivers/platform/surface/surface_aggregator_registry.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/surface/surface_aggregator_registry.c b/drivers/platform/surface/surface_aggregator_registry.c
index 07a4c4e1120d3..4dc79f791d390 100644
--- a/drivers/platform/surface/surface_aggregator_registry.c
+++ b/drivers/platform/surface/surface_aggregator_registry.c
@@ -265,7 +265,9 @@ static const struct software_node *ssam_node_group_sl5[] = {
    &ssam_node_root,
    &ssam_node_bat_ac,
    &ssam_node_bat_main,
-   &ssam_node_tmp_perf_profile,
+   &ssam_node_tmp_perf_profile_with_fan,
+   &ssam_node_tmp_sensors,
+   &ssam_node_fan_speed,
    &ssam_node_hid_main_keyboard,
    &ssam_node_hid_main_touchpad,
    &ssam_node_hid_main_iid5,
-- 
2.45.1
From 2294324190ce5366889069534a40e00962c9b692 Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Mon, 10 Jun 2024 21:48:02 +0200
Subject: [PATCH 2/2] platform/surface: aggregator_registry: Add fan and
 thermal sensor support for Surface Laptop Studio 2

---
 drivers/platform/surface/surface_aggregator_registry.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/surface/surface_aggregator_registry.c b/drivers/platform/surface/surface_aggregator_registry.c
index 4dc79f791d390..77f903a04d128 100644
--- a/drivers/platform/surface/surface_aggregator_registry.c
+++ b/drivers/platform/surface/surface_aggregator_registry.c
@@ -312,7 +312,9 @@ static const struct software_node *ssam_node_group_sls2[] = {
    &ssam_node_root,
    &ssam_node_bat_ac,
    &ssam_node_bat_main,
-   &ssam_node_tmp_perf_profile,
+   &ssam_node_tmp_perf_profile_with_fan,
+   &ssam_node_tmp_sensors,
+   &ssam_node_fan_speed,
    &ssam_node_pos_tablet_switch,
    &ssam_node_hid_sam_keyboard,
    &ssam_node_hid_sam_penstash,
-- 
2.45.1
sevenzip2 commented 2 weeks ago

Very sorry for that, I don't know how to patch a kernel.

CiaranWinna commented 1 week ago

Hi @qzed! I currently hitting the following issue:https://github.com/linux-surface/linux-surface/issues/1461. If I am able to find a work around I will test the code changes you mentioned above BR, Ciaran

sevenzip2 commented 4 hours ago

I compiled the kernel manually... and it worked! Please merge it into an official patch soon.