I have created some code to handle the winbond W83793G. The design of this
chip is different from other winbond chips, so the normal detection method
did not work, as different registers needed to be queried.

I left out the sensor information for the fans because I could not get
them working. If I try and configure them, sysctl does not print out
anything to do with them. I have the same error for the w83792d. I also
left out the chassis intrusion detection because I could not get it
working.

It would be nice if this was committed. I can help on any testing that
needs to be done.

I have only run the diff against 4.1 because that is what I developed it
on.

I just noticed that I forgot to replace 0x0d and 0x0e with constants. They
could be set as follows
#define WB_W83793G_BANK0_VENDID 0x0d
#define WB_W83793G_BANK0_CHIPID 0x0e

Thanks

Jonathan Steel


::::::::::::::
i2c_scan.c.diff
::::::::::::::
--- i2c_scan.c  2007-10-10 19:23:44.000000000 +0000
+++ ../../i2c/i2c_scan.c        2007-10-10 19:34:17.000000000 +0000
@@ -764,7 +764,16 @@
        } else if (name == NULL &&
            (addr & 0x78) == 0x48) {            /* addr 0b1001xxx */
                name = lm75probe();
+       } else if (iicprobe(0x0b) & 0x50) {
+               if ((iicprobe(0x0d) == 0x5c && (iicprobe(0x00) & 0x80)) ||
+                   (iicprobe(0x0d) == 0xa3 && !(iicprobe(0x00) & 0x80))) {
+                       if ( iicprobe(0x0e) == 0x7b ) {
+                               name = "w83793g";
+                       }
+               }
        }
+}
+
 #if 0
        /*
         * XXX This probe needs to be improved; the driver does some
::::::::::::::
lm78.c.diff
::::::::::::::
--- lm78.c      2007-10-10 19:23:29.000000000 +0000
+++ ../../ic/lm78.c     2007-10-10 19:30:49.000000000 +0000
@@ -299,6 +299,25 @@
        { NULL }
 };

+struct lm_sensor w83793g_sensors[] = {
+       /* Voltage */
+       { "VCore A", SENSOR_VOLTS_DC, 0, 0x10, lm_refresh_volt, RFACT_NONE
},
+       { "VCore B", SENSOR_VOLTS_DC, 0, 0x11, lm_refresh_volt, RFACT_NONE
},
+       { "-12V", SENSOR_VOLTS_DC, 0, 0x14, wb_refresh_nvolt, RFACT(232,
56) },
+       { "DIMM", SENSOR_VOLTS_DC, 0, 0x15, wb_refresh_nvolt, RFACT(232,
56) },
+       { "+3.3V", SENSOR_VOLTS_DC, 0, 0x16, lm_refresh_volt, RFACT_NONE },
+       { "+12V", SENSOR_VOLTS_DC, 0, 0x17, lm_refresh_volt, RFACT(28, 10)
},
+       { "-5V", SENSOR_VOLTS_DC, 0, 0x18, wb_refresh_nvolt, RFACT(120,
56) },
+       { "5VSB", SENSOR_VOLTS_DC, 0, 0x19, lm_refresh_volt, RFACT(17, 33)
},
+       { "VBAT", SENSOR_VOLTS_DC, 0, 0x1a, lm_refresh_volt, RFACT_NONE },
+
+       /* Temperature */
+       { "", SENSOR_TEMP, 0, 0x1c, lm_refresh_temp },
+       { "", SENSOR_TEMP, 0, 0x20, lm_refresh_temp },
+
+       { NULL }
+};
+
 struct lm_sensor as99127f_sensors[] = {
        /* Voltage */
        { "VCore A", SENSOR_VOLTS_DC, 0, 0x20, lm_refresh_volt, RFACT_NONE
},
@@ -411,6 +430,42 @@
 {
        int banksel, vendid, devid;

+       /* Read vendor ID for W83793G */
+       banksel = sc->lm_readreg(sc, 0x00);
+       banksel = banksel | 0x80;
+       sc->lm_writereg(sc, 0x00, banksel);
+       vendid = sc->lm_readreg(sc, 0x0d) << 8;
+       banksel = banksel & ~0x80;
+       sc->lm_writereg(sc, 0x00, banksel);
+       vendid |= sc->lm_readreg(sc, 0x0d);
+       DPRINTF((" winbond vend id 0x%x\n", vendid));
+
+       if (vendid == WB_VENDID_WINBOND) {
+               /* Read device/chip ID */
+               sc->chipid = sc->lm_readreg(sc, 0x0e);
+               DPRINTF((" winbond chip id 0x%x\n", sc->chipid));
+               devid = sc->lm_readreg(sc, 0x0f);
+
+               if (sc->chipid == WB_CHIPID_W83793G) {
+                       lm_setup_sensors(sc, w83793g_sensors);
+                       if (devid == 0x11)
+                               printf(": W83793G rev B\n");
+                       else if (devid == 0x12)
+                               printf(": W83793G rev C\n");
+                       else
+                               printf(": W83793G rev 0x%x\n", devid);
+                       goto found;
+               }
+               else {
+                       printf(": unknown Winbond chip (ID 0x%x)\n",
sc->chipid)
;
+                       /* Handle as a standard LM78. */
+                       lm_setup_sensors(sc, lm78_sensors);
+                       sc->refresh_sensor_data = lm_refresh_sensor_data;
+
+                       return 1;
+               }
+       }
+
        /* Read vendor ID */
        banksel = sc->lm_readreg(sc, WB_BANKSEL);
        sc->lm_writereg(sc, WB_BANKSEL, WB_BANKSEL_HBAC);
@@ -489,6 +544,7 @@
                return 1;
        }

+found:
        sc->refresh_sensor_data = wb_refresh_sensor_data;
        return 1;
 }
::::::::::::::
lm78_i2c.c.diff
::::::::::::::
--- lm78_i2c.c  2007-10-10 19:23:44.000000000 +0000
+++ ../../i2c/lm78_i2c.c        2007-10-10 19:34:17.000000000 +0000
@@ -54,7 +54,8 @@
            strcmp(ia->ia_name, "w83782d") == 0 ||
            strcmp(ia->ia_name, "w83783s") == 0 ||
            strcmp(ia->ia_name, "w83791d") == 0 ||
-           strcmp(ia->ia_name, "w83792d") == 0) {
+           strcmp(ia->ia_name, "w83792d") == 0 ||
+           strcmp(ia->ia_name, "w83793g") == 0) {
                return (1);
        }
        /*
::::::::::::::
lm78var.h.diff
::::::::::::::
--- lm78var.h   2007-10-10 19:23:29.000000000 +0000
+++ ../../ic/lm78var.h  2007-10-10 19:30:49.000000000 +0000
@@ -108,6 +108,7 @@
 #define WB_CHIPID_W83791D      0x71
 #define WB_CHIPID_W83791SD     0x72
 #define WB_CHIPID_W83792D      0x7a
+#define WB_CHIPID_W83793G      0x7b
 #define WB_CHIPID_W83637HF     0x80
 #define WB_CHIPID_W83627THF    0x90



--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

Reply via email to