From patchwork Thu Mar 4 19:28:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 392714 Delivered-To: patches@linaro.org Received: by 2002:a02:8562:0:0:0:0:0 with SMTP id g89csp244656jai; Thu, 4 Mar 2021 11:28:54 -0800 (PST) X-Received: by 2002:a2e:8881:: with SMTP id k1mr3098467lji.441.1614886133956; Thu, 04 Mar 2021 11:28:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614886133; cv=none; d=google.com; s=arc-20160816; b=jDO/Ehx798rWvFngf3vGExnZWBViJ98AmO4dgFfoFGRhi+DIHzu0rU/DiNaiatUZWE RzY/YvlIYHEBVLIxxUyaEg+jqWTS2pIvSn+wQEubjUS65fSFF5SvwtvFxJJ+qRwD4APM SwHhIxGDRr1K1OcWO0dr5S1zZ0QNJ2IJmXVyQ5Dp3qgi7Fq+Z/sXjvuIxbYtQb/KESvi qrxn41yzjjOthzZTFKpzkzeMq4uATyiiTNk/Rz9xv4MSLn3S8LE8NCR06UeW/hhSjHnY nUIFJqlRv13NlytribQ+0MDx3+SBgbH9jOqjZyhhzNy2vh6Runi2TVXX1kQCQ26EW1Kf amKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=d606i726IOli9oaA/A1UIGosXPZBxIF73t+6qPltjYY=; b=WanYzq2enOE2BVm0IsvzEZ3waIRlK/ixrV2ciM1U/3BNMsaVJobjeuocWwHRa6qMoY siBLuuQO8viJeheXUR1849Qw6zImulxiOI0h+de+12y3D2onn6UcjfvfVX0MzXTYWCC3 R1qUmfJ8MSC6vYdP0TIEK56xcS7uj0+TZCU9AWVOGpi8YbYtTC0efpturtBrS0AfAhO/ EeawCmOj7JsXsM7yEECm5A76SDQQ8a+par6zbyIRhKXhYtyPso1ffr7vCG43EHELI60c lAPN7B563Fmd0bMH3ynyUZOqbKEed6POsAKn4Fk31Cc2JGG6hPQsWoFm6VdxlKrBy6Cj g8fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W6TcUhVA; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id t16sor62446lfe.159.2021.03.04.11.28.53 for (Google Transport Security); Thu, 04 Mar 2021 11:28:53 -0800 (PST) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=W6TcUhVA; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=d606i726IOli9oaA/A1UIGosXPZBxIF73t+6qPltjYY=; b=W6TcUhVA8o1KNj6cyRxqjLYWI/eYSQkBdTDGOcHvXZYVKQV8RP8itZeHjPmlPTR09P 3s/rmQi6RAzhnWsppERLi59CV2Wvys81vXH30eAF3Gsj61AB/tmqKhEB5eC/BDGUx7Ed vibsYf7C/4tINooKIFU1NOnzSUB734QiyJ1Ozub8o7br2RwwJ7iUxRvDidQmo9FHtyqb FjQ0pVt8SNaoydj7uUfMcp7uyKzWVyXpJGlpGpotKlfePCdnCdnMKytfcMKsXLpTvA2K 5WwO8VrlrtyqxCQMVVtxjmZxm2t9GInhl+lZh1hYSrPkESgZMWQh3a9UhJnmq3B4nwt3 fG+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=d606i726IOli9oaA/A1UIGosXPZBxIF73t+6qPltjYY=; b=oG9gNz76KdpIdcgt9pFFAw70mlItpj2OL5NDXxXW2Ltlgf7Fm5VpAX4GMPlfCqU6zS 1xIl6/u99DF3SwABsktouITg/BPRzVebLUlAzwfwSU8pvP3usAdGYz0egF5qDawuk1G9 Xmeabmoi8LRx91240lQxaLevszlYQzXtAMMmFibwQWkx1zRW5FDjGL4yFprjqol6smvH fpJqpRNW8E5t5fQvui0nsH68KtuyggBkOEkB/wfy1Tk2RqLK68wVyfZwx/YfLGWO3qgz 8Vh+pjbOH9olbRr9LsY/wOj7FXdotsp6cBWZZQjRspryTriIse7H9JLEBc+DJt8eF5uO 8yXA== X-Gm-Message-State: AOAM532XUk6fEYvip08LBfjdHwSHG+P3JAb6D5Mlcz9/ntNltmWiDtdP 8pYlmKWAEJ1JOpEmd3q9casfcH2QSLLtGE022LY= X-Google-Smtp-Source: ABdhPJyjMHuu8+FmTrRPZUxbrIUpNi7K2AS1y2F9oonw9iSrgXQ+QULRweMde5R/ePU4TS/RWzRcQA== X-Received: by 2002:a05:6512:3a84:: with SMTP id q4mr3094421lfu.382.1614886133558; Thu, 04 Mar 2021 11:28:53 -0800 (PST) Return-Path: Received: from localhost.localdomain (h-155-4-129-234.NA.cust.bahnhof.se. [155.4.129.234]) by smtp.gmail.com with ESMTPSA id z6sm34281lfr.34.2021.03.04.11.28.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Mar 2021 11:28:52 -0800 (PST) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Lina Iyer , Ulf Hansson , Kevin Hilman , Geert Uytterhoeven , Heiko Stuebner , Matthias Brugger , linux-kernel@vger.kernel.org Subject: [PATCH] PM: domains: Don't runtime resume devices at genpd_prepare() Date: Thu, 4 Mar 2021 20:28:43 +0100 Message-Id: <20210304192843.216829-1-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Runtime resuming a device upfront in the genpd_prepare() callback, to check if there is a wakeup pending for it, seems like an unnecessary thing to do. The PM core already manages these kind of things in a common way in __device_suspend(), via calling pm_runtime_barrier() and pm_wakeup_pending(). Therefore, let's simply drop this behaviour from genpd_prepare(). Note that, this change is applicable only for devices that are attached to a genpd that has the GENPD_FLAG_ACTIVE_WAKEUP set (Renesas, Mediatek, and Rockchip platforms). Moreover, a driver that needs to restore power for its device to re-configure it for a system wakeup, may still call pm_runtime_get_sync(), for example, to do this. Signed-off-by: Ulf Hansson --- drivers/base/power/domain.c | 36 ------------------------------------ 1 file changed, 36 deletions(-) -- 2.25.1 diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 78c310d3179d..b6a782c31613 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -1087,34 +1087,6 @@ static void genpd_sync_power_on(struct generic_pm_domain *genpd, bool use_lock, genpd->status = GENPD_STATE_ON; } -/** - * resume_needed - Check whether to resume a device before system suspend. - * @dev: Device to check. - * @genpd: PM domain the device belongs to. - * - * There are two cases in which a device that can wake up the system from sleep - * states should be resumed by genpd_prepare(): (1) if the device is enabled - * to wake up the system and it has to remain active for this purpose while the - * system is in the sleep state and (2) if the device is not enabled to wake up - * the system from sleep states and it generally doesn't generate wakeup signals - * by itself (those signals are generated on its behalf by other parts of the - * system). In the latter case it may be necessary to reconfigure the device's - * wakeup settings during system suspend, because it may have been set up to - * signal remote wakeup from the system's working state as needed by runtime PM. - * Return 'true' in either of the above cases. - */ -static bool resume_needed(struct device *dev, - const struct generic_pm_domain *genpd) -{ - bool active_wakeup; - - if (!device_can_wakeup(dev)) - return false; - - active_wakeup = genpd_is_active_wakeup(genpd); - return device_may_wakeup(dev) ? active_wakeup : !active_wakeup; -} - /** * genpd_prepare - Start power transition of a device in a PM domain. * @dev: Device to start the transition of. @@ -1135,14 +1107,6 @@ static int genpd_prepare(struct device *dev) if (IS_ERR(genpd)) return -EINVAL; - /* - * If a wakeup request is pending for the device, it should be woken up - * at this point and a system wakeup event should be reported if it's - * set up to wake up the system from sleep states. - */ - if (resume_needed(dev, genpd)) - pm_runtime_resume(dev); - genpd_lock(genpd); if (genpd->prepared_count++ == 0)