From patchwork Wed Jun 24 17:13:39 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 32218 X-Patchwork-Delegate: khilman@deeprootsystems.com Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n5OHDmlU013963 for ; Wed, 24 Jun 2009 17:13:48 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752166AbZFXRNm (ORCPT ); Wed, 24 Jun 2009 13:13:42 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754498AbZFXRNm (ORCPT ); Wed, 24 Jun 2009 13:13:42 -0400 Received: from mail-pz0-f189.google.com ([209.85.222.189]:53802 "EHLO mail-pz0-f189.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752166AbZFXRNm (ORCPT ); Wed, 24 Jun 2009 13:13:42 -0400 Received: by pzk27 with SMTP id 27so775544pzk.33 for ; Wed, 24 Jun 2009 10:13:45 -0700 (PDT) Received: by 10.143.6.1 with SMTP id j1mr492759wfi.226.1245863625115; Wed, 24 Jun 2009 10:13:45 -0700 (PDT) Received: from localhost ([216.254.16.51]) by mx.google.com with ESMTPS id 30sm4132115wfa.15.2009.06.24.10.13.41 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 24 Jun 2009 10:13:41 -0700 (PDT) From: Kevin Hilman To: linux-omap@vger.kernel.org Cc: Chunqiu Wang Subject: [PATCH -pm] OMAP3: GPIO: Only enable WAKEUPEN for edge detection GPIOs Date: Wed, 24 Jun 2009 10:13:39 -0700 Message-Id: <1245863619-1222-1-git-send-email-khilman@deeprootsystems.com> X-Mailer: git-send-email 1.6.3.2 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org From: Chunqiu Wang According to the GPIO 'Wakeup and Interrupt' section of the TRM[1], wake-up requests can only be generated on edge transitions. Also for OMAP3, only edge GPIOs may lose interrupts when PER enters RET/OFF state, this is addressed by gpio prepare|resume idle functions [1] Section 25.5.3.1 OMAP34xx_ES3.1_TRM_V_Q Signed-off-by: Chunqiu Wang Signed-off-by: Kevin Hilman --- arch/arm/plat-omap/gpio.c | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-) diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index 8e6f511..de61a13 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c @@ -684,7 +684,11 @@ static inline void set_24xx_gpio_triggering(struct gpio_bank *bank, int gpio, trigger & IRQ_TYPE_EDGE_FALLING); if (likely(!(bank->non_wakeup_gpios & gpio_bit))) { - if (trigger != 0) + /* + * GPIO wakeup request can only be generated on edge + * transitions + */ + if (trigger & IRQ_TYPE_EDGE_BOTH) __raw_writel(1 << gpio, bank->base + OMAP24XX_GPIO_SETWKUENA); else @@ -693,7 +697,13 @@ static inline void set_24xx_gpio_triggering(struct gpio_bank *bank, int gpio, } /* This part needs to be executed always for OMAP34xx */ if (cpu_is_omap34xx() || (bank->non_wakeup_gpios & gpio_bit)) { - if (trigger != 0) + /* + * Log the edge gpio and manually trigger the IRQ + * after resume if the input level changes + * to avoid irq lost during PER RET/OFF mode + * Applies for omap2 non-wakeup gpio and all omap3 gpios + */ + if (trigger & IRQ_TYPE_EDGE_BOTH) bank->enabled_non_wakeup_gpios |= gpio_bit; else bank->enabled_non_wakeup_gpios &= ~gpio_bit;