Message ID | 20240102-j7200-pcie-s2r-v3-4-5c2e4a3fac1f@bootlin.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-67151-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:b825:b0:106:860b:bbdd with SMTP id da37csp470603dyb; Thu, 15 Feb 2024 07:19:47 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWJXbGxea4Ai2DXNIcHNmg1WWbJpevVgwj34QnACAaZD6daE803WarNnCR1qpsurbhiupo/rizt9S7ngDEVNS3Ke9Fe6A== X-Google-Smtp-Source: AGHT+IH1y6XUh0ZeTUDUEPoXtG99Y4J5F6MLrDDZeC17mxlLtb2q7HS9q8++ZC4GtgouIYzg9XJL X-Received: by 2002:aa7:c1d2:0:b0:561:e8c:791e with SMTP id d18-20020aa7c1d2000000b005610e8c791emr1809889edp.38.1708010387588; Thu, 15 Feb 2024 07:19:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708010387; cv=pass; d=google.com; s=arc-20160816; b=PHKMCYTpi+mwP9U23csFUeFujgRhYTEnz1eKHS+5eYJtoCwiF34I9p0H0iKSzHvisW DUhApFfG11s+ryCCVuyOmQZbrtcAPEL+1Qp8/I5B9kGalAtje8X50WKpG1mU/upLYKPj cyXgF5wyU3Q3/MoefFVLCOKIlyOLOgl9IEqyzhS7ldRLFxcbkm2jxfFFcrBaxIVP8avY hqvLzb5SkISHzYJpTB2jTfWmWL+E6DUiqPPCOeVKA4HPzhQ8nBGchZMWoXTX2ow3Vd2v dGGwpcKKpgmrAlcdr235fEHqXU/CKlybVYLKmchF3zwy+cOvHCOaFHYZJng5jq1XG+ra s/pg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=5Nb4IKDaAI4vBqYGKsypVxdn/pv7j5S+qa35Zvmbq10=; fh=wHZQkXie84v2FP+2z7dUEuyvptHwnAyqgx34WxJkhrY=; b=1CfyOwtNEUp4MDLHxKIsSt0oZ/pBp/4B2iRPEur5T1qLvTP4T4dNRb82dA0FAlgPBY t8Cn1RQ2G5hQIUeczP5GJVkLm6PQOt7FFnMAT3CBe/ksUINPH9RhzBoLnInQre9FNVwh sqz3PC87uGaYFA4hC85z4dD1QUmrrM241jAoePlFe/YkWH0QIrw6qxxruqeG16FlE+TG CIkcW45v1Cv2zY42TbuNt7VRvZ5RRe1+q+2++RlQDkDokInnm+ZlS/SCdZ+Lq4vIURi4 +rp2aPlgyACkvibGvWAulFWd57bobwZl+YQdNH7evxcK+h1XBR2O/UmZUb7/gokNTBtO 1R9A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=a1sPo+Sl; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-67151-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67151-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id et5-20020a056402378500b00563c62d868csi266494edb.61.2024.02.15.07.19.47 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 07:19:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-67151-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=a1sPo+Sl; arc=pass (i=1 spf=pass spfdomain=bootlin.com dkim=pass dkdomain=bootlin.com dmarc=pass fromdomain=bootlin.com); spf=pass (google.com: domain of linux-kernel+bounces-67151-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-67151-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 050581F2261F for <ouuuleilei@gmail.com>; Thu, 15 Feb 2024 15:19:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C694B13474B; Thu, 15 Feb 2024 15:18:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="a1sPo+Sl" Received: from relay1-d.mail.gandi.net (relay1-d.mail.gandi.net [217.70.183.193]) (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 CF3EC13249D; Thu, 15 Feb 2024 15:18:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.193 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708010288; cv=none; b=c4/dRJt+laqMArcKDScYQhJ21G1A5x05EnAZ93ji+XcvVOMB/riJJz4umDyJZCLOBKu/VWI6gfJh9HWZmpj38VziFgRf1Q6EQ6WZqZ3wej5wvzeQ6N3eMF5yyqocXUK/KztP5laaWbupMT9A921VffNmf/IJFJEJkLTyiOvDaLA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708010288; c=relaxed/simple; bh=gwP4GGnMLfEyHCmYyPO/TojmDhPU7kHveCMamRTjHN0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fiKOCX5TDz8aXQ7a12yj/OcZQBZZIf7yufTLI2uiU1kDTUPVPeiXScNUj5PBa8/VwxV+oisddcMtasTNEy6Izl532w2Y7MI+ByzHoVQeqdw2LWnskNvF1WAQG9NUb1uSs27F/PJhi29R/zkG82Px0kfkxL/BFtr7aTIhFJO2JMU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b=a1sPo+Sl; arc=none smtp.client-ip=217.70.183.193 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Received: by mail.gandi.net (Postfix) with ESMTPSA id 06364240006; Thu, 15 Feb 2024 15:18:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1708010284; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5Nb4IKDaAI4vBqYGKsypVxdn/pv7j5S+qa35Zvmbq10=; b=a1sPo+SljVkvFgmvNstzu6qhGzIn8T2Jlq8tR6v7f3Wbt2waxMx0PuXyqzenCM75tzcGFX /EFaVr4qjHtDeGymq+4E5AB4rp8tCP1yfFcg2ezFRM5SF2tHoz+oGaVIYhdUDJDDuKqQkX RMfkk8TZENhJCHFuKZRiqlsZU5G9g6gmNL0swzNg3pxdi92grHlbi6MIUQnYmxpu3f9Ueu aZEd4yXKtB7eHTAtqi/3ORkRti+LBBzONHFZbGbrEJJdrI41gF656WQxq8D1waPDOhrNEJ m+ECSeFtL8qio+b0CmbOQxBVJDbd5Yr8KkltuhGdubtNpfYUCvmb8wxccoMPyw== From: Thomas Richard <thomas.richard@bootlin.com> Date: Thu, 15 Feb 2024 16:17:49 +0100 Subject: [PATCH v3 04/18] i2c: omap: wakeup the controller during suspend() callback Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240102-j7200-pcie-s2r-v3-4-5c2e4a3fac1f@bootlin.com> References: <20240102-j7200-pcie-s2r-v3-0-5c2e4a3fac1f@bootlin.com> In-Reply-To: <20240102-j7200-pcie-s2r-v3-0-5c2e4a3fac1f@bootlin.com> To: Linus Walleij <linus.walleij@linaro.org>, Bartosz Golaszewski <brgl@bgdev.pl>, Andy Shevchenko <andy@kernel.org>, Tony Lindgren <tony@atomide.com>, Haojian Zhuang <haojian.zhuang@linaro.org>, Vignesh R <vigneshr@ti.com>, Aaro Koskinen <aaro.koskinen@iki.fi>, Janusz Krzysztofik <jmkrzyszt@gmail.com>, Andi Shyti <andi.shyti@kernel.org>, Peter Rosin <peda@axentia.se>, Vinod Koul <vkoul@kernel.org>, Kishon Vijay Abraham I <kishon@kernel.org>, Philipp Zabel <p.zabel@pengutronix.de>, Lorenzo Pieralisi <lpieralisi@kernel.org>, =?utf-8?q?Krzysztof_Wilczy=C5=84?= =?utf-8?q?ski?= <kw@linux.com>, Rob Herring <robh@kernel.org>, Bjorn Helgaas <bhelgaas@google.com> Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org, linux-i2c@vger.kernel.org, linux-phy@lists.infradead.org, linux-pci@vger.kernel.org, gregory.clement@bootlin.com, theo.lebrun@bootlin.com, thomas.petazzoni@bootlin.com, u-kumar1@ti.com, Thomas Richard <thomas.richard@bootlin.com> X-Mailer: b4 0.12.0 X-GND-Sasl: thomas.richard@bootlin.com X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790978700526674214 X-GMAIL-MSGID: 1790978700526674214 |
Series |
Add suspend to ram support for PCIe on J7200
|
|
Commit Message
Thomas Richard
Feb. 15, 2024, 3:17 p.m. UTC
A device may need the controller up during suspend_noirq() or
resume_noirq().
But if the controller is autosuspended, there is no way to wakeup it during
suspend_noirq() or resume_noirq() because runtime pm is disabled at this
time.
The suspend() callback wakes up the controller, so it is available until
its suspend_noirq() callback (pm_runtime_force_suspend()).
During the resume, it's restored by resume_noirq() callback
(pm_runtime_force_resume()). Then resume() callback enables autosuspend.
So the controller is up during a little time slot in suspend and resume
sequences even if it's not used.
Signed-off-by: Thomas Richard <thomas.richard@bootlin.com>
---
drivers/i2c/busses/i2c-omap.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
Comments
On Thu, Feb 15, 2024 at 04:17:49PM +0100, Thomas Richard wrote: > A device may need the controller up during suspend_noirq() or > resume_noirq(). > But if the controller is autosuspended, there is no way to wakeup it during > suspend_noirq() or resume_noirq() because runtime pm is disabled at this > time. > > The suspend() callback wakes up the controller, so it is available until > its suspend_noirq() callback (pm_runtime_force_suspend()). > During the resume, it's restored by resume_noirq() callback > (pm_runtime_force_resume()). Then resume() callback enables autosuspend. > > So the controller is up during a little time slot in suspend and resume > sequences even if it's not used. .. > + /* > + * If the controller is autosuspended, there is no way to wakeup it once > + * runtime pm is disabled (in suspend_late()). > + * But a device may need the controller up during suspend_noirq() or > + * resume_noirq(). > + * Wakeup the controller while runtime pm is enabled, so it is available until > + * its suspend_noirq(), and from resume_noirq(). > + */ It's a bit random line lengths... Can you repack this to be more condensed?
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index 42165ef57946..c11deb285114 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c @@ -1575,9 +1575,31 @@ static int __maybe_unused omap_i2c_runtime_resume(struct device *dev) return 0; } +static int omap_i2c_suspend(struct device *dev) +{ + /* + * If the controller is autosuspended, there is no way to wakeup it once + * runtime pm is disabled (in suspend_late()). + * But a device may need the controller up during suspend_noirq() or + * resume_noirq(). + * Wakeup the controller while runtime pm is enabled, so it is available until + * its suspend_noirq(), and from resume_noirq(). + */ + return pm_runtime_resume_and_get(dev); +} + +static int omap_i2c_resume(struct device *dev) +{ + pm_runtime_mark_last_busy(dev); + pm_runtime_put_autosuspend(dev); + + return 0; +} + static const struct dev_pm_ops omap_i2c_pm_ops = { SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) + SET_SYSTEM_SLEEP_PM_OPS(omap_i2c_suspend, omap_i2c_resume) SET_RUNTIME_PM_OPS(omap_i2c_runtime_suspend, omap_i2c_runtime_resume, NULL) };