@@ -19,6 +19,7 @@ internal class IT87XX : ISuperIO
1919 private readonly int _gpioCount ;
2020 private readonly bool _has16BitFanCounter ;
2121 private readonly bool _hasExtReg ;
22+ private readonly bool _hasAlt6thFanReg ;
2223 private readonly bool [ ] _initialFanOutputModeEnabled = new bool [ 3 ] ; // Initial Fan Controller Main Control Register value.
2324 private readonly byte [ ] _initialFanPwmControl = new byte [ MaxFanHeaders ] ; // This will also store the 2nd control register value.
2425 private readonly byte [ ] _initialFanPwmControlExt = new byte [ MaxFanHeaders ] ;
@@ -96,6 +97,8 @@ Chip.IT8631E or
9697 Chip . IT8638E or
9798 Chip . IT8696E ;
9899
100+ _hasAlt6thFanReg = chip is Chip . IT8665E or Chip . IT8625E ;
101+
99102 switch ( chip )
100103 {
101104 case Chip . IT8613E :
@@ -242,7 +245,16 @@ Chip.IT8638E or
242245 }
243246
244247 if ( Fans . Length >= 6 )
245- _fansDisabled [ 5 ] = ( modes & ( 1 << 2 ) ) == 0 ;
248+ {
249+ if ( chip == Chip . IT8665E )
250+ {
251+ modes = ReadByte ( FAN_TACHOMETER_16BIT_REGISTER_ALT , out valid ) ;
252+ if ( valid )
253+ _fansDisabled [ 5 ] = ( modes & ( 1 << 3 ) ) == 0 ;
254+ }
255+ else
256+ _fansDisabled [ 5 ] = ( modes & ( 1 << 2 ) ) == 0 ;
257+ }
246258 }
247259
248260 // Set the number of GPIO sets
@@ -460,11 +472,11 @@ public void Update()
460472 if ( _fansDisabled [ i ] )
461473 continue ;
462474
463- int value = ReadByte ( FAN_TACHOMETER_REG [ i ] , out bool valid ) ;
475+ int value = ReadByte ( _hasAlt6thFanReg ? FAN_TACHOMETER_REG_ALT [ i ] : FAN_TACHOMETER_REG [ i ] , out bool valid ) ;
464476 if ( ! valid )
465477 continue ;
466478
467- value |= ReadByte ( FAN_TACHOMETER_EXT_REG [ i ] , out valid ) << 8 ;
479+ value |= ReadByte ( _hasAlt6thFanReg ? FAN_TACHOMETER_EXT_REG_ALT [ i ] : FAN_TACHOMETER_EXT_REG [ i ] , out valid ) << 8 ;
468480 if ( ! valid )
469481 continue ;
470482
@@ -598,6 +610,7 @@ private void RestoreDefaultFanPwmControl(int index)
598610 private const byte DATA_REGISTER_OFFSET = 0x06 ;
599611 private const byte BANK_REGISTER = 0x06 ; // bit 5-6 define selected bank
600612 private const byte FAN_TACHOMETER_16BIT_REGISTER = 0x0C ;
613+ private const byte FAN_TACHOMETER_16BIT_REGISTER_ALT = 0x0B ;
601614 private const byte FAN_TACHOMETER_DIVISOR_REGISTER = 0x0B ;
602615
603616 private readonly byte [ ] ITE_VENDOR_IDS = { 0x90 , 0x7F } ;
@@ -612,6 +625,8 @@ private void RestoreDefaultFanPwmControl(int index)
612625 private readonly byte [ ] FAN_PWM_CTRL_EXT_REG = { 0x63 , 0x6b , 0x73 , 0x7b , 0xa3 , 0xab } ;
613626 private readonly byte [ ] FAN_TACHOMETER_EXT_REG = { 0x18 , 0x19 , 0x1a , 0x81 , 0x83 , 0x4d } ;
614627 private readonly byte [ ] FAN_TACHOMETER_REG = { 0x0d , 0x0e , 0x0f , 0x80 , 0x82 , 0x4c } ;
628+ private readonly byte [ ] FAN_TACHOMETER_EXT_REG_ALT = { 0x18 , 0x19 , 0x1a , 0x81 , 0x83 , 0x94 } ;
629+ private readonly byte [ ] FAN_TACHOMETER_REG_ALT = { 0x0d , 0x0e , 0x0f , 0x80 , 0x82 , 0x93 } ;
615630
616631 // Address of the Fan Controller Main Control Register.
617632 // No need for the 2nd control register (bit 7 of 0x15 0x16 0x17),
0 commit comments