public inbox for linux-i3c@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] i3c: master: Add WO sysfs option to re-DDA bus.
@ 2026-01-22 11:36 David Nyström
  2026-01-22 12:53 ` Wolfram Sang
  0 siblings, 1 reply; 4+ messages in thread
From: David Nyström @ 2026-01-22 11:36 UTC (permalink / raw)
  To: Alexandre Belloni, Frank Li; +Cc: linux-i3c, linux-kernel, David Nyström

Add ability to rescan the i3c bus from userspace, i.e. provoke a DDA.

Signed-off-by: David Nyström <david.nystrom@est.tech>
---
 drivers/i3c/master.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
index 80dda0e85558..edeae7493b3b 100644
--- a/drivers/i3c/master.c
+++ b/drivers/i3c/master.c
@@ -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 rescan_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(rescan);
+
 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_rescan.attr,
 	NULL,
 };
 ATTRIBUTE_GROUPS(i3c_masterdev);

---
base-commit: 9b7977f9e39b7768c70c2aa497f04e7569fd3e00
change-id: 20260116-i3c_rescan-4921d0b41a00

Best regards,
--  
David Nyström <david.nystrom@est.tech>


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

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

* Re: [PATCH] i3c: master: Add WO sysfs option to re-DDA bus.
  2026-01-22 11:36 [PATCH] i3c: master: Add WO sysfs option to re-DDA bus David Nyström
@ 2026-01-22 12:53 ` Wolfram Sang
  2026-01-22 15:47   ` David Nyström
  0 siblings, 1 reply; 4+ messages in thread
From: Wolfram Sang @ 2026-01-22 12:53 UTC (permalink / raw)
  To: David Nyström; +Cc: Alexandre Belloni, Frank Li, linux-i3c, linux-kernel

On Thu, Jan 22, 2026 at 12:36:30PM +0100, David Nyström wrote:
> Add ability to rescan the i3c bus from userspace, i.e. provoke a DDA.

Your are describing what you do but what is missing is why you want the
change. What is the use case?


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

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

* Re: [PATCH] i3c: master: Add WO sysfs option to re-DDA bus.
  2026-01-22 12:53 ` Wolfram Sang
@ 2026-01-22 15:47   ` David Nyström
  2026-01-22 16:00     ` Frank Li
  0 siblings, 1 reply; 4+ messages in thread
From: David Nyström @ 2026-01-22 15:47 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: David Nyström, Alexandre Belloni, Frank Li, linux-i3c,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 851 bytes --]


On Thu, 22 Jan 2026, Wolfram Sang wrote:

> On Thu, Jan 22, 2026 at 12:36:30PM +0100, David Nyström wrote:
>> Add ability to rescan the i3c bus from userspace, i.e. provoke a DDA.
>
> Your are describing what you do but what is missing is why you want the
> change. What is the use case?

The usecase would be an i3cdev userspace driver for a device with 
broken hotjoin support.
The device requires FW loading(userspace framework) before it will respond 
to DAA, and is thus not registered during initial bus probe.
I guess a similiar problem would apply if hot-join is bus disabled 
via sysfs, and resume hook DDA runs before i3c devices are powered up properly.

A bit of a niche usecase, I know.
I found it to be usable though, but perhaps this is better placed in 
debugfs in case its too much of an eyesore for the stable ABI.

[-- Attachment #2: Type: text/plain, Size: 111 bytes --]

-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

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

* Re: [PATCH] i3c: master: Add WO sysfs option to re-DDA bus.
  2026-01-22 15:47   ` David Nyström
@ 2026-01-22 16:00     ` Frank Li
  0 siblings, 0 replies; 4+ messages in thread
From: Frank Li @ 2026-01-22 16:00 UTC (permalink / raw)
  To: David Nyström
  Cc: Wolfram Sang, Alexandre Belloni, linux-i3c, linux-kernel

On Thu, Jan 22, 2026 at 04:47:23PM +0100, David Nyström wrote:
>
> On Thu, 22 Jan 2026, Wolfram Sang wrote:
>
> > On Thu, Jan 22, 2026 at 12:36:30PM +0100, David Nyström wrote:
> > > Add ability to rescan the i3c bus from userspace, i.e. provoke a DDA.
> >
> > Your are describing what you do but what is missing is why you want the
> > change. What is the use case?
>
> The usecase would be an i3cdev userspace driver for a device with broken
> hotjoin support.
> The device requires FW loading(userspace framework) before it will respond
> to DAA, and is thus not registered during initial bus probe.
> I guess a similiar problem would apply if hot-join is bus disabled via
> sysfs, and resume hook DDA runs before i3c devices are powered up properly.
>
> A bit of a niche usecase, I know.
> I found it to be usable though, but perhaps this is better placed in debugfs
> in case its too much of an eyesore for the stable ABI.

It is useful. Please improve commit message.

Frank


-- 
linux-i3c mailing list
linux-i3c@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-i3c

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

end of thread, other threads:[~2026-03-11 22:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-22 11:36 [PATCH] i3c: master: Add WO sysfs option to re-DDA bus David Nyström
2026-01-22 12:53 ` Wolfram Sang
2026-01-22 15:47   ` David Nyström
2026-01-22 16:00     ` Frank Li

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