From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D0F5138E8CF for ; Tue, 12 May 2026 12:17:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778588281; cv=none; b=CuJHx48CQtilqFN+J2wnCQ7rEjYQDF2tQBgj+1yEIFPoYAbPVLZbErJKS99AanYW0vZKPYKbmu06Wuvv/b+XMjjdfYfHmXgRg6JWvWGTu7NRhf/gBt4MIsg3hPJjKsHMRcjSX4N36B3m1sngSZ7QAbT17QK0IiTv27tt61N27nk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778588281; c=relaxed/simple; bh=dLRhDnWM4Di3J+tuOGINkNqL7RQRdQqfuYDocVs/c00=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iwN4BtbNiACAIv3DQfwGo30RNbrdY1feq8XuVMIt6t/iVUQ1UJnk/NmJ29Z5tfyeRfE87KjKCvGDQpBToOjEwLAeBq+JzlN7gGJEFtw8lffsxCmLdZZOIzAuD86X6uhNk/jC9LsRoE2v17lj1W6NuIpQi/V7wF0ZXVHqDiPfFcY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=YFUVCla7; arc=none smtp.client-ip=198.175.65.21 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="YFUVCla7" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1778588280; x=1810124280; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dLRhDnWM4Di3J+tuOGINkNqL7RQRdQqfuYDocVs/c00=; b=YFUVCla7dmHqM8tDhFBvoWPrPSlqx+fuJcmhtIisp/dVKcDY1qS/KW19 qQhQh+nsxQvXHrEJm5H6l4/ZYuFINP21oIMjzD62Qp5z6MJTea48K2u4R rskRfEidno7EAEissAgQUwuTQofT15Q370pcv84IFgOBc27tjUdWXL9mN F7TgG6iEMAaSB5LU0Zq44aCihXs7ngWoyEy7J/Tb5VUE0xO/oBjp7ZPP3 46JWgQ+RgRTA58D6V25zYYM6DxY1jFgUuq5ArGh9NJgYR0XXItBnnD43Z VuCrp0h5NgPlJG1zzpgk4OpVd0HKlvYA1ENcXU1f/lQA77t/RzXGIjPXl Q==; X-CSE-ConnectionGUID: iUitP0QFTPWFm8iZTUH5uw== X-CSE-MsgGUID: CgKMsN7hRBu+70XBmV5hLA== X-IronPort-AV: E=McAfee;i="6800,10657,11783"; a="79389512" X-IronPort-AV: E=Sophos;i="6.23,230,1770624000"; d="scan'208";a="79389512" Received: from orviesa003.jf.intel.com ([10.64.159.143]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2026 05:18:00 -0700 X-CSE-ConnectionGUID: sZgNtBxVTbSkdpcwrS/srw== X-CSE-MsgGUID: J9NmNwtBSnmO3iywpDOEoQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,230,1770624000"; d="scan'208";a="241756165" Received: from amilburn-desk.amilburn-desk (HELO ahunter6-desk) ([10.245.245.121]) by ORVIESA003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2026 05:17:58 -0700 From: Adrian Hunter To: alexandre.belloni@bootlin.com Cc: Frank.Li@nxp.com, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 7/8] i3c: master: Export i3c_master_enec_disec_locked() Date: Tue, 12 May 2026 15:17:31 +0300 Message-ID: <20260512121732.406009-8-adrian.hunter@intel.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260512121732.406009-1-adrian.hunter@intel.com> References: <20260512121732.406009-1-adrian.hunter@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Organization: Intel Finland Oy, Registered Address: c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Content-Transfer-Encoding: 8bit The existing i3c_master_enec_locked() wrapper always treats a NACKed ENEC CCC as a failure (M2 error). However, broadcasting ENEC to enable Hot-Join is legitimately useful even when no I3C devices are currently present on the bus, in which case the broadcast will be NACKed and should not be reported as an error. The underlying helper i3c_master_enec_disec_locked() already accepts a suppress_m2 flag that lets callers ignore such NACKs. Expose it so that a subsequent patch enabling Hot-Join events can issue ENEC with M2 suppression. Signed-off-by: Adrian Hunter --- drivers/i3c/master.c | 27 ++++++++++++++++++++++++--- include/linux/i3c/master.h | 2 ++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index 1eb157c8091d..db46cc12c7db 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -1121,9 +1121,29 @@ int i3c_master_entdaa_locked(struct i3c_master_controller *master) } EXPORT_SYMBOL_GPL(i3c_master_entdaa_locked); -static int i3c_master_enec_disec_locked(struct i3c_master_controller *master, - u8 addr, bool enable, u8 evts, - bool suppress_m2) +/** + * i3c_master_enec_disec_locked() - send an ENEC or DISEC CCC command + * @master: master used to send frames on the bus + * @addr: a valid I3C slave address or %I3C_BROADCAST_ADDR + * @enable: true to send ENEC, false to send DISEC + * @evts: events to enable or disable + * @suppress_m2: if true, treat an M2 (NACK) error from the CCC as success + * + * Send an ENEC or DISEC CCC command to enable or disable some or all events + * coming from a specific slave, or all devices if @addr is + * %I3C_BROADCAST_ADDR. + * + * When @suppress_m2 is true, a NACK of the broadcast (which can happen when + * no devices are present on the bus) is not reported as an error. This is + * useful for callers that want to configure event reporting unconditionally, + * regardless of whether any devices are currently on the bus. + * + * This function must be called with the bus lock held in write mode. + * + * Return: 0 in case of success, or a negative error code otherwise. + */ +int i3c_master_enec_disec_locked(struct i3c_master_controller *master, u8 addr, + bool enable, u8 evts, bool suppress_m2) { struct i3c_ccc_events *events; struct i3c_ccc_cmd_dest dest; @@ -1148,6 +1168,7 @@ static int i3c_master_enec_disec_locked(struct i3c_master_controller *master, return ret; } +EXPORT_SYMBOL_GPL(i3c_master_enec_disec_locked); /** * i3c_master_disec_locked() - send a DISEC CCC command diff --git a/include/linux/i3c/master.h b/include/linux/i3c/master.h index 8cdd7be505d3..e2c831fb5354 100644 --- a/include/linux/i3c/master.h +++ b/include/linux/i3c/master.h @@ -607,6 +607,8 @@ int i3c_master_disec_locked(struct i3c_master_controller *master, u8 addr, u8 evts); int i3c_master_enec_locked(struct i3c_master_controller *master, u8 addr, u8 evts); +int i3c_master_enec_disec_locked(struct i3c_master_controller *master, u8 addr, + bool enable, u8 evts, bool suppress_m2); int i3c_master_entdaa_locked(struct i3c_master_controller *master); int i3c_master_defslvs_locked(struct i3c_master_controller *master); -- 2.51.0