Analyzing the DSDT DSL
By looking at the DSL file, we find the registers we are interested in:
Scope (_TZ)
{
ThermalZone (TZ01)
{
Method (_TMP, 0, NotSerialized) // _TMP: Temperature
{
If (\_SB.ECOK)
{
Local0 = \_SB.PCI0.LPCB.EC0.CTMP
Return (((Local0 * 0x0A) + 0x0AAC))
}
Else
{
Return (0x0CD2)
}
}
[...]
}
}
OperationRegion (EMEM, SystemMemory, 0xFEDF8200, 0x0100)
Field (EMEM, ByteAcc, NoLock, Preserve)
{
[...]
Offset (0x58),
CTMP, 8,
Offset (0x5A),
[...]
}
The CTMP register is used in the calculation of the temperature reported by ThermalZone TZ01.
Calculating Register Addresses
We calculate the register addresses as follows:
- CTMP = Offset(0x58) = 0x58 = 88
Finding the WriteRegister
While CTMP is not a direct fan control register, manipulating its value allows us to simulate different CPU temperatures and indirectly trigger fan speed changes.
sudo ec_probe write 88 0
sudo ec_probe write 88 100
The fan speed changed.
Now we can run:
sudo ec_probe write 88 0
Wait until the fan turns down ...
sudo ec_probe monitor -c -r readings.csv
While running the monitor command, we spin the fan up:
sudo ec_probe write 88 100
Wait until the fan turns up ...
We kill the monitor command by typing CTRL+C
The readings.csv looks like this:
02,18,14,18,12,13,17,14,11,15,16,15,12,14,12,14,16,12,14,18,16,1B,12,14,13,19,13,12,13,15,18,13,1A,13,11,14,17,11,17,15,11,15,13,16,13,14,18,11,12,14,11,18,19,14,19,11,19,11,15,12,17,15,17
55,00,01,02,03,04,05,06,07
56,00,49,45,4B,47,4D,49,4F,55,5B,61,67,6D,73,79,7F,84,8A,91,97,9D,A0,A2,A4
58,25,64
5C,00,A3,2E,EA,DE,8D,21,B2,99,26,3A,A1,AA,2B,1E,F1,2D,CD,DE,6B,4C,5C,6B,DE,EF,6B,EF,DE,6B,5C,EF,7B,6B,DE,EF,6B,00,EF
5D,00,02,06,07,08,09,0A,0B,0C,0D,0E,0F,0E,0F,10,0F
82,C8,C9,C8,C9,C8,C9,C8,C9,C8
98,6D,6E,6D,6E,6D,6E,6D
We see that register 0x55 gives continuous values from 0x00 to 0x07.
We try to set the fan speed by writing to 0x55
sudo ec_probe write 0x55 0
sudo ec_probe write 0x55 4
sudo ec_probe write 0x55 7
The fan speed changed!
Result:
- 0x55 is the ReadRegister
- 0x55 is the WriteRegister
- 0 is the MinSpeedValue
- 7 is the MaxSpeedValue
Writing the Configuration File
- 85 is the ReadRegister
- 85 is the WriteRegister
- 0 is the MinSpeedValue
- 7 is the MaxSpeedValue
Since the fan speed gets periodically reset, we don't have a FanSpeedResetValue.
See the configuration file on GitHub