tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: need help with kern/42758 - correctly initialize W83627HF hwmon
On Sun, 7 Feb 2010, Paul Goyette wrote:
In the wiki on lm-sensors.org I could find only one configuration which
actually uses the temperature sensors of the W83627HF. This configuration
also configures it to use the 3904 mode.
Yes, I went through the datasheet, too, and there seems to be no way to tell
what type of sensor is actually used.
I think it would be OK to add a 'flags' to the config syntax, so you would
say
lm* at iic? addr 0xXX flags 1
to enable 2N3904 bipolar temp sensors. The default would be to keep current
behavior which expects a normal thermistor.
Now, I just need to figure out where the flags value gets passed into the
driver!
Can you try the attached diff, and set 'flags 1' in your config file?
-------------------------------------------------------------------------
| Paul Goyette | PGP DSS Key fingerprint: | E-mail addresses: |
| Customer Service | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com |
| Network Engineer | 0786 F758 55DE 53BA 7731 | pgoyette at juniper.net |
| Kernel Developer | | pgoyette at netbsd.org |
-------------------------------------------------------------------------
Index: nslm7x.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/nslm7x.c,v
retrieving revision 1.49
diff -u -p -r1.49 nslm7x.c
--- nslm7x.c 13 Oct 2008 12:44:46 -0000 1.49
+++ nslm7x.c 7 Feb 2010 23:04:42 -0000
@@ -1766,7 +1766,7 @@ static int
wb_match(struct lm_softc *sc)
{
const char *model = NULL;
- int banksel, vendid, devid;
+ int banksel, vendid, devid, regval;
aprint_normal("\n");
/* Read vendor ID */
@@ -1790,6 +1790,16 @@ wb_match(struct lm_softc *sc)
case WB_CHIPID_W83627HF:
model = "W83627HF";
lm_setup_sensors(sc, w83627hf_sensors);
+
+ if (device_cfdata(sc->sc_dev)->cf_flags & 1) {
+ /* Switch to 2N3904 mode for the temperature sensors */
+ lm_generic_banksel(sc, WB_BANKSEL_B0);
+ (*sc->lm_writereg)(sc, WB_BANK0_RESVD1, 0x0);
+ regval = (*sc->lm_readreg)(sc, 0x5d);
+ regval |= 0xe;
+ (*sc->lm_writereg)(sc, WB_BANK0_VBAT, regval);
+ lm_generic_banksel(sc, banksel);
+ }
break;
case WB_CHIPID_W83627THF:
model = "W83627THF";
Index: nslm7xvar.h
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/nslm7xvar.h,v
retrieving revision 1.26
diff -u -p -r1.26 nslm7xvar.h
--- nslm7xvar.h 12 Oct 2008 13:17:28 -0000 1.26
+++ nslm7xvar.h 7 Feb 2010 23:04:42 -0000
@@ -87,6 +87,7 @@
/* Bank 0 regs */
#define WB_BANK0_CHIPID 0x58 /* Chip ID */
+#define WB_BANK0_RESVD1 0x59 /* Resvd, bits 6-4 select temp sensor
mode */
#define WB_BANK0_FAN45 0x5c /* Fan 4/5 Divisor Control (W83791D only) */
#define WB_BANK0_VBAT 0x5d /* VBAT Monitor Control */
#define WB_BANK0_FAN4 0xba /* Fan 4 reading (W83791D only) */
Home |
Main Index |
Thread Index |
Old Index