From patchwork Tue Nov 17 22:37:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lina Iyer X-Patchwork-Id: 56889 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp2218278lbb; Tue, 17 Nov 2015 14:39:04 -0800 (PST) X-Received: by 10.69.4.5 with SMTP id ca5mr66216794pbd.149.1447799916943; Tue, 17 Nov 2015 14:38:36 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ax2si60766904pbd.123.2015.11.17.14.38.36; Tue, 17 Nov 2015 14:38:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dkim=neutral (body hash did not verify) header.i=@linaro_org.20150623.gappssmtp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932532AbbKQWif (ORCPT + 11 others); Tue, 17 Nov 2015 17:38:35 -0500 Received: from mail-pa0-f49.google.com ([209.85.220.49]:33679 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932542AbbKQWie (ORCPT ); Tue, 17 Nov 2015 17:38:34 -0500 Received: by pabfh17 with SMTP id fh17so22927696pab.0 for ; Tue, 17 Nov 2015 14:38:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro_org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=U4VKFabic7gV3E6bU2+1wsB/rab11yZ2sdJaObDv/5c=; b=a7pFGiV9tzJe/iPRquBMB/srKgTu6hupKvMAxksT/jDhnlHk0EJCrpiF4suQjHaoUk WKMeGyJIyUiUUNYf7siWYuYkL0AEqwuTgrk5mn5csvePyNDuFE+h/xoKY8zgXpeTP4gA KpMMHlLq4T/xSHiBr4mKefQKmDbr6RS27cNvRQFGDA2KF6TMT/8Z8Hml1qbmpwqudIe9 sKnP7tgxUV+E2db7nAgAAHgO3s5JjGtYcEHYW3MEso5XPyPbsBn04dDkRWmTO5xPgnO3 I0g0WnhZNDkbkLEETvf2FoS+RYSiXMgHrrin7otuJeyNGghQjxOwaPHaIwJpzf9TLctU lI/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=U4VKFabic7gV3E6bU2+1wsB/rab11yZ2sdJaObDv/5c=; b=VpT9K7LxN//QWCJOb/UVwsBrXE5g6EKFjZd3jdWV0HF0UGXgLohYScTFs61JhvSBsY Kic1/1RC2uMlrKKmPLjYP1cOn9XS0r40YAuBh/uGyplhtdv0uhnKADfNd8v3ESF5a/4S 0r2NN+WUCgAw7AkSy2czE7Rt3lz5vsKjr2l/G2SiiZhI6XP0ARZ6IrtP9Zozs91vT1Ts WxqfJ56xlO50zRBAua5XsKeYWieokBJWYRFS9cki6KbigoPwfpuxIsvdcV/tOaIGBAsG 16DSvHwpaCi77/ENcWCwRS3N9EnQk1UGnCQ9e1hBPi8/mL7AHfXfmVIzqomTE4pSEOzs 01hw== X-Gm-Message-State: ALoCoQlY467bhppJsqOv2igRty/lyNxiF29K0Lkz0UNCl2BA7aePsW6tzE8HaeKFrIWGB0fzSaaH X-Received: by 10.66.102.74 with SMTP id fm10mr67675548pab.33.1447799914066; Tue, 17 Nov 2015 14:38:34 -0800 (PST) Received: from ubuntu.localdomain ([8.42.77.226]) by smtp.gmail.com with ESMTPSA id hy1sm14875199pbb.63.2015.11.17.14.38.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Nov 2015 14:38:33 -0800 (PST) From: Lina Iyer To: ulf.hansson@linaro.org, khilman@linaro.org, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: geert@linux-m68k.org, k.kozlowski@samsung.com, msivasub@codeaurora.org, agross@codeaurora.org, sboyd@codeaurora.org, linux-arm-msm@vger.kernel.org, lorenzo.pieralisi@arm.com, ahaslam@baylibre.com, mtitinger@baylibre.com, Lina Iyer Subject: [PATCH RFC 09/27] PM / Domains: Attempt runtime suspend of IRQ safe parent domain Date: Tue, 17 Nov 2015 15:37:33 -0700 Message-Id: <1447799871-56374-10-git-send-email-lina.iyer@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1447799871-56374-1-git-send-email-lina.iyer@linaro.org> References: <1447799871-56374-1-git-send-email-lina.iyer@linaro.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org When a sub-domain is powered off, attempt powering off the parent domains to maximize power savings. A sub-domain that is IRQ safe may however have a parent that is not IRQ safe and therefore cannot be powered down in atomic context that the sub-domain may be powered off. An IRQ safe sub-domain may attempt to power down the parent domain in a synchronous call, if the parent is also IRQ safe. Signed-off-by: Lina Iyer --- drivers/base/power/domain.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 8df43f8..0310e2b 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -44,6 +44,8 @@ static int pm_genpd_alloc_states_names(struct generic_pm_domain *genpd, static LIST_HEAD(gpd_list); static DEFINE_MUTEX(gpd_list_lock); +static int genpd_poweroff(struct generic_pm_domain *genpd, bool is_async); + static inline int genpd_lock_nosleep(struct generic_pm_domain *genpd, unsigned int subclass) __acquires(&genpd->slock) @@ -298,6 +300,13 @@ static int __genpd_poweron(struct generic_pm_domain *genpd) &genpd->slave_links, slave_node) { genpd_sd_counter_dec(link->master); + + /* Assume masters that are non-irq safe are always-on */ + if (genpd->irq_safe && link->master->irq_safe) { + genpd_poweroff(link->master, false); + continue; + } + genpd_queue_power_off_work(link->master); } @@ -448,6 +457,13 @@ static int genpd_poweroff(struct generic_pm_domain *genpd, bool is_async) list_for_each_entry(link, &genpd->slave_links, slave_node) { genpd_sd_counter_dec(link->master); + + /* Assume masters that are non-irq safe are always-on */ + if (genpd->irq_safe && link->master->irq_safe) { + genpd_poweroff(link->master, false); + continue; + } + genpd_queue_power_off_work(link->master); }