From: Guenter Roeck <linux@roeck-us.net>
To: Hardware Monitoring <linux-hwmon@vger.kernel.org>
Cc: Jean Delvare <jdelvare@suse.com>,
Guenter Roeck <linux@roeck-us.net>,
Tzung-Bi Shih <tzungbi@kernel.org>
Subject: [PATCH] hwmon: (max6697) Document discrepancy in overtemperature status bit values
Date: Sat, 27 Jul 2024 13:20:07 -0700 [thread overview]
Message-ID: <20240727202007.1656841-1-linux@roeck-us.net> (raw)
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>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
drivers/hwmon/max6697.c | 10 ++++++++++
1 file changed, 10 insertions(+)
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, ®val);
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:
--
2.39.2
next reply other threads:[~2024-07-27 20:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-27 20:20 Guenter Roeck [this message]
2024-07-28 12:17 ` [PATCH] hwmon: (max6697) Document discrepancy in overtemperature status bit values Tzung-Bi Shih
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240727202007.1656841-1-linux@roeck-us.net \
--to=linux@roeck-us.net \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=tzungbi@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox