From patchwork Wed Oct 20 23:38:46 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 269571 X-Patchwork-Delegate: khilman@deeprootsystems.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o9KNd35T003402 for ; Wed, 20 Oct 2010 23:39:04 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752522Ab0JTXiy (ORCPT ); Wed, 20 Oct 2010 19:38:54 -0400 Received: from mail-px0-f174.google.com ([209.85.212.174]:56591 "EHLO mail-px0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752053Ab0JTXix (ORCPT ); Wed, 20 Oct 2010 19:38:53 -0400 Received: by pxi16 with SMTP id 16so1051071pxi.19 for ; Wed, 20 Oct 2010 16:38:53 -0700 (PDT) Received: by 10.142.162.5 with SMTP id k5mr105748wfe.203.1287617932823; Wed, 20 Oct 2010 16:38:52 -0700 (PDT) Received: from localhost (c-24-18-179-55.hsd1.wa.comcast.net [24.18.179.55]) by mx.google.com with ESMTPS id x18sm1210810wfa.23.2010.10.20.16.38.51 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 20 Oct 2010 16:38:52 -0700 (PDT) From: Kevin Hilman To: linux-omap@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Subject: [RFC/PATCH 2/2] OMAP3: CPUidle: trigger early idle notification call chain Date: Wed, 20 Oct 2010 16:38:46 -0700 Message-Id: <1287617926-24308-3-git-send-email-khilman@deeprootsystems.com> X-Mailer: git-send-email 1.7.2.1 In-Reply-To: <1287617926-24308-1-git-send-email-khilman@deeprootsystems.com> References: <1287617926-24308-1-git-send-email-khilman@deeprootsystems.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Wed, 20 Oct 2010 23:39:04 +0000 (UTC) diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c index 0d50b45..8c57360 100644 --- a/arch/arm/mach-omap2/cpuidle34xx.c +++ b/arch/arm/mach-omap2/cpuidle34xx.c @@ -30,6 +30,7 @@ #include #include #include +#include #include "pm.h" #include "control.h" @@ -128,12 +129,14 @@ static int omap3_enter_idle(struct cpuidle_device *dev, /* Used to keep track of the total time in idle */ getnstimeofday(&ts_preidle); - local_irq_disable(); - local_fiq_disable(); - pwrdm_set_next_pwrst(mpu_pd, mpu_state); pwrdm_set_next_pwrst(core_pd, core_state); + omap_early_idle_notifier_start(); + + local_irq_disable(); + local_fiq_disable(); + if (omap_irq_pending() || need_resched()) goto return_sleep_time; @@ -157,6 +160,8 @@ return_sleep_time: local_irq_enable(); local_fiq_enable(); + omap_early_idle_notifier_end(); + return ts_idle.tv_nsec / NSEC_PER_USEC + ts_idle.tv_sec * USEC_PER_SEC; } @@ -459,6 +464,21 @@ struct cpuidle_driver omap3_idle_driver = { .owner = THIS_MODULE, }; +static int omap3_idle_prepare(struct cpuidle_device *dev) +{ + /* + * Enable interrupts during the early part of the CPUidle path. + * They are later (re)disabled when the final state is selected. + * + * The primary reason for this is to enable non-atomic idle + * notifications to drivers that want to coordinate device + * idle transitions with CPU idle transitions. + */ + local_irq_enable(); + + return 0; +} + /** * omap3_idle_init - Init routine for OMAP3 idle * @@ -482,6 +502,7 @@ int __init omap3_idle_init(void) dev = &per_cpu(omap3_idle_dev, smp_processor_id()); + dev->prepare = omap3_idle_prepare; for (i = OMAP3_STATE_C1; i < OMAP3_MAX_STATES; i++) { cx = &omap3_power_states[i]; state = &dev->states[count];