[lm-sensors] pc87360 voltage reference constants

Jim Cromie jcromie at divsol.com
Fri Aug 12 17:42:15 CEST 2005

hi Jean, etal,

Im looking to understand why my temps are so high,
esp in comparison to values from my soekris as obtained from

    VREF = 1.214  V245 = 2.450
    Temp 2 (status=0x81)   54 C

in your code,

        data->in_vref = (i&0x02) ? 3025 : 2966;
        dev_dbg(&new_client->dev, "Using %s reference voltage\n",
            (i&0x02) ? "external" : "internal");

youve got 2 magical constants,  where are they from ?
I cant find mention of them in the pdf, but theyre/its used to scale
the voltages read by show_in_input()

    return sprintf(buf, "%u\n", IN_FROM_REG(data->in[attr->index],

#define IN_FROM_REG(val,ref)        (((val) * (ref) + 128) / 256)

I think my temp answers lie elsewhere (perhaps a cast to s8 for the 
register value),
but Im hoping your answer wrt the constants will clarify some stuff.


BTW, (since Im writing),  my patchset for pc87366 sensors-dev-attrs
(done against rc4-mm1), also applies (clean, iirc) to rc5-mm1, and works 

More information about the lm-sensors mailing list