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: 7643141 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: X-Original-To: patchwork-linux-arm-msm@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 07E4EBF90C for ; Tue, 17 Nov 2015 22:39:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2F4D72051F for ; Tue, 17 Nov 2015 22:39:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4BB8D2051C for ; Tue, 17 Nov 2015 22:39:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754955AbbKQWjq (ORCPT ); Tue, 17 Nov 2015 17:39:46 -0500 Received: from mail-pa0-f48.google.com ([209.85.220.48]:32973 "EHLO mail-pa0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932599AbbKQWi5 (ORCPT ); Tue, 17 Nov 2015 17:38:57 -0500 Received: by pabfh17 with SMTP id fh17so22936694pab.0 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=TfaAvHSeeCU0P5lTwyiwbXvU3+IHnYWFhkucQIUBWmnftAhtQLL5JvO861nauza/sl P6MF/0O+gDT9eIdtB75NLOMLkI7gU/6mNry/Y/432r5g6lcM4NmCyXOC0HP+KGU+xIz/ vJ/WNfUfVPALOHXnDU27Z/ELWZgCdVoq2VSaduL+UOwiH7GNJy49OKs3KxBCvbE7XDp6 MSyYs2gyXe12nq25ZE3S26SUdq5LOZbdGQbUrqHAjylkTJEqU/EV4pJCJ1iw+m3rjBwk VNu0Kb5ONsQHN09+JJSfXqsUbV87E5AQrRU8y1xiVzszM4jbfiaW1nBHYOpD1TQqsU4b 72BA== X-Gm-Message-State: ALoCoQkHpha1FvgKdGZ60Yjz09xax0ptUo2GTwJPIWpskDuPP/U7ZxQ45BuZJ3bHJFIuD5bgd5s9 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-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,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; } /**