[RFC PATCH 1/2] i3c: master: Emit firmware modalias for SETAASA devices
Nirmoy Das <[email protected]>
| Newsgroups | org.infradead.lists.linux-i3c,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
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 <[email protected]>
---
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
--
linux-i3c mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-i3c