[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260205102942.28745-2-tinsaetadesse2015@gmail.com>
Date: Thu, 5 Feb 2026 13:29:24 +0300
From: Tinsae Tadesse <tinsaetadesse2015@...il.com>
To: Wolfram Sang <wsa+renesas@...g-engineering.com>,
Jean Delvare <jdelvare@...e.com>,
Andi Shyti <andi.shyti@...nel.org>,
Guenter Roeck <linux@...ck-us.net>
Cc: Tinsae Tadesse <tinsaetadesse2015@...il.com>,
linux-i2c@...r.kernel.org,
linux-hwmon@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 1/2] i2c: i801: Detect SPD Write Disable and expose as adapter quirk
Detect SPD Write Disable in SMBHSTCFG and expose it through
I2C adapter quirk. The I2C client driver may decide whether
SPD write operations are supported without implementing
device-specific policies in the SMBus controller driver.
Signed-off-by: Tinsae Tadesse <tinsaetadesse2015@...il.com>
---
drivers/i2c/busses/i2c-i801.c | 16 +++++++++++++++-
include/linux/i2c.h | 3 +++
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index 9e1789725edf..d771e9f5f82f 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -1533,6 +1533,11 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
{
int err, i, bar = SMBBAR;
struct i801_priv *priv;
+ struct i2c_adapter_quirks *quirks;
+
+ quirks = devm_kzalloc(&dev->dev, sizeof(*quirks), GFP_KERNEL);
+ if (!quirks)
+ return -ENOMEM;
priv = devm_kzalloc(&dev->dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
@@ -1600,8 +1605,17 @@ static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
/* Disable SMBus interrupt feature if SMBus using SMI# */
priv->features &= ~FEATURE_IRQ;
}
- if (priv->original_hstcfg & SMBHSTCFG_SPD_WD)
+
+ /*
+ * Detect the SPD Write Disabled status. Mark the adapter
+ * as unable to perform SPD writes, which allows consuming
+ * drivers to decide on safe operation.
+ */
+ if (priv->original_hstcfg & SMBHSTCFG_SPD_WD) {
pci_info(dev, "SPD Write Disable is set\n");
+ quirks->flags |= I2C_AQ_SPD_WRITE_DISABLED;
+ }
+ priv->adapter.quirks = quirks;
/* Clear special mode bits */
if (priv->features & (FEATURE_SMBUS_PEC | FEATURE_BLOCK_BUFFER))
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 20fd41b51d5c..4b89f0bf62a1 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -726,6 +726,9 @@ struct i2c_adapter_quirks {
/* adapter cannot do repeated START */
#define I2C_AQ_NO_REP_START BIT(7)
+/* SPD writes are blocked by host controller */
+#define I2C_AQ_SPD_WRITE_DISABLED BIT(8)
+
/*
* i2c_adapter is the structure used to identify a physical i2c bus along
* with the access algorithms necessary to access it.
--
2.52.0
Powered by blists - more mailing lists