From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) (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 AB8133E714A for ; Fri, 15 May 2026 16:26:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.19 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778862401; cv=none; b=fCBm8V6KnfpzujkEBL0Z+fXVGvsMHpqqdehmocQ+S0gaw31VcZWxQx2r7SPIZsGWXSCp4nER21Mi9zVGvrYQ7UipuuuU+d4wTjaBOhwj3vzgqV1K4KPZZIk5lrirL1qdGoBrM8UNmlkZv9Yj8oCebIAWRpIFenAI6/+9UB9Z1Xo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778862401; c=relaxed/simple; bh=MqUQxPJtRMYyoi1ZCQXB70GwPNJeUef867jmLmOks/U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BwZeNXo3ljebwffLB7Y3ZGFriuxQJKqF/E4sE2KxZq3G6wNV6X8Lb0eBlZmZhXcK4zi2B1wugeEqQYgdAx41ds3t4nYwZV/d8l73zuEs6MyFDGQfITHHtwGJIqJR9VQmMsEv/pRg9aDK3CwORyVSvJmYHYJWGQKnmEXY4MAQ4VQ= 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=dfUgLfaY; arc=none smtp.client-ip=198.175.65.19 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="dfUgLfaY" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1778862400; x=1810398400; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=MqUQxPJtRMYyoi1ZCQXB70GwPNJeUef867jmLmOks/U=; b=dfUgLfaYtCdQr1ZgW1TgUEhP3SXDSqlHptizsMJfGY6QIn3rZ5pwi0TV qtIYldezmQHtraxivGB65xJYlc5oU2dSAzrJ14QCu/HqBc5KUykjjxBZf S/jFeb6ai+9M+v7mYz84FBP2qplxqw+aG1hLqJ6HLYC5FVMdrA8TiWs6S OSPFT+BIO62wbNqvJ49ysuVo0YbXoGxJK8lgBXrEK7kqq50V4nZm1AC8q SyckO6rp9lPIOL92aAbQuATJsRIACjlQESOuvuX7mOCC1owZsgj/3DuAG I/bPHReCzvn7th6O8CFcayMqnVY0xlcF3dDNOEMF2wuRGPN236rb6gVhg A==; X-CSE-ConnectionGUID: tWIsZwqkRpyR535jA80lZw== X-CSE-MsgGUID: gPNQrVPwS++S5WLFS+kz4A== X-IronPort-AV: E=McAfee;i="6800,10657,11787"; a="79785223" X-IronPort-AV: E=Sophos;i="6.23,236,1770624000"; d="scan'208";a="79785223" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 May 2026 09:26:38 -0700 X-CSE-ConnectionGUID: eeoBwHfTRRygzhT6+8r9bA== X-CSE-MsgGUID: b1wIOrVET8ivUnZR3VNi0A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,236,1770624000"; d="scan'208";a="238857129" Received: from ijarvine-mobl1.ger.corp.intel.com (HELO ahunter6-desk) ([10.245.245.28]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 May 2026 09:26:34 -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 V4 01/17] i3c: mipi-i3c-hci: Fix suspend behavior when bus disable falls back to software reset Date: Fri, 15 May 2026 19:26:05 +0300 Message-ID: <20260515162621.57719-2-adrian.hunter@intel.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260515162621.57719-1-adrian.hunter@intel.com> References: <20260515162621.57719-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 Software reset was introduced as a fallback if bus disable failed. The change was made in 2 places: the cleanup path and the suspend path. For the cleanup path (i3c_hci_bus_cleanup()), after software reset the function continues to do cleanup for the current I/O mode. For the suspend path (i3c_hci_rpm_suspend()), after software reset the function returns early. However software reset does not reset any Ring Headers in the Host Controller, so returning early is not the right thing to do. Instead, continue to call suspend for the current I/O mode, which for DMA mode will reset any Ring Headers. Note, although Ring Headers should not be active at this stage, performing this reset follows the procedure defined by the specification and keeps the suspend path consistent with the cleanup path. Note also, i3c_hci_sync_irq_inactive() is still called via the PIO and DMA hci->io->suspend() callbacks. Always return 0 because the device is quiesced as much as possible and returning a negative error code would unnecessarily prevent system suspend. Fixes: 9a258d1336f7 ("i3c: mipi-i3c-hci: Fallback to software reset when bus disable fails") Signed-off-by: Adrian Hunter Reviewed-by: Frank Li --- Changes in V4: None Changes in V3: Add Frank's rev'd-by Changes in V2: Always return 0 from suspend callback Amend commit message drivers/i3c/master/mipi-i3c-hci/core.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/i3c/master/mipi-i3c-hci/core.c b/drivers/i3c/master/mipi-i3c-hci/core.c index b781dbed2165..afb0764b5e1f 100644 --- a/drivers/i3c/master/mipi-i3c-hci/core.c +++ b/drivers/i3c/master/mipi-i3c-hci/core.c @@ -762,15 +762,10 @@ static int i3c_hci_reset_and_init(struct i3c_hci *hci) int i3c_hci_rpm_suspend(struct device *dev) { struct i3c_hci *hci = dev_get_drvdata(dev); - int ret; - ret = i3c_hci_bus_disable(hci); - if (ret) { - /* Fall back to software reset to disable the bus */ - ret = i3c_hci_software_reset(hci); - i3c_hci_sync_irq_inactive(hci); - return ret; - } + /* Fall back to software reset to disable the bus */ + if (i3c_hci_bus_disable(hci)) + i3c_hci_software_reset(hci); hci->io->suspend(hci); -- 2.51.0