public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hwmon: max34451: Workaround for lost page
@ 2025-04-01 22:08 William A. Kennington III
  2025-04-01 22:52 ` Guenter Roeck
  2025-04-08  1:10 ` [PATCH v2] hwmon: max34451: Work around " William A. Kennington III
  0 siblings, 2 replies; 11+ messages in thread
From: William A. Kennington III @ 2025-04-01 22:08 UTC (permalink / raw)
  To: Jean Delvare, Guenter Roeck
  Cc: linux-hwmon, linux-kernel, openbmc, William A. Kennington III

When requesting new pages from the max34451 we sometimes see that the
firmware doesn't update the page on the max34451 side fast enough. This
results in the kernel receiving data for a different page than what it
expects.

To remedy this, the manufacturer recommends we wait 50-100us until
the firmware should be ready with the new page.

Signed-off-by: William A. Kennington III <william@wkennington.com>
---
 drivers/hwmon/pmbus/max34440.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/hwmon/pmbus/max34440.c b/drivers/hwmon/pmbus/max34440.c
index c9dda33831ff..ac3a26f7cff3 100644
--- a/drivers/hwmon/pmbus/max34440.c
+++ b/drivers/hwmon/pmbus/max34440.c
@@ -12,6 +12,7 @@
 #include <linux/init.h>
 #include <linux/err.h>
 #include <linux/i2c.h>
+#include <linux/delay.h>
 #include "pmbus.h"
 
 enum chips { max34440, max34441, max34446, max34451, max34460, max34461 };
@@ -241,6 +242,12 @@ static int max34451_set_supported_funcs(struct i2c_client *client,
 		if (rv < 0)
 			return rv;
 
+		/* Firmware is sometimes not ready if we try and read the
+		 * data from the page immediately after setting. Maxim
+		 * recommends 50-100us delay.
+		 */
+		fsleep(50);
+
 		rv = i2c_smbus_read_word_data(client,
 					      MAX34451_MFR_CHANNEL_CONFIG);
 		if (rv < 0)
-- 
2.49.0.472.ge94155a9ec-goog


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-04-11  0:11 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-01 22:08 [PATCH] hwmon: max34451: Workaround for lost page William A. Kennington III
2025-04-01 22:52 ` Guenter Roeck
2025-04-01 22:55   ` William Kennington
2025-04-02  0:19     ` Guenter Roeck
2025-04-02  8:33       ` William Kennington
2025-04-02 13:34         ` Guenter Roeck
2025-04-08  1:10 ` [PATCH v2] hwmon: max34451: Work around " William A. Kennington III
2025-04-08  2:06   ` Guenter Roeck
2025-04-09  1:17     ` Torreno, Alexis Czezar
2025-04-10 23:59       ` Torreno, Alexis Czezar
2025-04-11  0:11         ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox