version 1.11.6.1, 2002/01/10 19:54:56 |
version 1.11.6.2, 2002/06/23 17:46:45 |
Line 103 void lm_refresh_sensor_data __P((struct |
|
Line 103 void lm_refresh_sensor_data __P((struct |
|
|
|
static void wb_svolt __P((struct lm_softc *)); |
static void wb_svolt __P((struct lm_softc *)); |
static void wb_stemp __P((struct lm_softc *, struct envsys_tre_data *, int)); |
static void wb_stemp __P((struct lm_softc *, struct envsys_tre_data *, int)); |
|
static void wb781_fanrpm __P((struct lm_softc *, struct envsys_tre_data *)); |
static void wb_fanrpm __P((struct lm_softc *, struct envsys_tre_data *)); |
static void wb_fanrpm __P((struct lm_softc *, struct envsys_tre_data *)); |
|
|
void wb781_refresh_sensor_data __P((struct lm_softc *)); |
void wb781_refresh_sensor_data __P((struct lm_softc *)); |
|
|
case LM_ID_LM79: |
case LM_ID_LM79: |
printf(": LM79\n"); |
printf(": LM79\n"); |
break; |
break; |
|
case LM_ID_LM81: |
|
printf(": LM81\n"); |
|
break; |
default: |
default: |
return 0; |
return 0; |
} |
} |
Line 467 generic_streinfo_fan(sc, info, n, binfo) |
|
Line 471 generic_streinfo_fan(sc, info, n, binfo) |
|
|
|
/* FAN1 and FAN2 can have divisors set, but not FAN3 */ |
/* FAN1 and FAN2 can have divisors set, but not FAN3 */ |
if ((sc->info[binfo->sensor].units == ENVSYS_SFANRPM) |
if ((sc->info[binfo->sensor].units == ENVSYS_SFANRPM) |
&& (binfo->sensor != 2)) { |
&& (n < 2)) { |
if (binfo->rpms == 0) { |
if (binfo->rpms == 0) { |
binfo->validflags = 0; |
binfo->validflags = 0; |
return (0); |
return (0); |
} |
} |
|
|
|
/* write back the nominal FAN speed */ |
|
info->rpms = binfo->rpms; |
|
|
/* 153 is the nominal FAN speed value */ |
/* 153 is the nominal FAN speed value */ |
divisor = 1350000 / (binfo->rpms * 153); |
divisor = 1350000 / (binfo->rpms * 153); |
|
|
Line 491 generic_streinfo_fan(sc, info, n, binfo) |
|
Line 498 generic_streinfo_fan(sc, info, n, binfo) |
|
* in <7:6> |
* in <7:6> |
*/ |
*/ |
sdata = lm_readreg(sc, LMD_VIDFAN); |
sdata = lm_readreg(sc, LMD_VIDFAN); |
if ( binfo->sensor == 0 ) { /* FAN1 */ |
if ( n == 0 ) { /* FAN1 */ |
divisor <<= 4; |
divisor <<= 4; |
sdata = (sdata & 0xCF) | divisor; |
sdata = (sdata & 0xCF) | divisor; |
} else { /* FAN2 */ |
} else { /* FAN2 */ |
Line 535 wb781_streinfo(sme, binfo) |
|
Line 542 wb781_streinfo(sme, binfo) |
|
struct envsys_basic_info *binfo; |
struct envsys_basic_info *binfo; |
{ |
{ |
struct lm_softc *sc = sme->sme_cookie; |
struct lm_softc *sc = sme->sme_cookie; |
|
int divisor; |
|
u_int8_t sdata; |
|
int i; |
|
|
if (sc->info[binfo->sensor].units == ENVSYS_SVOLTS_DC) |
if (sc->info[binfo->sensor].units == ENVSYS_SVOLTS_DC) |
sc->info[binfo->sensor].rfact = binfo->rfact; |
sc->info[binfo->sensor].rfact = binfo->rfact; |
else { |
else { |
if (sc->info[binfo->sensor].units == ENVSYS_SFANRPM) { |
if (sc->info[binfo->sensor].units == ENVSYS_SFANRPM) { |
generic_streinfo_fan(sc, &sc->info[binfo->sensor], |
if (binfo->rpms == 0) { |
binfo->sensor - 10, binfo); |
binfo->validflags = 0; |
|
return (0); |
|
} |
|
|
|
/* write back the nominal FAN speed */ |
|
sc->info[binfo->sensor].rpms = binfo->rpms; |
|
|
|
/* 153 is the nominal FAN speed value */ |
|
divisor = 1350000 / (binfo->rpms * 153); |
|
|
|
/* ...but we need lg(divisor) */ |
|
for (i = 0; i < 7; i++) { |
|
if (divisor <= (1 << i)) |
|
break; |
|
} |
|
divisor = i; |
|
|
|
if (binfo->sensor == 10 || binfo->sensor == 11) { |
|
/* |
|
* FAN1 div is in bits <5:4>, FAN2 div |
|
* is in <7:6> |
|
*/ |
|
sdata = lm_readreg(sc, LMD_VIDFAN); |
|
if ( binfo->sensor == 10 ) { /* FAN1 */ |
|
sdata = (sdata & 0xCF) | |
|
((divisor & 0x3) << 4); |
|
} else { /* FAN2 */ |
|
sdata = (sdata & 0x3F) | |
|
((divisor & 0x3) << 6); |
|
} |
|
lm_writereg(sc, LMD_VIDFAN, sdata); |
|
} else { |
|
/* FAN3 is in WB_PIN <7:6> */ |
|
sdata = lm_readreg(sc, WB_PIN); |
|
sdata = (sdata & 0x3F) | |
|
((divisor & 0x3) << 6); |
|
lm_writereg(sc, WB_PIN, sdata); |
|
} |
} |
} |
memcpy(sc->info[binfo->sensor].desc, binfo->desc, |
memcpy(sc->info[binfo->sensor].desc, binfo->desc, |
sizeof(sc->info[binfo->sensor].desc)); |
sizeof(sc->info[binfo->sensor].desc)); |
Line 572 wb782_streinfo(sme, binfo) |
|
Line 619 wb782_streinfo(sme, binfo) |
|
return (0); |
return (0); |
} |
} |
|
|
|
/* write back the nominal FAN speed */ |
|
sc->info[binfo->sensor].rpms = binfo->rpms; |
|
|
/* 153 is the nominal FAN speed value */ |
/* 153 is the nominal FAN speed value */ |
divisor = 1350000 / (binfo->rpms * 153); |
divisor = 1350000 / (binfo->rpms * 153); |
|
|
Line 601 wb782_streinfo(sme, binfo) |
|
Line 651 wb782_streinfo(sme, binfo) |
|
sdata = lm_readreg(sc, WB_PIN); |
sdata = lm_readreg(sc, WB_PIN); |
sdata = (sdata & 0x3F) | |
sdata = (sdata & 0x3F) | |
((divisor & 0x3) << 6); |
((divisor & 0x3) << 6); |
lm_writereg(sc, LMD_VIDFAN, sdata); |
lm_writereg(sc, WB_PIN, sdata); |
} |
} |
/* Bit 2 of divisor is in WB_BANK0_FANBAT */ |
/* Bit 2 of divisor is in WB_BANK0_FANBAT */ |
lm_writereg(sc, WB_BANKSEL, WB_BANKSEL_B0); |
lm_writereg(sc, WB_BANKSEL, WB_BANKSEL_B0); |
Line 760 wb_stemp(sc, sensors, n) |
|
Line 810 wb_stemp(sc, sensors, n) |
|
} |
} |
|
|
static void |
static void |
|
wb781_fanrpm(sc, sensors) |
|
struct lm_softc *sc; |
|
struct envsys_tre_data *sensors; |
|
{ |
|
int i, divisor, sdata; |
|
lm_writereg(sc, WB_BANKSEL, WB_BANKSEL_B0); |
|
for (i = 0; i < 3; i++) { |
|
sdata = lm_readreg(sc, LMD_SENSORBASE + i + 8); |
|
DPRINTF(("sdata[fan%d] 0x%x\n", i, sdata)); |
|
if (i == 0) |
|
divisor = (lm_readreg(sc, LMD_VIDFAN) >> 4) & 0x3; |
|
else if (i == 1) |
|
divisor = (lm_readreg(sc, LMD_VIDFAN) >> 6) & 0x3; |
|
else |
|
divisor = (lm_readreg(sc, WB_PIN) >> 6) & 0x3; |
|
|
|
DPRINTF(("sdata[%d] 0x%x div 0x%x\n", i, sdata, divisor)); |
|
if (sdata == 0xff || sdata == 0x00) { |
|
sensors[i].cur.data_us = 0; |
|
} else { |
|
sensors[i].cur.data_us = 1350000 / |
|
(sdata << divisor); |
|
} |
|
} |
|
} |
|
|
|
static void |
wb_fanrpm(sc, sensors) |
wb_fanrpm(sc, sensors) |
struct lm_softc *sc; |
struct lm_softc *sc; |
struct envsys_tre_data *sensors; |
struct envsys_tre_data *sensors; |
Line 798 wb781_refresh_sensor_data(sc) |
|
Line 875 wb781_refresh_sensor_data(sc) |
|
lm_writereg(sc, WB_BANKSEL, WB_BANKSEL_B0); |
lm_writereg(sc, WB_BANKSEL, WB_BANKSEL_B0); |
wb_stemp(sc, &sc->sensors[7], 3); |
wb_stemp(sc, &sc->sensors[7], 3); |
lm_writereg(sc, WB_BANKSEL, WB_BANKSEL_B0); |
lm_writereg(sc, WB_BANKSEL, WB_BANKSEL_B0); |
generic_fanrpm(sc, &sc->sensors[10]); |
wb781_fanrpm(sc, &sc->sensors[10]); |
} |
} |
|
|
void |
void |