From patchwork Wed Apr 8 10:54:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 6178161 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DDE149F1C4 for ; Wed, 8 Apr 2015 10:55:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id F2073202A1 for ; Wed, 8 Apr 2015 10:55:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 11EB42035D for ; Wed, 8 Apr 2015 10:55:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753492AbbDHKzN (ORCPT ); Wed, 8 Apr 2015 06:55:13 -0400 Received: from mail-wi0-f176.google.com ([209.85.212.176]:34868 "EHLO mail-wi0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753479AbbDHKzK (ORCPT ); Wed, 8 Apr 2015 06:55:10 -0400 Received: by widdi4 with SMTP id di4so50094600wid.0; Wed, 08 Apr 2015 03:55:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=kxTLBFF3qWoR/hNzZl+VWAE0g0cvVYq6KGY77oxgbco=; b=lGTJL1jIG24B5Vxobm+on4nxUxhSboAKEQ5ctDSi6NxQ1XfsJNMdg5fgJC/jZRR3XG I4KDguiO3aP4H5KHvcX2OOtDzADRJhXTDolvNBBEltFWurTbxA6V8ynm4JFcwicvBMRO uT9dmJs94JRHC7zHx+SZweG68rybAnAC5S8kMA55p2TiLiT/q4vU2WCwLQ2T+OU+vZiT 4UlY3aJQZfBJNqVYtRfaBbCOvG8ugUNMT8HlZ0OSxbwpRkeucz/cA+38p5dgZ0C0hGEn AZ24T9fm9c+f6Wxf16ReE9En1ME7TCX6lqQL3BBB09VDWFUr3TFa46hzaME5c6DyhhlY UqoA== X-Received: by 10.180.215.101 with SMTP id oh5mr13548759wic.6.1428490508866; Wed, 08 Apr 2015 03:55:08 -0700 (PDT) Received: from cizrna.lan ([109.72.12.35]) by mx.google.com with ESMTPSA id ey10sm15148264wib.2.2015.04.08.03.55.06 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Apr 2015 03:55:07 -0700 (PDT) From: Tomeu Vizoso To: linux-tegra@vger.kernel.org Cc: linux-pm@vger.kernel.org, Tomeu Vizoso , "Rafael J. Wysocki" , Russell King , Stephen Warren , Thierry Reding , Alexandre Courbot , Bartlomiej Zolnierkiewicz , Kyungmin Park , Daniel Lezcano , Kukjin Kim , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] ARM: tegra: cpuidle: implement cpuidle_state.enter_freeze() Date: Wed, 8 Apr 2015 12:54:38 +0200 Message-Id: <1428490480-10144-1-git-send-email-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 2.3.4 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,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 This callback is expected to do the same as enter() only that all non-wakeup IRQs are expected to be disabled. It will be called when the system goes to suspend-to-idle and will reduce power usage because CPUs won't be awaken for unnecessary IRQs. Signed-off-by: Tomeu Vizoso Cc: Rafael J. Wysocki --- arch/arm/mach-tegra/cpuidle-tegra114.c | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/arch/arm/mach-tegra/cpuidle-tegra114.c b/arch/arm/mach-tegra/cpuidle-tegra114.c index f2b586d..ef06001 100644 --- a/arch/arm/mach-tegra/cpuidle-tegra114.c +++ b/arch/arm/mach-tegra/cpuidle-tegra114.c @@ -39,28 +39,44 @@ static int tegra114_idle_power_down(struct cpuidle_device *dev, struct cpuidle_driver *drv, int index) { - local_fiq_disable(); - tegra_set_cpu_in_lp2(); cpu_pm_enter(); - clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu); - call_firmware_op(prepare_idle); /* Do suspend by ourselves if the firmware does not implement it */ if (call_firmware_op(do_idle, 0) == -ENOSYS) cpu_suspend(0, tegra30_sleep_cpu_secondary_finish); - clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu); - cpu_pm_exit(); tegra_clear_cpu_in_lp2(); + return index; +} + +static int tegra114_idle_enter(struct cpuidle_device *dev, + struct cpuidle_driver *drv, + int index) +{ + local_fiq_disable(); + + clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu); + + index = tegra114_idle_power_down(dev, drv, index); + + clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu); + local_fiq_enable(); return index; } + +static void tegra114_idle_enter_freeze(struct cpuidle_device *dev, + struct cpuidle_driver *drv, + int index) +{ + tegra114_idle_power_down(dev, drv, index); +} #endif static struct cpuidle_driver tegra_idle_driver = { @@ -71,7 +87,8 @@ static struct cpuidle_driver tegra_idle_driver = { [0] = ARM_CPUIDLE_WFI_STATE_PWR(600), #ifdef CONFIG_PM_SLEEP [1] = { - .enter = tegra114_idle_power_down, + .enter = tegra114_idle_enter, + .enter_freeze = tegra114_idle_enter_freeze, .exit_latency = 500, .target_residency = 1000, .power_usage = 0,