aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2021-12-13 11:26:54 -0800
committerGuenter Roeck <linux@roeck-us.net>2022-07-13 08:38:18 -0700
commitd8521f82dfb67442777a3f7ec2fdc1237384195e (patch)
treee59006100b6e53d0735bae3d08cd937b2ec61881
parenthwmon: (lm90) Add support for ON Semiconductor NCT214 and NCT72 (diff)
downloadlinux-dev-d8521f82dfb67442777a3f7ec2fdc1237384195e.tar.xz
linux-dev-d8521f82dfb67442777a3f7ec2fdc1237384195e.zip
hwmon: (lm90) Add support for ON Semiconductor NCT218
NCT218 is compatible to NCT72 and NCT214. It also supports PEC (packet error checking). Similar to NCT72 and NCT214, PEC support is undocumented. Unlike NCT214 and NCT72, NCT218 does not support the undocumented secondary chip and manufacturer ID registers at 0x3e and 0x3f and returns 0x00 when reading those registers. The value for the chip revision register is not documented but was observed to be 0xca. Use that information to improve chip detection accuracy. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r--Documentation/hwmon/lm90.rst10
-rw-r--r--drivers/hwmon/Kconfig2
-rw-r--r--drivers/hwmon/lm90.c31
3 files changed, 40 insertions, 3 deletions
diff --git a/Documentation/hwmon/lm90.rst b/Documentation/hwmon/lm90.rst
index 91947825e734..ef8b55c17118 100644
--- a/Documentation/hwmon/lm90.rst
+++ b/Documentation/hwmon/lm90.rst
@@ -157,6 +157,16 @@ Supported chips:
https://www.onsemi.com/PowerSolutions/product.do?id=NCT214
+ * ON Semiconductor NCT218
+
+ Prefix: 'nct218'
+
+ Addresses scanned: I2C 0x4c - 0x4d
+
+ Datasheet: Publicly available at the ON Semiconductor website
+
+ https://www.onsemi.com/PowerSolutions/product.do?id=NCT218
+
* ON Semiconductor NCT72
Prefix: 'nct72'
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 9353d207f254..32c605eaec7e 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -1365,7 +1365,7 @@ config SENSORS_LM90
Maxim MAX1617, MAX6642, MAX6646, MAX6647, MAX6648, MAX6649, MAX6654,
MAX6657, MAX6658, MAX6659, MAX6680, MAX6681, MAX6692, MAX6695,
MAX6696,
- ON Semiconductor NCT1008, NCT210, NCT72, NCT214,
+ ON Semiconductor NCT1008, NCT210, NCT72, NCT214, NCT218,
Winbond/Nuvoton W83L771W/G/AWG/ASG,
Philips SA56004, GMT G781, Texas Instruments TMP451 and TMP461
sensor chips.
diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
index 63bd7c3dcc6b..a553c611624b 100644
--- a/drivers/hwmon/lm90.c
+++ b/drivers/hwmon/lm90.c
@@ -69,8 +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 NCT72, NCT214, and NCT218 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.
@@ -262,6 +263,7 @@ static const struct i2c_device_id lm90_id[] = {
{ "nct1008", adt7461a },
{ "nct210", nct210 },
{ "nct214", nct72 },
+ { "nct218", nct72 },
{ "nct72", nct72 },
{ "w83l771", w83l771 },
{ "sa56004", sa56004 },
@@ -358,6 +360,10 @@ static const struct of_device_id __maybe_unused lm90_of_match[] = {
.data = (void *)nct72
},
{
+ .compatible = "onnn,nct218",
+ .data = (void *)nct72
+ },
+ {
.compatible = "onnn,nct72",
.data = (void *)nct72
},
@@ -1780,6 +1786,24 @@ static const char *lm90_detect_national(struct i2c_client *client, int chip_id,
return name;
}
+static const char *lm90_detect_on(struct i2c_client *client, int chip_id, int config1,
+ int convrate)
+{
+ int address = client->addr;
+ const char *name = NULL;
+
+ switch (chip_id) {
+ case 0xca: /* NCT218 */
+ if ((address == 0x4c || address == 0x4d) && !(config1 & 0x1b) &&
+ convrate <= 0x0a)
+ name = "nct218";
+ break;
+ default:
+ break;
+ }
+ return name;
+}
+
static const char *lm90_detect_analog(struct i2c_client *client, bool common_address,
int chip_id, int config1, int convrate)
{
@@ -2265,6 +2289,9 @@ static int lm90_detect(struct i2c_client *client, struct i2c_board_info *info)
case 0x01: /* National Semiconductor */
name = lm90_detect_national(client, chip_id, config1, convrate);
break;
+ case 0x1a: /* ON */
+ name = lm90_detect_on(client, chip_id, config1, convrate);
+ break;
case 0x23: /* Genesys Logic */
if (common_address && !(config1 & 0x3f) && !(convrate & 0xf8))
name = "gl523sm";