From patchwork Tue Nov 17 22:37:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lina Iyer X-Patchwork-Id: 7643231 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9E83ABF90C for ; Tue, 17 Nov 2015 22:44:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C2A3A20437 for ; Tue, 17 Nov 2015 22:44:07 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E1CB8203DC for ; Tue, 17 Nov 2015 22:44:06 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zyowo-0000m0-Dd; Tue, 17 Nov 2015 22:41:58 +0000 Received: from mail-pa0-x232.google.com ([2607:f8b0:400e:c03::232]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZyouA-0005dQ-2H for linux-arm-kernel@lists.infradead.org; Tue, 17 Nov 2015 22:39:21 +0000 Received: by pacej9 with SMTP id ej9so22079250pac.2 for ; Tue, 17 Nov 2015 14:38:56 -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=wQJYpjXUc9m+E2ZTmVWnPP+H0zA3xu1NZMiH6lhcd8c=; b=VV1HEatD5O1tx2Qu3bt+rdCKrt1uce/qSR8vXR0T+8ysX/XpQqbqrNPxD1ckZ/5ytW VXYBVpxWTkGuue0JGCH+3w793IY7CxArg0PDF1rgpFCYrrYUMkk3E9cdaUGl8LF/NkE2 99ma1XG4nSGX36+tET9245teMTm7xywG2PErBTyB89KbOcwN1eVs82Iriu7Nwhyy7uQg JC9S8NaWL+7IQV+BJQZCXjpsfhPo8X8CAtuRPRlKmC0F09MusYLQ8q1faZfhZWmiB97C qNIeVyu82mmFQWThS4xdfYlnc6/8nV7qkHFEJN1yzzK/ruMOixC9pkVxMlXAoP8/p+yu kAAg== 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=wQJYpjXUc9m+E2ZTmVWnPP+H0zA3xu1NZMiH6lhcd8c=; b=lCDBzp75PDQ0pEpMvBxcgfGzSJBBFb0PERUla4YW/RZUnpTlmPZ600kLo3S0mlH0ZN 1NSnu1rsikx6m4AY2NPTWz41nqPOg2xDk7KYHSsBUuFvLVeyKAm7HUqBBGK0WR8DWLnu Pk/XOxhJ5+IFoCh8iE38iJbP+HVqK6aX0DJKGL+DWb2ayca3khp9A1zRo/JF3+MN1Woc MMg8kw1RoxypbFr+ijyxcWcpEHvOUlnfiLMuU1YPJw9Z05jnfunsPgBNLL5B6OLN36Bo bcTJ+wmahq0wQRmfGaT4LToLaOHeDLApxYSJ7TZu/LoOkCcSXBG3go28erJi6aLl+7J0 ZrWg== X-Gm-Message-State: ALoCoQkbewOg7GPkLOoeBhGWeuikpMb0b7PDcxwBsYTzojsIhVGTJDTA0toygS8IRkl+sFdtccMf X-Received: by 10.68.197.99 with SMTP id it3mr66458938pbc.110.1447799936891; Tue, 17 Nov 2015 14:38:56 -0800 (PST) Received: from ubuntu.localdomain ([8.42.77.226]) by smtp.gmail.com with ESMTPSA id hy1sm14875199pbb.63.2015.11.17.14.38.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Nov 2015 14:38:55 -0800 (PST) From: Lina Iyer To: ulf.hansson@linaro.org, khilman@linaro.org, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH RFC 19/27] drivers: cpu-pd: Invoke CPU PM runtime on hotplug Date: Tue, 17 Nov 2015 15:37:43 -0700 Message-Id: <1447799871-56374-20-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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151117_143914_343943_AC345EA5 X-CRM114-Status: GOOD ( 14.44 ) X-Spam-Score: -2.6 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: k.kozlowski@samsung.com, lorenzo.pieralisi@arm.com, ahaslam@baylibre.com, linux-arm-msm@vger.kernel.org, sboyd@codeaurora.org, msivasub@codeaurora.org, geert@linux-m68k.org, Lina Iyer , agross@codeaurora.org, mtitinger@baylibre.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When a CPU is hotplugged off invoke CPU runtime suspend to notify runtime PM of the CPU being powered down and opportunistically power down the domain as well. Do that independent of the architecture using hotplug notifiers. Signed-off-by: Lina Iyer --- drivers/base/power/cpu-pd.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/drivers/base/power/cpu-pd.c b/drivers/base/power/cpu-pd.c index a00abc1..e331ae6 100644 --- a/drivers/base/power/cpu-pd.c +++ b/drivers/base/power/cpu-pd.c @@ -237,6 +237,30 @@ static int of_pm_domain_attach_cpus(struct device_node *dn, return 0; } +static int cpu_hotplug(struct notifier_block *nb, + unsigned long action, void *data) +{ + struct device *dev = get_cpu_device(smp_processor_id()); + + /* Execute CPU runtime PM on that CPU */ + switch (action) { + case CPU_DYING: + case CPU_DYING_FROZEN: + pm_runtime_put_sync_suspend(dev); + pm_runtime_disable(dev); + break; + case CPU_STARTING: + case CPU_STARTING_FROZEN: + pm_runtime_enable(dev); + pm_runtime_get_sync(dev); + break; + default: + break; + } + + return NOTIFY_OK; +} + int of_register_cpu_pm_domain(struct device_node *dn, struct cpu_pm_domain *pd) { @@ -277,10 +301,13 @@ int of_register_cpu_pm_domain(struct device_node *dn, /* Attach the CPUs to the CPU PM domain */ ret = of_pm_domain_attach_cpus(dn, pd); - if (ret) + if (ret) { of_genpd_del_provider(dn); + return ret; + } - return ret; + hotcpu_notifier(cpu_hotplug, 0) + return 0; } /**