Blog/IT87 driver for the it8686 sensor chip

From Forza's ramblings

2021-11-05 How to enable the IT87 driver for the it8686 sensor chip

Image of a rectangular CMOS image sensor with wires soldered onto several points along its four sides.
CMOS image sensor with electrical wiring

I have a Gigabyte B450M-DS3H motherboard and a AMD Ryzen 3000G CPU with it. The hardware monitoring support in Linux has long been lacking support for the ITE IT8686E Super IO Sensor chipset that this motherboard uses. This means that Linux has only had basic support for temperature monitoring, but no support for detailed temperatures and voltage monitoring. The output from lm_sensors has been very brief with k10temp showing one CPU temperature and the ACPI module not being accurate.

/home/forza # sensors
Adapter: PCI adapter
GPU temp:     +26.0°C  

Adapter: ACPI interface
ACPI temp:    +16.8°C  (crit = +20.8°C)

Adapter: PCI adapter
CPU temp:     +26.5°C

The modified it87 driver

I found a modified it87 driver that supports the IT8686 chipset over at Frank Crawford's fork of the it87 driver. Installation requires that you have kernel sources installed and that you have the gcc compiler toolchain installed. Please see your distribution's manual for how to do this.

Compiling the source code

1. Download the source code.

# mkdir /usr/src/it87
# cd /usr/src/it87
/usr/src/it87 # wget

2. Unpack the source code.

/usr/src/it87 # unzip
   creating: it87-master/
  inflating: it87-master/ISSUES      
  inflating: it87-master/ITE_Register_map.csv  
  inflating: it87-master/ITE_Register_map.pdf  
  inflating: it87-master/Makefile    
  inflating: it87-master/README      
  inflating: it87-master/compat.h    
  inflating: it87-master/dkms.conf   
  inflating: it87-master/it87.c

3. Compile the source code

/usr/src/it87 # cd it87-master
/usr/src/it87/it87-master # make
 CC [M]  /usr/src/it87/new/it87-master/it87.o
/usr/src/it87/new/it87-master/it87.c: In function ‘get_temp_type’:
/usr/src/it87/new/it87-master/it87.c:1479:28: warning: this statement may fall through [-Wimplicit-fallthrough=]
 1479 |                         if (index < 3)
      |                            ^
/usr/src/it87/new/it87-master/it87.c:1481:17: note: here
 1481 |                 case it8655:
      |                 ^~~~
  MODPOST /usr/src/it87/new/it87-master/Module.symvers
  CC [M]  /usr/src/it87/new/it87-master/it87.mod.o
  LD [M]  /usr/src/it87/new/it87-master/it87.ko

4. Install the it87 module

/usr/src/it87/it87-master # sudo make install

5. Load the module. You have add force_id=0x8686 ignore_resource_conflict=1 to modprobe to load the module.

/usr/src/it87/it87-master # sudo modprobe it87 force_id=0x8686 ignore_resource_conflict=1

The kernel logs will show it successfully loaded:

# dmesg
[435404.633106] it87: loading out-of-tree module taints kernel.
[435404.634328] it87: it87 driver version v1.0-48-g40bec4b
[435404.634447] it87: Found IT8686E chip at 0xa40, revision 2
[435404.634494] it87: Beeping is supported
[435404.634532] ACPI Warning: SystemIO range 0x0000000000000A45-0x0000000000000A46 conflicts with OpRegion 0x0000000000000A45-0x0000000000000A46 (\GSA1.SIO1) (20210604/utaddress-204)
[435404.634543] ACPI: OSL: Resource conflict; ACPI support missing from driver?
[435404.634544] ACPI: OSL: Resource conflict: System may be unstable or behave erratically

Creating a custom senors.d/it87.conf

The raw voltage and temperature values from the sensor chip needs adjusting to be correct. Different motherboard models need different calculations to show the correct values and names for each of the inputs. This is achieved by creating a file /etc/sensors.d/gigabyte-it87.conf with the following content:

File: /etc/sensors.d/gigabyte-it87.conf
chip "it8686-*"
    label in0 "Vcore"
    label in1 "+3.3V"
        compute in1 @ * 1.65, @ / 1.65
    label in2 "+12.0V"
        compute in2 @ * 6, @ / 6
    label in3 "+5.0V"
        compute in3 @ * 2.5, @ / 2.5
    label in4 "VSOC"
    label in5 "VDDP"
    label in6 "DRAM"
    label in7 "3VSB"
    label in8 "VBAT"
    label fan1 "CPU Fan"
    label fan2 "SYS Fan 1"
    label fan3 "SYS Fan 2"
    label fan4 "SYS Fan 3_PUMP"
    label fan5 "CPU_OPT"
    label temp1 "System"
    label temp2 "Chipset"
    label temp3 "CPU"
    label temp4 "PCIe x16"
    label temp5 "VRM"
    label temp6 "VSoC"
    label intrusion0 "Intrusion"

I based the above from a sensors.d config file for a similar Gigabyte motherboard, so the values might not be absolutely correct.

Now when you run sensors you get proper names and values for each input.

# sensors
Adapter: ISA adapter
Vcore:       732.00 mV (min =  +0.00 V, max =  +3.06 V)
+3.3V:         3.43 V  (min =  +0.00 V, max =  +5.05 V)
+12.0V:       12.31 V  (min =  +0.00 V, max = +18.36 V)
+5.0V:         4.98 V  (min =  +0.00 V, max =  +7.65 V)
VSOC:          1.10 V  (min =  +0.00 V, max =  +3.06 V)
VDDP:        912.00 mV (min =  +0.00 V, max =  +3.06 V)
DRAM:          1.21 V  (min =  +0.00 V, max =  +3.06 V)
3VSB:          3.29 V  (min =  +0.00 V, max =  +6.12 V)
VBAT:          3.26 V  
CPU Fan:      744 RPM  (min =    0 RPM)
SYS Fan 1:      0 RPM  (min =    0 RPM)
System:       +32.0°C  (low  = +127.0°C, high = +127.0°C)  sensor = thermistor
Chipset:      +51.0°C  (low  = +127.0°C, high = +127.0°C)  sensor = thermistor
CPU:          +26.0°C  (low  =  +0.0°C, high = +70.0°C)  sensor = AMD AMDSI
PCIe x16:     +18.0°C  (low  =  +0.0°C, high = +127.0°C)  sensor = thermistor
VRM:          +30.0°C  (low  =  +0.0°C, high = -113.0°C)  sensor = thermistor
VSoC:         +37.0°C  (low  =  +0.0°C, high = -113.0°C)  sensor = thermistor

Loading it87 on Gentoo Linux

If you want to autoload the module on Gentoo Linux during the boot you can add the module config to either /etc/modules-load.d/it87.conf (systemd) or /etc/conf.d/modules (OpenRC). Then you must add the modprobe options to /etc/modprobe.d/it87.conf.

File: /etc/modprobe.d/it87.conf
options it87 force_id=0x8686 ignore_resource_conflict=1

For OpenRC you would use:

File: /etc/conf.d/modules

For systemd you would use:

File: /etc/modules-load.d/it87.conf