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: 56902 Delivered-To: patch@linaro.org Received: by 10.112.155.196 with SMTP id vy4csp2218709lbb; Tue, 17 Nov 2015 14:40:08 -0800 (PST) X-Received: by 10.66.62.202 with SMTP id a10mr66043065pas.131.1447799985132; Tue, 17 Nov 2015 14:39:45 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id kj7si4288480pab.5.2015.11.17.14.39.44; Tue, 17 Nov 2015 14:39:45 -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 S1754182AbbKQWjn (ORCPT + 11 others); Tue, 17 Nov 2015 17:39:43 -0500 Received: from mail-pa0-f49.google.com ([209.85.220.49]:36841 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932595AbbKQWi5 (ORCPT ); Tue, 17 Nov 2015 17:38:57 -0500 Received: by pacdm15 with SMTP id dm15so22085012pac.3 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=Le2X3ssF4IxJLdAQrw5CjV041gDDBp67UMJ69+AMtZfQuQ9Eju/PnM+0L5X3LW7RqY gGqVS7NeYaXAhJvtBpeeBjpwARo5aqGryt+sII+ExQZp4YoAgwQpKaArUcePYzGc0tft VLblGMa0WiS8SrSMhKfjc6sLJAfoB8EMLGJAHM54g/6+2fwsUDwbBpqrKi7ssKtShSB8 lq5U53Q3Cm8ncxHhM3/qmYyFCSHLbWNaboB5Tax4KIL5+04vqQAfYONc6ZNApxPaqbTA ZJDftLDbxjW6gbytHr3OTUMVBbvhNSVPS8gsHBPCB/GstJ7S1QH3AitodcPLYSIHjcbc WSXA== X-Gm-Message-State: ALoCoQk2z4twUcBElIGPEpU7aofsXizFxzxrjbFhxKqFFhYQlhsdFPuKhrkt10KPy3dRv+mN4gxy 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 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 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> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org 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(-) -- 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/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; } /**