From patchwork Tue Aug 4 23:35:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lina Iyer X-Patchwork-Id: 6945261 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 7D31FC05AC for ; Tue, 4 Aug 2015 23:39:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9B59E203DC for ; Tue, 4 Aug 2015 23:39:49 +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 AB9132042A for ; Tue, 4 Aug 2015 23:39:48 +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 1ZMlmG-0006pF-25; Tue, 04 Aug 2015 23:37:48 +0000 Received: from merlin.infradead.org ([2001:4978:20e::2]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZMllC-0006Bh-4B for linux-arm-kernel@bombadil.infradead.org; Tue, 04 Aug 2015 23:36:42 +0000 Received: from mail-pa0-f43.google.com ([209.85.220.43]) by merlin.infradead.org with esmtps (Exim 4.85 #2 (Red Hat Linux)) id 1ZMllA-0007Jv-6c for linux-arm-kernel@lists.infradead.org; Tue, 04 Aug 2015 23:36:41 +0000 Received: by pacgq8 with SMTP id gq8so19581432pac.3 for ; Tue, 04 Aug 2015 16:36:16 -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=1SV+HrsXLljD+LzuO5SD3T2iD82h7WyIG3DABXBxec0=; b=jC1C/xuOC6FlxBMr7GrDRG80NYs+7P8QlPXfqT7CHpFTLglHxqYFJe82HUG7bwJhA+ s3iyyXSCqwp1pnpUru/3z7JdB3fgKB41aU7URQQ7shyun0eoju5j4DGsugHSzyHky2G6 ZQIJW805RyrUBkdl5U0TNE/8SkIRxiWlBCMRukePMDQxedoC3CW07OGg9/VX8ENhZYg4 IxGRi7JI+zx6YL/E1ZyRRbnxFJ92VI9QkwCbOkF5upbzFid0YS51HGDo6d0qnvUUqO0f ndFoFnPXcfzeorEH53eEytCPw9MYXLGaWxYJ8tWumNUEnzWHmccp2ih3wtI/AmCribwo unXw== X-Gm-Message-State: ALoCoQmJJMqRgAX/Vf2/WVDDZEEyJtrAk/rcEsWzfX5qVCeanCqlmFF84OcvGTT4LzSTNaoHMC81 X-Received: by 10.67.5.231 with SMTP id cp7mr13166452pad.36.1438731376736; Tue, 04 Aug 2015 16:36:16 -0700 (PDT) Received: from ubuntu.localdomain (i-global254.qualcomm.com. [199.106.103.254]) by smtp.gmail.com with ESMTPSA id to5sm527525pac.33.2015.08.04.16.36.15 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 04 Aug 2015 16:36:16 -0700 (PDT) From: Lina Iyer To: rjw@rjwysocki.net, ulf.hansson@linaro.org, khilman@linaro.org Subject: [PATCH 7/9] ARM: cpuidle: Add runtime PM support for CPU idle Date: Tue, 4 Aug 2015 17:35:37 -0600 Message-Id: <1438731339-58317-8-git-send-email-lina.iyer@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1438731339-58317-1-git-send-email-lina.iyer@linaro.org> References: <1438731339-58317-1-git-send-email-lina.iyer@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150804_193640_326308_80EABBBE X-CRM114-Status: GOOD ( 14.11 ) 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 , linux-pm@vger.kernel.org, Daniel Lezcano , sboyd@codeaurora.org, 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.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/cpuidle/cpuidle-arm.c b/drivers/cpuidle/cpuidle-arm.c index 545069d..ca118ed 100644 --- a/drivers/cpuidle/cpuidle-arm.c +++ b/drivers/cpuidle/cpuidle-arm.c @@ -11,12 +11,14 @@ #define pr_fmt(fmt) "CPUidle arm: " fmt +#include #include #include #include #include #include #include +#include #include #include @@ -37,6 +39,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 +49,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. + */ + 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); + pm_runtime_get_sync(cpu_dev); cpu_pm_exit(); }