From patchwork Fri Mar 3 20:41:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lina Iyer X-Patchwork-Id: 9603517 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3DE4760414 for ; Fri, 3 Mar 2017 20:48:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2C25728584 for ; Fri, 3 Mar 2017 20:48:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 20EAE28589; Fri, 3 Mar 2017 20:48:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A909C28584 for ; Fri, 3 Mar 2017 20:48:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751970AbdCCUsa (ORCPT ); Fri, 3 Mar 2017 15:48:30 -0500 Received: from mail-pf0-f180.google.com ([209.85.192.180]:36374 "EHLO mail-pf0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751989AbdCCUs2 (ORCPT ); Fri, 3 Mar 2017 15:48:28 -0500 Received: by mail-pf0-f180.google.com with SMTP id x66so36674545pfb.3 for ; Fri, 03 Mar 2017 12:47:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=b64DY7c06fi7gb468KaUgcMCr/VhwxWFnyq1ssIafEQ=; b=PEMyGLx2ZuA4czOy1fnc7KPJH/exoNKvRkkQDndv9WY8NAl359q27sx4zpYZIhvLLU FgsnovECPJPrgqW+oh4H6slQsOinXo1eVr5Wc0oSUymcjhhGfLpQGWd1zLXga5/0QS7R QURclsYEwlpqfR3NUOvvHhFYl3JVyTMak1VzY= 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:in-reply-to :references; bh=b64DY7c06fi7gb468KaUgcMCr/VhwxWFnyq1ssIafEQ=; b=AOu9wUH7rW3LEFMMkdrBb+1wcRxNE9m5cy+Uim6RzSxr1UuWjrlqLzl5MmxD3cAUIj Yn0Q36PvhPUpixCPVUnK5C6BPvwhOfz+QfwAadTgjceDClJq4uFe9b4NacqqXkf/9D6k jCfso9lXStihg+XHLEaM9/WsiBcMFJIxdb8MuhOb/YSI5d+NOKPDYWQS4RH9n403lQdi 1eISA/ljFUJFO+fncHlLntU2WzTcwdoBD5J/ZOe806tLMPP7G6ACZ2kqN+94AC3ZEBlA 3Wix7hBAJvIl8l+LlpmtnFup2IAasasMCmyWbks0QxcdTYVzKlDMZSZXLQzqKTLPx/VW fxbg== X-Gm-Message-State: AMke39lr0616q1rBXvUm5WzXBzYwyu2mpDgIuY10q6EUuHCOeDNu9RV0RjZ/MeEJzzSrHPh2 X-Received: by 10.84.232.9 with SMTP id h9mr7007668plk.102.1488573705181; Fri, 03 Mar 2017 12:41:45 -0800 (PST) Received: from ubuntu.localdomain (i-global254.qualcomm.com. [199.106.103.254]) by smtp.gmail.com with ESMTPSA id o189sm25207003pga.12.2017.03.03.12.41.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 03 Mar 2017 12:41:44 -0800 (PST) From: Lina Iyer To: ulf.hansson@linaro.org, khilman@kernel.org, rjw@rjwysocki.net, linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: andy.gross@linaro.org, sboyd@codeaurora.org, linux-arm-msm@vger.kernel.org, brendan.jackman@arm.com, lorenzo.pieralisi@arm.com, sudeep.holla@arm.com, Juri.Lelli@arm.com, Lina Iyer Subject: [PATCH V5 2/9] drivers: cpu: Setup CPU devices to do runtime PM Date: Fri, 3 Mar 2017 12:41:28 -0800 Message-Id: <1488573695-106680-3-git-send-email-lina.iyer@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488573695-106680-1-git-send-email-lina.iyer@linaro.org> References: <1488573695-106680-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-Virus-Scanned: ClamAV using ClamSMTP CPU devices just like any other device, can do runtime PM. However, CPU devices may only do runtime only when IRQs are disabled. The devices must be set as IRQ safe. Cc: Kevin Hilman Cc: Rafael J. Wysocki Signed-off-by: Lina Iyer --- drivers/base/cpu.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 2c3b359..77451ad 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@ -18,6 +18,7 @@ #include #include #include +#include #include "base.h" @@ -345,6 +346,19 @@ static int cpu_uevent(struct device *dev, struct kobj_uevent_env *env) } #endif +#ifdef CONFIG_PM +static void cpu_runtime_pm_init(struct device *dev) +{ + pm_runtime_irq_safe(dev); + pm_runtime_enable(dev); + if (cpu_online(dev->id)) + pm_runtime_set_active(dev); +} +#else +static void cpu_runtime_pm_init(struct device *dev) +{ } +#endif + /* * register_cpu - Setup a sysfs device for a CPU. * @cpu - cpu->hotpluggable field set to 1 will generate a control file in @@ -379,6 +393,7 @@ int register_cpu(struct cpu *cpu, int num) register_cpu_under_node(num, cpu_to_node(num)); dev_pm_qos_expose_latency_limit(&cpu->dev, 0); + cpu_runtime_pm_init(&cpu->dev); return 0; }