On Wed, Feb 14, 2024 at 12:34:17PM +0100, Mark Kettenis wrote:

Hello Mark,

>> It seems that I have two (at least) lm devices on my motherboard and
>> that it's random which attaches. Here are the two I've seen:
>> 
>>   lm0 at isa0 port 0x290/8: W83627DHG
>>   lm0 at isa0 port 0x290/8: NCT6792D
>> 
>> The W83627DHG gives one fan reading, with an obviously incorrect value:
>> 
>>   $ sysctl hw|grep fan
>>   hw.sensors.lm0.fan0=56250 RPM
>> 
>> The NCT6792D gave more than one, and seemingly correct, fan readings in
>> `sysctl hw`. From memory there were at least fan readings for the CPU
>> and rear fan, both were showing in the range 350-600 RPM when idling,
>> and as soon as I made the CPU do some work the readings went up, and
>> when the CPU stopped doing some work the readings went down.
>>
>> The reason I'm being vague about that is that I have only noticed the
>> NCT6792D attaching once, so I can't give those fan readings now. AFAICT
>> the W83627DHG nearly always attaches: out of 19 dmesgs I've
>> (accidentally) stored over many months, only one contains
>> "lm0...NCT6792D".
>> 
>> I'm attaching a dmesg from a kernel built from -current yesterday in
>> case this is useful, though it's from an W83627DHG attach.
> It is probably a misdetection.  There are some heuristics involved in
> detecting the chip.  And there may even be a 2nd agent here (IPMI, SMM)
> that may interfere with the code that tries to detect the chip.

I put a `printf` to see what value `sc->sioid` is set to. In fact it seems
it can be set to more than one value! So far I've seen: 0x9, 0x89, 0xe9.

If I match on those values with the (obviously not commitable!) diff at
the end of this email then I get sensible fan values:

  $ dmesg | grep lm0
  lm0 at isa0 port 0x290/8 (0xe9) : unknown 6779D-ish
  $ sysctl hw.sensors|grep fan
  hw.sensors.lm0.fan0=610 RPM (System Fan)
  hw.sensors.lm0.fan1=363 RPM (CPU Fan)
  hw.sensors.lm0.fan2=0 RPM (Aux Fan0)
  hw.sensors.lm0.fan3=0 RPM (Aux Fan1)
  hw.sensors.lm0.fan4=0 RPM (Aux Fan2)

These go up and down as I'd expect as the system load varies.

I had a quick look at the equivalent Linux driver, but it looks to me like
it does detection in a very way that doesn't involve making choices based
on sioid?


Laurie


diff --git sys/dev/ic/lm78.c sys/dev/ic/lm78.c
index e60f38577a6..561fe603689 100644
--- sys/dev/ic/lm78.c
+++ sys/dev/ic/lm78.c
@@ -563,6 +563,7 @@ wb_match(struct lm_softc *sc)
                lm_setup_sensors(sc, w83627ehf_sensors);
                break;
        case WB_CHIPID_W83627DHG:
+               printf(" (%d) ", sc->sioid);
                switch (sc->sioid) {
                case WBSIO_ID_NCT6775F:
                        printf(": NCT6775F\n");
@@ -596,6 +597,12 @@ wb_match(struct lm_softc *sc)
                        printf(": NCT6795D\n");
                        lm_setup_sensors(sc, nct6779d_sensors);
                        break;
+               case 0x89:
+               case 0x9:
+               case 0xe9:
+                       printf(": unknown 6779D-ish\n");
+                       lm_setup_sensors(sc, nct6779d_sensors);
+                       break;
                default:
                        printf(": W83627DHG\n");
                        lm_setup_s

Reply via email to