]> git.sur5r.net Git - groeck-it87/blobdiff - it87.c
Makefile: DKMS fix
[groeck-it87] / it87.c
diff --git a/it87.c b/it87.c
index 8a51027b38cfc0b1280f742f855f081108285364..6a30e99ad72bb56ae6d673cfb5a625e738691d80 100644 (file)
--- a/it87.c
+++ b/it87.c
@@ -258,6 +258,10 @@ static bool fix_pwm_polarity;
  * Super-I/O configuration space.
  */
 #define IT87_REG_VID           0x0a
+
+/* Interface Selection register on other chips */
+#define IT87_REG_IFSEL         0x0a
+
 /*
  * The IT8705F and IT8712F earlier than revision 0x08 use register 0x0b
  * for fan divisors. Later IT8712F revisions must use 16-bit tachometer
@@ -1465,11 +1469,12 @@ static int get_temp_type(struct it87_data *data, int index)
        if (type)
                return type;
 
-       /* Dectect PECI vs. AMDTSI if possible */
+       /* Dectect PECI vs. AMDTSI */
        ttype = 6;
-       if ((has_temp_peci(data, index)) && data->type != it8721) {
-               extra = data->read(data, 0x98); /* PCH/AMDTSI host status */
-               if (extra & BIT(6))
+       if ((has_temp_peci(data, index)) || data->type == it8721 ||
+           data->type == it8720) {
+               extra = data->read(data, IT87_REG_IFSEL);
+               if ((extra & 0x70) == 0x40)
                        ttype = 5;
        }
 
@@ -3944,6 +3949,17 @@ static int it87_probe(struct platform_device *pdev)
        /* Initialize register pointers */
        it87_init_regs(pdev);
 
+       /*
+        * We need to disable SMBus before we can read any registers in
+        * the envmon address space, even if it is for chip identification
+        * purposes. If the chip has SMBus client support, it likely also has
+        * multi-page envmon registers, so we have to set the page anyway
+        * before accessing those registers. Kind of a chicken-and-egg
+        * problem.
+        * Fortunately, the chip was already identified through the SIO
+        * address space, only recent chips are affected, and this is just
+        * an additional safeguard.
+        */
        err = smbus_disable(data);
        if (err)
                return err;
@@ -4247,6 +4263,7 @@ module_param(fix_pwm_polarity, bool, 0000);
 MODULE_PARM_DESC(fix_pwm_polarity,
                 "Force PWM polarity to active high (DANGEROUS)");
 MODULE_LICENSE("GPL");
+MODULE_VERSION(IT87_DRIVER_VERSION);
 
 module_init(sm_it87_init);
 module_exit(sm_it87_exit);