Skip to contentSkip to conversation

i3c: master: Add sysfs option to rescan bus via entdaa

PATCH Superseded David Nyström 3 participants 6 messages Jan 26 – Feb 5 I3C

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 i3c: master: Add sysfs option to rescan bus via entdaa

Allow userspace to request dynamic address assignment, which is useful for i3cdev devices with broken hot-join support. This will assign dynamic addresses to all devices on the I3C bus which are currently unassigned.

---
Changes in v4:
- Improved commit message, once more. Comment: Frank Li
- Added required documentation for sysfs addition. Comment: Frank Li
- Link to v3: https://patch.msgid.link/[email protected]

Changes in v3:
- Rename sysfs entry from rescan to entdda, Comment: Joshua Yeong
- Link to v2: https://patch.msgid.link/[email protected]

Changes in v2:
- Improved the commit message with "why".
- Link to v1: https://patch.msgid.link/[email protected]

---
 Documentation/ABI/testing/sysfs-bus-i3c | 19 +++++++++++++++++++
 drivers/i3c/master.c                    | 24 ++++++++++++++++++++++++
 2 files changed, 43 insertions(+)
Documentation/ABI/testing/sysfs-bus-i3c +19 -0
index c1e048957a01..040824ac7401 100644
@@ -172,3 +172,22 @@ Description:
 		the automatic retries. Exist only when I3C constroller supports
 		this retry on nack feature.
 
+What:		/sys/bus/i3c/devices/i3c-<bus-id>/entdaa
+KernelVersion:  6.20
+Contact:	[email protected]
+Description:
+		Write-only attribute that triggers a Dynamic Address Assignment
+		(DAA) procedure which discovers new I3C devices on the bus.
+		Writing any non-zero value to this attribute
+		causes the master controller to broadcast an ENTDAA
+		(Enter Dynamic Address Assignment) Common Command Code(CCC) on
+		the bus.
+
+		This is useful for discovering I3C devices that were not present
+		during initial bus initialization and are unable to issue
+		Hot-Join. Only devices without a currently assigned dynamic address
+		will respond to the ENTDAA broadcast and be assigned addresses.
+
+		Note that this mechanism is distinct from Hot-Join, since this is
+		controller-initiated discovery, while Hot-Join is device-initiated
+		method to provoke controller discovery procedure.
drivers/i3c/master.c +24 -0
index 80dda0e85558..a1d816634a25 100644
@@ -758,6 +758,29 @@ static ssize_t dev_nack_retry_count_store(struct device *dev,
 
 static DEVICE_ATTR_RW(dev_nack_retry_count);
 
+static ssize_t entdaa_store(struct device *dev,
+			    struct device_attribute *attr,
+			    const char *buf, size_t count)
+{
+	struct i3c_master_controller *master = dev_to_i3cmaster(dev);
+	unsigned long val;
+	int ret;
+
+	ret = kstrtoul(buf, 0, &val);
+	if (ret)
+		return ret;
+
+	if (val) {
+		ret = i3c_master_do_daa(master);
+		if (ret)
+			return ret;
+	}
+
+	return count;
+}
+
+static DEVICE_ATTR_WO(entdaa);
+
 static struct attribute *i3c_masterdev_attrs[] = {
 	&dev_attr_mode.attr,
 	&dev_attr_current_master.attr,
@@ -769,6 +792,7 @@ static struct attribute *i3c_masterdev_attrs[] = {
 	&dev_attr_dynamic_address.attr,
 	&dev_attr_hdrcap.attr,
 	&dev_attr_hotjoin.attr,
+	&dev_attr_entdaa.attr,
 	NULL,
 };
 ATTRIBUTE_GROUPS(i3c_masterdev);

---
base-commit: e3b32dcb9f23e3c3927ef3eec6a5842a988fb574
change-id: 20260116-i3c_rescan-4921d0b41a00

Best regards,

Signature · 1 line
David Nyström <[email protected]>
reviewer Reviewed-by on v4 1/1
#1 lore raw
Quoted 4 lines · David Nyström

Allow userspace to request dynamic address assignment, which is useful for i3cdev devices with broken hot-join support. This will assign dynamic addresses to all devices on the I3C bus which are currently unassigned.

Quoted 103 lines

---
Changes in v4:
- Improved commit message, once more. Comment: Frank Li
- Added required documentation for sysfs addition. Comment: Frank Li
- Link to v3: https://patch.msgid.link/[email protected]

Changes in v3:
- Rename sysfs entry from rescan to entdda, Comment: Joshua Yeong
- Link to v2: https://patch.msgid.link/[email protected]

Changes in v2:
- Improved the commit message with "why".
- Link to v1: https://patch.msgid.link/[email protected]

---
 Documentation/ABI/testing/sysfs-bus-i3c | 19 +++++++++++++++++++
 drivers/i3c/master.c                    | 24 ++++++++++++++++++++++++
 2 files changed, 43 insertions(+)
Documentation/ABI/testing/sysfs-bus-i3c +19 -0
index c1e048957a01..040824ac7401 100644
@@ -172,3 +172,22 @@ Description:
 		the automatic retries. Exist only when I3C constroller supports
 		this retry on nack feature.
 
+What:		/sys/bus/i3c/devices/i3c-<bus-id>/entdaa
+KernelVersion:  6.20
+Contact:	[email protected]
+Description:
+		Write-only attribute that triggers a Dynamic Address Assignment
+		(DAA) procedure which discovers new I3C devices on the bus.
+		Writing any non-zero value to this attribute
+		causes the master controller to broadcast an ENTDAA
+		(Enter Dynamic Address Assignment) Common Command Code(CCC) on
+		the bus.
+
+		This is useful for discovering I3C devices that were not present
+		during initial bus initialization and are unable to issue
+		Hot-Join. Only devices without a currently assigned dynamic address
+		will respond to the ENTDAA broadcast and be assigned addresses.
+
+		Note that this mechanism is distinct from Hot-Join, since this is
+		controller-initiated discovery, while Hot-Join is device-initiated
+		method to provoke controller discovery procedure.
drivers/i3c/master.c +24 -1
index 80dda0e85558..a1d816634a25 100644
@@ -758,6 +758,29 @@ static ssize_t dev_nack_retry_count_store(struct device *dev,
 
 static DEVICE_ATTR_RW(dev_nack_retry_count);
 
+static ssize_t entdaa_store(struct device *dev,
+			    struct device_attribute *attr,
+			    const char *buf, size_t count)
+{
+	struct i3c_master_controller *master = dev_to_i3cmaster(dev);
+	unsigned long val;
+	int ret;
+
+	ret = kstrtoul(buf, 0, &val);
+	if (ret)
+		return ret;
+
+	if (val) {
+		ret = i3c_master_do_daa(master);
+		if (ret)
+			return ret;
+	}
+
+	return count;
+}
+
+static DEVICE_ATTR_WO(entdaa);
+
 static struct attribute *i3c_masterdev_attrs[] = {
 	&dev_attr_mode.attr,
 	&dev_attr_current_master.attr,
@@ -769,6 +792,7 @@ static struct attribute *i3c_masterdev_attrs[] = {
 	&dev_attr_dynamic_address.attr,
 	&dev_attr_hdrcap.attr,
 	&dev_attr_hotjoin.attr,
+	&dev_attr_entdaa.attr,
 	NULL,
 };
 ATTRIBUTE_GROUPS(i3c_masterdev);
 
---

base-commit: e3b32dcb9f23e3c3927ef3eec6a5842a988fb574
change-id: 20260116-i3c_rescan-4921d0b41a00

Best regards,
--
David Nyström <[email protected]>

--
linux-i3c mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-i3c

#2 lore raw
Quoted 70 lines · Frank Li
Quoted 4 lines · David Nyström

Allow userspace to request dynamic address assignment, which is useful for i3cdev devices with broken hot-join support. This will assign dynamic addresses to all devices on the I3C bus which are currently unassigned.

Quoted 64 lines

---
Changes in v4:
- Improved commit message, once more. Comment: Frank Li
- Added required documentation for sysfs addition. Comment: Frank Li
- Link to v3: https://patch.msgid.link/[email protected]

Changes in v3:
- Rename sysfs entry from rescan to entdda, Comment: Joshua Yeong
- Link to v2: https://patch.msgid.link/[email protected]

Changes in v2:
- Improved the commit message with "why".
- Link to v1: https://patch.msgid.link/[email protected]

---
 Documentation/ABI/testing/sysfs-bus-i3c | 19 +++++++++++++++++++
 drivers/i3c/master.c                    | 24 ++++++++++++++++++++++++
 2 files changed, 43 insertions(+)
Documentation/ABI/testing/sysfs-bus-i3c +19 -0
index c1e048957a01..040824ac7401 100644
@@ -172,3 +172,22 @@ Description:
 		the automatic retries. Exist only when I3C constroller supports
 		this retry on nack feature.
 
+What:		/sys/bus/i3c/devices/i3c-<bus-id>/entdaa
+KernelVersion:  6.20
+Contact:	[email protected]
+Description:
+		Write-only attribute that triggers a Dynamic Address Assignment
+		(DAA) procedure which discovers new I3C devices on the bus.
+		Writing any non-zero value to this attribute
+		causes the master controller to broadcast an ENTDAA
+		(Enter Dynamic Address Assignment) Common Command Code(CCC) on
+		the bus.
+
+		This is useful for discovering I3C devices that were not present
+		during initial bus initialization and are unable to issue
+		Hot-Join. Only devices without a currently assigned dynamic address
+		will respond to the ENTDAA broadcast and be assigned addresses.
+
+		Note that this mechanism is distinct from Hot-Join, since this is
+		controller-initiated discovery, while Hot-Join is device-initiated
+		method to provoke controller discovery procedure.
drivers/i3c/master.c +10 -0
index 80dda0e85558..a1d816634a25 100644
@@ -758,6 +758,29 @@ static ssize_t dev_nack_retry_count_store(struct device *dev,
 
 static DEVICE_ATTR_RW(dev_nack_retry_count);
 
+static ssize_t entdaa_store(struct device *dev,
+			    struct device_attribute *attr,
+			    const char *buf, size_t count)
+{
+	struct i3c_master_controller *master = dev_to_i3cmaster(dev);
+	unsigned long val;
+	int ret;
+
+	ret = kstrtoul(buf, 0, &val);
+	if (ret)
Quoted 8 lines

drivers/i3c/master.c static ssize_t dev_nack_retry_count_store(struct device *dev, · line 778

Quoted 8 lines
drivers/i3c/master.c +8 -0
+		return ret;
+
+	if (val) {
+		ret = i3c_master_do_daa(master);
+		if (ret)
+			return ret;
+	}
+

Why not use kstrtobool and return -EINVAL for inputs that evaluate to false?

Quoted 5 lines
Quoted 5 lines
drivers/i3c/master.c +5 -0
+	return count;
+}
+
+static DEVICE_ATTR_WO(entdaa);
+
Quoted 8 lines

drivers/i3c/master.c static struct attribute *i3c_masterdev_attrs[] = { · line 795

Quoted 8 lines
drivers/i3c/master.c +1 -0
 static struct attribute *i3c_masterdev_attrs[] = {
 	&dev_attr_mode.attr,
 	&dev_attr_current_master.attr,
@@ -769,6 +792,7 @@ static struct attribute *i3c_masterdev_attrs[] = {
 	&dev_attr_dynamic_address.attr,
 	&dev_attr_hdrcap.attr,
 	&dev_attr_hotjoin.attr,
+	&dev_attr_entdaa.attr,

Is 'entdaa' the best naming here? Keeping it general i.e. 'daa' or 'trigger_daa' would be more flexible/extensible in my opinion.

Quoted 17 lines
Quoted 17 lines
drivers/i3c/master.c +0 -1
 	NULL,
 };
 ATTRIBUTE_GROUPS(i3c_masterdev);
 
---

base-commit: e3b32dcb9f23e3c3927ef3eec6a5842a988fb574
change-id: 20260116-i3c_rescan-4921d0b41a00

Best regards,
--
David Nyström <[email protected]>

--
linux-i3c mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-i3c

#3 lore raw
Quoted 81 lines · Meagan Lloyd
Quoted 70 lines · Frank Li
Quoted 4 lines · David Nyström

Allow userspace to request dynamic address assignment, which is useful for i3cdev devices with broken hot-join support. This will assign dynamic addresses to all devices on the I3C bus which are currently unassigned.

Quoted 64 lines

---
Changes in v4:
- Improved commit message, once more. Comment: Frank Li
- Added required documentation for sysfs addition. Comment: Frank Li
- Link to v3: https://patch.msgid.link/[email protected]

Changes in v3:
- Rename sysfs entry from rescan to entdda, Comment: Joshua Yeong
- Link to v2: https://patch.msgid.link/[email protected]

Changes in v2:
- Improved the commit message with "why".
- Link to v1: https://patch.msgid.link/[email protected]

---
 Documentation/ABI/testing/sysfs-bus-i3c | 19 +++++++++++++++++++
 drivers/i3c/master.c                    | 24 ++++++++++++++++++++++++
 2 files changed, 43 insertions(+)
Documentation/ABI/testing/sysfs-bus-i3c +19 -0
index c1e048957a01..040824ac7401 100644
@@ -172,3 +172,22 @@ Description:
 		the automatic retries. Exist only when I3C constroller supports
 		this retry on nack feature.
 
+What:		/sys/bus/i3c/devices/i3c-<bus-id>/entdaa
+KernelVersion:  6.20
+Contact:	[email protected]
+Description:
+		Write-only attribute that triggers a Dynamic Address Assignment
+		(DAA) procedure which discovers new I3C devices on the bus.
+		Writing any non-zero value to this attribute
+		causes the master controller to broadcast an ENTDAA
+		(Enter Dynamic Address Assignment) Common Command Code(CCC) on
+		the bus.
+
+		This is useful for discovering I3C devices that were not present
+		during initial bus initialization and are unable to issue
+		Hot-Join. Only devices without a currently assigned dynamic address
+		will respond to the ENTDAA broadcast and be assigned addresses.
+
+		Note that this mechanism is distinct from Hot-Join, since this is
+		controller-initiated discovery, while Hot-Join is device-initiated
+		method to provoke controller discovery procedure.
drivers/i3c/master.c +10 -0
index 80dda0e85558..a1d816634a25 100644
@@ -758,6 +758,29 @@ static ssize_t dev_nack_retry_count_store(struct device *dev,
 
 static DEVICE_ATTR_RW(dev_nack_retry_count);
 
+static ssize_t entdaa_store(struct device *dev,
+			    struct device_attribute *attr,
+			    const char *buf, size_t count)
+{
+	struct i3c_master_controller *master = dev_to_i3cmaster(dev);
+	unsigned long val;
+	int ret;
+
+	ret = kstrtoul(buf, 0, &val);
+	if (ret)
Quoted 8 lines

drivers/i3c/master.c static ssize_t dev_nack_retry_count_store(struct device *dev, · line 778

Quoted 8 lines
drivers/i3c/master.c +8 -0
+		return ret;
+
+	if (val) {
+		ret = i3c_master_do_daa(master);
+		if (ret)
+			return ret;
+	}
+

Why not use kstrtobool and return -EINVAL for inputs that evaluate to false?

Quoted 14 lines
Quoted 5 lines
Quoted 5 lines
drivers/i3c/master.c +5 -0
+	return count;
+}
+
+static DEVICE_ATTR_WO(entdaa);
+
Quoted 8 lines

drivers/i3c/master.c static struct attribute *i3c_masterdev_attrs[] = { · line 795

Quoted 8 lines
drivers/i3c/master.c +1 -0
 static struct attribute *i3c_masterdev_attrs[] = {
 	&dev_attr_mode.attr,
 	&dev_attr_current_master.attr,
@@ -769,6 +792,7 @@ static struct attribute *i3c_masterdev_attrs[] = {
 	&dev_attr_dynamic_address.attr,
 	&dev_attr_hdrcap.attr,
 	&dev_attr_hotjoin.attr,
+	&dev_attr_entdaa.attr,

Is 'entdaa' the best naming here? Keeping it general i.e. 'daa' or 'trigger_daa' would be more flexible/extensible in my opinion.

On second thought, I guess this sysfs attribute doesn't need to be extensible. For example, if a need arises to issue SETDASA or SETAASA before ENTDAA is issued, we'd create separate sysfs attributes for those & they could be used beforehand.

Indeed, it does seem that .do_daa is intended for the ENTDAA mechanism in Dynamic Address Assignment. My suggestion would still be for a generic naming like 'daa' rather than a direct reference to the ENTDAA CCC since other CCCs can still happen on the code path depending on the controller driver's implementation. For example, other CCCs on the path currently include SETNEWDA, DEFSLVS, ENEC. What are your thoughts?

Meagan

Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
drivers/i3c/master.c +0 -1
 	NULL,
 };
 ATTRIBUTE_GROUPS(i3c_masterdev);
 
---

base-commit: e3b32dcb9f23e3c3927ef3eec6a5842a988fb574
change-id: 20260116-i3c_rescan-4921d0b41a00

Best regards,
--
David Nyström <[email protected]>

--
linux-i3c mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-i3c

reviewer
#4 lore raw
Quoted 98 lines · Meagan Lloyd
Quoted 81 lines · Meagan Lloyd
Quoted 70 lines · Frank Li
Quoted 4 lines · David Nyström

Allow userspace to request dynamic address assignment, which is useful for i3cdev devices with broken hot-join support. This will assign dynamic addresses to all devices on the I3C bus which are currently unassigned.

Quoted 64 lines

---
Changes in v4:
- Improved commit message, once more. Comment: Frank Li
- Added required documentation for sysfs addition. Comment: Frank Li
- Link to v3: https://patch.msgid.link/[email protected]

Changes in v3:
- Rename sysfs entry from rescan to entdda, Comment: Joshua Yeong
- Link to v2: https://patch.msgid.link/[email protected]

Changes in v2:
- Improved the commit message with "why".
- Link to v1: https://patch.msgid.link/[email protected]

---
 Documentation/ABI/testing/sysfs-bus-i3c | 19 +++++++++++++++++++
 drivers/i3c/master.c                    | 24 ++++++++++++++++++++++++
 2 files changed, 43 insertions(+)
Documentation/ABI/testing/sysfs-bus-i3c +19 -0
index c1e048957a01..040824ac7401 100644
@@ -172,3 +172,22 @@ Description:
 		the automatic retries. Exist only when I3C constroller supports
 		this retry on nack feature.
 
+What:		/sys/bus/i3c/devices/i3c-<bus-id>/entdaa
+KernelVersion:  6.20
+Contact:	[email protected]
+Description:
+		Write-only attribute that triggers a Dynamic Address Assignment
+		(DAA) procedure which discovers new I3C devices on the bus.
+		Writing any non-zero value to this attribute
+		causes the master controller to broadcast an ENTDAA
+		(Enter Dynamic Address Assignment) Common Command Code(CCC) on
+		the bus.
+
+		This is useful for discovering I3C devices that were not present
+		during initial bus initialization and are unable to issue
+		Hot-Join. Only devices without a currently assigned dynamic address
+		will respond to the ENTDAA broadcast and be assigned addresses.
+
+		Note that this mechanism is distinct from Hot-Join, since this is
+		controller-initiated discovery, while Hot-Join is device-initiated
+		method to provoke controller discovery procedure.
drivers/i3c/master.c +10 -0
index 80dda0e85558..a1d816634a25 100644
@@ -758,6 +758,29 @@ static ssize_t dev_nack_retry_count_store(struct device *dev,
 
 static DEVICE_ATTR_RW(dev_nack_retry_count);
 
+static ssize_t entdaa_store(struct device *dev,
+			    struct device_attribute *attr,
+			    const char *buf, size_t count)
+{
+	struct i3c_master_controller *master = dev_to_i3cmaster(dev);
+	unsigned long val;
+	int ret;
+
+	ret = kstrtoul(buf, 0, &val);
+	if (ret)
Quoted 8 lines

drivers/i3c/master.c static ssize_t dev_nack_retry_count_store(struct device *dev, · line 778

Quoted 8 lines
drivers/i3c/master.c +8 -0
+		return ret;
+
+	if (val) {
+		ret = i3c_master_do_daa(master);
+		if (ret)
+			return ret;
+	}
+

Why not use kstrtobool and return -EINVAL for inputs that evaluate to false?

Quoted 14 lines
Quoted 5 lines
Quoted 5 lines
drivers/i3c/master.c +5 -0
+	return count;
+}
+
+static DEVICE_ATTR_WO(entdaa);
+
Quoted 8 lines

drivers/i3c/master.c static struct attribute *i3c_masterdev_attrs[] = { · line 795

Quoted 8 lines
drivers/i3c/master.c +1 -0
 static struct attribute *i3c_masterdev_attrs[] = {
 	&dev_attr_mode.attr,
 	&dev_attr_current_master.attr,
@@ -769,6 +792,7 @@ static struct attribute *i3c_masterdev_attrs[] = {
 	&dev_attr_dynamic_address.attr,
 	&dev_attr_hdrcap.attr,
 	&dev_attr_hotjoin.attr,
+	&dev_attr_entdaa.attr,

Is 'entdaa' the best naming here? Keeping it general i.e. 'daa' or 'trigger_daa' would be more flexible/extensible in my opinion.

Quoted 3 lines

On second thought, I guess this sysfs attribute doesn't need to be extensible. For example, if a need arises to issue SETDASA or SETAASA before ENTDAA is issued, we'd create separate sysfs attributes for those & they could be used beforehand.

Indeed, it does seem that .do_daa is intended for the ENTDAA mechanism in Dynamic Address Assignment. My suggestion would still be for a generic naming like 'daa' rather than a direct reference to the ENTDAA CCC since other CCCs can still happen on the code path depending on the controller driver's implementation. For example, other CCCs on the path currently include SETNEWDA, DEFSLVS, ENEC. What are your thoughts?

I vote do_daa, which is easy to understand by user who has less i3c background knowledge.

Please wrap your reply.

Frank

Quoted 20 lines

Meagan

Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
drivers/i3c/master.c +0 -1
 	NULL,
 };
 ATTRIBUTE_GROUPS(i3c_masterdev);
 
---

base-commit: e3b32dcb9f23e3c3927ef3eec6a5842a988fb574
change-id: 20260116-i3c_rescan-4921d0b41a00

Best regards,
--
David Nyström <[email protected]>

--
linux-i3c mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-i3c

#5 lore raw
Quoted 97 lines · Frank Li
Quoted 96 lines · Meagan Lloyd
Quoted 95 lines · Meagan Lloyd
Quoted 70 lines · Frank Li
Quoted 4 lines · David Nyström

Allow userspace to request dynamic address assignment, which is useful for i3cdev devices with broken hot-join support. This will assign dynamic addresses to all devices on the I3C bus which are currently unassigned.

Quoted 64 lines

---
Changes in v4:
- Improved commit message, once more. Comment: Frank Li
- Added required documentation for sysfs addition. Comment: Frank Li
- Link to v3: https://patch.msgid.link/[email protected]

Changes in v3:
- Rename sysfs entry from rescan to entdda, Comment: Joshua Yeong
- Link to v2: https://patch.msgid.link/[email protected]

Changes in v2:
- Improved the commit message with "why".
- Link to v1: https://patch.msgid.link/[email protected]

---
 Documentation/ABI/testing/sysfs-bus-i3c | 19 +++++++++++++++++++
 drivers/i3c/master.c                    | 24 ++++++++++++++++++++++++
 2 files changed, 43 insertions(+)
Documentation/ABI/testing/sysfs-bus-i3c +19 -0
index c1e048957a01..040824ac7401 100644
@@ -172,3 +172,22 @@ Description:
 		the automatic retries. Exist only when I3C constroller supports
 		this retry on nack feature.
 
+What:		/sys/bus/i3c/devices/i3c-<bus-id>/entdaa
+KernelVersion:  6.20
+Contact:	[email protected]
+Description:
+		Write-only attribute that triggers a Dynamic Address Assignment
+		(DAA) procedure which discovers new I3C devices on the bus.
+		Writing any non-zero value to this attribute
+		causes the master controller to broadcast an ENTDAA
+		(Enter Dynamic Address Assignment) Common Command Code(CCC) on
+		the bus.
+
+		This is useful for discovering I3C devices that were not present
+		during initial bus initialization and are unable to issue
+		Hot-Join. Only devices without a currently assigned dynamic address
+		will respond to the ENTDAA broadcast and be assigned addresses.
+
+		Note that this mechanism is distinct from Hot-Join, since this is
+		controller-initiated discovery, while Hot-Join is device-initiated
+		method to provoke controller discovery procedure.
drivers/i3c/master.c +10 -0
index 80dda0e85558..a1d816634a25 100644
@@ -758,6 +758,29 @@ static ssize_t dev_nack_retry_count_store(struct device *dev,
 
 static DEVICE_ATTR_RW(dev_nack_retry_count);
 
+static ssize_t entdaa_store(struct device *dev,
+			    struct device_attribute *attr,
+			    const char *buf, size_t count)
+{
+	struct i3c_master_controller *master = dev_to_i3cmaster(dev);
+	unsigned long val;
+	int ret;
+
+	ret = kstrtoul(buf, 0, &val);
+	if (ret)
Quoted 8 lines

drivers/i3c/master.c static ssize_t dev_nack_retry_count_store(struct device *dev, · line 778

Quoted 8 lines
drivers/i3c/master.c +8 -0
+		return ret;
+
+	if (val) {
+		ret = i3c_master_do_daa(master);
+		if (ret)
+			return ret;
+	}
+

Why not use kstrtobool and return -EINVAL for inputs that evaluate to false?

Quoted 5 lines
Quoted 5 lines
drivers/i3c/master.c +5 -0
+	return count;
+}
+
+static DEVICE_ATTR_WO(entdaa);
+
Quoted 8 lines

drivers/i3c/master.c static struct attribute *i3c_masterdev_attrs[] = { · line 795

Quoted 8 lines
drivers/i3c/master.c +1 -0
 static struct attribute *i3c_masterdev_attrs[] = {
 	&dev_attr_mode.attr,
 	&dev_attr_current_master.attr,
@@ -769,6 +792,7 @@ static struct attribute *i3c_masterdev_attrs[] = {
 	&dev_attr_dynamic_address.attr,
 	&dev_attr_hdrcap.attr,
 	&dev_attr_hotjoin.attr,
+	&dev_attr_entdaa.attr,

Is 'entdaa' the best naming here? Keeping it general i.e. 'daa' or 'trigger_daa' would be more flexible/extensible in my opinion.

Quoted 5 lines
Quoted 3 lines

On second thought, I guess this sysfs attribute doesn't need to be extensible. For example, if a need arises to issue SETDASA or SETAASA before ENTDAA is issued, we'd create separate sysfs attributes for those & they could be used beforehand.

Indeed, it does seem that .do_daa is intended for the ENTDAA mechanism in Dynamic Address Assignment. My suggestion would still be for a generic naming like 'daa' rather than a direct reference to the ENTDAA CCC since other CCCs can still happen on the code path depending on the controller driver's implementation. For example, other CCCs on the path currently include SETNEWDA, DEFSLVS, ENEC. What are your thoughts?

I vote do_daa, which is easy to understand by user who has less i3c background knowledge.

I like your suggestion. do_daa is straightforward and appropriate since that's the function that is directly called here.

Quoted 1 line

Please wrap your reply.

ack, thank you!

Meagan

Quoted 21 lines

Frank

Quoted 19 lines

Meagan

Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
drivers/i3c/master.c +0 -1
 	NULL,
 };
 ATTRIBUTE_GROUPS(i3c_masterdev);
 
---

base-commit: e3b32dcb9f23e3c3927ef3eec6a5842a988fb574
change-id: 20260116-i3c_rescan-4921d0b41a00

Best regards,
--
David Nyström <[email protected]>

--
linux-i3c mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-i3c