[PATCH v4 2/2] hwmon: (spd5118) Avoid probing when 16-bit addressing is enabled

From: Armin Wolf

Date: Tue Sep 01 2026 - 16:07:53 EST


Support for 16-bit addressing was removed when support for i3c
was added to the driver. Switching between 8-bit and 16-bit addressing
might confuse the system firmware, so we are forced to bail out if
16-bit addressing was configured during boot.

Signed-off-by: Armin Wolf <W_Armin@xxxxxx>
---
Changes since v3:
- new patch
---
drivers/hwmon/spd5118.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/drivers/hwmon/spd5118.c b/drivers/hwmon/spd5118.c
index f79b46085ecc..52f354489341 100644
--- a/drivers/hwmon/spd5118.c
+++ b/drivers/hwmon/spd5118.c
@@ -16,6 +16,7 @@

#include <linux/bitops.h>
#include <linux/bits.h>
+#include <linux/dev_printk.h>
#include <linux/err.h>
#include <linux/i2c.h>
#include <linux/i3c/device.h>
@@ -664,6 +665,13 @@ static int spd5118_i2c_init(struct i2c_client *client)
if (mode < 0)
return mode;

+ /* 16-bit addressing is not supported */
+ if (mode & SPD5118_LEGACY_MODE_ADDR) {
+ dev_notice(&client->dev,
+ "Unable to access device due to 16-bit addressing being enabled\n");
+ return -ENODEV;
+ }
+
err = i2c_smbus_write_byte_data(client, SPD5118_REG_I2C_LEGACY_MODE,
mode & ~SPD5118_LEGACY_PAGE_MASK);
if (err < 0)
--
2.39.5