From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.15]) (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 9104A3B7753 for ; Wed, 1 Jul 2026 20:06:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.15 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782936375; cv=none; b=P3pyXM1v93AACpEufl2BqEcAKTkE0ZLuj+Nmn+EeLOq+eb3gH1NJqJ6G23iJ1IOJy5uoiBX070u+T5C9ix8BbfUIaeWhUTlJ2HJn75IHD1TLa1oGTizA6qkH8+GCzoqap1nHvZB2CZdIej08yZ7rb4gXlQGxqoGv/zF6BuKzq10= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782936375; c=relaxed/simple; bh=3P3wdcp+8UpuSxAdjYoys5NJLGvY0xP8Nj5ewS+gK0c=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=L8zmV7rF7yWXa+29cXFO30/0qyszHWhhlA489NCP24vWF9KnjI7XOE4cttfMryv1hJZd3uZdWD/bdIrS78tfDNgtKJmxHYN89UdWZ8djDieB7zlS9knVdg4x1RPC1Z2VgJvJg7srhlSr/RhwkVBdESYAmyq9q1SFWxX/WWcatvo= 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=YHIOOKJ1; arc=none smtp.client-ip=192.198.163.15 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="YHIOOKJ1" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1782936375; x=1814472375; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3P3wdcp+8UpuSxAdjYoys5NJLGvY0xP8Nj5ewS+gK0c=; b=YHIOOKJ1JhRpBesVyo2+Ek24eYe/+XlRMF09ZG4q1+8rfjmHDTEJAuEe aF3e3OxXTgk/fl4GTxywGUm62cl43ScyDIbgsS7l65JHpor4OqLfxUV95 Bi6ilzA3pvSLGyZGb1fTNaMq2s27dp4415C57phDrI16ZpSrQvR46Z8Sd 8FX7UTWkcV/FeGBF7r1q7ccUYeYe17o6Bq5o79KoOrjTUnRnHKUZ2Bhtm 5HFon5ZSQ/pG2nqC+TG41QZUCU9T3vQGoRHdm02FJjKMDGu5sEorRKUx3 5/kai9OsCdCgzSwVx7pLh7yYiSXT47mF77hMJJjtKiD8WVMASLbxW63ji A==; X-CSE-ConnectionGUID: 9zk8Z1N5R8CiSnhKpxCoDg== X-CSE-MsgGUID: 8tMg2ThfQmiBYxjeAxEBxQ== X-IronPort-AV: E=McAfee;i="6800,10657,11834"; a="83812921" X-IronPort-AV: E=Sophos;i="6.25,142,1779174000"; d="scan'208";a="83812921" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by fmvoesa109.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jul 2026 13:06:15 -0700 X-CSE-ConnectionGUID: Om5ZPycHSDekOLV1ewq8HA== X-CSE-MsgGUID: j3E+ijG7RPuonhT7Jv+F9Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,142,1779174000"; d="scan'208";a="252805033" Received: from conormcd-mobl2.ger.corp.intel.com (HELO ahunter6-desk) ([10.245.244.30]) by orviesa007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Jul 2026 13:06:12 -0700 From: Adrian Hunter To: alexandre.belloni@bootlin.com Cc: Frank.Li@nxp.com, rafael@kernel.org, linux-i3c@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pci@lists.infradead.org, linux-pm@lists.infradead.org Subject: [PATCH RFC 3/7] i3c: master: Add helper to query bus wakeup requirements Date: Wed, 1 Jul 2026 23:05:48 +0300 Message-ID: <20260701200552.220042-4-adrian.hunter@intel.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260701200552.220042-1-adrian.hunter@intel.com> References: <20260701200552.220042-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 Add i3c_master_any_wakeup_enabled(), which iterates over the devices on an I3C bus and reports whether any of them are enabled for system wakeup. Controller drivers can use this helper to determine whether wakeup support must remain available while the system is suspended. Signed-off-by: Adrian Hunter --- drivers/i3c/master.c | 27 +++++++++++++++++++++++++++ include/linux/i3c/master.h | 1 + 2 files changed, 28 insertions(+) diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index a36f9b617cbf..979457e635bd 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -1957,6 +1957,33 @@ static void i3c_master_reg_work_fn(struct work_struct *work) i3c_bus_normaluse_unlock(&master->bus); } +/** + * i3c_master_any_wakeup_enabled() - check if any device can wake the system + * @master: I3C master controller + * + * Iterate over devices on the bus and return true if any device has + * system wakeup enabled. + * + * Return: true if any device may wake the system, false otherwise. + */ +bool i3c_master_any_wakeup_enabled(struct i3c_master_controller *master) +{ + struct i3c_dev_desc *desc; + bool wakeup = false; + + i3c_bus_normaluse_lock(&master->bus); + i3c_bus_for_each_i3cdev(&master->bus, desc) { + if (desc->dev && device_may_wakeup(&desc->dev->dev)) { + wakeup = true; + break; + } + } + i3c_bus_normaluse_unlock(&master->bus); + + return wakeup; +} +EXPORT_SYMBOL_GPL(i3c_master_any_wakeup_enabled); + /** * i3c_master_dma_map_single() - Map buffer for single DMA transfer * @dev: device object of a device doing DMA diff --git a/include/linux/i3c/master.h b/include/linux/i3c/master.h index af3c35a8e7b6..b9f2d84ac276 100644 --- a/include/linux/i3c/master.h +++ b/include/linux/i3c/master.h @@ -746,6 +746,7 @@ void i3c_generic_ibi_recycle_slot(struct i3c_generic_ibi_pool *pool, struct i3c_ibi_slot *slot); void i3c_master_queue_ibi(struct i3c_dev_desc *dev, struct i3c_ibi_slot *slot); +bool i3c_master_any_wakeup_enabled(struct i3c_master_controller *master); struct i3c_ibi_slot *i3c_master_get_free_ibi_slot(struct i3c_dev_desc *dev); -- 2.53.0