diff mbox series

[22/40] hwmon: (lm90) Add support for MAX6690

Message ID 20220525135758.2944744-23-linux@roeck-us.net (mailing list archive)
State Accepted
Headers show
Series hwmon: (lm90) Various improvements to lm90 driver | expand

Commit Message

Guenter Roeck May 25, 2022, 1:57 p.m. UTC
MAX6690 is all but identical to MAX6654. Revision 1 of its
datasheet lists the same chip ID as MAX6654, and a chip labeled
MAX6654 was found to have the chip ID listed as MAX6690 chip ID
in Revision 2 of its datasheet.

A devicetree node is not added for this chip since it is quite unlikely
that such an old chip will ever be used in a devicetree based system.
It can be added later if needed.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 Documentation/hwmon/lm90.rst |  2 +-
 drivers/hwmon/lm90.c         | 17 ++++++++++++++++-
 2 files changed, 17 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/Documentation/hwmon/lm90.rst b/Documentation/hwmon/lm90.rst
index 53429f79b819..45bc333a1219 100644
--- a/Documentation/hwmon/lm90.rst
+++ b/Documentation/hwmon/lm90.rst
@@ -370,7 +370,7 @@  MAX6648, MAX6692:
   * Better local resolution
   * Unsigned temperature
 
-MAX6654:
+MAX6654, MAX6690:
   * Better local resolution
   * Selectable address
   * Remote sensor type selection
diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
index abc64738e892..22ea75535ab4 100644
--- a/drivers/hwmon/lm90.c
+++ b/drivers/hwmon/lm90.c
@@ -42,7 +42,8 @@ 
  * accordingly, and is done during initialization. Extended precision is only
  * available at conversion rates of 1 Hz and slower. Note that extended
  * precision is not enabled by default, as this driver initializes all chips
- * to 2 Hz by design.
+ * to 2 Hz by design. The driver also supports MAX6690, which is practically
+ * identical to MAX6654.
  *
  * This driver also supports the MAX6646, MAX6647, MAX6648, MAX6649 and
  * MAX6692 chips made by Maxim.  These are again similar to the LM86,
@@ -237,6 +238,7 @@  static const struct i2c_device_id lm90_id[] = {
 	{ "max6659", max6659 },
 	{ "max6680", max6680 },
 	{ "max6681", max6680 },
+	{ "max6690", max6654 },
 	{ "max6692", max6648 },
 	{ "max6695", max6696 },
 	{ "max6696", max6696 },
@@ -1716,6 +1718,19 @@  static const char *lm90_detect_maxim(struct i2c_client *client, int chip_id,
 		if (!(config1 & 0x07) && convrate <= 0x07)
 			name = "max6654";
 		break;
+	case 0x09:
+		/*
+		 * The chip_id of the MAX6690 holds the revision of the chip.
+		 * The lowest 3 bits of the config1 register are unused and
+		 * should return zero when read.
+		 * Note that MAX6654 and MAX6690 are practically the same chips.
+		 * The only diference is the rated accuracy. Rev. 1 of the
+		 * MAX6690 datasheet lists a chip ID of 0x08, and a chip labeled
+		 * MAX6654 was observed to have a chip ID of 0x09.
+		 */
+		if (!(config1 & 0x07) && convrate <= 0x07)
+			name = "max6690";
+		break;
 	case 0x4d:
 		/*
 		 * The MAX6657, MAX6658 and MAX6659 do NOT have a chip_id