mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RFC PATCH 1/2] i3c: master: Emit firmware modalias for SETAASA devices
@ 2026-08-11 10:38 Nirmoy Das
  2026-08-11 10:38 ` [RFC PATCH 2/2] i3c: master: Propagate SETAASA early device-add failures Nirmoy Das
  0 siblings, 1 reply; 2+ messages in thread
From: Nirmoy Das @ 2026-08-11 10:38 UTC (permalink / raw)
  To: Alexandre Belloni, Frank Li; +Cc: Akhil R, linux-i3c, linux-kernel, Nirmoy Das

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
Signed-off-by: Nirmoy Das <nirmoyd@nvidia.com>
---
 drivers/i3c/master.c | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
index afcd7a21a3e66e..922da77cbdf324 100644
--- a/drivers/i3c/master.c
+++ b/drivers/i3c/master.c
@@ -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
-- 
2.43.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [RFC PATCH 2/2] i3c: master: Propagate SETAASA early device-add failures
  2026-08-11 10:38 [RFC PATCH 1/2] i3c: master: Emit firmware modalias for SETAASA devices Nirmoy Das
@ 2026-08-11 10:38 ` Nirmoy Das
  0 siblings, 0 replies; 2+ messages in thread
From: Nirmoy Das @ 2026-08-11 10:38 UTC (permalink / raw)
  To: Alexandre Belloni, Frank Li; +Cc: Akhil R, linux-i3c, linux-kernel, Nirmoy Das

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
Signed-off-by: Nirmoy Das <nirmoyd@nvidia.com>
---
 drivers/i3c/master.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
index 922da77cbdf324..7a83f39448e8ed 100644
--- a/drivers/i3c/master.c
+++ b/drivers/i3c/master.c
@@ -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;
+		}
 	}
 
 	/*
-- 
2.43.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-11 10:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-11 10:38 [RFC PATCH 1/2] i3c: master: Emit firmware modalias for SETAASA devices Nirmoy Das
2026-08-11 10:38 ` [RFC PATCH 2/2] i3c: master: Propagate SETAASA early device-add failures Nirmoy Das

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®