vitorafsr / i8kutils

Fan control for some Dell laptops
https://launchpad.net/i8kutils
GNU General Public License v3.0
219 stars 28 forks source link

Not enough fans #39

Open alexforencich opened 9 months ago

alexforencich commented 9 months ago

On my 7920 (workstation tower), there are at least 10 fans. I added this to fan_speed in i8kctl.c:

for (int x = 0; x < 20; x++) printf("%d: %d\n", x, i8k_get_fan_speed(x));

And with that modification, when I run i8kctl speed I get:

$ ./i8kctl speed
0: 0
1: 819
2: 787
3: 777
4: 800
5: 808
6: 788
7: 802
8: 1502
9: 1843
10: 0
11: 0
12: 0
13: 0
14: 0
15: 0
16: 0
17: 0
18: 0
19: 0
819 0

Running the same on a 7820 also shows several additional fans:

$ ./i8kctl speed
0: 0
1: 0
2: 694
3: 971
4: 1037
5: 815
6: 810
7: 0
8: 0
9: 0
10: 0
11: 0
12: 0
13: 0
14: 0
15: 0
16: 0
17: 0
18: 0
19: 0
0 0

So, both the kernel module and the userspace tools should be updated to support a lot more fans. Not sure how many would be the max across all Dell machines, and I have not looked at temp sensors or PWM controls at all. Perhaps it makes sense to autodetect the number of fans that are actually present in some way.

alexforencich commented 9 months ago

Interesting, just did another quick test, scanning all 256 channels. All unused channels on the 7820 report 0, while on my laptop (XPS 15 7590) all unused channels report -1.

alexforencich commented 9 months ago

The 7920 manual states that there can be up to 12 system fans: https://www.dell.com/support/manuals/en-us/precision-7920-workstation/precision_7920_om_pub/fan-and-sensor-cable-assembly?guid=guid-d85e692b-fccb-49a8-a543-fde6d8774b48&lang=en-us

I haven't been able to find a similar summary for the 7820, but presumably the 7920 would have more fans than the 7820. Also not sure what the story is with the first channel or two reading as 0.

Also, I would be happy to run some experiments on my 7820 and 7920, and potentially provide remote access to a 7920.

Batwam commented 9 months ago

I'm not an expert but this status -1 reminds me of a problem I have which was diagnosed as a BIOS issue: https://github.com/vitorafsr/i8kutils/issues/38#issuecomment-1825155260

Best thing would be to get @Wer-Wolf view on this

Wer-Wolf commented 9 months ago

Detecting the number of installed fans is not possible, the driver would have to probe all 256 fans. This however takes too long on some machines. How many fans can you guys test? I can provide you with a patched kernel driver which probes for more fans (current limit is 3).

alexforencich commented 9 months ago

Well, I think there are probably a few techniques and heuristics that could cut that down by a lot. Is there a way to know if a channel could potentially be connected to a fan? If you assume that the channels will be used contiguously, then you can scan the first few channels first so it's fast for things like laptops, then do binary search if necessary to find the last usable channel, which should only require testing 8 channels at most to cover the full range.

Anyway, I don't have a pile of fans, but I can potentially try moving around some of the connections, at least for the flex bays. I can really only do extensive experiments on the 7920s as these are set up for hardware dev, the only 7820 is set up as a workstation so that's going to be limited to non-disruptive userspace stuff for the time being. I also don't have a CPU expansion card for the 7820 - that has another fan on it that presumably would use another channel.

Wer-Wolf commented 9 months ago

AFAIK there are machines which do not have contiguously numbered fan channels.

Can you try moving the fans a bit and check which channels are used by them?