From: Tinsae Tadesse <tinsaetadesse2015@gmail.com>
To: Wolfram Sang <wsa+renesas@sang-engineering.com>,
Jean Delvare <jdelvare@suse.com>,
Andi Shyti <andi.shyti@kernel.org>,
Guenter Roeck <linux@roeck-us.net>
Cc: Tinsae Tadesse <tinsaetadesse2015@gmail.com>,
linux-i2c@vger.kernel.org, linux-hwmon@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] i2c: i801: Detect SPD Write Disable and expose as adapter quirk
Date: Thu, 5 Feb 2026 13:29:24 +0300 [thread overview]
Message-ID: <20260205102942.28745-2-tinsaetadesse2015@gmail.com> (raw)
In-Reply-To: <20260205102942.28745-1-tinsaetadesse2015@gmail.com>
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@gmail.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
next prev parent reply other threads:[~2026-02-05 10:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-05 10:29 [PATCH 0/2] i2c: i801: Detect SPD Write Disable and expose as adapter quirk Tinsae Tadesse
2026-02-05 10:29 ` Tinsae Tadesse [this message]
2026-02-05 10:29 ` [PATCH 2/2] hwmon: spd5118: Fail probe if SPD writes are disabled Tinsae Tadesse
2026-02-05 13:46 ` Guenter Roeck
2026-02-21 9:57 ` [PATCH 0/2] i2c: i801: Detect SPD Write Disable and expose as adapter quirk TINSAE TADESSE
2026-04-21 17:56 ` Mark Pearson
2026-04-23 11:21 ` TINSAE TADESSE
2026-05-04 21:41 ` Mark Pearson
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=20260205102942.28745-2-tinsaetadesse2015@gmail.com \
--to=tinsaetadesse2015@gmail.com \
--cc=andi.shyti@kernel.org \
--cc=jdelvare@suse.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=wsa+renesas@sang-engineering.com \
/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