]> git.ipfire.org Git - people/ms/linux.git/commitdiff
hwmon: (lm90) Add support for ON Semiconductor NCT214 and NCT72
authorGuenter Roeck <linux@roeck-us.net>
Fri, 3 Dec 2021 05:58:25 +0000 (21:58 -0800)
committerGuenter Roeck <linux@roeck-us.net>
Wed, 13 Jul 2022 15:38:18 +0000 (08:38 -0700)
NCT214 and NCT72 are compatible to ADT7461/ADT7461A but have full
PEC (packet error checking) support. PEC support is undocumented.

Both chips support the undocumented secondary chip and manufacturer
ID registers at 0x3e and 0x3f, and return 0x61 as chip ID. Use this
information to improve the accuracy of chip detection code.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Documentation/hwmon/lm90.rst
drivers/hwmon/Kconfig
drivers/hwmon/lm90.c

index ca8368ac1cf20fb47d207620fa34c72f28349dcc..91947825e7342ab3fdd1133bc5508d070b251be3 100644 (file)
@@ -147,6 +147,26 @@ Supported chips:
 
               https://www.onsemi.com/PowerSolutions/product.do?id=NCT210
 
+  * ON Semiconductor NCT214
+
+    Prefix: 'nct214'
+
+    Addresses scanned: I2C 0x18 - 0x1a, 0x29 - 0x2b, 0x4c - 0x4e
+
+    Datasheet: Publicly available at the ON Semiconductor website
+
+              https://www.onsemi.com/PowerSolutions/product.do?id=NCT214
+
+  * ON Semiconductor NCT72
+
+    Prefix: 'nct72'
+
+    Addresses scanned: I2C 0x4c - 0x4d
+
+    Datasheet: Publicly available at the ON Semiconductor website
+
+              https://www.onsemi.com/PowerSolutions/product.do?id=NCT72
+
   * Maxim MAX1617
 
     Prefix: 'max1617'
index d30ea2fea3e2bcdbe9dc4ec524c0e27ecb753812..9353d207f254a6d092798844301597738d267c25 100644 (file)
@@ -1365,7 +1365,8 @@ config SENSORS_LM90
          Maxim MAX1617, MAX6642, MAX6646, MAX6647, MAX6648, MAX6649, MAX6654,
          MAX6657, MAX6658, MAX6659, MAX6680, MAX6681, MAX6692, MAX6695,
          MAX6696,
-         ON Semiconductor NCT1008, NCT210, Winbond/Nuvoton W83L771W/G/AWG/ASG,
+         ON Semiconductor NCT1008, NCT210, NCT72, NCT214,
+         Winbond/Nuvoton W83L771W/G/AWG/ASG,
          Philips SA56004, GMT G781, Texas Instruments TMP451 and TMP461
          sensor chips.
 
index 9939a77ac00a1a1aa4ea0e06ae0c352187e9c9cf..63bd7c3dcc6be0eaa437917b10a667b958958ef8 100644 (file)
@@ -69,6 +69,9 @@
  * / ON Semiconductor. The chips are similar to ADT7461 but support two external
  * temperature sensors.
  *
+ * This driver also supports NCT72 and NCT214 from ON Semiconductor. The chips
+ * are similar to ADT7461/ADT7461A but have full PEC support (undocumented).
+ *
  * This driver also supports the SA56004 from Philips. This device is
  * pin-compatible with the LM86, the ED/EDP parts are also address-compatible.
  *
@@ -125,7 +128,7 @@ static const unsigned short normal_i2c[] = {
 enum chips { adm1023, adm1032, adt7461, adt7461a, adt7481,
        g781, lm84, lm90, lm99,
        max1617, max6642, max6646, max6648, max6654, max6657, max6659, max6680, max6696,
-       nct210, sa56004, tmp451, tmp461, w83l771,
+       nct210, nct72, sa56004, tmp451, tmp461, w83l771,
 };
 
 /*
@@ -258,6 +261,8 @@ static const struct i2c_device_id lm90_id[] = {
        { "mc1066", max1617 },
        { "nct1008", adt7461a },
        { "nct210", nct210 },
+       { "nct214", nct72 },
+       { "nct72", nct72 },
        { "w83l771", w83l771 },
        { "sa56004", sa56004 },
        { "thmc10", max1617 },
@@ -348,6 +353,14 @@ static const struct of_device_id __maybe_unused lm90_of_match[] = {
                .compatible = "onnn,nct1008",
                .data = (void *)adt7461a
        },
+       {
+               .compatible = "onnn,nct214",
+               .data = (void *)nct72
+       },
+       {
+               .compatible = "onnn,nct72",
+               .data = (void *)nct72
+       },
        {
                .compatible = "winbond,w83l771",
                .data = (void *)w83l771
@@ -534,6 +547,15 @@ static const struct lm90_params lm90_params[] = {
                .reg_status2 = MAX6696_REG_STATUS2,
                .reg_local_ext = MAX6657_REG_LOCAL_TEMPL,
        },
+       [nct72] = {
+               .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT
+                 | LM90_HAVE_BROKEN_ALERT | LM90_HAVE_EXTENDED_TEMP
+                 | LM90_HAVE_CRIT | LM90_HAVE_PEC | LM90_HAVE_UNSIGNED_TEMP
+                 | LM90_HAVE_LOW | LM90_HAVE_CONVRATE | LM90_HAVE_REMOTE_EXT,
+               .alert_alarms = 0x7c,
+               .max_convrate = 10,
+               .resolution = 10,
+       },
        [nct210] = {
                .flags = LM90_HAVE_ALARMS | LM90_HAVE_BROKEN_ALERT
                  | LM90_HAVE_REM_LIMIT_EXT | LM90_HAVE_LOW | LM90_HAVE_CONVRATE
@@ -1818,12 +1840,23 @@ static const char *lm90_detect_analog(struct i2c_client *client, bool common_add
                    convrate <= 0x0a)
                        name = "nct1008";
                break;
+       case 0x55:      /* NCT72 */
+               if (man_id2 == 0x41 && chip_id2 == 0x61 &&
+                   (address == 0x4c || address == 0x4d) && !(config1 & 0x1b) &&
+                   convrate <= 0x0a)
+                       name = "nct72";
+               break;
        case 0x57:      /* ADT7461A, NCT1008 (datasheet rev. 3) */
                if (man_id2 == 0x41 && chip_id2 == 0x61 &&
                    (address == 0x4c || address == 0x4d) && !(config1 & 0x1b) &&
                    convrate <= 0x0a)
                        name = "adt7461a";
                break;
+       case 0x5a:      /* NCT214 */
+               if (man_id2 == 0x41 && chip_id2 == 0x61 &&
+                   common_address && !(config1 & 0x1b) && convrate <= 0x0a)
+                       name = "nct214";
+               break;
        case 0x62:      /* ADT7481, undocumented */
                if (man_id2 == 0x41 && chip_id2 == 0x81 &&
                    (address == 0x4b || address == 0x4c) && !(config1 & 0x10) &&