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: 6427361 Return-Path: X-Original-To: patchwork-linux-pm@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 5D23EC0432 for ; Mon, 18 May 2015 09:40:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 80D3420613 for ; Mon, 18 May 2015 09:40:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 542A42060C for ; Mon, 18 May 2015 09:40:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752721AbbERJkW (ORCPT ); Mon, 18 May 2015 05:40:22 -0400 Received: from mail-wi0-f175.google.com ([209.85.212.175]:35478 "EHLO mail-wi0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750988AbbERJkV (ORCPT ); Mon, 18 May 2015 05:40:21 -0400 Received: by wicmx19 with SMTP id mx19so71491130wic.0; 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 Cc: Lorenzo Pieralisi , Tomeu Vizoso , "Rafael J. Wysocki" , Russell King , Stephen Warren , Thierry Reding , Alexandre Courbot , Kukjin Kim , Kyungmin Park , Thomas Gleixner , Daniel Lezcano , Bartlomiej Zolnierkiewicz , linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org, linux-kernel@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 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=ham 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,