Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ic W83781D: Explicitely reselect bank0 before using ...



details:   https://anonhg.NetBSD.org/src/rev/a2404ee2b9ab
branches:  trunk
changeset: 495675:a2404ee2b9ab
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Wed Aug 02 22:20:41 2000 +0000

description:
W83781D: Explicitely reselect bank0 before using "value RAM" registers.
Hopefully this will make the W83781D works.
Also use common functions to set up fan & temp info[] & sensors[] for
the W83781D.

diffstat:

 sys/dev/ic/nslm7x.c |  22 +++++++++-------------
 1 files changed, 9 insertions(+), 13 deletions(-)

diffs (53 lines):

diff -r 49bcc1a2e3d3 -r a2404ee2b9ab sys/dev/ic/nslm7x.c
--- a/sys/dev/ic/nslm7x.c       Wed Aug 02 21:52:08 2000 +0000
+++ b/sys/dev/ic/nslm7x.c       Wed Aug 02 22:20:41 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nslm7x.c,v 1.8 2000/08/02 21:50:37 bouyer Exp $ */
+/*     $NetBSD: nslm7x.c,v 1.9 2000/08/02 22:20:41 bouyer Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -309,8 +309,6 @@
        switch(j) {
        case WB_CHIPID_83781:
                printf(": W83781D\n");
-               sc->numsensors = WB83781_NUM_SENSORS;
-               sc->refresh_sensor_data = wb781_refresh_sensor_data;
 
                for (i = 0; i < 7; ++i) {
                        sc->sensors[i].units = sc->info[i].units =
@@ -326,17 +324,11 @@
                sc->info[5].rfact = (int)((210.0 / 60.4) * 10000);
                sc->info[6].rfact = (int)(( 90.9 / 60.4) * 10000);
 
-               for (i = 7; i < 10; ++i) {
-                       sc->sensors[i].units = sc->info[i].units =
-                           ENVSYS_STEMP;
-                       sprintf(sc->info[i].desc, "Temp%d", i - 6);
-               }
+               setup_temp(sc, 7, 3);
+               setup_fan(sc, 10, 3);
 
-               for (i = 10; i < 13; ++i) {
-                       sc->sensors[i].units = sc->info[i].units =
-                           ENVSYS_SFANRPM;
-                       sprintf(sc->info[i].desc, "Fan %d", i - 9);
-               }
+               sc->numsensors = WB83781_NUM_SENSORS;
+               sc->refresh_sensor_data = wb781_refresh_sensor_data;
                sc->sc_sysmon.sme_streinfo = wb781_streinfo;
                return 1;
        case WB_CHIPID_83697:
@@ -792,8 +784,12 @@
        struct lm_softc *sc;
 {
        /* Refresh our stored data for every sensor */
+       /* we need to reselect bank0 to access common registers */
+       lm_writereg(sc, WB_BANKSEL, WB_BANKSEL_B0);
        generic_svolt(sc, &sc->sensors[0], &sc->info[0]);
+       lm_writereg(sc, WB_BANKSEL, WB_BANKSEL_B0);
        wb_stemp(sc, &sc->sensors[7], 3);
+       lm_writereg(sc, WB_BANKSEL, WB_BANKSEL_B0);
        generic_fanrpm(sc, &sc->sensors[10]);
 }
 



Home | Main Index | Thread Index | Old Index