Browse Source

hwmon: (lm90) Add support for the W83L771W/G

I was wondering if that chip ever existed publicly... Apparently yes,
so add support for it.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Tested-by: Alexander Stein <alexander.stein@informatik.tu-chemnitz.de>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
Jean Delvare 14 years ago
parent
commit
c4f99a2b8f
3 changed files with 30 additions and 9 deletions
  1. 10 2
      Documentation/hwmon/lm90
  2. 1 1
      drivers/hwmon/Kconfig
  3. 19 6
      drivers/hwmon/lm90.c

+ 10 - 2
Documentation/hwmon/lm90

@@ -95,6 +95,10 @@ Supported chips:
                            0x4c, 0x4d and 0x4e
                            0x4c, 0x4d and 0x4e
     Datasheet: Publicly available at the Maxim website
     Datasheet: Publicly available at the Maxim website
                http://www.maxim-ic.com/datasheet/index.mvp/id/4199
                http://www.maxim-ic.com/datasheet/index.mvp/id/4199
+  * Winbond/Nuvoton W83L771W/G
+    Prefix: 'w83l771'
+    Addresses scanned: I2C 0x4c
+    Datasheet: No longer available
   * Winbond/Nuvoton W83L771AWG/ASG
   * Winbond/Nuvoton W83L771AWG/ASG
     Prefix: 'w83l771'
     Prefix: 'w83l771'
     Addresses scanned: I2C 0x4c
     Addresses scanned: I2C 0x4c
@@ -169,11 +173,15 @@ MAX6695 and MAX6696:
   * Second critical temperature limit
   * Second critical temperature limit
   * Two remote sensors
   * Two remote sensors
 
 
+W83L771W/G
+  * The G variant is lead-free, otherwise similar to the W.
+  * Filter and alert configuration register at 0xBF
+  * Moving average (depending on conversion rate)
+
 W83L771AWG/ASG
 W83L771AWG/ASG
+  * Successor of the W83L771W/G, same features.
   * The AWG and ASG variants only differ in package format.
   * The AWG and ASG variants only differ in package format.
-  * Filter and alert configuration register at 0xBF
   * Diode ideality factor configuration (remote sensor) at 0xE3
   * Diode ideality factor configuration (remote sensor) at 0xE3
-  * Moving average (depending on conversion rate)
 
 
 All temperature values are given in degrees Celsius. Resolution
 All temperature values are given in degrees Celsius. Resolution
 is 1.0 degree for the local temperature, 0.125 degree for the remote
 is 1.0 degree for the local temperature, 0.125 degree for the remote

+ 1 - 1
drivers/hwmon/Kconfig

@@ -615,7 +615,7 @@ config SENSORS_LM90
 	  LM86, LM89 and LM99, Analog Devices ADM1032 and ADT7461, Maxim
 	  LM86, LM89 and LM99, Analog Devices ADM1032 and ADT7461, Maxim
 	  MAX6646, MAX6647, MAX6648, MAX6649, MAX6657, MAX6658, MAX6659,
 	  MAX6646, MAX6647, MAX6648, MAX6649, MAX6657, MAX6658, MAX6659,
 	  MAX6680, MAX6681, MAX6692, MAX6695, MAX6696, and Winbond/Nuvoton
 	  MAX6680, MAX6681, MAX6692, MAX6695, MAX6696, and Winbond/Nuvoton
-	  W83L771AWG/ASG sensor chips.
+	  W83L771W/G/AWG/ASG sensor chips.
 
 
 	  This driver can also be built as a module.  If so, the module
 	  This driver can also be built as a module.  If so, the module
 	  will be called lm90.
 	  will be called lm90.

+ 19 - 6
drivers/hwmon/lm90.c

@@ -88,8 +88,8 @@
  * Addresses to scan
  * Addresses to scan
  * Address is fully defined internally and cannot be changed except for
  * Address is fully defined internally and cannot be changed except for
  * MAX6659, MAX6680 and MAX6681.
  * MAX6659, MAX6680 and MAX6681.
- * LM86, LM89, LM90, LM99, ADM1032, ADM1032-1, ADT7461, MAX6649, MAX6657
- * and MAX6658 have address 0x4c.
+ * LM86, LM89, LM90, LM99, ADM1032, ADM1032-1, ADT7461, MAX6649, MAX6657,
+ * MAX6658 and W83L771 have address 0x4c.
  * ADM1032-2, ADT7461-2, LM89-1, LM99-1 and MAX6646 have address 0x4d.
  * ADM1032-2, ADT7461-2, LM89-1, LM99-1 and MAX6646 have address 0x4d.
  * MAX6647 has address 0x4e.
  * MAX6647 has address 0x4e.
  * MAX6659 can have address 0x4c, 0x4d or 0x4e.
  * MAX6659 can have address 0x4c, 0x4d or 0x4e.
@@ -1237,10 +1237,23 @@ static int lm90_detect(struct i2c_client *new_client,
 	} else
 	} else
 	if (address == 0x4C
 	if (address == 0x4C
 	 && man_id == 0x5C) { /* Winbond/Nuvoton */
 	 && man_id == 0x5C) { /* Winbond/Nuvoton */
-		if ((chip_id & 0xFE) == 0x10 /* W83L771AWG/ASG */
-		 && (reg_config1 & 0x2A) == 0x00
-		 && reg_convrate <= 0x08) {
-			name = "w83l771";
+		int reg_config2;
+
+		reg_config2 = i2c_smbus_read_byte_data(new_client,
+						LM90_REG_R_CONFIG2);
+		if (reg_config2 < 0)
+			return -ENODEV;
+
+		if ((reg_config1 & 0x2A) == 0x00
+		 && (reg_config2 & 0xF8) == 0x00) {
+			if (chip_id == 0x01 /* W83L771W/G */
+			 && reg_convrate <= 0x09) {
+				name = "w83l771";
+			} else
+			if ((chip_id & 0xFE) == 0x10 /* W83L771AWG/ASG */
+			 && reg_convrate <= 0x08) {
+				name = "w83l771";
+			}
 		}
 		}
 	}
 	}