From patchwork Thu Sep 3 19:58:32 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lina Iyer X-Patchwork-Id: 7119091 Return-Path: X-Original-To: patchwork-linux-arm@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 083DCBEEC1 for ; Thu, 3 Sep 2015 20:01:35 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 17E03207DE for ; Thu, 3 Sep 2015 20:01:34 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id E21EB207CA for ; Thu, 3 Sep 2015 20:01:32 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZXafg-00009I-MJ; Thu, 03 Sep 2015 19:59:44 +0000 Received: from mail-pa0-f42.google.com ([209.85.220.42]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZXafC-0008AN-H6 for linux-arm-kernel@lists.infradead.org; Thu, 03 Sep 2015 19:59:15 +0000 Received: by pacex6 with SMTP id ex6so314454pac.0 for ; Thu, 03 Sep 2015 12:58:53 -0700 (PDT) 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=0WD2OcseZeSW1QSrP44V5lWgi0Rp/YPFg/rN73OETSk=; b=EIgonts/NdRSdqfxWS2r85qBpYpBnu0zB1Ae6C3TEUDvTOhlj6EJgEREIuGAFcdJP6 a+sA01vHIxCzJGtoixNGiDof5mCOa88VDTjE34+gjOZhbSthDEKUGtydmtKt1G1UTBvx 3QZp/PabzNv8BQZrx7/Tq/CWarNUhTIxx0gu+naJRgzYVYmQ+9l3g464/HA4CMYBPlv0 PZdFVOwVd/7w/ThKGy8RueBlbfxkTScVWwAdJOEgdDjkNx33x0SiUO/Dbxxg9fPxguwV IMHzAM6sfkCiTrG6C3WILALxZXAK4dgAA3/tVJPzUW+vLnCrlDgJCASDGzRUdh0Kejpf Rfhw== X-Gm-Message-State: ALoCoQkY0C2uoqnSBX+Rm6OcyW+wX0gITfP/IDhXLta7rbPNCSWsfw8WjbqZhkHeGsc3qAdUd0Uw X-Received: by 10.68.231.5 with SMTP id tc5mr72690992pbc.54.1441310333746; Thu, 03 Sep 2015 12:58:53 -0700 (PDT) Received: from ubuntu.localdomain (i-global254.qualcomm.com. [199.106.103.254]) by smtp.gmail.com with ESMTPSA id a17sm13396430pbu.55.2015.09.03.12.58.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 03 Sep 2015 12:58:52 -0700 (PDT) From: Lina Iyer To: ulf.hansson@linaro.org, khilman@linaro.org, linux-pm@vger.kernel.org Subject: [PATCH v2 5/7] ARM: cpuidle: Add runtime PM support for CPU idle Date: Thu, 3 Sep 2015 13:58:32 -0600 Message-Id: <1441310314-8857-6-git-send-email-lina.iyer@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1441310314-8857-1-git-send-email-lina.iyer@linaro.org> References: <1441310314-8857-1-git-send-email-lina.iyer@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150903_125914_660245_4AF1610E X-CRM114-Status: GOOD ( 13.42 ) X-Spam-Score: -2.6 (--) 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: k.kozlowski@samsung.com, Lorenzo Pieralisi , sboyd@codeaurora.org, Daniel Lezcano , rjw@rjwysocki.net, msivasub@codeaurora.org, geert@linux-m68k.org, Lina Iyer , agross@codeaurora.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Notify runtime PM when the CPU is going to be powered off in the idle state. This allows for runtime PM suspend/resume of the CPU as well as its PM domain. Cc: Daniel Lezcano Cc: Lorenzo Pieralisi Signed-off-by: Lina Iyer --- drivers/cpuidle/cpuidle-arm.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/cpuidle/cpuidle-arm.c b/drivers/cpuidle/cpuidle-arm.c index 545069d..7c791f9 100644 --- a/drivers/cpuidle/cpuidle-arm.c +++ b/drivers/cpuidle/cpuidle-arm.c @@ -11,13 +11,16 @@ #define pr_fmt(fmt) "CPUidle arm: " fmt +#include #include #include #include #include #include #include +#include #include +#include #include @@ -37,6 +40,7 @@ static int arm_enter_idle_state(struct cpuidle_device *dev, struct cpuidle_driver *drv, int idx) { int ret; + struct device *cpu_dev = get_cpu_device(dev->cpu); if (!idx) { cpu_do_idle(); @@ -46,12 +50,19 @@ static int arm_enter_idle_state(struct cpuidle_device *dev, ret = cpu_pm_enter(); if (!ret) { /* + * Notify runtime PM as well of this cpu powering down + * TODO: Merge CPU_PM and runtime PM. + */ + RCU_NONIDLE(pm_runtime_put_sync(cpu_dev)); + + /* * Pass idle state index to cpu_suspend which in turn will * call the CPU ops suspend protocol with idle index as a * parameter. */ arm_cpuidle_suspend(idx); + RCU_NONIDLE(pm_runtime_get_sync(cpu_dev)); cpu_pm_exit(); }