All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Hunter, Jon" <jon-hunter@ti.com>
To: Kevin Hilman <khilman@deeprootsystems.com>
Cc: "linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
	Tony Lindgren <tony@atomide.com>
Subject: RE: [PATCH 08/11] ARM: OMAP2/3: GPIO: do not attempt to wake-enable
Date: Mon, 18 May 2009 14:50:49 -0500	[thread overview]
Message-ID: <7B4574D56E4ADF438756313E9A172A87397A91F5@dlee01.ent.ti.com> (raw)
In-Reply-To: <20090414215826.9878.86819.stgit@localhost>

Hi Kevin,

> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
>  arch/arm/plat-omap/gpio.c |   14 ++++----------
>  1 files changed, 4 insertions(+), 10 deletions(-)
> 
> diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
> index d3fa41e..210a1c0 100644
> --- a/arch/arm/plat-omap/gpio.c
> +++ b/arch/arm/plat-omap/gpio.c
> @@ -921,13 +921,10 @@ static int _set_gpio_wakeup(struct gpio_bank *bank,
> int gpio, int enable)
>  	case METHOD_MPUIO:
>  	case METHOD_GPIO_1610:
>  		spin_lock_irqsave(&bank->lock, flags);
> -		if (enable) {
> +		if (enable)
>  			bank->suspend_wakeup |= (1 << gpio);
> -			enable_irq_wake(bank->irq);
> -		} else {
> -			disable_irq_wake(bank->irq);
> +		else
>  			bank->suspend_wakeup &= ~(1 << gpio);
> -		}
>  		spin_unlock_irqrestore(&bank->lock, flags);
>  		return 0;
>  #endif
> @@ -940,13 +937,10 @@ static int _set_gpio_wakeup(struct gpio_bank *bank,
> int gpio, int enable)
>  			return -EINVAL;
>  		}
>  		spin_lock_irqsave(&bank->lock, flags);
> -		if (enable) {
> +		if (enable)
>  			bank->suspend_wakeup |= (1 << gpio);
> -			enable_irq_wake(bank->irq);
> -		} else {
> -			disable_irq_wake(bank->irq);
> +		else
>  			bank->suspend_wakeup &= ~(1 << gpio);
> -		}
>  		spin_unlock_irqrestore(&bank->lock, flags);
>  		return 0;
>  #endif


I have been looking into an issue that appears to be related to this. I have the following questions with regard to this patch. 

1). Although, I agree with the above change was there any reason why we did not add some code to set/clear the appropriate bit in the WKUENA register in this function? If this function is called via a call to set_irq_wake it will not modify the WKUENA register. Therefore, we were thinking of something along the lines of:

diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index 17d7afe..895c548 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -941,10 +941,13 @@ static int _set_gpio_wakeup(struct gpio_bank *bank, int gpio, int enable)
                        return -EINVAL;
                }
                spin_lock_irqsave(&bank->lock, flags);
-               if (enable)
+               if (enable) {
                        bank->suspend_wakeup |= (1 << gpio);
-               else
+                       __raw_writel(1 << gpio, bank->base + OMAP24XX_GPIO_SETWKUENA);
+               } else {
+                       __raw_writel(1 << gpio, bank->base + OMAP24XX_GPIO_CLEARWKUENA);
                        bank->suspend_wakeup &= ~(1 << gpio);
+               }
                spin_unlock_irqrestore(&bank->lock, flags);
                return 0;
 #endif


2). We have found that a call to request_irq results in a call to the function "set_24xx_gpio_triggering()" (for OMAP3430). In addition to configuring the triggering for a given GPIO, this function is also programming the WKUENA register. Hence, the wake-up enable is enabled for GPIO without calling set_irq_wake(). 

I am not sure if this is the intended behaviour or if drivers should explicitly be calling set_irq_wake to enable/disable the wake-up. 

The other problem with this is that once request_irq is called for a gpio, then even if we call disable_irq the wake-up event is not cleared. So this means that a gpio event will still wake-up the device without the gpio being enabled and because the gpio is disabled the event will never be cleared and hence will prevent retention. 

So should the wake-up event only be enabled/disabled by a call to set_irq_wake() or should we make sure that calling disable_irq in turn calls gpio_mask_irq and make sure this clears the wake-up event? 

Cheers
Jon

  reply	other threads:[~2009-05-18 19:50 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-14 21:47 [PATCH 00/11] Omap fixes for 2.6.30-rc1 Tony Lindgren
2009-04-14 21:49 ` [PATCH 01/11] ARM: OMAP: Fix for possible race condition in omap_free_dma() Tony Lindgren
2009-04-14 21:50 ` [PATCH 02/11] ARM: OMAP: Remove old dead gpio expander code Tony Lindgren
2009-04-14 21:51 ` [PATCH 03/11] ARM: OMAP: MMC: Remove unused power_pin Tony Lindgren
2009-04-14 21:53 ` [PATCH 04/11] ARM: OMAP1: Simplify board-h2 MMC setup Tony Lindgren
2009-04-14 21:54 ` [PATCH 05/11] ARM: OMAP1: Fix mmc_set_power GPIO usage Tony Lindgren
2009-04-14 21:55 ` [PATCH 06/11] ARM: OMAP2: Remove defines and resource init for OMAP24XX EAC Tony Lindgren
2009-04-14 21:57 ` [PATCH 07/11] ARM: OMAP2: possible division by 0 Tony Lindgren
2009-04-14 21:58 ` [PATCH 08/11] ARM: OMAP2/3: GPIO: do not attempt to wake-enable Tony Lindgren
2009-05-18 19:50   ` Hunter, Jon [this message]
2009-05-21 15:53     ` Kevin Hilman
2009-04-14 21:59 ` [PATCH 09/11] ARM: OMAP3: remove duplicated #include Tony Lindgren
2009-04-14 22:01 ` [PATCH 10/11] ARM: OMAP3: Fixed spurious IRQ issue for GPIO interrupts Tony Lindgren
2009-04-14 22:02 ` [PATCH 11/11] ARM: OMAP3: Clean up spurious interrupt check logic Tony Lindgren
2009-04-17  1:23 ` git pull request for omap fixes (Re: [PATCH 00/11] Omap fixes for 2.6.30-rc1) Tony Lindgren
2009-04-21  4:57   ` git pull request for omap fixes, v2 " Tony Lindgren
2009-04-21 15:55     ` Tony Lindgren
2009-04-23 18:20       ` git pull request for omap fixes, v3 " Tony Lindgren
2009-04-24 17:53         ` git pull request for omap fixes, v4 " Tony Lindgren
2009-04-24 21:16           ` Russell King - ARM Linux
2009-04-24 21:33             ` Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7B4574D56E4ADF438756313E9A172A87397A91F5@dlee01.ent.ti.com \
    --to=jon-hunter@ti.com \
    --cc=khilman@deeprootsystems.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=tony@atomide.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.