From: Guenter Roeck Date: Sun, 11 Sep 2016 16:46:56 +0000 (-0700) Subject: nct6775: Add support for multiple virtual temperature sources X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=bf8c5df732be867ccaa0a20641e8862e1926f267;p=groeck-nct6775 nct6775: Add support for multiple virtual temperature sources For virtual temperatures, the actual temperature values are written by software, presumably by the BIOS. This functionality is (as of right now) supported on NCT6791D, NCT6792D, and NCT6793D. On those chips, the temperatures are written into registers 0xea..0xef on page 0. This is known to be used on some Asus motherboards. Report the 'virtual' temperatures for all monotoring sources to address this situation. Signed-off-by: Guenter Roeck --- diff --git a/nct6775.c b/nct6775.c index 3cd9a38..f87ad02 100644 --- a/nct6775.c +++ b/nct6775.c @@ -196,6 +196,8 @@ superio_exit(int ioreg) #define NUM_FAN 6 +#define TEMP_SOURCE_VIRTUAL 0x1f + /* Common and NCT6775 specific data */ /* Voltage min/max registers for nr=7..14 are in bank 5 */ @@ -3959,7 +3961,7 @@ static int nct6775_probe(struct platform_device *pdev) continue; src = nct6775_read_value(data, data->REG_TEMP_SEL[i]) & 0x1f; - if (!src || (mask & (1 << src))) + if (!src) continue; if (src >= data->temp_label_num || @@ -3971,7 +3973,16 @@ static int nct6775_probe(struct platform_device *pdev) continue; } - mask |= 1 << src; + /* + * For virtual temperature sources, the 'virtual' temperature + * for each fan reflects a different temperature, and there + * are no duplicates. + */ + if (src != TEMP_SOURCE_VIRTUAL) { + if (mask & (1 << src)) + continue; + mask |= 1 << src; + } /* Use fixed index for SYSTIN(1), CPUTIN(2), AUXTIN(3) */ if (src <= data->temp_fixed_num) {