Message ID | 20240102-j7200-pcie-s2r-v1-3-84e55da52400@bootlin.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-26240-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2614:b0:101:6a76:bbe3 with SMTP id mm20csp1802794dyc; Mon, 15 Jan 2024 08:19:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IGuca6YjIUTA2Bs/VPhxVhSYAsevuyZuikHkHJ8Lmcn3/lfPBuFR/rSLudTyEg2xDJ7d87C X-Received: by 2002:a17:903:41d1:b0:1d4:b4b8:90c3 with SMTP id u17-20020a17090341d100b001d4b4b890c3mr8490655ple.6.1705335580193; Mon, 15 Jan 2024 08:19:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705335580; cv=none; d=google.com; s=arc-20160816; b=fgEeK3m4g/7hN/D1LyifF1jeyZ12xl6Rhiklc0piHCHDw4Zv62Zwzo4m+l1dQm+U+e 4a4tFbQtN0NxRt37ODNJpQ3pO/WQmwTF2yC6fqMFLrK7PgDpSIer02GAeVRJ3xgGdPIJ nKwvqOCJOs1Gvv3f+oqa9sK8SZJxv7iNb83RZJkhvjAE5LEWeH8MKgpfLGJeNfhomCJ/ KYCSsXnlk8bggBCb+MIrFTdoy7eU3oRN07VDxqmNsekaKPvRGgKyMgi+4TfFewzJZdp3 p1jnnryLDdTwxTXMkvIF7XgVtpuX6L2w+GnII5Rhaf4Gi7ySXHdSQ8/QcnWN0lLT299K OqZQ== ARC-Message-Signature: i=1; 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=luuiYzsnns/OhtWeHFFRwSXyejuX6Zby2kvPJdFacfc=; fh=ihwxVJW8DyodhmdJo1IfhLUDNDWeXh+49SpWXYbpL2Y=; b=zaXu1cciM6D6wwAN0bkydwezLSeae+Ni4dQeEme5AkCMJ+LjxwViAa2hg/XXQChQSS Ufalsj4Lc+T9LTMVVHNtjU9UJJa7YTSWY7fMR58e3YdrEVZZsv5ib0P+F8nLNeUBiU7s 9eZCSJiciI1Ngf0a4rcuYsrE5DhGy0rSg3q7y8AvYjmR2bLCo4b0f61QZ+doqIt4jRYf MMARvW3gp66UgADz4LeAB7gdxw/mID2BrUwbELiCwAQrZBxGc4V6IfoZq81XdtCjLtWa aMK93h06XsU6g1htOy/Jj4LlY2HMqg3Q5O1l8L1JD/Uc50HeQ5Y7l33zVENWNoMhWeDM XURw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=Crp6RWxA; spf=pass (google.com: domain of linux-kernel+bounces-26240-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26240-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id cl1-20020a056a02098100b005ce018f427csi9915476pgb.235.2024.01.15.08.19.40 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 08:19:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-26240-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=Crp6RWxA; spf=pass (google.com: domain of linux-kernel+bounces-26240-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26240-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id D21DE282E65 for <ouuuleilei@gmail.com>; Mon, 15 Jan 2024 16:19:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 06690199C7; Mon, 15 Jan 2024 16:16:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="Crp6RWxA" Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) (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 DDE4A17C95; Mon, 15 Jan 2024 16:16:26 +0000 (UTC) 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 77D41C000B; Mon, 15 Jan 2024 16:16:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1705335378; 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=luuiYzsnns/OhtWeHFFRwSXyejuX6Zby2kvPJdFacfc=; b=Crp6RWxAJP1bUpPZkHVslhQDy0LElcVFI6AwLcwULZs5RsYzIudWQYt8Q3iRhDgSSnaVZK 7ymwpYUXf0wGkO5wq+5zCpEykusRLnHd/2731m5szrEcC5N5vLQ/lkof9wfprFL2GDVlYU afNaDKsSr4+VALNWEMFWoWM0E5iBdmI/TqzLmaSDb8LhG0uu0N1htYIBEBKEjvqeHJsd6I PLElpPuwjvTy40jIgKBGS+dcAtKQwxZDjDs4wNOTVGcTD54SeSVUhAphBiFx+ccLAAaDHM 9Zw+x3r/aYZpT99MMMs2BmRWWIFYXclINT6abTZtRXkI30meD4hNw7NHLai+Rw== From: Thomas Richard <thomas.richard@bootlin.com> Date: Mon, 15 Jan 2024 17:14:44 +0100 Subject: [PATCH 03/14] 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-v1-3-84e55da52400@bootlin.com> References: <20240102-j7200-pcie-s2r-v1-0-84e55da52400@bootlin.com> In-Reply-To: <20240102-j7200-pcie-s2r-v1-0-84e55da52400@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>, Tom Joseph <tjoseph@cadence.com>, 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: 1788173961584408560 X-GMAIL-MSGID: 1788173961584408560 |
Series |
Add suspend to ram support for PCIe on J7200
|
|
Commit Message
Thomas Richard
Jan. 15, 2024, 4:14 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 | 15 +++++++++++++++
1 file changed, 15 insertions(+)
Comments
On Mon, Jan 15, 2024 at 6:16 PM Thomas Richard <thomas.richard@bootlin.com> 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. Same comment ->...callback...() .. > } > > + Stray blank line is added. > +static int omap_i2c_suspend(struct device *dev)
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index 42165ef57946..57f0738fa748 100644 --- a/drivers/i2c/busses/i2c-omap.c +++ b/drivers/i2c/busses/i2c-omap.c @@ -1575,9 +1575,24 @@ static int __maybe_unused omap_i2c_runtime_resume(struct device *dev) return 0; } + +static int omap_i2c_suspend(struct device *dev) +{ + 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) };