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: 74836 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp544159qga; Fri, 26 Aug 2016 13:18:48 -0700 (PDT) X-Received: by 10.66.253.101 with SMTP id zz5mr9224648pac.32.1472242714998; Fri, 26 Aug 2016 13:18:34 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i29si22890162pfa.172.2016.08.26.13.18.34; Fri, 26 Aug 2016 13:18:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753891AbcHZUSd (ORCPT + 8 others); Fri, 26 Aug 2016 16:18:33 -0400 Received: from mail-pf0-f182.google.com ([209.85.192.182]:35511 "EHLO mail-pf0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752977AbcHZUSa (ORCPT ); Fri, 26 Aug 2016 16:18:30 -0400 Received: by mail-pf0-f182.google.com with SMTP id x72so31716913pfd.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=LMQ3FOqS/W1h6Q1xzq0LSNSSsAmILyvVFVTKD+uohriTaAp9sIH46aj0vcvjSfHw5v kq//peAovRzY4U0vaHLG8UYOZJOShGKDRrHHqtbseZ/rY6Px5F/ML+ffgIMQ5TRiFaaP Z5JMxaf8w68yNHkN/XWeMGftsay4G8eYkDhzK+LujFWjrAsSMM1IsDNIkeB4KzoMC/1W Mt0we4kFXM7pl+IZpq9ddBIftQMbM28V5VW5Ljc7f1/8c3s5p4QgcEG63/5SeQmjYbOa yuCEacIgv+w0KkQsO0V4+w09nhAP06xpLDbiw3Xg79jdkXhP1rXOlxOH/8rBGiwRx17k U1Iw== X-Gm-Message-State: AE9vXwNlPk3QvIgLjfAT2B5l3RvhQRIVOeZYezD12Cbw5m04IXHrzDZXSys7vHfPB1tbrp03 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 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 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> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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(+) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" 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/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; }