From f2b722c7b6e7e59a89b4e01fbf3519ce1915e690 Mon Sep 17 00:00:00 2001 From: Werner Sembach Date: Wed, 3 Mar 2021 12:09:52 +0100 Subject: [PATCH] Don't reset fan speed on disable full-fan-mode because it gets reset automatically --- src/tuxedo_io/tongfang_wmi.h | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/tuxedo_io/tongfang_wmi.h b/src/tuxedo_io/tongfang_wmi.h index 6d5c959..b4ba64a 100644 --- a/src/tuxedo_io/tongfang_wmi.h +++ b/src/tuxedo_io/tongfang_wmi.h @@ -336,25 +336,13 @@ static u32 uw_set_fan(u32 fan_index, u8 fan_speed) static u32 uw_set_fan_auto(void) { - u8 reg_high = 0x18; - u32 i; union uw_ec_read_return reg_read_return; union uw_ec_write_return reg_write_return; - u8 low_reg_fan0 = 0x04; - u8 low_reg_fan1 = 0x09; - // Check current mode + // Get current mode uw_ec_read_addr(0x51, 0x07, ®_read_return); - if (reg_read_return.bytes.data_low & 0x40) { - // If "full fan mode" (i.e. 0x40 bit set) switch it off - uw_ec_write_addr(0x51, 0x07, reg_read_return.bytes.data_low & 0xbf, 0x00, ®_write_return); - // Attempt to write both fans to 100% to restore default "full fan mode" - for (i = 0; i < 10; ++i) { - uw_ec_write_addr(low_reg_fan0, reg_high, 0xc8, 0x00, ®_write_return); - uw_ec_write_addr(low_reg_fan1, reg_high, 0xc8, 0x00, ®_write_return); - msleep(10); - } - } + // Switch off "full fan mode" (i.e. unset 0x40 bit) + uw_ec_write_addr(0x51, 0x07, reg_read_return.bytes.data_low & 0xbf, 0x00, ®_write_return); return 0; }