Re: [PATCH 2/6] OMAP3: GPIO: Only enable WAKEUPEN for edge detection GPIOs

2010-05-11 Thread Kevin Hilman
Tony Lindgren t...@atomide.com writes:

 * Kevin Hilman khil...@deeprootsystems.com [100503 16:28]:
 From: Chunqiu Wang cqw...@motorola.com
 
 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

 There's a generic solution to this problem. The solution is to temporarily
 set the level GPIO pins into edge for the duration of idle. Then
 they need to be set back to level after the system is woken up.

Sure, but that doesn't change the need for this patch which is
a correctness fix.

Adding wakeup support for level GPIOs would be a separate fix.

Kevin



  
 [1] Section 25.5.3.1 OMAP34xx_ES3.1_TRM_V_Q
 
 Signed-off-by: Chunqiu Wang cqw...@motorola.com
 Signed-off-by: Kevin Hilman khil...@deeprootsystems.com
 ---
  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 678fd08..4d43cda 100644
 --- a/arch/arm/plat-omap/gpio.c
 +++ b/arch/arm/plat-omap/gpio.c
 @@ -724,7 +724,11 @@ static inline void set_24xx_gpio_triggering(struct 
 gpio_bank *bank, int gpio,
   OMAP4_GPIO_IRQWAKEN0);
  }
  } else {
 -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
 @@ -734,7 +738,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;
 -- 
 1.7.0.2
 
 --
 To unsubscribe from this list: send the line unsubscribe linux-omap in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/6] OMAP3: GPIO: Only enable WAKEUPEN for edge detection GPIOs

2010-05-11 Thread Tony Lindgren
* Kevin Hilman khil...@deeprootsystems.com [100511 07:22]:
 Tony Lindgren t...@atomide.com writes:
 
  * Kevin Hilman khil...@deeprootsystems.com [100503 16:28]:
  From: Chunqiu Wang cqw...@motorola.com
  
  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
 
  There's a generic solution to this problem. The solution is to temporarily
  set the level GPIO pins into edge for the duration of idle. Then
  they need to be set back to level after the system is woken up.
 
 Sure, but that doesn't change the need for this patch which is
 a correctness fix.
 
 Adding wakeup support for level GPIOs would be a separate fix.

OK, let's plan on merging these then. Want me to pick these,
or pull from some branch?

Looks like they also need to be posted to LAKML too, and we
should get them into linux-omap master for some testing.

Looks like these should not cause much of merge issues with
the gpio platform init patches. It would be nice to get those
merged too if possible.

Regards,

Tony
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/6] OMAP3: GPIO: Only enable WAKEUPEN for edge detection GPIOs

2010-05-11 Thread Kevin Hilman
-cqwang address which is bouncing

Tony Lindgren t...@atomide.com writes:

 * Kevin Hilman khil...@deeprootsystems.com [100511 07:22]:
 Tony Lindgren t...@atomide.com writes:
 
  * Kevin Hilman khil...@deeprootsystems.com [100503 16:28]:
  From: Chunqiu Wang cqw...@motorola.com
  
  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
 
  There's a generic solution to this problem. The solution is to temporarily
  set the level GPIO pins into edge for the duration of idle. Then
  they need to be set back to level after the system is woken up.
 
 Sure, but that doesn't change the need for this patch which is
 a correctness fix.
 
 Adding wakeup support for level GPIOs would be a separate fix.

 OK, let's plan on merging these then. Want me to pick these,
 or pull from some branch?

You can pull from the gpio-2.6.35 branch in my tree.

 Looks like they also need to be posted to LAKML too, and we
 should get them into linux-omap master for some testing.

Oops, meant to cc l-a-k.  Will repost with l-a-k in Cc.

Kevin

 Looks like these should not cause much of merge issues with
 the gpio platform init patches. It would be nice to get those
 merged too if possible.

 Regards,

 Tony
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/6] OMAP3: GPIO: Only enable WAKEUPEN for edge detection GPIOs

2010-05-11 Thread Kevin Hilman
From: Chunqiu Wang cqw...@motorola.com

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 cqw...@motorola.com
Signed-off-by: Kevin Hilman khil...@deeprootsystems.com
---
 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 6216f4f..2f185ff 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -724,7 +724,11 @@ static inline void set_24xx_gpio_triggering(struct 
gpio_bank *bank, int gpio,
 OMAP4_GPIO_IRQWAKEN0);
}
} else {
-   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
@@ -734,7 +738,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;
-- 
1.7.0.2

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/6] OMAP3: GPIO: Only enable WAKEUPEN for edge detection GPIOs

2010-05-11 Thread Tony Lindgren
* Kevin Hilman khil...@deeprootsystems.com [100511 16:22]:
 -cqwang address which is bouncing
 
 Tony Lindgren t...@atomide.com writes:
 
  * Kevin Hilman khil...@deeprootsystems.com [100511 07:22]:
 
  OK, let's plan on merging these then. Want me to pick these,
  or pull from some branch?
 
 You can pull from the gpio-2.6.35 branch in my tree.

OK
 
  Looks like they also need to be posted to LAKML too, and we
  should get them into linux-omap master for some testing.
 
 Oops, meant to cc l-a-k.  Will repost with l-a-k in Cc.

Will merge them into linux-omap master branch today, then
will wait a few days for any comments on LAKML, then pull
them into omap-for-linus.

Regards,

Tony
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/6] OMAP3: GPIO: Only enable WAKEUPEN for edge detection GPIOs

2010-05-10 Thread Tony Lindgren
* Kevin Hilman khil...@deeprootsystems.com [100503 16:28]:
 From: Chunqiu Wang cqw...@motorola.com
 
 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

There's a generic solution to this problem. The solution is to temporarily
set the level GPIO pins into edge for the duration of idle. Then
they need to be set back to level after the system is woken up.

Regards,

Tony

 
 [1] Section 25.5.3.1 OMAP34xx_ES3.1_TRM_V_Q
 
 Signed-off-by: Chunqiu Wang cqw...@motorola.com
 Signed-off-by: Kevin Hilman khil...@deeprootsystems.com
 ---
  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 678fd08..4d43cda 100644
 --- a/arch/arm/plat-omap/gpio.c
 +++ b/arch/arm/plat-omap/gpio.c
 @@ -724,7 +724,11 @@ static inline void set_24xx_gpio_triggering(struct 
 gpio_bank *bank, int gpio,
OMAP4_GPIO_IRQWAKEN0);
   }
   } else {
 - 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
 @@ -734,7 +738,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;
 -- 
 1.7.0.2
 
 --
 To unsubscribe from this list: send the line unsubscribe linux-omap in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html