[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20231009211420.3454026-3-lakshmiy@us.ibm.com>
Date: Mon, 9 Oct 2023 16:14:20 -0500
From: Lakshmi Yadlapati <lakshmiy@...ibm.com>
To: linux@...ck-us.net, wsa@...nel.org, sumit.semwal@...aro.org,
christian.koenig@....com, jdelvare@...e.com, joel@....id.au,
andrew@...id.au, eajames@...ux.ibm.com, ninad@...ux.ibm.com
Cc: Lakshmi Yadlapati <lakshmiy@...ibm.com>, linux-i2c@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-media@...r.kernel.org,
linux-hwmon@...r.kernel.org, dri-devel@...ts.freedesktop.org
Subject: [PATCH v1 2/2] hwmon: (pmbus/max31785) Add minimum delay between bus accesses
The MAX31785 has shown erratic behaviour across multiple system
designs, unexpectedly clock stretching and NAKing transactions.
Inserting a small delay (250us) after register writes makes the
issue go away.
Signed-off-by: Lakshmi Yadlapati <lakshmiy@...ibm.com>
---
drivers/hwmon/pmbus/max31785.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/hwmon/pmbus/max31785.c b/drivers/hwmon/pmbus/max31785.c
index f9aa576495a5..532e1c8f632c 100644
--- a/drivers/hwmon/pmbus/max31785.c
+++ b/drivers/hwmon/pmbus/max31785.c
@@ -5,6 +5,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
+#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/err.h>
#include <linux/i2c.h>
@@ -24,6 +25,9 @@ enum max31785_regs {
#define MAX31785_NR_PAGES 23
#define MAX31785_NR_FAN_PAGES 6
+static unsigned long throttle_delay_us = 250;
+module_param(throttle_delay_us, ulong, 0664);
+
static int max31785_read_byte_data(struct i2c_client *client, int page,
int reg)
{
@@ -337,6 +341,10 @@ static int max31785_probe(struct i2c_client *client)
I2C_FUNC_SMBUS_WORD_DATA))
return -ENODEV;
+ ret = i2c_smbus_throttle_client(client, throttle_delay_us);
+ if (ret)
+ return ret;
+
info = devm_kzalloc(dev, sizeof(struct pmbus_driver_info), GFP_KERNEL);
if (!info)
return -ENOMEM;
--
2.39.2
Powered by blists - more mailing lists