Skip to contentSkip to conversation

hwmon: (it87) Add support for IT8781F, IT8782F, IT8783E/F

PATCH Superseded Guenter Roeck 6 participants 18 messages Mar 8, 2012 – Aug 4, 2015

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Guenter Roeck

author maintainer
#0 lore raw

PATCH 1/1 hwmon: (it87) Add support for IT8781F, IT8782F, IT8783E/F

Assume all three are compatible and have the same functionality.

---
This patch depends on the other pending changes for the it87 driver in my hwmon-next tree.

 Documentation/hwmon/it87 |   24 +++++++----
 drivers/hwmon/it87.c     |   93 ++++++++++++++++++++++++++++++++++++++++++----
 2 files changed, 100 insertions(+), 17 deletions(-)
Documentation/hwmon/it87 +15 -9
index 23b7def..b0c1dcd 100644
@@ -30,6 +30,10 @@ Supported chips:
     Prefix: 'it8728'
     Addresses scanned: from Super I/O config space (8 I/O ports)
     Datasheet: Not publicly available
+  * IT8781F/IT8782F/IT8783E/F
+    Prefix: 'it8783'
+    Addresses scanned: from Super I/O config space (8 I/O ports)
+    Datasheet: Not publicly available
   * SiS950   [clone of IT8705F]
     Prefix: 'it87'
     Addresses scanned: from Super I/O config space (8 I/O ports)
@@ -75,7 +79,8 @@ Description
 -----------
 
 This driver implements support for the IT8705F, IT8712F, IT8716F,
-IT8718F, IT8720F, IT8721F, IT8726F, IT8728F, IT8758E and SiS950 chips.
+IT8718F, IT8720F, IT8721F, IT8726F, IT8728F, IT8758E, IT8781F, IT8782F,
+IT8783E/F, and SiS950 chips.
 
 These chips are 'Super I/O chips', supporting floppy disks, infrared ports,
 joysticks and other miscellaneous stuff. For hardware monitoring, they
@@ -99,11 +104,11 @@ The IT8716F, IT8718F, IT8720F, IT8721F/IT8758E and later IT8712F revisions
 have support for 2 additional fans. The additional fans are supported by the
 driver.
 
-The IT8716F, IT8718F, IT8720F and IT8721F/IT8758E, and late IT8712F and
-IT8705F also have optional 16-bit tachometer counters for fans 1 to 3. This
-is better (no more fan clock divider mess) but not compatible with the older
-chips and revisions. The 16-bit tachometer mode is enabled by the driver when
-one of the above chips is detected.
+The IT8716F, IT8718F, IT8720F and IT8721F/IT8758E, IT8781F, IT8782F, IT8783E/F,
+and late IT8712F and IT8705F also have optional 16-bit tachometer counters for
+fans 1 to 3. This is better (no more fan clock divider mess) but not compatible
+with the older chips and revisions. The 16-bit tachometer mode is enabled by the
+driver when one of the above chips is detected.
 
 The IT8726F is just bit enhanced IT8716F with additional hardware
 for AMD power sequencing. Therefore the chip will appear as IT8716F
@@ -131,9 +136,10 @@ inputs can measure voltages between 0 and 4.08 volts, with a resolution of
 0.016 volt (except IT8721F/IT8758E and IT8728F: 0.012 volt.) The battery
 voltage in8 does not have limit registers.
 
-On the IT8721F/IT8758E, some voltage inputs are internal and scaled inside
-the chip (in7, in8 and optionally in3). The driver handles this transparently
-so user-space doesn't have to care.
+On the IT8721F/IT8758E/IT8781F/IT8782F/IT8783E/F, some voltage inputs are
+internal and scaled inside the chip (in7 (optional for IT8781/2/3), in8 and
+optionally in3). The driver handles this transparently so user-space doesn't
+have to care.
 
 The VID lines (IT8712F/IT8716F/IT8718F/IT8720F) encode the core voltage value:
 the voltage level your processor should work with. This is hardcoded by
drivers/hwmon/it87.c +85 -8

166 lines not on this page · raw message

Signature · 7 lines
1.7.5.4


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Tested-by on v1 1/1
#1 lore raw

2012/3/8 Guenter Roeck <[email protected]>:

Quoted 3 lines

Assume all three are compatible and have the same functionality.

Quoted 249 lines

---
This patch depends on the other pending changes for the it87 driver in my hwmon-next tree.

 Documentation/hwmon/it87 |   24 +++++++----
 drivers/hwmon/it87.c     |   93 ++++++++++++++++++++++++++++++++++++++++++----

 2 files changed, 100 insertions(+), 17 deletions(-)
Documentation/hwmon/it87 +0 -0
index 23b7def..b0c1dcd 100644
@@ -30,6 +30,10 @@ Supported chips:

    Prefix: 'it8728'
    Addresses scanned: from Super I/O config space (8 I/O ports)
    Datasheet: Not publicly available
+  * IT8781F/IT8782F/IT8783E/F
+    Prefix: 'it8783'
+    Addresses scanned: from Super I/O config space (8 I/O ports)
+    Datasheet: Not publicly available
  * SiS950   [clone of IT8705F]
    Prefix: 'it87'
    Addresses scanned: from Super I/O config space (8 I/O ports)

Documentation/hwmon/it87 +0 -0
@@ -75,7 +79,8 @@ Description

 -----------

 This driver implements support for the IT8705F, IT8712F, IT8716F,

Documentation/hwmon/it87 +2 -1
-IT8718F, IT8720F, IT8721F, IT8726F, IT8728F, IT8758E and SiS950 chips.
+IT8718F, IT8720F, IT8721F, IT8726F, IT8728F, IT8758E, IT8781F, IT8782F,
+IT8783E/F, and SiS950 chips.

 These chips are 'Super I/O chips', supporting floppy disks, infrared ports, joysticks and other miscellaneous stuff. For hardware monitoring, they

Documentation/hwmon/it87 +0 -0
@@ -99,11 +104,11 @@ The IT8716F, IT8718F, IT8720F, IT8721F/IT8758E and later IT8712F revisions

 have support for 2 additional fans. The additional fans are supported by the driver.

Documentation/hwmon/it87 +5 -5
-The IT8716F, IT8718F, IT8720F and IT8721F/IT8758E, and late IT8712F and
-IT8705F also have optional 16-bit tachometer counters for fans 1 to 3. This
-is better (no more fan clock divider mess) but not compatible with the older
-chips and revisions. The 16-bit tachometer mode is enabled by the driver when
-one of the above chips is detected.
+The IT8716F, IT8718F, IT8720F and IT8721F/IT8758E, IT8781F, IT8782F, IT8783E/F,
+and late IT8712F and IT8705F also have optional 16-bit tachometer counters for
+fans 1 to 3. This is better (no more fan clock divider mess) but not compatible
+with the older chips and revisions. The 16-bit tachometer mode is enabled by the
+driver when one of the above chips is detected.

 The IT8726F is just bit enhanced IT8716F with additional hardware for AMD power sequencing. Therefore the chip will appear as IT8716F

Documentation/hwmon/it87 +0 -0
@@ -131,9 +136,10 @@ inputs can measure voltages between 0 and 4.08 volts, with a resolution of

 0.016 volt (except IT8721F/IT8758E and IT8728F: 0.012 volt.) The battery voltage in8 does not have limit registers.

Documentation/hwmon/it87 +4 -3
-On the IT8721F/IT8758E, some voltage inputs are internal and scaled inside
-the chip (in7, in8 and optionally in3). The driver handles this transparently
-so user-space doesn't have to care.
+On the IT8721F/IT8758E/IT8781F/IT8782F/IT8783E/F, some voltage inputs are
+internal and scaled inside the chip (in7 (optional for IT8781/2/3), in8 and
+optionally in3). The driver handles this transparently so user-space doesn't
+have to care.

 The VID lines (IT8712F/IT8716F/IT8718F/IT8720F) encode the core voltage value:
 the voltage level your processor should work with. This is hardcoded by

drivers/hwmon/it87.c +10 -1
index 0b204e4..afaf19b 100644
@@ -19,6 +19,9 @@
  *            IT8726F  Super I/O chip w/LPC interface
  *            IT8728F  Super I/O chip w/LPC interface
  *            IT8758E  Super I/O chip w/LPC interface
+ *            IT8781F  Super I/O chip w/LPC interface
+ *            IT8782F  Super I/O chip w/LPC interface
+ *            IT8783E/F Super I/O chip w/LPC interface
  *            Sis950   A clone of the IT8705F
  *
  *  Copyright (C) 2001 Chris Gauthron
@@ -59,7 +62,7 @@
 
  #define DRVNAME "it87"
 
-enum chips { it87, it8712, it8716, it8718, it8720, it8721, it8728 };
+enum chips { it87, it8712, it8716, it8718, it8720, it8721, it8728, it8783 };
 
  static unsigned short force_id;
  module_param(force_id, ushort, 0);
@@ -137,13 +140,19 @@ static inline void superio_exit(void)
  #define IT8721F_DEVID 0x8721
  #define IT8726F_DEVID 0x8726
  #define IT8728F_DEVID 0x8728
+#define IT8781F_DEVID 0x8781
+#define IT8782F_DEVID 0x8782
+#define IT8783E_DEVID 0x8783
  #define IT87_ACT_REG  0x30
  #define IT87_BASE_REG 0x60
 
  /* Logical device 7 registers (IT8712F and later) */
+#define IT87_SIO_GPIO1_REG     0x25
  #define IT87_SIO_GPIO3_REG     0x27
  #define IT87_SIO_GPIO5_REG     0x29
+#define IT87_SIO_PINX1_REG     0x2a    /* Pin selection */
  #define IT87_SIO_PINX2_REG     0x2c    /* Pin selection */
+#define IT87_SIO_SPI_REG       0xef    /* SPI function pin select */
  #define IT87_SIO_VID_REG       0xfc    /* VID value */
  #define IT87_SIO_BEEP_PIN_REG  0xf6    /* Beep pin mapping */
 
@@ -313,8 +322,12 @@ static u8 in_to_reg(const struct it87_data *data, int nr, long val)
                        lsb = 24;

               else
                       lsb = 12;
-       } else
-               lsb = 16;
+       } else {
+               if (data->in_scaled & (1 << nr))
+                       lsb = 32;
+               else
+                       lsb = 16;
+       }

       val = DIV_ROUND_CLOSEST(val, lsb);
       return SENSORS_LIMIT(val, 0, 255);

drivers/hwmon/it87.c +0 -0
@@ -327,8 +340,12 @@ static int in_from_reg(const struct it87_data *data, int nr, int val)
                        return val * 24;

               else
                       return val * 12;
-       } else
-               return val * 16;
+       } else {
+               if (data->in_scaled & (1 << nr))
+                       return val * 32;
+               else
+                       return val * 16;
+       }
 }

 static inline u8 FAN_TO_REG(long rpm, int div)

drivers/hwmon/it87.c +0 -0
@@ -407,7 +424,8 @@ static inline int has_16bit_fans(const struct it87_data *data)
           || data->type == it8718
           || data->type == it8720
           || data->type == it8721
-           || data->type == it8728;
+           || data->type == it8728
+           || data->type == it8783;

 }

 static inline int has_old_autopwm(const struct it87_data *data)

drivers/hwmon/it87.c +0 -0
@@ -1651,6 +1669,11 @@ static int __init it87_find(unsigned short *address,

       case IT8728F_DEVID:
               sio_data->type = it8728;
               break;
+       case IT8781F_DEVID:
+       case IT8782F_DEVID:
+       case IT8783E_DEVID:
+               sio_data->type = it8783;
+               break;
       case 0xffff:    /* No device at all */
               goto exit;
       default:

drivers/hwmon/it87.c +49 -0
@@ -1686,6 +1709,54 @@ static int __init it87_find(unsigned short *address,
                /* The IT8705F has a different LD number for GPIO */
                superio_select(5);
                sio_data->beep_pin = superio_inb(IT87_SIO_BEEP_PIN_REG) & 0x3f;
+       } else if (sio_data->type == it8783) {
+               int reg25, reg27, reg2A, reg2C, regEF;
+
+               sio_data->skip_vid = 1; /* No VID */
+
+               superio_select(GPIO);
+
+               reg25 = superio_inb(IT87_SIO_GPIO1_REG);
+               reg27 = superio_inb(IT87_SIO_GPIO3_REG);
+               reg2A = superio_inb(IT87_SIO_PINX1_REG);
+               reg2C = superio_inb(IT87_SIO_PINX2_REG);
+               regEF = superio_inb(IT87_SIO_SPI_REG);
+
+               /* Check if fan3 is there or not */
+               if ((reg27 & (1 << 0)) || !(reg2C & (1 << 2)))
+                       sio_data->skip_fan |= (1 << 2);
+               if ((reg25 & (1 << 4))
+                   || (!(reg2A & (1 << 1)) && (regEF & (1 << 0))))
+                       sio_data->skip_pwm |= (1 << 2);
+
+               /* Check if fan2 is there or not */
+               if (reg27 & (1 << 7))
+                       sio_data->skip_fan |= (1 << 1);
+               if (reg27 & (1 << 3))
+                       sio_data->skip_pwm |= (1 << 1);
+
+               /* VIN5 */
+               if ((reg27 & (1 << 0)) || (reg2C & (1 << 2)))
+                       ; /* No VIN5 */
+
+               /* VIN6 */
+               if ((reg27 & (1 << 1)) || (reg2C & (1 << 2)))
+                       ; /* No VIN6 */
+
+               /*
+                * VIN7
+                * Does not depend on bit 2 of Reg2C, contrary to datasheet.
+                */
+               if (reg27 & (1 << 2))
+                       ; /* No VIN7 */
+
+               if (reg2C & (1 << 0))
+                       sio_data->internal |= (1 << 0);
+               if (reg2C & (1 << 1))
+                       sio_data->internal |= (1 << 1);
+
+               sio_data->beep_pin = superio_inb(IT87_SIO_BEEP_PIN_REG) & 0x3f;
+
        } else {
                int reg;
 
@@ -1823,6 +1894,7 @@ static int __devinit it87_probe(struct platform_device *pdev)
                "it8720",
                "it8721",
                "it8728",
+               "it8783",
        };
 
        res = platform_get_resource(pdev, IORESOURCE_IO, 0);
@@ -1867,6 +1939,11 @@ static int __devinit it87_probe(struct platform_device *pdev)

                       data->in_scaled |= (1 << 7);    /* in7 is VSB */ if (sio_data->internal & (1 << 2)) data->in_scaled |= (1 << 8);    /* in8 is Vbat */
+       } else if (sio_data->type == it8783) {
+               if (sio_data->internal & (1 << 0))
+                       data->in_scaled |= (1 << 3);    /* in3 is VCC5V */
+               if (sio_data->internal & (1 << 1))
+                       data->in_scaled |= (1 << 7);    /* in7 is VCCH5V */ }

       /* Initialize the IT87 chip */

drivers/hwmon/it87.c +2 -2
@@ -2143,8 +2220,8 @@ static void __devinit it87_init_device(struct platform_device *pdev)
                        it87_write_value(data, IT87_REG_FAN_16BIT,
                                         tmp | 0x07);
                }
-               /* IT8705F only supports three fans. */
-               if (data->type != it87) {
+               /* IT8705F and IT8783E/F only support three fans. */
+               if (data->type != it87 && data->type != it8783) {
                        if (tmp & (1 << 4))

                               data->has_fan |= (1 << 3); /* fan4 enabled */ if (tmp & (1 << 5))
--
1.7.5.4

Quoted 4 lines

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#2 lore raw
In reply to Guenter Roeck
Quoted 4 lines · Guenter Roeck

Assume all three are compatible and have the same functionality.

---

So .. I got Tested-by feedback (thanks), but unfortunately no review feedback. The 3.3 kernel is just around the corner, meaning we might miss the 3.4 commit window, since I won't let this patch go in without
Reviewed-by: or Acked-by:.

Jean, I know you are terribly busy, but is there any chance for you to have a look ?

Thanks,
Guenter

Quoted 234 lines

This patch depends on the other pending changes for the it87 driver in my hwmon-next tree.

 Documentation/hwmon/it87 |   24 +++++++----
 drivers/hwmon/it87.c     |   93 ++++++++++++++++++++++++++++++++++++++++++----
 2 files changed, 100 insertions(+), 17 deletions(-)
Documentation/hwmon/it87 +15 -9
index 23b7def..b0c1dcd 100644
@@ -30,6 +30,10 @@ Supported chips:
     Prefix: 'it8728'
     Addresses scanned: from Super I/O config space (8 I/O ports)
     Datasheet: Not publicly available
+  * IT8781F/IT8782F/IT8783E/F
+    Prefix: 'it8783'
+    Addresses scanned: from Super I/O config space (8 I/O ports)
+    Datasheet: Not publicly available
   * SiS950   [clone of IT8705F]
     Prefix: 'it87'
     Addresses scanned: from Super I/O config space (8 I/O ports)
@@ -75,7 +79,8 @@ Description
 -----------
 
 This driver implements support for the IT8705F, IT8712F, IT8716F,
-IT8718F, IT8720F, IT8721F, IT8726F, IT8728F, IT8758E and SiS950 chips.
+IT8718F, IT8720F, IT8721F, IT8726F, IT8728F, IT8758E, IT8781F, IT8782F,
+IT8783E/F, and SiS950 chips.
 
 These chips are 'Super I/O chips', supporting floppy disks, infrared ports,
 joysticks and other miscellaneous stuff. For hardware monitoring, they
@@ -99,11 +104,11 @@ The IT8716F, IT8718F, IT8720F, IT8721F/IT8758E and later IT8712F revisions
 have support for 2 additional fans. The additional fans are supported by the
 driver.
 
-The IT8716F, IT8718F, IT8720F and IT8721F/IT8758E, and late IT8712F and
-IT8705F also have optional 16-bit tachometer counters for fans 1 to 3. This
-is better (no more fan clock divider mess) but not compatible with the older
-chips and revisions. The 16-bit tachometer mode is enabled by the driver when
-one of the above chips is detected.
+The IT8716F, IT8718F, IT8720F and IT8721F/IT8758E, IT8781F, IT8782F, IT8783E/F,
+and late IT8712F and IT8705F also have optional 16-bit tachometer counters for
+fans 1 to 3. This is better (no more fan clock divider mess) but not compatible
+with the older chips and revisions. The 16-bit tachometer mode is enabled by the
+driver when one of the above chips is detected.
 
 The IT8726F is just bit enhanced IT8716F with additional hardware
 for AMD power sequencing. Therefore the chip will appear as IT8716F
@@ -131,9 +136,10 @@ inputs can measure voltages between 0 and 4.08 volts, with a resolution of
 0.016 volt (except IT8721F/IT8758E and IT8728F: 0.012 volt.) The battery
 voltage in8 does not have limit registers.
 
-On the IT8721F/IT8758E, some voltage inputs are internal and scaled inside
-the chip (in7, in8 and optionally in3). The driver handles this transparently
-so user-space doesn't have to care.
+On the IT8721F/IT8758E/IT8781F/IT8782F/IT8783E/F, some voltage inputs are
+internal and scaled inside the chip (in7 (optional for IT8781/2/3), in8 and
+optionally in3). The driver handles this transparently so user-space doesn't
+have to care.
 
 The VID lines (IT8712F/IT8716F/IT8718F/IT8720F) encode the core voltage value:
 the voltage level your processor should work with. This is hardcoded by
drivers/hwmon/it87.c +83 -6
index 0b204e4..afaf19b 100644
@@ -19,6 +19,9 @@
  *            IT8726F  Super I/O chip w/LPC interface
  *            IT8728F  Super I/O chip w/LPC interface
  *            IT8758E  Super I/O chip w/LPC interface
+ *            IT8781F  Super I/O chip w/LPC interface
+ *            IT8782F  Super I/O chip w/LPC interface
+ *            IT8783E/F Super I/O chip w/LPC interface
  *            Sis950   A clone of the IT8705F
  *
  *  Copyright (C) 2001 Chris Gauthron
@@ -59,7 +62,7 @@
 
 #define DRVNAME "it87"
 
-enum chips { it87, it8712, it8716, it8718, it8720, it8721, it8728 };
+enum chips { it87, it8712, it8716, it8718, it8720, it8721, it8728, it8783 };
 
 static unsigned short force_id;
 module_param(force_id, ushort, 0);
@@ -137,13 +140,19 @@ static inline void superio_exit(void)
 #define IT8721F_DEVID 0x8721
 #define IT8726F_DEVID 0x8726
 #define IT8728F_DEVID 0x8728
+#define IT8781F_DEVID 0x8781
+#define IT8782F_DEVID 0x8782
+#define IT8783E_DEVID 0x8783
 #define IT87_ACT_REG  0x30
 #define IT87_BASE_REG 0x60
 
 /* Logical device 7 registers (IT8712F and later) */
+#define IT87_SIO_GPIO1_REG	0x25
 #define IT87_SIO_GPIO3_REG	0x27
 #define IT87_SIO_GPIO5_REG	0x29
+#define IT87_SIO_PINX1_REG	0x2a	/* Pin selection */
 #define IT87_SIO_PINX2_REG	0x2c	/* Pin selection */
+#define IT87_SIO_SPI_REG	0xef	/* SPI function pin select */
 #define IT87_SIO_VID_REG	0xfc	/* VID value */
 #define IT87_SIO_BEEP_PIN_REG	0xf6	/* Beep pin mapping */
 
@@ -313,8 +322,12 @@ static u8 in_to_reg(const struct it87_data *data, int nr, long val)
 			lsb = 24;
 		else
 			lsb = 12;
-	} else
-		lsb = 16;
+	} else {
+		if (data->in_scaled & (1 << nr))
+			lsb = 32;
+		else
+			lsb = 16;
+	}
 
 	val = DIV_ROUND_CLOSEST(val, lsb);
 	return SENSORS_LIMIT(val, 0, 255);
@@ -327,8 +340,12 @@ static int in_from_reg(const struct it87_data *data, int nr, int val)
 			return val * 24;
 		else
 			return val * 12;
-	} else
-		return val * 16;
+	} else {
+		if (data->in_scaled & (1 << nr))
+			return val * 32;
+		else
+			return val * 16;
+	}
 }
 
 static inline u8 FAN_TO_REG(long rpm, int div)
@@ -407,7 +424,8 @@ static inline int has_16bit_fans(const struct it87_data *data)
 	    || data->type = it8718
 	    || data->type = it8720
 	    || data->type = it8721
-	    || data->type = it8728;
+	    || data->type = it8728
+	    || data->type = it8783;
 }
 
 static inline int has_old_autopwm(const struct it87_data *data)
@@ -1651,6 +1669,11 @@ static int __init it87_find(unsigned short *address,
 	case IT8728F_DEVID:
 		sio_data->type = it8728;
 		break;
+	case IT8781F_DEVID:
+	case IT8782F_DEVID:
+	case IT8783E_DEVID:
+		sio_data->type = it8783;
+		break;
 	case 0xffff:	/* No device at all */
 		goto exit;
 	default:
@@ -1686,6 +1709,54 @@ static int __init it87_find(unsigned short *address,
 		/* The IT8705F has a different LD number for GPIO */
 		superio_select(5);
 		sio_data->beep_pin = superio_inb(IT87_SIO_BEEP_PIN_REG) & 0x3f;
+	} else if (sio_data->type = it8783) {
+		int reg25, reg27, reg2A, reg2C, regEF;
+
+		sio_data->skip_vid = 1;	/* No VID */
+
+		superio_select(GPIO);
+
+		reg25 = superio_inb(IT87_SIO_GPIO1_REG);
+		reg27 = superio_inb(IT87_SIO_GPIO3_REG);
+		reg2A = superio_inb(IT87_SIO_PINX1_REG);
+		reg2C = superio_inb(IT87_SIO_PINX2_REG);
+		regEF = superio_inb(IT87_SIO_SPI_REG);
+
+		/* Check if fan3 is there or not */
+		if ((reg27 & (1 << 0)) || !(reg2C & (1 << 2)))
+			sio_data->skip_fan |= (1 << 2);
+		if ((reg25 & (1 << 4))
+		    || (!(reg2A & (1 << 1)) && (regEF & (1 << 0))))
+			sio_data->skip_pwm |= (1 << 2);
+
+		/* Check if fan2 is there or not */
+		if (reg27 & (1 << 7))
+			sio_data->skip_fan |= (1 << 1);
+		if (reg27 & (1 << 3))
+			sio_data->skip_pwm |= (1 << 1);
+
+		/* VIN5 */
+		if ((reg27 & (1 << 0)) || (reg2C & (1 << 2)))
+			; /* No VIN5 */
+
+		/* VIN6 */
+		if ((reg27 & (1 << 1)) || (reg2C & (1 << 2)))
+			; /* No VIN6 */
+
+		/*
+		 * VIN7
+		 * Does not depend on bit 2 of Reg2C, contrary to datasheet.
+		 */
+		if (reg27 & (1 << 2))
+			; /* No VIN7 */
+
+		if (reg2C & (1 << 0))
+			sio_data->internal |= (1 << 0);
+		if (reg2C & (1 << 1))
+			sio_data->internal |= (1 << 1);
+
+		sio_data->beep_pin = superio_inb(IT87_SIO_BEEP_PIN_REG) & 0x3f;
+
 	} else {
 		int reg;
 
@@ -1823,6 +1894,7 @@ static int __devinit it87_probe(struct platform_device *pdev)
 		"it8720",
 		"it8721",
 		"it8728",
+		"it8783",
 	};
 
 	res = platform_get_resource(pdev, IORESOURCE_IO, 0);
@@ -1867,6 +1939,11 @@ static int __devinit it87_probe(struct platform_device *pdev)
 			data->in_scaled |= (1 << 7);	/* in7 is VSB */
 		if (sio_data->internal & (1 << 2))
 			data->in_scaled |= (1 << 8);	/* in8 is Vbat */
+	} else if (sio_data->type = it8783) {
+		if (sio_data->internal & (1 << 0))
+			data->in_scaled |= (1 << 3);	/* in3 is VCC5V */
+		if (sio_data->internal & (1 << 1))
+			data->in_scaled |= (1 << 7);	/* in7 is VCCH5V */
 	}
 
 	/* Initialize the IT87 chip */

drivers/hwmon/it87.c static void __devinit it87_init_device(struct platform_device *pdev) · line 2227

Quoted 10 lines
drivers/hwmon/it87.c +2 -2
@@ -2143,8 +2220,8 @@ static void __devinit it87_init_device(struct platform_device *pdev)
 			it87_write_value(data, IT87_REG_FAN_16BIT,
 					 tmp | 0x07);
 		}
-		/* IT8705F only supports three fans. */
-		if (data->type != it87) {
+		/* IT8705F and IT8783E/F only support three fans. */
+		if (data->type != it87 && data->type != it8783) {
 			if (tmp & (1 << 4))
 				data->has_fan |= (1 << 3); /* fan4 enabled */
 			if (tmp & (1 << 5))

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#3 lore raw
In reply to Guenter Roeck
Quoted 6 lines · Guenter Roeck
Quoted 4 lines · Guenter Roeck

Assume all three are compatible and have the same functionality.

---

Quoted 7 lines

So .. I got Tested-by feedback (thanks), but unfortunately no review feedback. The 3.3 kernel is just around the corner, meaning we might miss the 3.4 commit window, since I won't let this patch go in without
Reviewed-by: or Acked-by:.

Jean, I know you are terribly busy, but is there any chance for you to have a look ?

That's on my to-do list, but not before next Monday I'm afraid :(

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#4 lore raw
In reply to Guenter Roeck
Quoted 5 lines · Bjoern Gerhart

2012/3/8 Guenter Roeck <[email protected]>:

Quoted 3 lines

Assume all three are compatible and have the same functionality.

Care to share the output of "sensors" with us?

Thanks,

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#5 lore raw
In reply to Guenter Roeck

Hi Guenter,

Quoted 1 line · Guenter Roeck

Assume all three are compatible and have the same functionality.

A dangerous assumption, if you ask me. The pin selection part in particular is tricky and I wouldn't be surprised if it differs between these chips. I don't think anyone asked for IT8781F or IT8782F support yet, so we could play it safe and ignore these chips for now?

Quoted 4 lines

---
This patch depends on the other pending changes for the it87 driver in my hwmon-next tree.

Review:

Quoted 47 lines
 Documentation/hwmon/it87 |   24 +++++++----
 drivers/hwmon/it87.c     |   93 ++++++++++++++++++++++++++++++++++++++++++----
 2 files changed, 100 insertions(+), 17 deletions(-)
Documentation/hwmon/it87 +11 -6
index 23b7def..b0c1dcd 100644
@@ -30,6 +30,10 @@ Supported chips:
     Prefix: 'it8728'
     Addresses scanned: from Super I/O config space (8 I/O ports)
     Datasheet: Not publicly available
+  * IT8781F/IT8782F/IT8783E/F
+    Prefix: 'it8783'
+    Addresses scanned: from Super I/O config space (8 I/O ports)
+    Datasheet: Not publicly available
   * SiS950   [clone of IT8705F]
     Prefix: 'it87'
     Addresses scanned: from Super I/O config space (8 I/O ports)
@@ -75,7 +79,8 @@ Description
 -----------
 
 This driver implements support for the IT8705F, IT8712F, IT8716F,
-IT8718F, IT8720F, IT8721F, IT8726F, IT8728F, IT8758E and SiS950 chips.
+IT8718F, IT8720F, IT8721F, IT8726F, IT8728F, IT8758E, IT8781F, IT8782F,
+IT8783E/F, and SiS950 chips.
 
 These chips are 'Super I/O chips', supporting floppy disks, infrared ports,
 joysticks and other miscellaneous stuff. For hardware monitoring, they
@@ -99,11 +104,11 @@ The IT8716F, IT8718F, IT8720F, IT8721F/IT8758E and later IT8712F revisions
 have support for 2 additional fans. The additional fans are supported by the
 driver.
 
-The IT8716F, IT8718F, IT8720F and IT8721F/IT8758E, and late IT8712F and
-IT8705F also have optional 16-bit tachometer counters for fans 1 to 3. This
-is better (no more fan clock divider mess) but not compatible with the older
-chips and revisions. The 16-bit tachometer mode is enabled by the driver when
-one of the above chips is detected.
+The IT8716F, IT8718F, IT8720F and IT8721F/IT8758E, IT8781F, IT8782F, IT8783E/F,
+and late IT8712F and IT8705F also have optional 16-bit tachometer counters for
+fans 1 to 3. This is better (no more fan clock divider mess) but not compatible
+with the older chips and revisions. The 16-bit tachometer mode is enabled by the
+driver when one of the above chips is detected.
 
 The IT8726F is just bit enhanced IT8716F with additional hardware
 for AMD power sequencing. Therefore the chip will appear as IT8716F

Documentation/hwmon/it87 inputs can measure voltages between 0 and 4.08 volts, with a resolution of · line 139

Quoted 7 lines
Documentation/hwmon/it87 +1 -3
@@ -131,9 +136,10 @@ inputs can measure voltages between 0 and 4.08 volts, with a resolution of
 0.016 volt (except IT8721F/IT8758E and IT8728F: 0.012 volt.) The battery
 voltage in8 does not have limit registers.
 
-On the IT8721F/IT8758E, some voltage inputs are internal and scaled inside
-the chip (in7, in8 and optionally in3). The driver handles this transparently
-so user-space doesn't have to care.
+On the IT8721F/IT8758E/IT8781F/IT8782F/IT8783E/F, some voltage inputs are

So far we used "/" to separate chip names which have the same device ID so they can't be differentiated by the driver. For really different chips we use a comma instead.

Documentation/hwmon/it87 inputs can measure voltages between 0 and 4.08 volts, with a resolution of · line 140

Quoted 1 line
Documentation/hwmon/it87 +1 -0
+internal and scaled inside the chip (in7 (optional for IT8781/2/3), in8 and

I prefer when device names are spelled completely (except maybe the suffix) rather than shortened that way. This allows the users to grep quickly for their device name and find all occurrences right away.

Quoted 66 lines
Documentation/hwmon/it87 +2 -0
+optionally in3). The driver handles this transparently so user-space doesn't
+have to care.
 
 The VID lines (IT8712F/IT8716F/IT8718F/IT8720F) encode the core voltage value:
 the voltage level your processor should work with. This is hardcoded by
drivers/hwmon/it87.c +16 -3
index 0b204e4..afaf19b 100644
@@ -19,6 +19,9 @@
  *            IT8726F  Super I/O chip w/LPC interface
  *            IT8728F  Super I/O chip w/LPC interface
  *            IT8758E  Super I/O chip w/LPC interface
+ *            IT8781F  Super I/O chip w/LPC interface
+ *            IT8782F  Super I/O chip w/LPC interface
+ *            IT8783E/F Super I/O chip w/LPC interface
  *            Sis950   A clone of the IT8705F
  *
  *  Copyright (C) 2001 Chris Gauthron
@@ -59,7 +62,7 @@
 
 #define DRVNAME "it87"
 
-enum chips { it87, it8712, it8716, it8718, it8720, it8721, it8728 };
+enum chips { it87, it8712, it8716, it8718, it8720, it8721, it8728, it8783 };
 
 static unsigned short force_id;
 module_param(force_id, ushort, 0);
@@ -137,13 +140,19 @@ static inline void superio_exit(void)
 #define IT8721F_DEVID 0x8721
 #define IT8726F_DEVID 0x8726
 #define IT8728F_DEVID 0x8728
+#define IT8781F_DEVID 0x8781
+#define IT8782F_DEVID 0x8782
+#define IT8783E_DEVID 0x8783
 #define IT87_ACT_REG  0x30
 #define IT87_BASE_REG 0x60
 
 /* Logical device 7 registers (IT8712F and later) */
+#define IT87_SIO_GPIO1_REG	0x25
 #define IT87_SIO_GPIO3_REG	0x27
 #define IT87_SIO_GPIO5_REG	0x29
+#define IT87_SIO_PINX1_REG	0x2a	/* Pin selection */
 #define IT87_SIO_PINX2_REG	0x2c	/* Pin selection */
+#define IT87_SIO_SPI_REG	0xef	/* SPI function pin select */
 #define IT87_SIO_VID_REG	0xfc	/* VID value */
 #define IT87_SIO_BEEP_PIN_REG	0xf6	/* Beep pin mapping */
 
@@ -313,8 +322,12 @@ static u8 in_to_reg(const struct it87_data *data, int nr, long val)
 			lsb = 24;
 		else
 			lsb = 12;
-	} else
-		lsb = 16;
+	} else {
+		if (data->in_scaled & (1 << nr))
+			lsb = 32;
+		else
+			lsb = 16;
+	}
 
 	val = DIV_ROUND_CLOSEST(val, lsb);
 	return SENSORS_LIMIT(val, 0, 255);
@@ -327,8 +340,12 @@ static int in_from_reg(const struct it87_data *data, int nr, int val)
 			return val * 24;
 		else

drivers/hwmon/it87.c static int in_from_reg(const struct it87_data *data, int nr, int val) · line 349

Quoted 10 lines
drivers/hwmon/it87.c +6 -2
 			return val * 12;
-	} else
-		return val * 16;
+	} else {
+		if (data->in_scaled & (1 << nr))
+			return val * 32;
+		else
+			return val * 16;
+	}
 }

I think both functions can then be rewritten more efficiently. I'll do some testing and send a patch later.

drivers/hwmon/it87.c static inline int has_16bit_fans(const struct it87_data *data) · line 429

Quoted 10 lines
drivers/hwmon/it87.c +2 -1
 static inline u8 FAN_TO_REG(long rpm, int div)
@@ -407,7 +424,8 @@ static inline int has_16bit_fans(const struct it87_data *data)
 	    || data->type = it8718
 	    || data->type = it8720
 	    || data->type = it8721
-	    || data->type = it8728;
+	    || data->type = it8728
+	    || data->type = it8783;
 }

As the list grows longer, it might make sense to cache the result of this function into struct it87_data itself. Right now it's called twice in it87_update_device() amongst other. Separate patch, obviously...

drivers/hwmon/it87.c static int __init it87_find(unsigned short *address, · line 1675

Quoted 10 lines
drivers/hwmon/it87.c +4 -0
 static inline int has_old_autopwm(const struct it87_data *data)
@@ -1651,6 +1669,11 @@ static int __init it87_find(unsigned short *address,
 	case IT8728F_DEVID:
 		sio_data->type = it8728;
 		break;
+	case IT8781F_DEVID:
+	case IT8782F_DEVID:
+	case IT8783E_DEVID:
+		sio_data->type = it8783;

I'm curious why you decided to go with a single chip type for all 3 devices. Having separate prefixes would seem to have some value, from a supportability perspective is nothing else.

Quoted 14 lines
drivers/hwmon/it87.c +7 -0
+		break;
 	case 0xffff:	/* No device at all */
 		goto exit;
 	default:
@@ -1686,6 +1709,54 @@ static int __init it87_find(unsigned short *address,
 		/* The IT8705F has a different LD number for GPIO */
 		superio_select(5);
 		sio_data->beep_pin = superio_inb(IT87_SIO_BEEP_PIN_REG) & 0x3f;
+	} else if (sio_data->type = it8783) {
+		int reg25, reg27, reg2A, reg2C, regEF;
+
+		sio_data->skip_vid = 1;	/* No VID */
+
+		superio_select(GPIO);

drivers/hwmon/it87.c static int __init it87_find(unsigned short *address, · line 1727

Quoted 10 lines
drivers/hwmon/it87.c +10 -0
+
+		reg25 = superio_inb(IT87_SIO_GPIO1_REG);
+		reg27 = superio_inb(IT87_SIO_GPIO3_REG);
+		reg2A = superio_inb(IT87_SIO_PINX1_REG);
+		reg2C = superio_inb(IT87_SIO_PINX2_REG);
+		regEF = superio_inb(IT87_SIO_SPI_REG);
+
+		/* Check if fan3 is there or not */
+		if ((reg27 & (1 << 0)) || !(reg2C & (1 << 2)))
+			sio_data->skip_fan |= (1 << 2);

I'm a bit skeptical how a single pin can be FAN_TAC3 and SIN6 at the same time...

drivers/hwmon/it87.c static int __init it87_find(unsigned short *address, · line 1740

Quoted 13 lines
drivers/hwmon/it87.c +13 -0
+		if ((reg25 & (1 << 4))
+		    || (!(reg2A & (1 << 1)) && (regEF & (1 << 0))))
+			sio_data->skip_pwm |= (1 << 2);
+
+		/* Check if fan2 is there or not */
+		if (reg27 & (1 << 7))
+			sio_data->skip_fan |= (1 << 1);
+		if (reg27 & (1 << 3))
+			sio_data->skip_pwm |= (1 << 1);
+
+		/* VIN5 */
+		if ((reg27 & (1 << 0)) || (reg2C & (1 << 2)))
+			; /* No VIN5 */

Obviously we can't leave things that way. I presume we want to add a skip_in field to struct it87_sio_data and a has_in field to struct it87_data, same we have for fans? I'm fine having this as a separate patch, but both should go upstream together.

drivers/hwmon/it87.c static int __init it87_find(unsigned short *address, · line 1748

Quoted 8 lines
drivers/hwmon/it87.c +8 -0
+
+		/* VIN6 */
+		if ((reg27 & (1 << 1)) || (reg2C & (1 << 2)))
+			; /* No VIN6 */
+
+		/*
+		 * VIN7
+		 * Does not depend on bit 2 of Reg2C, contrary to datasheet.

Datasheet is pretty confusing for this configuration bit. If the pin can be used for a 3rd function ("SO") there must be a extra bit to check somewhere... Hopefully it won't matter much as I expect vin7 to be internal on most systems.

drivers/hwmon/it87.c static int __init it87_find(unsigned short *address, · line 1751

Quoted 3 lines
drivers/hwmon/it87.c +3 -0
+		 */
+		if (reg27 & (1 << 2))
+			; /* No VIN7 */

Unless vin7 is internal, in which case the test above doesn't matter.

Quoted 20 lines
drivers/hwmon/it87.c +9 -0
+
+		if (reg2C & (1 << 0))
+			sio_data->internal |= (1 << 0);
+		if (reg2C & (1 << 1))
+			sio_data->internal |= (1 << 1);
+
+		sio_data->beep_pin = superio_inb(IT87_SIO_BEEP_PIN_REG) & 0x3f;
+
 	} else {
 		int reg;
 
@@ -1823,6 +1894,7 @@ static int __devinit it87_probe(struct platform_device *pdev)
 		"it8720",
 		"it8721",
 		"it8728",
+		"it8783",
 	};
 
 	res = platform_get_resource(pdev, IORESOURCE_IO, 0);

drivers/hwmon/it87.c static int __devinit it87_probe(struct platform_device *pdev) · line 1946

Quoted 8 lines
drivers/hwmon/it87.c +5 -0
@@ -1867,6 +1939,11 @@ static int __devinit it87_probe(struct platform_device *pdev)
 			data->in_scaled |= (1 << 7);	/* in7 is VSB */
 		if (sio_data->internal & (1 << 2))
 			data->in_scaled |= (1 << 8);	/* in8 is Vbat */
+	} else if (sio_data->type = it8783) {
+		if (sio_data->internal & (1 << 0))
+			data->in_scaled |= (1 << 3);	/* in3 is VCC5V */
+		if (sio_data->internal & (1 << 1))
+			data->in_scaled |= (1 << 7);	/* in7 is VCCH5V */

The "Features" page says that Vbat is measured internally. If this true, then it is necessarily always scaled too. This should let you merge both blocks.

Quoted 4 lines
drivers/hwmon/it87.c +0 -0
 	}
 
 	/* Initialize the IT87 chip */

drivers/hwmon/it87.c static void __devinit it87_init_device(struct platform_device *pdev) · line 2227

Quoted 10 lines
drivers/hwmon/it87.c +2 -2
@@ -2143,8 +2220,8 @@ static void __devinit it87_init_device(struct platform_device *pdev)
 			it87_write_value(data, IT87_REG_FAN_16BIT,
 					 tmp | 0x07);
 		}
-		/* IT8705F only supports three fans. */
-		if (data->type != it87) {
+		/* IT8705F and IT8783E/F only support three fans. */
+		if (data->type != it87 && data->type != it8783) {
 			if (tmp & (1 << 4))
 				data->has_fan |= (1 << 3); /* fan4 enabled */
 			if (tmp & (1 << 5))

The rest looks reasonable, although to be completely sure, a throughout reading of the datasheet would be needed, for which I unfortunately do not have the time.

Good work!

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#6 lore raw
In reply to Guenter Roeck

Hi Jean,

Am 23.03.2012 um 22:02 schrieb Jean Delvare:

Quoted 9 lines · Bjoern Gerhart
Quoted 5 lines

2012/3/8 Guenter Roeck <[email protected]>:

Quoted 3 lines

Assume all three are compatible and have the same functionality.

Care to share the output of "sensors" with us?

Sure. To be more precise, I tested with an IT8783 chip configured and wired by the hardware team at the company I'm working for on a proprietary mainboard. With the sensors.conf created therefore, the sensors output looks like this:

[root@localhost ~]# LANG=C sensors
it8783-isa-0a10
Adapter: ISA adapter
CPU Core: +1.15 V (min = +0.70 V, max = +1.70 V)

+1.50V:      +1.50 V  (min =  +1.10 V, max =  +1.90 V)
+3.30V:      +3.38 V  (min =  +2.70 V, max =  +4.00 V)
+12.0V:     +12.16 V  (min = +10.69 V, max = +13.70 V)
-12.0V:     -11.95 V  (min = -13.68 V, max = -10.30 V)
+1.10V:      +1.12 V  (min =  +0.90 V, max =  +1.22 V)
VBat:        +3.09 V
Fan1:       1662 RPM  (min =  300 RPM)
PSU:        1245 RPM  (min =  500 RPM)
Board T.:    +30.0 C  (low  =  +0.0 C, high = +55.0 C)  sensor = thermal diode
CPU T.:      +47.0 C  (low  =  +0.0 C, high = +63.0 C)  sensor = thermal diode

coretemp-isa-0000

Adapter: ISA adapter
Core 0:      +40.0 C  (high = +86.0 C, crit = +100.0 C)
Core 1:      +43.0 C  (high = +86.0 C, crit = +100.0 C)

These are about the same values as the "Hardware Monitor" section at the BIOS setup shows also. So all values look reasonable.

In general, for future Tested-bys: does it make sense to append a kind of test report (like the above one) directly after the Tested-by statement, or should it be located in a separate mail?

Björn

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#7 lore raw
In reply to Guenter Roeck

Hi Jean,

Quoted 10 lines · Jean Delvare

Hi Guenter,

Quoted 1 line · Guenter Roeck

Assume all three are compatible and have the same functionality.

A dangerous assumption, if you ask me. The pin selection part in particular is tricky and I wouldn't be surprised if it differs between these chips. I don't think anyone asked for IT8781F or IT8782F support yet, so we could play it safe and ignore these chips for now?

Agreed, especially since I stumbled over a datasheet for IT8782F, and it turns out to be more closely related to IT8721F than to IT8783F.

I'll drop IT8781F and keep the other two.

[ ... ]

Quoted 9 lines

Documentation/hwmon/it87 inputs can measure voltages between 0 and 4.08 volts, with a resolution of · line 139

Quoted 4 lines
Documentation/hwmon/it87 +1 -3
-On the IT8721F/IT8758E, some voltage inputs are internal and scaled inside
-the chip (in7, in8 and optionally in3). The driver handles this transparently
-so user-space doesn't have to care.
+On the IT8721F/IT8758E/IT8781F/IT8782F/IT8783E/F, some voltage inputs are

So far we used "/" to separate chip names which have the same device ID so they can't be differentiated by the driver. For really different chips we use a comma instead.

Quoted 6 lines
Quoted 1 line

+internal and scaled inside the chip (in7 (optional for IT8781/2/3), in8 and

I prefer when device names are spelled completely (except maybe the suffix) rather than shortened that way. This allows the users to grep quickly for their device name and find all occurrences right away.

ok.

Quoted 12 lines

drivers/hwmon/it87.c static int in_from_reg(const struct it87_data *data, int nr, int val) · line 349

Quoted 11 lines
              else
                      return val * 12;
drivers/hwmon/it87.c +6 -2
-     } else
-             return val * 16;
+     } else {
+             if (data->in_scaled & (1 << nr))
+                     return val * 32;
+             else
+                     return val * 16;
+     }
 }
Quoted 3 lines

I think both functions can then be rewritten more efficiently. I'll do some testing and send a patch later.

I know, I was a bit lazy ;).

How about the following ?

static int adc_lsb(const struct it87_data *data)

{
	int lsb = has_12mv_adc(data) ? 12 : 16;
	if (data->in_scaled & (1 << nr))
		lsb <<= 1;
	return lsb;
}

and:

	val = DIV_ROUND_CLOSEST(val, adc_lsb(data));

and:

	return val * adc_lsb(data);
Quoted 15 lines

drivers/hwmon/it87.c static inline int has_16bit_fans(const struct it87_data *data) · line 429

Quoted 10 lines

static inline u8 FAN_TO_REG(long rpm, int div)

drivers/hwmon/it87.c +2 -1
@@ -407,7 +424,8 @@ static inline int has_16bit_fans(const struct it87_data *data)
          || data->type = it8718
          || data->type = it8720
          || data->type = it8721
-         || data->type = it8728;
+         || data->type = it8728
+         || data->type = it8783;
 }

As the list grows longer, it might make sense to cache the result of this function into struct it87_data itself. Right now it's called twice in it87_update_device() amongst other. Separate patch, obviously...

Agreed.

Quoted 15 lines

drivers/hwmon/it87.c static int __init it87_find(unsigned short *address, · line 1675

Quoted 10 lines
drivers/hwmon/it87.c +4 -0
 static inline int has_old_autopwm(const struct it87_data *data)
@@ -1651,6 +1669,11 @@ static int __init it87_find(unsigned short *address,
      case IT8728F_DEVID:
              sio_data->type = it8728;
              break;
+     case IT8781F_DEVID:
+     case IT8782F_DEVID:
+     case IT8783E_DEVID:
+             sio_data->type = it8783;

I'm curious why you decided to go with a single chip type for all 3 devices. Having separate prefixes would seem to have some value, from a supportability perspective is nothing else.

No special reason, and it was wrong anyway since the IT8781F does not have 6 uarts per its shortened data sheet and thus presumably does not multiplex the respective pins. And IT8782F is all different.

I'll split it8782 and it8783 and drop IT8781F support until we get a daatasheet.

Quoted 15 lines
Quoted 15 lines
drivers/hwmon/it87.c +11 -0
@@ -1686,6 +1709,54 @@ static int __init it87_find(unsigned short *address,
              /* The IT8705F has a different LD number for GPIO */
              superio_select(5);
              sio_data->beep_pin = superio_inb(IT87_SIO_BEEP_PIN_REG) & 0x3f;
+     } else if (sio_data->type = it8783) {
+             int reg25, reg27, reg2A, reg2C, regEF;
+
+             sio_data->skip_vid = 1; /* No VID */
+
+             superio_select(GPIO);
+
+             reg25 = superio_inb(IT87_SIO_GPIO1_REG);
+             reg27 = superio_inb(IT87_SIO_GPIO3_REG);
+             reg2A = superio_inb(IT87_SIO_PINX1_REG);
+             reg2C = superio_inb(IT87_SIO_PINX2_REG);
Quoted 9 lines

drivers/hwmon/it87.c static int __init it87_find(unsigned short *address, · line 1727

Quoted 5 lines
drivers/hwmon/it87.c +5 -0
+             regEF = superio_inb(IT87_SIO_SPI_REG);
+
+             /* Check if fan3 is there or not */
+             if ((reg27 & (1 << 0)) || !(reg2C & (1 << 2)))
+                     sio_data->skip_fan |= (1 << 2);

I'm a bit skeptical how a single pin can be FAN_TAC3 and SIN6 at the same time...

Issue here is that the pin is also multiplexed to VIN5 (see below), and it is kind of difficult to determine how GP30, VIN5, FAN_TAC3, and SIN6 are selected with only two configuration bits (one of which selects GP30). Maybe there is another configuration bit somewhere, but I did not find it.

Quoted 10 lines
Quoted 10 lines
drivers/hwmon/it87.c +10 -0
+             if ((reg25 & (1 << 4))
+                 || (!(reg2A & (1 << 1)) && (regEF & (1 << 0))))
+                     sio_data->skip_pwm |= (1 << 2);
+
+             /* Check if fan2 is there or not */
+             if (reg27 & (1 << 7))
+                     sio_data->skip_fan |= (1 << 1);
+             if (reg27 & (1 << 3))
+                     sio_data->skip_pwm |= (1 << 1);
+
Quoted 9 lines

drivers/hwmon/it87.c static int __init it87_find(unsigned short *address, · line 1740

Quoted 3 lines
drivers/hwmon/it87.c +3 -0
+             /* VIN5 */
+             if ((reg27 & (1 << 0)) || (reg2C & (1 << 2)))
+                     ; /* No VIN5 */

Obviously we can't leave things that way. I presume we want to add a skip_in field to struct it87_sio_data and a has_in field to struct it87_data, same we have for fans? I'm fine having this as a separate patch, but both should go upstream together.

Something like that. I'll think about it. I prefer a separate patch since it will require quite some reshuffling of code (which is why I did not do it in the first place).

Quoted 5 lines
Quoted 5 lines
drivers/hwmon/it87.c +5 -0
+
+             /* VIN6 */
+             if ((reg27 & (1 << 1)) || (reg2C & (1 << 2)))
+                     ; /* No VIN6 */
+
Quoted 9 lines

drivers/hwmon/it87.c static int __init it87_find(unsigned short *address, · line 1748

Quoted 3 lines
drivers/hwmon/it87.c +3 -0
+             /*
+              * VIN7
+              * Does not depend on bit 2 of Reg2C, contrary to datasheet.

Datasheet is pretty confusing for this configuration bit. If the pin can be used for a 3rd function ("SO") there must be a extra bit to check somewhere... Hopefully it won't matter much as I expect vin7 to be internal on most systems.

Same as with VIN5 ...

Quoted 6 lines

drivers/hwmon/it87.c static int __init it87_find(unsigned short *address, · line 1751

Quoted 3 lines
drivers/hwmon/it87.c +3 -0
+              */
+             if (reg27 & (1 << 2))
+                     ; /* No VIN7 */

Unless vin7 is internal, in which case the test above doesn't matter.

I'll add a note.

Quoted 18 lines
Quoted 18 lines
drivers/hwmon/it87.c +9 -0
+
+             if (reg2C & (1 << 0))
+                     sio_data->internal |= (1 << 0);
+             if (reg2C & (1 << 1))
+                     sio_data->internal |= (1 << 1);
+
+             sio_data->beep_pin = superio_inb(IT87_SIO_BEEP_PIN_REG) & 0x3f;
+
      } else {
              int reg;
 
@@ -1823,6 +1894,7 @@ static int __devinit it87_probe(struct platform_device *pdev)
              "it8720",
              "it8721",
              "it8728",
+             "it8783",
      };
 
Quoted 15 lines

drivers/hwmon/it87.c static int __devinit it87_probe(struct platform_device *pdev) · line 1946

Quoted 10 lines
drivers/hwmon/it87.c +5 -0
      res = platform_get_resource(pdev, IORESOURCE_IO, 0);
@@ -1867,6 +1939,11 @@ static int __devinit it87_probe(struct platform_device *pdev)
                      data->in_scaled |= (1 << 7);    /* in7 is VSB */
              if (sio_data->internal & (1 << 2))
                      data->in_scaled |= (1 << 8);    /* in8 is Vbat */
+     } else if (sio_data->type = it8783) {
+             if (sio_data->internal & (1 << 0))
+                     data->in_scaled |= (1 << 3);    /* in3 is VCC5V */
+             if (sio_data->internal & (1 << 1))
+                     data->in_scaled |= (1 << 7);    /* in7 is VCCH5V */

The "Features" page says that Vbat is measured internally. If this true, then it is necessarily always scaled too. This should let you merge both blocks.

The IT8783F has a 16mv ADV which measures up to 4V, so scaling VBAT is not necessary. I think the sensors output confirms that it is not scaled, unless I am missing something.

Thanks,
Guenter

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#8 lore raw
In reply to Guenter Roeck

SGFsbG8gQmrDtnJuLAoKT24gU2F0LCAyNCBNYXIgMjAxMiAwMDoyNDo1OCArMDEwMCwgQmrDtnJu IEdlcmhhcnQgd3JvdGU6Cj4gQW0gMjMuMDMuMjAxMiB1bSAyMjowMiBzY2hyaWViIEplYW4gRGVs dmFyZToKPiAKPiA+IE9uIFR1ZSwgMTMgTWFyIDIwMTIgMTk6NDM6MTUgKzAxMDAsIEJqb2VybiBH ZXJoYXJ0IHdyb3RlOgo+ID4+IDIwMTIvMy84IEd1ZW50ZXIgUm9lY2sgPGxpbnV4QHJvZWNrLXVz Lm5ldD46Cj4gPj4+IEFzc3VtZSBhbGwgdGhyZWUgYXJlIGNvbXBhdGlibGUgYW5kIGhhdmUgdGhl IHNhbWUgZnVuY3Rpb25hbGl0eS4KPiA+Pj4gCj4gPj4+IFNpZ25lZC1vZmYtYnk6IEd1ZW50ZXIg Um9lY2sgPGxpbnV4QHJvZWNrLXVzLm5ldD4KPiA+PiBUZXN0ZWQtYnk6IEJqb2VybiBHZXJoYXJ0 IDxvc3NAZXh0cmFjbG91ZC5kZT4KPiA+IAo+ID4gQ2FyZSB0byBzaGFyZSB0aGUgb3V0cHV0IG9m ICJzZW5zb3JzIiB3aXRoIHVzPwo+ID4gCj4gU3VyZS4gVG8gYmUgbW9yZSBwcmVjaXNlLCBJIHRl c3RlZCB3aXRoIGFuIElUODc4MyBjaGlwIGNvbmZpZ3VyZWQgYW5kIHdpcmVkIGJ5IHRoZSBoYXJk d2FyZSB0ZWFtIGF0IHRoZSBjb21wYW55IEknbSB3b3JraW5nIGZvciBvbiBhIHByb3ByaWV0YXJ5 IG1haW5ib2FyZC4gV2l0aCB0aGUgc2Vuc29ycy5jb25mIGNyZWF0ZWQgdGhlcmVmb3JlLCB0aGUg c2Vuc29ycyBvdXRwdXQgbG9va3MgbGlrZSB0aGlzOgo+IAo+IFtyb290QGxvY2FsaG9zdCB+XSMg TEFORz1DIHNlbnNvcnMKPiBpdDg3ODMtaXNhLTBhMTAKPiBBZGFwdGVyOiBJU0EgYWRhcHRlcgo+ IENQVSBDb3JlOiAgICArMS4xNSBWICAobWluID0gICswLjcwIFYsIG1heCA9ICArMS43MCBWKQo+ ICsxLjUwVjogICAgICArMS41MCBWICAobWluID0gICsxLjEwIFYsIG1heCA9ICArMS45MCBWKQo+ ICszLjMwVjogICAgICArMy4zOCBWICAobWluID0gICsyLjcwIFYsIG1heCA9ICArNC4wMCBWKQo+ ICsxMi4wVjogICAgICsxMi4xNiBWICAobWluID0gKzEwLjY5IFYsIG1heCA9ICsxMy43MCBWKQo+ IC0xMi4wVjogICAgIC0xMS45NSBWICAobWluID0gLTEzLjY4IFYsIG1heCA9IC0xMC4zMCBWKQo+ ICsxLjEwVjogICAgICArMS4xMiBWICAobWluID0gICswLjkwIFYsIG1heCA9ICArMS4yMiBWKQo+ IFZCYXQ6ICAgICAgICArMy4wOSBWCj4gRmFuMTogICAgICAgMTY2MiBSUE0gIChtaW4gPSAgMzAw IFJQTSkKPiBQU1U6ICAgICAgICAxMjQ1IFJQTSAgKG1pbiA9ICA1MDAgUlBNKQo+IEJvYXJkIFQu OiAgICArMzAuMCBDICAobG93ICA9ICArMC4wIEMsIGhpZ2ggPSArNTUuMCBDKSAgc2Vuc29yID0g dGhlcm1hbCBkaW9kZQo+IENQVSBULjogICAgICArNDcuMCBDICAobG93ICA9ICArMC4wIEMsIGhp Z2ggPSArNjMuMCBDKSAgc2Vuc29yID0gdGhlcm1hbCBkaW9kZQo+IAo+IGNvcmV0ZW1wLWlzYS0w MDAwCj4gQWRhcHRlcjogSVNBIGFkYXB0ZXIKPiBDb3JlIDA6ICAgICAgKzQwLjAgQyAgKGhpZ2gg PSArODYuMCBDLCBjcml0ID0gKzEwMC4wIEMpCj4gQ29yZSAxOiAgICAgICs0My4wIEMgIChoaWdo ID0gKzg2LjAgQywgY3JpdCA9ICsxMDAuMCBDKQo+IAo+IAo+IFRoZXNlIGFyZSBhYm91dCB0aGUg c2FtZSB2YWx1ZXMgYXMgdGhlICJIYXJkd2FyZSBNb25pdG9yIiBzZWN0aW9uIGF0IHRoZSBCSU9T IHNldHVwIHNob3dzIGFsc28uIFNvIGFsbCB2YWx1ZXMgbG9vayByZWFzb25hYmxlLgoKVGhhbmtz LiBDYW4gd2Ugc2VlIHRoZSBjb25maWd1cmF0aW9uIGZpbGUgYXNzb2NpYXRlZCB3aXRoIHRoaXM/ IFdoYXQgSQphbSBwYXJ0aWN1bGFybHkgaW50ZXJlc3RlZCBpbiBhcmUgaW4zLCBpbjcgYW5kIGlu OCAoVmJhdCkgYXMgdGhleSBhcmUKdHJlYXRlZCBzcGVjaWFsbHkgYnkgdGhlIGNoaXAgYW5kIHRo ZSBkcml2ZXIuCgo+IEluIGdlbmVyYWwsIGZvciBmdXR1cmUgVGVzdGVkLWJ5czogZG9lcyBpdCBt YWtlIHNlbnNlIHRvIGFwcGVuZCBhIGtpbmQgb2YgdGVzdCByZXBvcnQgKGxpa2UgdGhlIGFib3Zl IG9uZSkgZGlyZWN0bHkgYWZ0ZXIgdGhlIFRlc3RlZC1ieSBzdGF0ZW1lbnQsIG9yIHNob3VsZCBp dCBiZSBsb2NhdGVkIGluIGEgc2VwYXJhdGUgbWFpbD8KClllcywgdGVzdCByZXN1bHRzIGFyZSBh bHdheXMgd2VsY29tZSwgYW5kIGluY2x1ZGluZyB0aGVtIGluIHRoZSBzYW1lCmUtbWFpbCBpcyBm aW5lLgoKLS0gCkplYW4gRGVsdmFyZQoKX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f X19fX19fX19fX19fX18KbG0tc2Vuc29ycyBtYWlsaW5nIGxpc3QKbG0tc2Vuc29yc0BsbS1zZW5z b3JzLm9yZwpodHRwOi8vbGlzdHMubG0tc2Vuc29ycy5vcmcvbWFpbG1hbi9saXN0aW5mby9sbS1z ZW5zb3Jz

#9 lore raw
In reply to Guenter Roeck

Salut Jean,

Am 24.03.2012 um 08:05 schrieb Jean Delvare:

Quoted 37 lines

Hallo Björn,

Quoted 34 lines · Björn Gerhart

Am 23.03.2012 um 22:02 schrieb Jean Delvare:

Quoted 9 lines · Bjoern Gerhart
Quoted 5 lines

2012/3/8 Guenter Roeck <[email protected]>:

Quoted 3 lines

Assume all three are compatible and have the same functionality.

Care to share the output of "sensors" with us?

Sure. To be more precise, I tested with an IT8783 chip configured and wired by the hardware team at the company I'm working for on a proprietary mainboard. With the sensors.conf created therefore, the sensors output looks like this:

[root@localhost ~]# LANG=C sensors
it8783-isa-0a10
Adapter: ISA adapter
CPU Core: +1.15 V (min = +0.70 V, max = +1.70 V)

+1.50V:      +1.50 V  (min =  +1.10 V, max =  +1.90 V)
+3.30V:      +3.38 V  (min =  +2.70 V, max =  +4.00 V)
+12.0V:     +12.16 V  (min = +10.69 V, max = +13.70 V)
-12.0V:     -11.95 V  (min = -13.68 V, max = -10.30 V)
+1.10V:      +1.12 V  (min =  +0.90 V, max =  +1.22 V)
VBat:        +3.09 V
Fan1:       1662 RPM  (min =  300 RPM)
PSU:        1245 RPM  (min =  500 RPM)
Board T.:    +30.0 C  (low  =  +0.0 C, high = +55.0 C)  sensor = thermal diode
CPU T.:      +47.0 C  (low  =  +0.0 C, high = +63.0 C)  sensor = thermal diode

coretemp-isa-0000

Adapter: ISA adapter
Core 0:      +40.0 C  (high = +86.0 C, crit = +100.0 C)
Core 1:      +43.0 C  (high = +86.0 C, crit = +100.0 C)
Quoted 6 lines
Quoted 1 line

These are about the same values as the "Hardware Monitor" section at the BIOS setup shows also. So all values look reasonable.

Thanks. Can we see the configuration file associated with this? What I am particularly interested in are in3, in7 and in8 (Vbat) as they are treated specially by the chip and the driver.

Ok. in3 gets ignored, maybe not wired on that design. in7 and in8 don't get computed.

chip "it8783-isa-0a10"

    #=== voltages
    label in0 "CPU Core"
    compute in0  @, @
    set in0_min  0.7
    set in0_max  1.7
    
    label in1 "+1.50V"
    compute in1 @,@
    set in1_min  1.1
    set in1_max  1.9

    label in2 "+3.30V"
    compute in2  @, @
    set in2_min  2.7
    set in2_max  4.0

    label in4 "+12.0V"
    compute in4 ((30/10) +1)*@  , @/((30/10) +1)
    set in4_min  10.7
    set in4_max  13.7

    label in6 "-12.0V"
    compute in6 (1+232/56)*@ - 4.096*232/56, (@ + 4.096*232/56)/(1+232/56)
    set in6_min  -13.7
    set in6_max  -10.3
    
    label in7 "+1.10V"
    set in7_min  0.89
    set in7_max  1.21
    
    label in8 "VBat"

    ignore  in3
    ignore  in5
    ignore  vid

    #=== temps
    label temp2 "Board T."
    set temp2_min   0
    set temp2_max   55
    
    label temp3 "CPU T."
    compute temp3 100+@,-1*(100-@)
    set temp3_min   0
    set temp3_max   63

    ignore temp1
    ignore temp4

    #=== fans
    label fan1 "Fan1"
    set fan1_min  300

    label fan3 "PSU"
    set fan3_min  500

    ignore fan2
    ignore fan4
Quoted 5 lines
Quoted 1 line

In general, for future Tested-bys: does it make sense to append a kind of test report (like the above one) directly after the Tested-by statement, or should it be located in a separate mail?

Yes, test results are always welcome, and including them in the same e-mail is fine.

ok, perfect ;-)

Björn

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#10 lore raw
In reply to Guenter Roeck
Quoted 29 lines · Guenter Roeck
Quoted 13 lines · Jean Delvare

drivers/hwmon/it87.c static int in_from_reg(const struct it87_data *data, int nr, int val) · line 349

Quoted 11 lines · Guenter Roeck
              else
                      return val * 12;
drivers/hwmon/it87.c +6 -2
-     } else
-             return val * 16;
+     } else {
+             if (data->in_scaled & (1 << nr))
+                     return val * 32;
+             else
+                     return val * 16;
+     }
 }
Quoted 2 lines

I think both functions can then be rewritten more efficiently. I'll do some testing and send a patch later.

I know, I was a bit lazy ;).

How about the following ?

static int adc_lsb(const struct it87_data *data)

{
	int lsb = has_12mv_adc(data) ? 12 : 16;
	if (data->in_scaled & (1 << nr))
		lsb <<= 1;
	return lsb;
}
Quoted 5 lines

and:

	val = DIV_ROUND_CLOSEST(val, adc_lsb(data));

and:

	return val * adc_lsb(data);

Except that you have to pass nr around as a parameter, but otherwise yes, that's what I had in mind.

Quoted 11 lines
Quoted 6 lines

drivers/hwmon/it87.c static int __init it87_find(unsigned short *address, · line 1727

Quoted 3 lines
drivers/hwmon/it87.c +3 -0
+             /* Check if fan3 is there or not */
+             if ((reg27 & (1 << 0)) || !(reg2C & (1 << 2)))
+                     sio_data->skip_fan |= (1 << 2);

I'm a bit skeptical how a single pin can be FAN_TAC3 and SIN6 at the same time...

Issue here is that the pin is also multiplexed to VIN5 (see below), and it is kind of difficult to determine how GP30, VIN5, FAN_TAC3, and SIN6 are selected with only two configuration bits (one of which selects GP30). Maybe there is another configuration bit somewhere, but I did not find it.

Neither did I. I think the datasheet is incomplete.

Quoted 15 lines
Quoted 6 lines
Quoted 6 lines

(...)

drivers/hwmon/it87.c +1 -0
@@ -1867,6 +1939,11 @@ static int __devinit it87_probe(struct platform_device *pdev)
                      data->in_scaled |= (1 << 7);    /* in7 is VSB */
              if (sio_data->internal & (1 << 2))
                      data->in_scaled |= (1 << 8);    /* in8 is Vbat */
+     } else if (sio_data->type = it8783) {
Quoted 8 lines

drivers/hwmon/it87.c static int __devinit it87_probe(struct platform_device *pdev) · line 1946

Quoted 4 lines
drivers/hwmon/it87.c +4 -0
+             if (sio_data->internal & (1 << 0))
+                     data->in_scaled |= (1 << 3);    /* in3 is VCC5V */
+             if (sio_data->internal & (1 << 1))
+                     data->in_scaled |= (1 << 7);    /* in7 is VCCH5V */

The "Features" page says that Vbat is measured internally. If this true, then it is necessarily always scaled too. This should let you merge both blocks.

Quoted 2 lines

The IT8783F has a 16mv ADV which measures up to 4V, so scaling VBAT is not necessary. I think the sensors output confirms that it is not scaled, unless I am missing something.

Oh, you're completely right, I had forgotten about the different LSB value, sorry.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#11 lore raw
In reply to Guenter Roeck

Hi Jean,

Quoted 30 lines · Jean Delvare
Quoted 29 lines · Guenter Roeck
Quoted 13 lines · Jean Delvare

drivers/hwmon/it87.c static int in_from_reg(const struct it87_data *data, int nr, int val) · line 349

Quoted 11 lines · Guenter Roeck
              else
                      return val * 12;
drivers/hwmon/it87.c +6 -2
-     } else
-             return val * 16;
+     } else {
+             if (data->in_scaled & (1 << nr))
+                     return val * 32;
+             else
+                     return val * 16;
+     }
 }
Quoted 2 lines

I think both functions can then be rewritten more efficiently. I'll do some testing and send a patch later.

I know, I was a bit lazy ;).

How about the following ?

static int adc_lsb(const struct it87_data *data)

{
	int lsb = has_12mv_adc(data) ? 12 : 16;
	if (data->in_scaled & (1 << nr))
		lsb <<= 1;
	return lsb;
}
Quoted 9 lines
Quoted 5 lines

and:

	val = DIV_ROUND_CLOSEST(val, adc_lsb(data));

and:

	return val * adc_lsb(data);

Except that you have to pass nr around as a parameter, but otherwise yes, that's what I had in mind.

Yes, I noticed that when I tried to compile it. Dumb compiler, should have known what I meant and auto-fixed it ;).

Thanks,
Guenter

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#12 lore raw

PATCH 1/1 hwmon: (it87) Add support for IT8732F

In reply to Guenter Roeck

Add support for the IT8732F. This chip is pretty similar to IT8721F, with the main difference being that the ADC LSB is 10.9 mV instead of 12 mV.

---
 Documentation/hwmon/it87 | 35 +++++++++++++++++++------------
 drivers/hwmon/it87.c     | 54 +++++++++++++++++++++++++++++++++++++++---------
 2 files changed, 66 insertions(+), 23 deletions(-)
Documentation/hwmon/it87 +22 -13
index e872948..733296d 100644
@@ -38,6 +38,10 @@ Supported chips:
     Prefix: 'it8728'
     Addresses scanned: from Super I/O config space (8 I/O ports)
     Datasheet: Not publicly available
+  * IT8732F
+    Prefix: 'it8732'
+    Addresses scanned: from Super I/O config space (8 I/O ports)
+    Datasheet: Not publicly available
   * IT8771E
     Prefix: 'it8771'
     Addresses scanned: from Super I/O config space (8 I/O ports)
@@ -111,9 +115,9 @@ Description
 -----------
 
 This driver implements support for the IT8603E, IT8620E, IT8623E, IT8705F,
-IT8712F, IT8716F, IT8718F, IT8720F, IT8721F, IT8726F, IT8728F, IT8758E,
-IT8771E, IT8772E, IT8781F, IT8782F, IT8783E/F, IT8786E, IT8790E, and SiS950
-chips.
+IT8712F, IT8716F, IT8718F, IT8720F, IT8721F, IT8726F, IT8728F, IT8732F,
+IT8758E, IT8771E, IT8772E, IT8781F, IT8782F, IT8783E/F, IT8786E, IT8790E, and
+SiS950 chips.
 
 These chips are 'Super I/O chips', supporting floppy disks, infrared ports,
 joysticks and other miscellaneous stuff. For hardware monitoring, they
@@ -137,10 +141,10 @@ The IT8716F, IT8718F, IT8720F, IT8721F/IT8758E and later IT8712F revisions
 have support for 2 additional fans. The additional fans are supported by the
 driver.
 
-The IT8716F, IT8718F, IT8720F, IT8721F/IT8758E, IT8781F, IT8782F, IT8783E/F,
-and late IT8712F and IT8705F also have optional 16-bit tachometer counters
-for fans 1 to 3. This is better (no more fan clock divider mess) but not
-compatible with the older chips and revisions. The 16-bit tachometer mode
+The IT8716F, IT8718F, IT8720F, IT8721F/IT8758E, IT8732F, IT8781F, IT8782F,
+IT8783E/F, and late IT8712F and IT8705F also have optional 16-bit tachometer
+counters for fans 1 to 3. This is better (no more fan clock divider mess) but
+not compatible with the older chips and revisions. The 16-bit tachometer mode
 is enabled by the driver when one of the above chips is detected.
 
 The IT8726F is just bit enhanced IT8716F with additional hardware
@@ -159,6 +163,9 @@ IT8728F. It only supports 16-bit fan mode.
 
 The IT8790E supports up to 3 fans. 16-bit fan mode is always enabled.
 
+The IT8732F supports a closed-loop mode for fan control, but this is not
+currently implemented by the driver.
+
 Temperatures are measured in degrees Celsius. An alarm is triggered once
 when the Overtemperature Shutdown limit is crossed.
 
@@ -173,12 +180,14 @@ is done.
 Voltage sensors (also known as IN sensors) report their values in volts. An
 alarm is triggered if the voltage has crossed a programmable minimum or
 maximum limit. Note that minimum in this case always means 'closest to
-zero'; this is important for negative voltage measurements. All voltage
-inputs can measure voltages between 0 and 4.08 volts, with a resolution of
-0.016 volt (except IT8603E, IT8721F/IT8758E and IT8728F: 0.012 volt.) The
-battery voltage in8 does not have limit registers.
-
-On the IT8603E, IT8721F/IT8758E, IT8781F, IT8782F, and IT8783E/F, some
+zero'; this is important for negative voltage measurements. On most chips, all
+voltage inputs can measure voltages between 0 and 4.08 volts, with a resolution
+of 0.016 volt.  IT8603E, IT8721F/IT8758E and IT8728F can measure between 0 and
+3.06 volts, with a resolution of 0.012 volt.  IT8732F can measure between 0 and
+2.8 volts with a resolution of 0.0109 volt.  The battery voltage in8 does not
+have limit registers.
+
+On the IT8603E, IT8721F/IT8758E, IT8732F, IT8781F, IT8782F, and IT8783E/F, some
 voltage inputs are internal and scaled inside the chip:
 * in3 (optional)
 * in7 (optional for IT8781F, IT8782F, and IT8783E/F)
drivers/hwmon/it87.c +44 -10

120 lines not on this page · raw message

Signature · 7 lines
2.5.0


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
author maintainer
#13 lore raw

Re: [lm-sensors] [PATCH] hwmon: (it87) Add support for IT8732F

In reply to Guenter Roeck

Hi Justin,

Quoted 4 lines · Justin Maggard

Add support for the IT8732F. This chip is pretty similar to IT8721F, with the main difference being that the ADC LSB is 10.9 mV instead of 12 mV.

I assume you have a datasheet. Since you say "main difference", are you aware of any other differences ? Would it by any chance be possible to share the datasheet with us ?

Further comments inline.

Thanks,
Guenter

Quoted 157 lines
---
 Documentation/hwmon/it87 | 35 +++++++++++++++++++------------
 drivers/hwmon/it87.c     | 54 +++++++++++++++++++++++++++++++++++++++---------
 2 files changed, 66 insertions(+), 23 deletions(-)
Documentation/hwmon/it87 +22 -13
index e872948..733296d 100644
@@ -38,6 +38,10 @@ Supported chips:
     Prefix: 'it8728'
     Addresses scanned: from Super I/O config space (8 I/O ports)
     Datasheet: Not publicly available
+  * IT8732F
+    Prefix: 'it8732'
+    Addresses scanned: from Super I/O config space (8 I/O ports)
+    Datasheet: Not publicly available
   * IT8771E
     Prefix: 'it8771'
     Addresses scanned: from Super I/O config space (8 I/O ports)
@@ -111,9 +115,9 @@ Description
 -----------
 
 This driver implements support for the IT8603E, IT8620E, IT8623E, IT8705F,
-IT8712F, IT8716F, IT8718F, IT8720F, IT8721F, IT8726F, IT8728F, IT8758E,
-IT8771E, IT8772E, IT8781F, IT8782F, IT8783E/F, IT8786E, IT8790E, and SiS950
-chips.
+IT8712F, IT8716F, IT8718F, IT8720F, IT8721F, IT8726F, IT8728F, IT8732F,
+IT8758E, IT8771E, IT8772E, IT8781F, IT8782F, IT8783E/F, IT8786E, IT8790E, and
+SiS950 chips.
 
 These chips are 'Super I/O chips', supporting floppy disks, infrared ports,
 joysticks and other miscellaneous stuff. For hardware monitoring, they
@@ -137,10 +141,10 @@ The IT8716F, IT8718F, IT8720F, IT8721F/IT8758E and later IT8712F revisions
 have support for 2 additional fans. The additional fans are supported by the
 driver.
 
-The IT8716F, IT8718F, IT8720F, IT8721F/IT8758E, IT8781F, IT8782F, IT8783E/F,
-and late IT8712F and IT8705F also have optional 16-bit tachometer counters
-for fans 1 to 3. This is better (no more fan clock divider mess) but not
-compatible with the older chips and revisions. The 16-bit tachometer mode
+The IT8716F, IT8718F, IT8720F, IT8721F/IT8758E, IT8732F, IT8781F, IT8782F,
+IT8783E/F, and late IT8712F and IT8705F also have optional 16-bit tachometer
+counters for fans 1 to 3. This is better (no more fan clock divider mess) but
+not compatible with the older chips and revisions. The 16-bit tachometer mode
 is enabled by the driver when one of the above chips is detected.
 
 The IT8726F is just bit enhanced IT8716F with additional hardware
@@ -159,6 +163,9 @@ IT8728F. It only supports 16-bit fan mode.
 
 The IT8790E supports up to 3 fans. 16-bit fan mode is always enabled.
 
+The IT8732F supports a closed-loop mode for fan control, but this is not
+currently implemented by the driver.
+
 Temperatures are measured in degrees Celsius. An alarm is triggered once
 when the Overtemperature Shutdown limit is crossed.
 
@@ -173,12 +180,14 @@ is done.
 Voltage sensors (also known as IN sensors) report their values in volts. An
 alarm is triggered if the voltage has crossed a programmable minimum or
 maximum limit. Note that minimum in this case always means 'closest to
-zero'; this is important for negative voltage measurements. All voltage
-inputs can measure voltages between 0 and 4.08 volts, with a resolution of
-0.016 volt (except IT8603E, IT8721F/IT8758E and IT8728F: 0.012 volt.) The
-battery voltage in8 does not have limit registers.
-
-On the IT8603E, IT8721F/IT8758E, IT8781F, IT8782F, and IT8783E/F, some
+zero'; this is important for negative voltage measurements. On most chips, all
+voltage inputs can measure voltages between 0 and 4.08 volts, with a resolution
+of 0.016 volt.  IT8603E, IT8721F/IT8758E and IT8728F can measure between 0 and
+3.06 volts, with a resolution of 0.012 volt.  IT8732F can measure between 0 and
+2.8 volts with a resolution of 0.0109 volt.  The battery voltage in8 does not
+have limit registers.
+
+On the IT8603E, IT8721F/IT8758E, IT8732F, IT8781F, IT8782F, and IT8783E/F, some
 voltage inputs are internal and scaled inside the chip:
 * in3 (optional)
 * in7 (optional for IT8781F, IT8782F, and IT8783E/F)
drivers/hwmon/it87.c +22 -4
index d0ee556..4f0efe7 100644
@@ -21,6 +21,7 @@
  *            IT8721F  Super I/O chip w/LPC interface
  *            IT8726F  Super I/O chip w/LPC interface
  *            IT8728F  Super I/O chip w/LPC interface
+ *            IT8732F  Super I/O chip w/LPC interface
  *            IT8758E  Super I/O chip w/LPC interface
  *            IT8771E  Super I/O chip w/LPC interface
  *            IT8772E  Super I/O chip w/LPC interface
@@ -69,8 +70,9 @@
 
 #define DRVNAME "it87"
 
-enum chips { it87, it8712, it8716, it8718, it8720, it8721, it8728, it8771,
-	     it8772, it8781, it8782, it8783, it8786, it8790, it8603, it8620 };
+enum chips { it87, it8712, it8716, it8718, it8720, it8721, it8728, it8732,
+	     it8771, it8772, it8781, it8782, it8783, it8786, it8790, it8603,
+	     it8620 };
 
 static unsigned short force_id;
 module_param(force_id, ushort, 0);
@@ -147,6 +149,7 @@ static inline void superio_exit(void)
 #define IT8720F_DEVID 0x8720
 #define IT8721F_DEVID 0x8721
 #define IT8726F_DEVID 0x8726
+#define IT8732F_DEVID 0x8732
 #define IT8728F_DEVID 0x8728
 #define IT8771E_DEVID 0x8771
 #define IT8772E_DEVID 0x8772
@@ -265,6 +268,7 @@ struct it87_devices {
 #define FEAT_VID		(1 << 9)	/* Set if chip supports VID */
 #define FEAT_IN7_INTERNAL	(1 << 10)	/* Set if in7 is internal */
 #define FEAT_SIX_FANS		(1 << 11)	/* Supports six fans */
+#define FEAT_10_9MV_ADC		(1 << 12)
 
 static const struct it87_devices it87_devices[] = {
 	[it87] = {
@@ -315,6 +319,15 @@ static const struct it87_devices it87_devices[] = {
 		  | FEAT_IN7_INTERNAL,
 		.peci_mask = 0x07,
 	},
+	[it8732] = {
+		.name = "it8732",
+		.suffix = "F",
+		.features = FEAT_NEWER_AUTOPWM | FEAT_16BIT_FANS
+		  | FEAT_TEMP_OFFSET | FEAT_TEMP_OLD_PECI | FEAT_TEMP_PECI
+		  | FEAT_10_9MV_ADC | FEAT_IN7_INTERNAL,
+		.peci_mask = 0x07,
+		.old_peci_mask = 0x02,	/* Actually reports PCH */
+	},
 	[it8771] = {
 		.name = "it8771",
 		.suffix = "E",
@@ -391,6 +404,7 @@ static const struct it87_devices it87_devices[] = {
 
 #define has_16bit_fans(data)	((data)->features & FEAT_16BIT_FANS)
 #define has_12mv_adc(data)	((data)->features & FEAT_12MV_ADC)
+#define has_10_9mv_adc(data)	((data)->features & FEAT_10_9MV_ADC)
 #define has_newer_autopwm(data)	((data)->features & FEAT_NEWER_AUTOPWM)
 #define has_old_autopwm(data)	((data)->features & FEAT_OLD_AUTOPWM)
 #define has_temp_offset(data)	((data)->features & FEAT_TEMP_OFFSET)
@@ -473,23 +487,35 @@ struct it87_data {
 	s8 auto_temp[3][5];	/* [nr][0] is point1_temp_hyst */
 };
 
-static int adc_lsb(const struct it87_data *data, int nr)
+static void adc_lsb(const struct it87_data *data, int nr, int *num, int *denom)
 {
-	int lsb = has_12mv_adc(data) ? 12 : 16;
+	if (has_12mv_adc(data)) {
+		*num =  12;
+		*denom =  1;
+	} else if (has_10_9mv_adc(data)) {
+		*num =  109;

drivers/hwmon/it87.c struct it87_data { · line 504

Quoted 10 lines
drivers/hwmon/it87.c +6 -2
+		*denom =  10;
+	} else {
+		*num =  16;
+		*denom =  1;
+	}
 	if (data->in_scaled & (1 << nr))
-		lsb <<= 1;
-	return lsb;
+		*num <<= 1;
 }

I would suggest to scale all return values up by a factor of 10, and always divide by 10 in the calling code.

drivers/hwmon/it87.c struct it87_data { · line 509

Quoted 7 lines
drivers/hwmon/it87.c +3 -1
 static u8 in_to_reg(const struct it87_data *data, int nr, long val)
 {
-	val = DIV_ROUND_CLOSEST(val, adc_lsb(data, nr));
+	int num, denom;
+	adc_lsb(data, nr, &num, &denom);
+	val = DIV_ROUND_CLOSEST(val * denom, num);

.. making this

	val = DIV_ROUND_CLOSEST(val * 10, adc_lsb(data, nr));

drivers/hwmon/it87.c struct it87_data { · line 515

Quoted 7 lines
drivers/hwmon/it87.c +1 -1
 	return clamp_val(val, 0, 255);
 }
 
 static int in_from_reg(const struct it87_data *data, int nr, int val)
 {
-	return val * adc_lsb(data, nr);
+	int num, denom;

[ side note: use checkpatch ]

drivers/hwmon/it87.c struct it87_data { · line 517

Quoted 2 lines
drivers/hwmon/it87.c +2 -0
+	adc_lsb(data, nr, &num, &denom);
+	return val * num / denom;

similar

	return (val * adc_lsb(data, nr)) / 10;
or better
	return DIV_ROUND_CLOSEST(val * adc_lsb(data, nr), 10);
Quoted 38 lines
drivers/hwmon/it87.c +10 -2
 }
 
 static inline u8 FAN_TO_REG(long rpm, int div)
@@ -1515,9 +1541,14 @@ static ssize_t show_label(struct device *dev, struct device_attribute *attr,
 	};
 	struct it87_data *data = dev_get_drvdata(dev);
 	int nr = to_sensor_dev_attr(attr)->index;
+	const char *label;
 
-	return sprintf(buf, "%s\n", has_12mv_adc(data) ? labels_it8721[nr]
-						       : labels[nr]);
+	if (has_12mv_adc(data) || has_10_9mv_adc(data))
+		label = labels_it8721[nr];
+	else
+		label = labels[nr];
+
+	return sprintf(buf, "%s\n", label);
 }
 static SENSOR_DEVICE_ATTR(in3_label, S_IRUGO, show_label, NULL, 0);
 static SENSOR_DEVICE_ATTR(in7_label, S_IRUGO, show_label, NULL, 1);
@@ -1853,6 +1884,9 @@ static int __init it87_find(unsigned short *address,
 	case IT8728F_DEVID:
 		sio_data->type = it8728;
 		break;
+	case IT8732F_DEVID:
+		sio_data->type = it8732;
+		break;
 	case IT8771E_DEVID:
 		sio_data->type = it8771;
 		break;
Signature · 7 lines
2.5.0


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#14 lore raw

Re: [lm-sensors] [PATCH] hwmon: (it87) Add support for IT8732F

In reply to Guenter Roeck
Quoted 3 lines · Justin Maggard

Add support for the IT8732F. This chip is pretty similar to IT8721F, with the main difference being that the ADC LSB is 10.9 mV instead of 12 mV.

10.9 mV. No kidding. Sigh.

Drunk people shouldn't be allowed to design chipsets really.

Signature · 7 lines
Jean Delvare
SUSE L3 Support

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
author maintainer
#15 lore raw

Re: [lm-sensors] [PATCH] hwmon: (it87) Add support for IT8732F

In reply to Guenter Roeck
Quoted 9 lines · Jean Delvare
Quoted 3 lines · Justin Maggard

Add support for the IT8732F. This chip is pretty similar to IT8721F, with the main difference being that the ADC LSB is 10.9 mV instead of 12 mV.

10.9 mV. No kidding. Sigh.

Drunk people shouldn't be allowed to design chipsets really.

Well, we are lucky. It could be 10.931 mV, after all. Wait, maybe it is ;-).

Makes me wonder, though - I hope this is a real chip value and not just the value computed as the result after some external resistor pre-scaling.

Guenter

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#16 lore raw

Re: [lm-sensors] [PATCH] hwmon: (it87) Add support for IT8732F

In reply to Guenter Roeck
Quoted 12 lines · Guenter Roeck

Hi Justin,

Quoted 4 lines · Justin Maggard

Add support for the IT8732F. This chip is pretty similar to IT8721F, with the main difference being that the ADC LSB is 10.9 mV instead of 12 mV.

I assume you have a datasheet. Since you say "main difference", are you aware of any other differences ? Would it by any chance be possible to share the datasheet with us ?

Yes, I do have a datasheet. I'm investigating our confidentiality obligations now, but I'm unsure what that outcome will be. I don't have datasheets for any other chips, so I can't really do a proper comparison. But the driver code for IT8721F seems to line up well with the IT8732F datasheet.

IT8732F has up to 4 fan tachometer inputs, and up to 4 PWM outputs. The "SmartGuardian" piece appears identical. As I mentioned in the doc change, it also has a fan tachometer closed-loop mode that seems new (at least I didn't see any reference to it in the driver). That gets enabled by setting IT87_REG_PWM to automatic mode, and also setting bit 2. Temp sensors appear identical, with the obvious exception of the 10.9 mV ADS LSB.

Quoted 2 lines

Further comments inline.

OK, I'll whip up a v2 patch shortly to address your comments.

-Justin

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

author maintainer
#17 lore raw

Re: [lm-sensors] [PATCH] hwmon: (it87) Add support for IT8732F

In reply to Guenter Roeck

Hi Justin,

Quoted 9 lines · Justin Maggard
Quoted 8 lines · Guenter Roeck

Hi Justin,

Quoted 4 lines · Justin Maggard

Add support for the IT8732F. This chip is pretty similar to IT8721F, with the main difference being that the ADC LSB is 10.9 mV instead of 12 mV.

Quoted 7 lines
Quoted 4 lines

I assume you have a datasheet. Since you say "main difference", are you aware of any other differences ? Would it by any chance be possible to share the datasheet with us ?

Yes, I do have a datasheet. I'm investigating our confidentiality obligations now, but I'm unsure what that outcome will be. I don't

Ok.

Quoted 8 lines

have datasheets for any other chips, so I can't really do a proper comparison. But the driver code for IT8721F seems to line up well with the IT8732F datasheet.

IT8732F has up to 4 fan tachometer inputs, and up to 4 PWM outputs. The "SmartGuardian" piece appears identical. As I mentioned in the doc change, it also has a fan tachometer closed-loop mode that seems new (at least I didn't see any reference to it in the driver). That

IT8772F supports it as well. Datasheet isn't published, but you might be able to find leaked versions on the web. Search for IT8772_F_V0.4_031612.

Guenter

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors