Skip to contentSkip to conversation

i3c: master: Emit firmware modalias for SETAASA devices

RFC PATCH New Nirmoy Das 1 participant 2 messages Aug 11 I3C

lore
Share & tools
lore

Nirmoy Das

author
#0 lore raw

RFC PATCH 1/2 i3c: master: Emit firmware modalias for SETAASA devices

SETAASA devices are allowed to omit their PID and device information CCCs. The I3C core can match these devices through firmware descriptions, but the uevent and sysfs modalias paths expose only an identity-based I3C alias.

For a PID-less SETAASA device, that alias contains no useful identity and cannot trigger loading of a driver that matches through Device Tree or ACPI. Such a driver can bind when already loaded, but it is not automatically loaded for the device.

For PID-less SETAASA devices, emit the Device Tree or ACPI modalias from both paths when available. Preserve the existing I3C identity alias for devices that report a PID and as a fallback when no firmware modalias can be generated.

Fixes 3456baa2110c ("i3c: master: match I3C device through DT and ACPI")
Assisted-by Codex:gpt-5.6-sol
---
 drivers/i3c/master.c | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)
drivers/i3c/master.c +36 -0
index afcd7a21a3e66e..922da77cbdf324 100644
@@ -283,9 +283,27 @@ static ssize_t modalias_show(struct device *dev,
 {
 	struct i3c_device *i3c = dev_to_i3cdev(dev);
 	struct i3c_device_info devinfo;
+	u8 static_addr_method = 0;
 	u16 manuf, part, ext;
+	int ret;
+
+	i3c_bus_normaluse_lock(i3c->bus);
+	if (i3c->desc->boardinfo)
+		static_addr_method = i3c->desc->boardinfo->static_addr_method;
+	i3c_bus_normaluse_unlock(i3c->bus);
 
 	i3c_device_get_info(i3c, &devinfo);
+
+	if ((static_addr_method & I3C_ADDR_METHOD_SETAASA) && !devinfo.pid) {
+		ret = of_device_modalias(dev, buf, PAGE_SIZE);
+		if (ret != -ENODEV)
+			return ret;
+
+		ret = acpi_device_modalias(dev, buf, PAGE_SIZE - 1);
+		if (ret != -ENODEV)
+			return ret;
+	}
+
 	manuf = I3C_PID_MANUF_ID(devinfo.pid);
 	part = I3C_PID_PART_ID(devinfo.pid);
 	ext = I3C_PID_EXTRA_INFO(devinfo.pid);
@@ -314,9 +332,27 @@ static int i3c_device_uevent(const struct device *dev, struct kobj_uevent_env *e
 {
 	const struct i3c_device *i3cdev = dev_to_i3cdev(dev);
 	struct i3c_device_info devinfo;
+	u8 static_addr_method = 0;
 	u16 manuf, part, ext;
+	int ret;
+
+	i3c_bus_normaluse_lock(i3cdev->bus);
+	if (i3cdev->desc->boardinfo)
+		static_addr_method = i3cdev->desc->boardinfo->static_addr_method;
+	i3c_bus_normaluse_unlock(i3cdev->bus);
 
 	i3c_device_get_info(i3cdev, &devinfo);
+
+	if ((static_addr_method & I3C_ADDR_METHOD_SETAASA) && !devinfo.pid) {
+		ret = of_device_uevent_modalias(dev, env);
+		if (ret != -ENODEV)
+			return ret;
+
+		ret = acpi_device_uevent_modalias(dev, env);
+		if (ret != -ENODEV)
+			return ret;
+	}
+
 	manuf = I3C_PID_MANUF_ID(devinfo.pid);
 	part = I3C_PID_PART_ID(devinfo.pid);
 	ext = I3C_PID_EXTRA_INFO(devinfo.pid);

base-commit: b6e56fd8c8a8ac7992868a28702192372ab04015

Signature · 1 line
2.43.0
author
#1 lore raw

RFC PATCH 2/2 i3c: master: Propagate SETAASA early device-add failures

i3c_master_bus_init() ignores errors from i3c_master_early_i3c_dev_add(). This is recoverable for SETDASA devices because they can be discovered later through ENTDAA.

SETAASA devices do not participate in ENTDAA. If their early attach or reattach fails, bus initialization still sends the SETAASA broadcast and continues without registering the device. The target may consequently have an active address without a corresponding I3C device.

Abort bus initialization when early device registration fails for a SETAASA device. Preserve the existing fallback behavior for other static address methods.

Fixes bbaf8733b848 ("i3c: master: Add support for devices using SETAASA")
Assisted-by Codex:gpt-5.6-sol
---
 drivers/i3c/master.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/i3c/master.c +6 -2
index 922da77cbdf324..7a83f39448e8ed 100644
@@ -2537,8 +2537,12 @@ static int i3c_master_bus_init(struct i3c_master_controller *master)
 		 * addressable.
 		 */
 
-		if (i3cboardinfo->static_addr)
-			i3c_master_early_i3c_dev_add(master, i3cboardinfo);
+		if (i3cboardinfo->static_addr) {
+			ret = i3c_master_early_i3c_dev_add(master, i3cboardinfo);
+			if (ret && (i3cboardinfo->static_addr_method &
+				    I3C_ADDR_METHOD_SETAASA))
+				goto err_rstdaa;
+		}
 	}
 
 	/*
Signature · 1 line
2.43.0