FAN control on Clevo based laptops

habl

New Member
Hi all! In HWinfo64 we can control FAN on some laptops.

On Clevo based laptops can control CPU, GPU1 and GPU2 fan from EC registers. It confirms Linux utility https://github.com/tuxedocomputers/tuxedo-fan-control and Windows utility https://github.com/duguzuyang/RLECViewer (I tested it on my Clevo P157SM - it fully works). There is also a working paid Windows utility https://code.obsidian-pc.com/clevo-software/fan-control/.

We can see register conrol in code https://github.com/tuxedocomputers/tuxedo-fan-control/blob/master/native/ec_access.cc.
C++:
#define EC_COMMAND_PORT         0x66
#define EC_DATA_PORT            0x62

static void SendCommand(int command)
{
   int tt = 0;
    while((inb(EC_COMMAND_PORT) & 2))
    {
        tt++;
        if(tt>30000)
        {
            break;
        }
    }

    outb(command, EC_COMMAND_PORT);
}

static void WriteData(int data)
{
    while((inb(EC_COMMAND_PORT) & 2));

    outb(data, EC_DATA_PORT);
}

Napi::Boolean SetFanDuty(const Napi::CallbackInfo& info)
{
    EcInit();
    SendCommand(0x99); //in 0x66=102 port command 0x99=153

    switch(index)
    {
        case 1:
            WriteData(0x01); //in 0x62=98 port command 0x1=1
            break;
        case 2:
            WriteData(0x02);
            break;
        case 3:
            WriteData(0x03);
            break;
        default:
            return Napi::Boolean::New(env, false);
    }

    WriteData(fanDuty); //in 0x62 port fan speed
    return Napi::Boolean::New(env, true);
}
I analyzed this code and realized this. From this code it is clear that for manual control of the fan speed we need:
1) send in 0x66 port command 0x99
2) for the case of CPU FAN in 0x62 port send command 0x1
3) then sent hex data FAN speed to 0x62 port

It seems I made a mistake somewhere because in RW utility (Read Write everything) http://rweverything.phpnet.us/download.html this sequence does not work. But the code is working, because tuxedo-fan-control works on my laptop.

I changed registry 0x62 and 0x66, but data 0xCE and 0xD0 and 0xD1 dont changed.

Let's deal with this code together and set the fan speed control on Clevo laptops!
 
Hello,
Thank you for this useful summary. I also tried under Linux the same thing that you did. I used the "ioport" package (probably the equivalent of "Read Write everything"), which provides "inb, outb, inw, outw, inl, outl" from the command line. But I had no success.
However, after searching more on the internet, I found a simple and clear code that performs the fan control successfully under Linux. I am yet not clear whether it is dangerous for the computer, i.e. whether the trip points will still be taken into account automatically. So, I am currently checking the temperature regularly.
Olivier
 
Back
Top