summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2024-07-27 12:06:04 -0700
committerGuenter Roeck <linux@roeck-us.net>2024-07-31 10:43:53 -0700
commit3adc2857bb6a7c6cb669627b87e9998a3a28231d (patch)
treeb77ddbab9c8f7f3136e4a145a9ed4df89928724d
parentc1b93b5414b48054600c96e28c325ad5920a47e6 (diff)
downloadlwn-3adc2857bb6a7c6cb669627b87e9998a3a28231d.tar.gz
lwn-3adc2857bb6a7c6cb669627b87e9998a3a28231d.zip
hwmon: (max6697) Document discrepancy in overtemperature status bit values
In the MAX6581 datasheet Revision 0 to 3, the local channel overtemperature status is reported in bit 6 of register 0x45, and the overtemperature status for remote channel 7 is reported in bit 7. In Revision 4 and later, the local channel overtemperature status is reported in bit 7, and the remote channel 7 overtemperature status is reported in bit 6. A real chip was found to match the functionality documented in Revision 4 and later. The code was fixed with commit 1ea3fd1eb986 ("hwmon: (max6697) Fix swapped temp{1,8} critical alarms"). At that time it looked like this was an original bug. It only turned out later that the problem was the result of incorrect information in the chip datasheet. Document the discrepancy to avoid confusion caused by old versions of the datasheet. Cc: Tzung-Bi Shih <tzungbi@kernel.org> Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
-rw-r--r--drivers/hwmon/max6697.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/hwmon/max6697.c b/drivers/hwmon/max6697.c
index 0c34c0c81232..0735a1d2c20f 100644
--- a/drivers/hwmon/max6697.c
+++ b/drivers/hwmon/max6697.c
@@ -248,6 +248,16 @@ static int max6697_read(struct device *dev, enum hwmon_sensor_types type,
ret = regmap_read(regmap, MAX6697_REG_STAT_CRIT, &regval);
if (ret)
return ret;
+ /*
+ * In the MAX6581 datasheet revision 0 to 3, the local channel
+ * overtemperature status is reported in bit 6 of register 0x45,
+ * and the overtemperature status for remote channel 7 is
+ * reported in bit 7. In Revision 4 and later, the local channel
+ * overtemperature status is reported in bit 7, and the remote
+ * channel 7 overtemperature status is reported in bit 6. A real
+ * chip was found to match the functionality documented in
+ * Revision 4 and later.
+ */
*val = !!(regval & BIT(channel ? channel - 1 : 7));
break;
case hwmon_temp_max_alarm: