[SRU][P][PATCH 3/11] UBUNTU: SAUCE: i2c: i801: Do not instantiate spd5118 under SPD Write Disable
Alice C. Munduruca
alice.munduruca at canonical.com
Tue Sep 2 14:37:12 UTC 2025
From: "Yo-Jung (Leo) Lin" <leo.lin at canonical.com>
BugLink: https://bugs.launchpad.net/bugs/2114963
If SPD Write Disable bit in the SMBus is enabled, writing data to
addresses from 0x50 to 0x57 is forbidden. This may lead to the
following issues for spd5118 devices:
1) Writes to the sensor hwmon sysfs attributes will always result
in ENXIO.
2) During system-wide resume, errors may occur during regcache sync,
resulting in the following error messages:
kernel: spd5118 1-0050: failed to write b = 0: -6
kernel: spd5118 1-0050: pm: dpm_run_callback(): spd5118_resume [spd5118] returns -6
kernel: spd5118 1-0050: pm: failed to resume async: error -6
3) nvmem won't be usable, because writing to the page selector becomes
impossible.
Also, BIOS vendors may choose to set the page to a value != 0 after a board
reset. This will make the sensor not functional unless its MR11 register
can be changed, which is impossible due to writes being disabled.
To address these issues, don't instantiate it at all if the SPD Write Disable
bit is set.
Signed-off-by: Yo-Jung Lin (Leo) <leo.lin at canonical.com>
(cherry picked from https://lore.kernel.org/all/20250613-for-upstream-not-instantiate-spd5118-v2-1-cf456ed9b587@canonical.com/)
Signed-off-by: Yo-Jung (Leo) Lin <leo.lin at canonical.com>
(backported from commit cbb6c74a6507331f0bfd03b33fb763a1005b29ac noble-linux-oem)
[cremfuelled: context differed between patch and file, and so a verbatim copy of]
[cremfuelled: each hunk was placed where it most faithfully followed the original patch]
Signed-off-by: Alice C. Munduruca <alice.munduruca at canonical.com>
---
drivers/i2c/busses/i2c-i801.c | 28 +++++++++++++++++++++++-----
1 file changed, 23 insertions(+), 5 deletions(-)
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index 224dc65c7416..a5322665661b 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -983,6 +983,14 @@ static void i801_disable_host_notify(struct i801_priv *priv)
outb_p(priv->original_slvcmd, SMBSLVCMD(priv));
}
+static inline __maybe_unused void __i801_register_spd(struct i801_priv *priv)
+{
+ if (priv->original_hstcfg & SMBHSTCFG_SPD_WD)
+ i2c_register_spd_write_disable(&priv->adapter);
+ else
+ i2c_register_spd_write_enable(&priv->adapter);
+}
+
static const struct i2c_algorithm smbus_algorithm = {
.smbus_xfer = i801_access,
.functionality = i801_func,
@@ -1162,6 +1170,19 @@ static void dmi_check_onboard_devices(const struct dmi_header *dm, void *adap)
}
}
+#ifdef CONFIG_I2C_I801_MUX
+static void i801_register_spd(struct i801_priv *priv)
+{
+ if (!priv->mux_pdev)
+ __i801_register_spd(priv);
+}
+#else
+static void i801_register_spd(struct i801_priv *priv)
+{
+ __i801_register_spd(priv);
+}
+#endif
+
/* Register optional targets */
static void i801_probe_optional_targets(struct i801_priv *priv)
{
@@ -1182,10 +1203,7 @@ static void i801_probe_optional_targets(struct i801_priv *priv)
dmi_walk(dmi_check_onboard_devices, &priv->adapter);
/* Instantiate SPD EEPROMs unless the SMBus is multiplexed */
-#ifdef CONFIG_I2C_I801_MUX
- if (!priv->mux_pdev)
-#endif
- i2c_register_spd_write_enable(&priv->adapter);
+ i801_register_spd(priv);
}
#else
static void __init input_apanel_init(void) {}
@@ -1288,7 +1306,7 @@ static int i801_notifier_call(struct notifier_block *nb, unsigned long action,
return NOTIFY_DONE;
/* Call i2c_register_spd for muxed child segments */
- i2c_register_spd_write_enable(to_i2c_adapter(dev));
+ __i801_register_spd(priv);
return NOTIFY_OK;
}
--
2.48.1
More information about the kernel-team
mailing list