Benjamin-Loison / EmbeddedController

Embedded Controller firmware for the Framework Laptop
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Be able to change fan speed on Linux Mint #4

Open Benjamin-Loison opened 7 months ago

Benjamin-Loison commented 7 months ago
THERMAL_FOLDER_PATH=/sys/class/thermal
# https://en.wikipedia.org/wiki/Celsius
MAX_DEGREES=-274
for thermalZone in $THERMAL_FOLDER_PATH/thermal_zone*
do
    cat $thermalZone/type
    DEGREES=$((`cat $thermalZone/temp` / 1000))
    echo $DEGREES°C
    if [ $DEGREES -gt $MAX_DEGREES ]
    then
        MAX_DEGREES=$DEGREES
    fi
    echo
done
echo "Maximum degrees: $MAX_DEGREES°C"
THERMAL_FOLDER_PATH=/sys/class/thermal
while [ 1 ]
do
    # https://en.wikipedia.org/wiki/Celsius
    MAX_DEGREES=-274
    for thermalZone in $THERMAL_FOLDER_PATH/thermal_zone*
    do
        DEGREES=$((`cat $thermalZone/temp` / 1000))
        if [ $DEGREES -gt $MAX_DEGREES ]
        then
            MAX_DEGREES=$DEGREES
        fi
    done
    echo "`date` Maximum degrees: $MAX_DEGREES°C"
    sleep 1
done

Related to the Ask Ubuntu question 1110943.

sensors
coretemp-isa-0000
Adapter: ISA adapter
Package id 0:  +59.0°C  (high = +100.0°C, crit = +100.0°C)
Core 0:        +56.0°C  (high = +100.0°C, crit = +100.0°C)
Core 4:        +57.0°C  (high = +100.0°C, crit = +100.0°C)
Core 8:        +55.0°C  (high = +100.0°C, crit = +100.0°C)
Core 12:       +54.0°C  (high = +100.0°C, crit = +100.0°C)
Core 16:       +56.0°C  (high = +100.0°C, crit = +100.0°C)
Core 17:       +56.0°C  (high = +100.0°C, crit = +100.0°C)
Core 18:       +56.0°C  (high = +100.0°C, crit = +100.0°C)
Core 19:       +56.0°C  (high = +100.0°C, crit = +100.0°C)
Core 20:       +56.0°C  (high = +100.0°C, crit = +100.0°C)
Core 21:       +56.0°C  (high = +100.0°C, crit = +100.0°C)
Core 22:       +56.0°C  (high = +100.0°C, crit = +100.0°C)
Core 23:       +56.0°C  (high = +100.0°C, crit = +100.0°C)

BAT1-acpi-0
Adapter: ACPI interface
in0:          17.14 V  
curr1:         2.31 A  

iwlwifi_1-virtual-0
Adapter: Virtual device
temp1:        +38.0°C  

nvme-pci-0100
Adapter: PCI adapter
Composite:    +46.9°C  (low  =  -5.2°C, high = +89.8°C)
                       (crit = +93.8°C)

acpitz-acpi-0
Adapter: ACPI interface
temp1:        +60.8°C  (crit = +210.0°C)
temp2:        +53.8°C  (crit = +210.0°C)
temp3:        +55.8°C  (crit = +210.0°C)
temp4:        +51.8°C  (crit = +210.0°C)
temp5:        +40.8°C  (crit = +210.0°C)

So

sensors | grep -i fan

does not return anything.

psensor

image

Benjamin-Loison commented 2 months ago
./build/hx30/util/ectool help
  autofanctrl <on>
      Turn on automatic fan speed control.
...
  fanduty <percent>
      Forces the fan PWM to a constant duty cycle
...
  hello
      Checks for basic communication with EC
...
  pwmgetduty
      Prints the current 16 bit duty cycle for given PWM
...
  temps <sensorid>
      Print temperature.
  tempsinfo <sensorid>
      Print temperature sensor info.
  thermalget <platform-specific args>
      Get the threshold temperature values from the thermal engine.
  thermalset <platform-specific args>
      Set the threshold temperature values for the thermal engine.
Benjamin-Loison commented 2 months ago
sudo ./build/hx30/util/ectool autofanctrl
Automatic fan control is now on for all fans.
sudo ./build/hx30/util/ectool inventory
EC supported features:
...
2   : Direct Fan power management support
...
10  : Thermal management support
Benjamin-Loison commented 2 months ago

When fan is quite quiet:

sudo ./build/hx30/util/ectool pwmgetfanrpm
Fan 0 RPM: 3658
sudo ./build/hx30/util/ectool pwmgetnumfans
Number of fans = 1
sudo ./build/hx30/util/ectool pwmsetfanrpm 15000
sudo ./build/hx30/util/ectool pwmgetfanrpm
Fan 0 RPM: 8902
sudo ./build/hx30/util/ectool pwmsetfanrpm 0
sudo ./build/hx30/util/ectool pwmgetfanrpm
Fan 0 RPM: 2055
Benjamin-Loison commented 2 months ago

Laptop fan control to make it silent when no significant workload.

Pay attention that the system should stop if the temperature is too high. Check what too high means here and can warn me about the temperature later on if I lost my current work.