Message ID | 20240102-j7200-pcie-s2r-v4-3-6f1f53390c85@bootlin.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-90842-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6359:6299:b0:17c:1df7:5ed3 with SMTP id se25csp287954rwb; Mon, 4 Mar 2024 08:07:49 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVAV7BUpwRqNd8eexeVjh9c3I5gYzFBHTVKrR5BBWc2I071b0XBQhY76HI4j5aXoGdWdTx+jbFjN5tj8mlwoSaEim7qEQ== X-Google-Smtp-Source: AGHT+IErBuB0G+VsLbPrIC1+mDRcFqHFju5dNdqcGlRu+La8N+9mz0/y7OzaLgPsaWFsmUAwBwbJ X-Received: by 2002:a17:90a:b005:b0:29b:3cec:497d with SMTP id x5-20020a17090ab00500b0029b3cec497dmr2993437pjq.35.1709568469174; Mon, 04 Mar 2024 08:07:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709568469; cv=pass; d=google.com; s=arc-20160816; b=J/KJy6+LBYcocngyYXFVItVJDgGBd3ZmWNaq68wIlEzaWiLBW8Ql/orFoLWF4G/hRr Pe6ViDbcRIPqH4XTuXN9C9PQxC5rFnlwu++0TtfoJcZtTlAVCue88GG1I+HgSsseN8aL AkbHJpU+RPkDzJt8hLYrqwq486oqrvhW+HdP1+D9jCAZkg8Nt0vQCT3N6vH+s5XNQ6NS teDbGIh2FBKMfRM/2j7cRfKhEUicoGHqtTfBTBdx0K9a7bnZmKmy1RdWCbB3AiOnCtRB wd4MClXSl93i3/I7dcgOLKuYu3XBBJ2dnrh+KRksOuLR8d++EkB8T9RVOYGKWbVwCzoZ v1Iw== 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=gl1VkLUtlzwgjyFHXIWhWfMxiJmBAtrbqfGEcOsrt6A=; fh=wHZQkXie84v2FP+2z7dUEuyvptHwnAyqgx34WxJkhrY=; b=gY68idVJAWk6Pp3QuusDyUuRXx5qtqM625grE+5Kf4nQlgwZIgJFIF0uvxzcPtwJEE nnvyQE1SgOMJ+ol5ueb/Njy9MTT3etBEHqEThT7LmUco2EsHLCIYX38eaD2l4wG1uM/c iRJAAC+ztgHyMmIJRms/6TXbRZR0Ne5PH9tfOr9/iIjSruHlSxRO+oEWrii8azEQV84V +53Zr4TgGoV4rjmqyN+GAm/Vc+4BaXU6q0Tccm/SDoD43TWbrntLD182BRe3BhH1mbdT Hyb/WcDuOyQewn6P2qi2iFiD9hO0B6QDzAApFiTvTX63jVZmAcBURYImFcGzBQVE73FT jxtA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=KEWC1IKF; 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-90842-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90842-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id s24-20020a17090aad9800b0029ac01b0281si10381928pjq.180.2024.03.04.08.07.48 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 08:07:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-90842-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=KEWC1IKF; 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-90842-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-90842-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id E19D9B26925 for <ouuuleilei@gmail.com>; Mon, 4 Mar 2024 15:37:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6F7D44E1C1; Mon, 4 Mar 2024 15:36:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bootlin.com header.i=@bootlin.com header.b="KEWC1IKF" Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) (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 679C8487AE; Mon, 4 Mar 2024 15:36:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.70.183.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709566578; cv=none; b=nfUTMv73tLndztqcLkIyonpIm2LvUn3ghKywhM6vrz3BkyeI2+BJEAoOD0TiPswmKxcqSrDXstwmtcJQP02MHUz2wmfYzrco5x+82iMdhFD8fgyn75h9nZdhKP4MXkXOiw+aSJt3f3MYPqs2hIFh2vrz5BG5QUXsCzeLioTtAc4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709566578; c=relaxed/simple; bh=Ff5habTJBwpnMGCWcJcXduOtk4oykNyYJ1ARoENGFO4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=L8JZb2u0jY6P4VBVMX98e/k1NBP38UzEIDH0LwY9u1It0DX6LZWBqUnCmoLEDW/6l8zJyUe95WbdVf6t661c72jmpAD5yxcUrOM5nQ7ppC8Tnv+oMqWhZky4T92a7bWUHCYU1eX8SDck65A8vpqbynFPohsbtW+rpYYMg7JShI0= 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=KEWC1IKF; arc=none smtp.client-ip=217.70.183.201 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 0A9B61BF20A; Mon, 4 Mar 2024 15:36:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1709566574; 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=gl1VkLUtlzwgjyFHXIWhWfMxiJmBAtrbqfGEcOsrt6A=; b=KEWC1IKFF6+WH764Ea9IkJgO1K0u3tppkwQfA0RE2+3oC4gLo8ZNlA2jHd4/2XDAe4PmK0 TMiqXGm31hhI4L5f7IOPlKybsmyogXbRtpAQaI3hwmg0ibql2l4y7t3NmeUdGGFoQkFwM1 tIEszKtCKzxUKAVMKyy1Qam5JZwCrUDzidj0FFO+ZFhBbhXgEJMHIaJF0+nWSZoJ32pdh3 N2cNG9JALpmFvLzLB0Nf9aP3kgiFHcVK/4aWQ0ULdXTXW/6VX8D6FZ3UEWEXTSGRYbBGsM rZ0om+g5FXbQDL5fk4mi4A6muXj3dpVWn1V+wqf867eqall84fE/FZ2xC7aObA== From: Thomas Richard <thomas.richard@bootlin.com> Date: Mon, 04 Mar 2024 16:35:46 +0100 Subject: [PATCH v4 03/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-v4-3-6f1f53390c85@bootlin.com> References: <20240102-j7200-pcie-s2r-v4-0-6f1f53390c85@bootlin.com> In-Reply-To: <20240102-j7200-pcie-s2r-v4-0-6f1f53390c85@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: 1792612466981082021 X-GMAIL-MSGID: 1792612466981082021 |
Series |
Add suspend to ram support for PCIe on J7200
|
|
Commit Message
Thomas Richard
March 4, 2024, 3:35 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(+)
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c index 42165ef57946..28417b2a18b0 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) };