From patchwork Mon May 18 09:38:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 6427381 Return-Path: X-Original-To: patchwork-linux-arm@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 CF1E69F1CC for ; Mon, 18 May 2015 09:43:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CAD7E2049E for ; Mon, 18 May 2015 09:43:11 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E469620499 for ; Mon, 18 May 2015 09:43:10 +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 1YuHXR-0004Wu-Rl; Mon, 18 May 2015 09:40:45 +0000 Received: from mail-wi0-x232.google.com ([2a00:1450:400c:c05::232]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YuHXN-0004Up-S1 for linux-arm-kernel@lists.infradead.org; Mon, 18 May 2015 09:40:42 +0000 Received: by wizk4 with SMTP id k4so71510817wiz.1 for ; Mon, 18 May 2015 02:40:19 -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=NJkTXzSYwSZcyBVZhxyXhVcgC90WOO0bmifagZmPnis=; b=yciZHZyL6WGeYWkmcjTAQQfGSjyhBhymjI1hbsZMju1fobk7Ejt+lYCcHBIc1CcPxQ K+z2XtgcsJGT14kf5GbTlm0N0lFiYrFCbfTrRGv4I+q511vqdGKqGYiNDuX26iV5/m+s m2uNLPpWL9c+DTM9mPWksdECkz+GgzxeyneM8XR8FDMLKz0PHu9sfPWZUikR9I8xzbog vqX45DDD4bMTZcd/GxL12LuIe2J7ojopf+49QD9v+B0ZxCtXXB8LA8hBZUSbSOgpT6rn 38L4zr0FIw2WhhkzzV9z7Ezt3C+XKd7TPywln/4jMVjkja9CH0Phe0pWg1lXwAUM0Bxj OPeA== X-Received: by 10.194.189.228 with SMTP id gl4mr4385852wjc.1.1431942019733; Mon, 18 May 2015 02:40:19 -0700 (PDT) Received: from cizrna.lan ([109.72.12.78]) by mx.google.com with ESMTPSA id nb9sm11567430wic.10.2015.05.18.02.40.17 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 May 2015 02:40:18 -0700 (PDT) From: Tomeu Vizoso To: linux-pm@vger.kernel.org Subject: [PATCH v2] ARM: tegra: cpuidle: implement cpuidle_state.enter_freeze() Date: Mon, 18 May 2015 11:38:51 +0200 Message-Id: <1431941933-18574-1-git-send-email-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 2.4.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150518_024042_098214_DD5DFFA0 X-CRM114-Status: GOOD ( 13.01 ) X-Spam-Score: -0.7 (/) Cc: Alexandre Courbot , Lorenzo Pieralisi , Russell King , Daniel Lezcano , Tomeu Vizoso , Stephen Warren , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org, Kyungmin Park , Thierry Reding , linux-tegra@vger.kernel.org, Kukjin Kim , Thomas Gleixner , linux-arm-kernel@lists.infradead.org, Bartlomiej Zolnierkiewicz X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, 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 won't re-enable interrupts on exit. 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 --- v2: * Disable FIQs also when suspending-to-idle --- arch/arm/mach-tegra/cpuidle-tegra114.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/arch/arm/mach-tegra/cpuidle-tegra114.c b/arch/arm/mach-tegra/cpuidle-tegra114.c index 155807f..e7c4359 100644 --- a/arch/arm/mach-tegra/cpuidle-tegra114.c +++ b/arch/arm/mach-tegra/cpuidle-tegra114.c @@ -35,32 +35,42 @@ #endif #ifdef CONFIG_PM_SLEEP -static int tegra114_idle_power_down(struct cpuidle_device *dev, - struct cpuidle_driver *drv, - int index) +static void tegra114_idle_power_down(void) { local_fiq_disable(); tegra_set_cpu_in_lp2(); cpu_pm_enter(); - tick_broadcast_enter(); - 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); - tick_broadcast_exit(); - cpu_pm_exit(); tegra_clear_cpu_in_lp2(); local_fiq_enable(); +} + +static int tegra114_idle_enter(struct cpuidle_device *dev, + struct cpuidle_driver *drv, + int index) +{ + tick_broadcast_enter(); + tegra114_idle_power_down(); + tick_broadcast_exit(); return index; } + +static void tegra114_idle_enter_freeze(struct cpuidle_device *dev, + struct cpuidle_driver *drv, + int index) +{ + tegra114_idle_power_down(); +} #endif static struct cpuidle_driver tegra_idle_driver = { @@ -71,7 +81,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,