From patchwork Fri Aug 26 20:17:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lina Iyer X-Patchwork-Id: 9302023 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 EFD0460757 for ; Fri, 26 Aug 2016 20:23:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1BE229651 for ; Fri, 26 Aug 2016 20:23:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D60A729653; Fri, 26 Aug 2016 20:23:18 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id 82A2D29651 for ; Fri, 26 Aug 2016 20:23:18 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bdNdE-00034V-TB; Fri, 26 Aug 2016 20:21:40 +0000 Received: from mail-pf0-x22c.google.com ([2607:f8b0:400e:c00::22c]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bdNaT-00006t-VX for linux-arm-kernel@lists.infradead.org; Fri, 26 Aug 2016 20:18:51 +0000 Received: by mail-pf0-x22c.google.com with SMTP id x72so31716915pfd.2 for ; Fri, 26 Aug 2016 13:18:29 -0700 (PDT) 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=v4giJ2zY4MiQdi5mekBGlbnd8eFD9Eif5QFU83FhFJc=; b=Gb0zwmd3Z6hheG6JPt3nuDD1vGRTI9TMzlSm9mCaV83Yo/fXN+LahNjh/kuegsus72 dbZW3r5kWywpY+GyCOlZQBWnCWXxHIY84NvUJ3SOHiP8QEJAXIYQWzr4Cunk51+O4Qp8 GrJf4/MfHtwtyL6G01y5j6+yTAvSYcHf2wI8I= 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=v4giJ2zY4MiQdi5mekBGlbnd8eFD9Eif5QFU83FhFJc=; b=IRXHEk/dqRrsSwtf8R1lF5rmHWt1xqsdQm4j6G81Z6BnKf01MQb4MDWSUEn+r82SiT Jv2YKdhqZs+s8XBxc3Z8iG3SsfsJyIyuT7KEDZ0UA27jmUCYVG2LqbdZ1Q9RDziZwCdA fFDn6DvMg2XF7tz1pYKX1VdBeR/7FqZXRpQpGZbVgGtuKPZCpSgRksJE8UzjwZvGnFW4 w3nCvKDy0e3XZYs3WbGkcAEabca4mQvgGBitMSAuoct8EKMWgmugLq8vxZNcG89diJjK I0Gwi43RLz7lpLVojJzSM9HJ0pZEJbRNGuCx4wtLjLJ0bXqzsy6vveJ3OOmLN1hxK5nl QZ6g== X-Gm-Message-State: AE9vXwOMUHKsE1UvyBnCIXHdeVjgrWqzMrL28kI7vLTAum19hP+C74fsKmkX6y5YFwxBrYg5 X-Received: by 10.98.31.219 with SMTP id l88mr9187659pfj.155.1472242709250; Fri, 26 Aug 2016 13:18:29 -0700 (PDT) Received: from ubuntu.localdomain (i-global254.qualcomm.com. [199.106.103.254]) by smtp.gmail.com with ESMTPSA id m128sm30761463pfm.42.2016.08.26.13.18.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 26 Aug 2016 13:18:28 -0700 (PDT) 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 Subject: [PATCH v5 06/16] drivers: cpu: Setup CPU devices to do runtime PM Date: Fri, 26 Aug 2016 14:17:48 -0600 Message-Id: <1472242678-33700-7-git-send-email-lina.iyer@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1472242678-33700-1-git-send-email-lina.iyer@linaro.org> References: <1472242678-33700-1-git-send-email-lina.iyer@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160826_131850_220404_CE8CFD86 X-CRM114-Status: GOOD ( 10.20 ) 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: lorenzo.pieralisi@arm.com, Juri.Lelli@arm.com, linux-arm-msm@vger.kernel.org, sboyd@codeaurora.org, brendan.jackman@arm.com, sudeep.holla@arm.com, andy.gross@linaro.org, Lina Iyer MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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 | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 691eeea..c1e5e77 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@ -17,6 +17,7 @@ #include #include #include +#include #include "base.h" @@ -344,6 +345,21 @@ 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_get_noresume(dev); + 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 @@ -376,6 +392,8 @@ int register_cpu(struct cpu *cpu, int num) if (!error) register_cpu_under_node(num, cpu_to_node(num)); + cpu_runtime_pm_init(&cpu->dev); + return error; }