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: 9603501 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 355A460414 for ; Fri, 3 Mar 2017 20:43:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 22A8B28555 for ; Fri, 3 Mar 2017 20:43:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1786828584; Fri, 3 Mar 2017 20:43:15 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7637B28559 for ; Fri, 3 Mar 2017 20:43:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=lxup9H2ZSDe9Do1BUnL8/oM/tsMznKC8Nwv0bwzOGKU=; b=QWn6v9+IN2e3uzOGK4511Xl+to UEQoS8aDHT5GaC9m3rHl8o9gqJbyy6euuRlRjc3HZs2zIxZx4h8vqhq9/aKTFqwi81mWYrEpgVpn3 9qP3CWfYEl5+bcTurUBs08IsJ7V6RbBHzkeeKRXYtU9X+Xa56zFtf/oW8OqFBOVR1aq2g0KPdqo+1 js8tBopYm6vCmklQR4pfi9SAtpd/gMli5XXy2b6oWD2TN9t3h3Nr5kynq5DKzl48oEwHCxnpqDcTm CC1Vs+mAqNDz2oR1P0qzM9+R+YBP35CuiTU9SMVJWX/OD7R+N1usPOLLpVGykspybdpAgSAX5LwlR /yQJFHVA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cju2Z-0005Pr-Vf; Fri, 03 Mar 2017 20:43:03 +0000 Received: from mail-pg0-x22d.google.com ([2607:f8b0:400e:c05::22d]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cju1f-0004qb-9W for linux-arm-kernel@lists.infradead.org; Fri, 03 Mar 2017 20:42:09 +0000 Received: by mail-pg0-x22d.google.com with SMTP id 77so3204727pgc.1 for ; Fri, 03 Mar 2017 12:41:45 -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=D4Yvdw1MT3WgCacjseyVSc3QVXjcUGqMk52GSFtiwjsX+7sFOXyV9V0bRmh1cyfWrj wIIX0e/5Gm/ZWmnueD7wxyIHhEZw3r2hAzUpAj0DchZC3A6I5vOVPgnlBU6+gaLw1uCA D/QOr6HxzXdlmG04YzTl32eE6udEEm398sbWdn5DcaSGRuyTyLsULXVdaQLH0IPFW1bI prqAXGsLFUGKnYShbTkLz0r4xGgPoFkTsCU4yPkH5PY3VERXZU5PI4/r2dsgx7B0oJUt j4gCUn3+N6E3viJJUsYXVMvGfcWrecs7hXJLwk5bDMOkj4ovuGEcPx7l2RWXOSPo+6+7 055g== X-Gm-Message-State: AMke39l/KG5RzMVQOYnUUIxkwB/NOH15NImRHmAMfmJf+OhfIHiK6Ene0NO9ezgji7334HOC 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170303_124207_388757_D44383D4 X-CRM114-Status: UNSURE ( 9.57 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 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 | 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; }