Fans of AN515-57-520Y doesn't respond to writing to EC on linux

asjkiduhaisu
asjkiduhaisu Member Posts: 15 Troubleshooter

This is kinda tech hacky stuff.


On windows we have NitroSense, it works ok, on linux we don't, but still possible to control the fans with projects like nbfc-revive and nbfc-linux, basically what these tools does is to use acpi_ec, ec_sys, ec_linux to write to the ec registries.


I know what registries I should write to and what values, I monitored them and basically it's like so:

Writing 0x0c to 0x22 enable manual fan for the CPU.
Writing 0x30 to 0x21 enable manual fan for the GPU.
Writing (0x00 to 0x64) to registry 0x37 controls the speed of  fan of CPU.
Writing (0x00 to 0x64) to registry 0x3a controls the speed of fan of CPU.


So doing stuff like this should run the fans at 50% speed (but don't):

ec_probe write 0x22 0x0C
ec_probe write 0x21 0x30
ec_probe write 0x37 0x32
ec_probe write 0x3a 0x32

Also I can do something like this (is the same as the above (but just for the cpu fan, I'm tired of typing xd)):

echo -n -e "\014" | dd of="/sys/kernel/debug/ec/ec0/io" bs=1 seek=34 count=1 conv=notrunc

echo -n -e "\062" | dd of="/sys/kernel/debug/ec/ec0/io" bs=1 seek=55 count=1 conv=notrunc

The registries I getting write correctly I can monitor them or read the specifics registries, the values are there, but nothing happens.


On windows when I write to the sameh registries of the EC it works normally.


It's like something on linux is ignoring the values.


Like the only distro I tested was on Arch Linux, so I don't know if it's happening on other distros too.

Best Answer

  • asjkiduhaisu
    asjkiduhaisu Member Posts: 15 Troubleshooter
    Answer ✓

    Apparently in my case I needed to write the value 0x11 to the register 0x03 (supported values for controlling the fans are 0x11 to 0x20), you need to sum it up with another values to get a combination of things working, like battery health which is 0x41 sum it to 0x11 and you have 0x52 write 0x52 to register 0x03 and you will be able to control the fan speed through the registers 0x21, 0x22, 0x37 and 0x3a.

Answers

  • StevenGen
    StevenGen ACE Posts: 12,174 Trailblazer

    Go here and see this guide How to control fan speed? as on Linux the best fan control is to use and configure pwmconfig to observe sensors under CPU and GPU load. Use those values at idle and full load to set MINTEMP and MAXTEMP respectively, with INTERVAL=1. This ramps your fans in real time as load increases. This is the most active cooling for Linux that provides a baseline for further tweaking. 

  • asjkiduhaisu
    asjkiduhaisu Member Posts: 15 Troubleshooter

    @StevenGen thank you :), that was the second tool I tried, but lm-sensors don't detect any fan control pwm, it only detect the temperature related sensor and suggest only intel _core_temp (iirc this is the module name).


    But I think it's something else, writing to registers of the ec should give some response too.

  • Eded
    Eded Member Posts: 1 New User

    Hi @asjkiduhaisu,

    Just fyi, the sequence that you describe works fine to control CPU & GPU fans on Aspire A715-43G.

    Tested using ec_probe from nbsc-linux on vanilla 6.1.11 kernel.

    Thank you for figuring it out!

  • asjkiduhaisu
    asjkiduhaisu Member Posts: 15 Troubleshooter
    Answer ✓

    Apparently in my case I needed to write the value 0x11 to the register 0x03 (supported values for controlling the fans are 0x11 to 0x20), you need to sum it up with another values to get a combination of things working, like battery health which is 0x41 sum it to 0x11 and you have 0x52 write 0x52 to register 0x03 and you will be able to control the fan speed through the registers 0x21, 0x22, 0x37 and 0x3a.