From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DD2BC1F3D56 for ; Tue, 27 Jan 2026 02:50:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769482222; cv=none; b=b3IFUI0XgDGdtguK7+Um/gUarBiBbSEPVHKsVSpD+nhHVRb4F9SvY0QltPZ2QJhTYtYWpu5mZK1SDx8ki35kCQ2r2OCeVMmTYsh4l7n5p0luBkRJTHevNJ3zpwbzh6jPKxX/WxdGa1CBf/1GlxRim6SSgkIklqnTTeDga40n9J8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769482222; c=relaxed/simple; bh=Qpac9JeeFivwg6E9fwZHV2g4BsdgI7XIYLa1Vf9cf/c=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=NmoQIaaGkLFQL594+IZQ4FmQYWro8a1XrXNhKvbAsEtTQdnyf0iHpE+klMn6yoEEqbBgkdwWsI4z7IU8CZGLkhi+XLRfZvK/YrjQPuBMZthw03MYauyQjua4uNngbE5IwWziQlKslPO3dOsVj+T8vZ4Sa/9Yb3XJkWBGC2DXodM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b=g+JNte+H; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="g+JNte+H" Received: from [100.64.217.192] (unknown [20.29.225.195]) by linux.microsoft.com (Postfix) with ESMTPSA id 492F020B7165; Mon, 26 Jan 2026 18:50:20 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 492F020B7165 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1769482220; bh=vpRBYzhE+o0Tr/BwdMUTP0BC68Y6RBFAK/palQlBJXg=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=g+JNte+Hwm08TqrplPg31c6tltqWhBnlpTZD41AzubyzsQ3a/rDl9wt+OTto8OH7p jnvNyy1m15BcxFBxlVo24Hli9EdFzbBu6x/7J2Cwkfsmy/jL3VmptghStGYNRw5L9g q6bYOqFuCEPVR+qC4fn5ojPaCnG9ixPhZq5rf444= Message-ID: <149b630d-ba89-453d-aad1-a0d96b0c26b6@linux.microsoft.com> Date: Mon, 26 Jan 2026 18:50:20 -0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4] i3c: master: Add sysfs option to rescan bus via entdaa To: Frank Li , =?UTF-8?Q?David_Nystr=C3=B6m?= Cc: Alexandre Belloni , linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, Joshua Yeong References: <20260126-i3c_rescan-v4-1-6b3559d82abc@est.tech> Content-Language: en-US From: Meagan Lloyd In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 1/26/2026 9:18 AM, Frank Li wrote: > On Mon, Jan 26, 2026 at 09:37:01AM +0100, David Nyström wrote: >> 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. > Reviewed-by: Frank Li >> Signed-off-by: David Nyström >> --- >> 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/20260123-i3c_rescan-v3-1-026429fa0c65@est.tech >> >> Changes in v3: >> - Rename sysfs entry from rescan to entdda, Comment: Joshua Yeong >> - Link to v2: https://patch.msgid.link/20260122-i3c_rescan-v2-1-84c74a483f03@est.tech >> >> Changes in v2: >> - Improved the commit message with "why". >> - Link to v1: https://patch.msgid.link/20260122-i3c_rescan-v1-1-0c17071e232b@est.tech >> --- >> Documentation/ABI/testing/sysfs-bus-i3c | 19 +++++++++++++++++++ >> drivers/i3c/master.c | 24 ++++++++++++++++++++++++ >> 2 files changed, 43 insertions(+) >> >> diff --git a/Documentation/ABI/testing/sysfs-bus-i3c b/Documentation/ABI/testing/sysfs-bus-i3c >> index c1e048957a01..040824ac7401 100644 >> --- a/Documentation/ABI/testing/sysfs-bus-i3c >> +++ b/Documentation/ABI/testing/sysfs-bus-i3c >> @@ -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-/entdaa >> +KernelVersion: 6.20 >> +Contact: linux-i3c@vger.kernel.org >> +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. >> diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c >> index 80dda0e85558..a1d816634a25 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 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; >> + } >> + Why not use kstrtobool and return -EINVAL for inputs that evaluate to false? >> + 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, Is 'entdaa' the best naming here? Keeping it general i.e. 'daa' or 'trigger_daa' would be more flexible/extensible in my opinion. >> NULL, >> }; >> ATTRIBUTE_GROUPS(i3c_masterdev); >> >> --- >> base-commit: e3b32dcb9f23e3c3927ef3eec6a5842a988fb574 >> change-id: 20260116-i3c_rescan-4921d0b41a00 >> >> Best regards, >> -- >> David Nyström >> >> >> -- >> linux-i3c mailing list >> linux-i3c@lists.infradead.org >> http://lists.infradead.org/mailman/listinfo/linux-i3c