Re: [PATCH] hwmon: (nct6683) Report the fan curves of MSI boards with NCT6687D-R
From: Guenter Roeck
Date: Mon Nov 09 2026 - 13:29:53 EST
On Mon, Nov 09, 2026 at 02:57:59AM +0100, Tomasz Bojanowski wrote:
> In automatic mode, the fans of MSI boards with an NCT6687D-R (customer
> ID 0x20d) follow the fan curve configured in the BIOS setup. Report
> these curves with the standard pwmN_auto_point[1-7]_temp,
> pwmN_auto_point[1-7]_pwm and pwmN_auto_channels_temp attributes,
> so that users can see what automatic mode does.
>
> The register layout comes from reverse engineering of the vendor's
> Windows software and was confirmed by reading the EC of an MSI MAG
> B850M MORTAR WIFI (MS-7E61, BIOS 1.A68, EC firmware build 03/10/25):
> for all six controlled fans, the curves match the settings in the BIOS
> setup, also after changing them and after a power cycle. Other boards
> with customer ID 0x20d have not been checked.
>
> The curve of fan channel n is stored at 0xb00 + 0x18 * n: seven
> temperatures in degrees Celsius, followed by seven outputs of two bytes
> each. On the test board, the high byte of each output is zero and the
> low byte holds the duty cycle (0-255). Register 0xa08 + n (channels
> 0-7) or 0x240 + n - 10 (channels 10-15) is 0x40 on the test board for
> all channels with a fan header. The temperature source of the curve
> appears to be a bitmap of monitoring channels at 0x910 + 4 * n. The
> driver assumes that bit k of this 32-bit big-endian value selects
> monitoring channel k; on the test board, all curves use bit 0, which is
> temp1.
>
> The attributes are created for the channels which support fan control,
> if the mode register of their curve is 0x40 and the high byte of each
> output is zero when the driver is probed. They are read-only and read
> from the EC on each access. If a curve uses a temperature source which
> the driver does not report, reading pwmN_auto_channels_temp returns
> -ENODATA. The new code only reads EC registers.
>
> Tested on the same board with kernel 7.2.15 and the driver built as an
> out-of-tree module: all attributes show the values read from the EC
> with a separate read-only tool, and pwm4, which does not support fan
> control, gets no fan curve attributes.
>
> Signed-off-by: Tomasz Bojanowski <tomasz@xxxxxxxxxxxxx>
This also seems to work with B650 boards, even though those use a different
manufacturer ID (NCT6683_CUSTOMER_ID_MSI3). When adding that manufacturer ID,
I get:
pwm1:94
pwm1_auto_channels_temp:1
pwm1_auto_point1_pwm:51
pwm1_auto_point1_temp:0
pwm1_auto_point2_pwm:89
pwm1_auto_point2_temp:45000
pwm1_auto_point3_pwm:178
pwm1_auto_point3_temp:65000
pwm1_auto_point4_pwm:255
pwm1_auto_point4_temp:80000
pwm1_auto_point5_pwm:255
pwm1_auto_point5_temp:80000
pwm1_auto_point6_pwm:255
pwm1_auto_point6_temp:80000
pwm1_auto_point7_pwm:255
pwm1_auto_point7_temp:80000
pwm1_enable:2
pwm2:82
pwm2_auto_channels_temp:1
pwm2_auto_point1_pwm:56
pwm2_auto_point1_temp:0
pwm2_auto_point2_pwm:76
pwm2_auto_point2_temp:40000
pwm2_auto_point3_pwm:102
pwm2_auto_point3_temp:70000
pwm2_auto_point4_pwm:204
pwm2_auto_point4_temp:90000
pwm2_auto_point5_pwm:204
pwm2_auto_point5_temp:90000
pwm2_auto_point6_pwm:204
pwm2_auto_point6_temp:90000
pwm2_auto_point7_pwm:204
pwm2_auto_point7_temp:90000
pwm2_enable:2
pwm3:82
pwm4:82
pwm5:82
pwm6:255
pwm7:255
pwm8:128
I don't feel comfortable enough to enable it for good on those boards (I don't know
why pwm3..8 are skipped), but it is good enough for testing.
Applied.
Thanks,
Guenter