From: NeilBrown <neilb@suse.de>
To: "Shilimkar, Santosh" <santosh.shilimkar@ti.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>,
Tarun Kanti DebBarma <tarun.kanti@ti.com>,
Kevin Hilman <khilman@ti.com>, Tony Lindgren <tony@atomide.com>,
Cousson@suse.de, Benoit <b-cousson@ti.com>,
Grant Likely <grant.likely@secretlab.ca>,
Felipe Balbi <balbi@ti.com>,
linux-omap@vger.kernel.org, lkml <linux-kernel@vger.kernel.org>,
Jon Hunter <jon-hunter@ti.com>
Subject: Re: [PATCH] OMAP GPIO - don't wake from suspend unless requested.
Date: Thu, 6 Sep 2012 13:05:10 +1000 [thread overview]
Message-ID: <20120906130510.32b0b877@notabene.brown> (raw)
In-Reply-To: <CAMQu2gw2b8HHDPuSRuHXVYn3sJ5BYi_PuOT=snpa3zD5ert=QQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 6504 bytes --]
On Mon, 3 Sep 2012 22:59:06 -0700 "Shilimkar, Santosh"
<santosh.shilimkar@ti.com> wrote:
> On Sun, Aug 26, 2012 at 6:29 PM, Shilimkar, Santosh
> <santosh.shilimkar@ti.com> wrote:
> > On Sun, Aug 26, 2012 at 3:53 PM, NeilBrown <neilb@suse.de> wrote:
> >>
> >> On Sun, 26 Aug 2012 09:47:50 +0530 "Shilimkar, Santosh"
> >> <santosh.shilimkar@ti.com> wrote:
> >>
> >> > + Jon,
> >> >
> >> > On Sat, Aug 25, 2012 at 5:14 PM, NeilBrown <neilb@suse.de> wrote:
> >> > >
> >> > >
> >> > >
> >> > > Current kernel will wake from suspend on an event on any active
> >> > > GPIO even if enable_irq_wake() wasn't called.
> >> > >
> >> > > There are two reasons that the hardware wake-enable bit should be set:
> >> > >
> >> > > 1/ while non-suspended the CPU might go into a deep sleep (off_mode)
> >> > > in which the wake-enable bit is needed for an interrupt to be
> >> > > recognised.
> >> > > 2/ while suspended the GPIO interrupt should wake from suspend if and
> >> > > only if irq_wake as been enabled.
> >> > >
> >> > > The code currently doesn't keep these two reasons separate so they get
> >> > > confused and sometimes the wakeup flags is set incorrectly.
> >> > >
> >> > > This patch reverts:
> >> > > commit 9c4ed9e6c01e7a8bd9079da8267e1f03cb4761fc
> >> > > gpio/omap: remove suspend/resume callbacks
> >> > > and
> >> > > commit 0aa2727399c0b78225021413022c164cb99fbc5e
> >> > > gpio/omap: remove suspend_wakeup field from struct gpio_bank
> >> > >
> >> > > and makes some minor changes so that we have separate flags for "GPIO
> >> > > should wake from deep idle" and "GPIO should wake from suspend".
> >> > >
> >> > > With this patch, the GPIO from my touch screen doesn't wake my device
> >> > > any more, which is what I want.
> >> > >
> >> > > Cc: Kevin Hilman <khilman@ti.com>
> >> > > Cc: Tony Lindgren <tony@atomide.com>
> >> > > Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
> >> > > Cc: Cousson, Benoit <b-cousson@ti.com>
> >> > > Cc: Grant Likely <grant.likely@secretlab.ca>
> >> > > Cc: Tarun Kanti DebBarma <tarun.kanti@ti.com>
> >> > > Cc: Felipe Balbi <balbi@ti.com>
> >> > > Cc: Govindraj.R <govindraj.raja@ti.com>
> >> > >
> >> > > Signed-off-by: NeilBrown <neilb@suse.de>
> >> > >
> >> > The patch doesn't seems to be correct. At least the 2/ gets
> >> > fixed with a proper IRQCHIP flag. Can you try the patch at
> >> > end of the email and see if it helps ? Am attaching it in case
> >> > mailer damages it.
> >> >
> >> > Regards
> >> > Santosh
> >> >
> >> > >From b8a38fc75e046f6462610e26c47c620cad850c24 Mon Sep 17 00:00:00 2001
> >> > From: Santosh Shilimkar <santosh.shilimkar@ti.com>
> >> > Date: Sun, 26 Aug 2012 09:39:51 +0530
> >> > Subject: [PATCH] gpio: omap: Set IRQCHIP_MASK_ON_SUSPEND to mask all
> >> > non-wakeup gpio wakeups.
> >> >
> >> > Set the irq chip flag IRQCHIP_MASK_ON_SUSPEND to cause the irq pm code
> >> > to mask all non-wake gpios in suspend, which will ensure the wakeup
> >> > enable
> >> > bit is not set on non-wake gpios.
> >> >
> >> > Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
> >> > ---
> >> > drivers/gpio/gpio-omap.c | 1 +
> >> > 1 file changed, 1 insertion(+)
> >> >
> >> > diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
> >> > index e6efd77..50b4c18 100644
> >> > --- a/drivers/gpio/gpio-omap.c
> >> > +++ b/drivers/gpio/gpio-omap.c
> >> > @@ -779,6 +779,7 @@ static struct irq_chip gpio_irq_chip = {
> >> > .irq_unmask = gpio_unmask_irq,
> >> > .irq_set_type = gpio_irq_type,
> >> > .irq_set_wake = gpio_wake_enable,
> >> > + .flags = IRQCHIP_MASK_ON_SUSPEND;
> >> > };
> >> >
> >> >
> >> > /*---------------------------------------------------------------------*/
> >>
> >>
> >> No obvious damage, unless the mailer is responsible or the ';' at the end
> >> of
> >> the line, rather than ',' :-)
> >>
> > :-) That was typo.
> >
> >> The approach makes sense, but does actually work. Should be fixable
> >> though.
> >>
> >> When I try this I get:
> >>
> >>
> >>
> >> [ 158.114440] Checking wakeup interrupts
> >> [ 158.118408] Unhandled fault: external abort on non-linefetch (0x1028)
> >> at 0xfb054040
> >> [ 158.126403] Internal error: : 1028 [#1] PREEMPT ARM
> >> [ 158.131500] Modules linked in: ipv6 g_ether hso libertas_sdio libertas
> >> cfg80211
> >> [ 158.139190] CPU: 0 Not tainted (3.5.0-gta04-debug+ #2)
> >> [ 158.144927] PC is at _set_gpio_triggering+0x38/0x258
> >> [ 158.150115] LR is at gpio_mask_irq+0xac/0xc0
> >> [ 158.154602] pc : [<c01d24a0>] lr : [<c01d2f68>] psr: 60000193
> >> [ 158.154602] sp : db521e90 ip : 00000011 fp : beeecc2c
> >> [ 158.166595] r10: c05c8ebc r9 : daa5a858 r8 : 00000003
> >> [ 158.172027] r7 : a0000193 r6 : 00000000 r5 : fb054000 r4 : ded44e18
> >> [ 158.178863] r3 : 00000001 r2 : 00000000 r1 : ded30340 r0 : 00000040
> >> [ 158.185668] Flags: nZCv IRQs off FIQs on Mode SVC_32 ISA ARM
> >> Segment use
> >>
> >> so it looks like runtime PM has turned off the iclk to the GPIO module so
> >> that
> >> when we try to tell it to change settings, it is no longer listening to
> >> us.
> > From the crash logs it appears like that.
> >
> >> The "Checking wakeup interrupts" function happens very late in the suspend
> >> cycle, after all the suspend_late and suspend_noirq functions have run.
> >> Maybe it needs to be moved earlier...
> >>
> > No it shouldn't be moved and it is that point for lot many good
> > reasons. Ofcourse
> > this omap gpio driver crash needs to be addressed. Need to think bit
> > more on this
> > issue.
> >
> After thinking bit more on this, the problem seems to be coming
> mainly because the gpio device is runtime suspended bit early than
> it should be. Similar issue seen with i2c driver as well. The i2c issue
> was discussed with Rafael at LPC last week. The idea is to move
> the pm_runtime_enable/disable() calls entirely up to the
> _late/_early stage of device suspend/resume.
> Will update this thread once I have further update.
This won't be late enough. IRQCHIP_MASK_ON_SUSPEND takes effect after all
the _late callbacks have been called.
I, too, spoke to Rafael about this in San Diego. He seemed to agree with me
that the interrupt needs to be masked in the ->suspend callback. any later
is too late.
NeilBrown
>
> Regards
> Santosh
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
next prev parent reply other threads:[~2012-09-06 3:05 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20120825214459.7333a376@notabene.brown>
2012-08-26 4:17 ` [PATCH] OMAP GPIO - don't wake from suspend unless requested Shilimkar, Santosh
2012-08-26 22:53 ` NeilBrown
2012-08-27 1:29 ` Shilimkar, Santosh
2012-09-04 5:59 ` Shilimkar, Santosh
2012-09-06 3:05 ` NeilBrown [this message]
2012-09-06 5:48 ` Shilimkar, Santosh
2012-09-06 7:02 ` NeilBrown
2012-09-06 7:27 ` Shilimkar, Santosh
2012-09-06 7:51 ` NeilBrown
2012-09-06 8:43 ` Shilimkar, Santosh
2012-09-06 13:26 ` Felipe Balbi
2012-09-10 6:58 ` NeilBrown
2012-09-06 14:11 ` Shubhrajyoti
2012-09-07 21:37 ` Kevin Hilman
2012-09-08 7:55 ` Shilimkar, Santosh
2012-09-10 17:57 ` Kevin Hilman
2012-12-14 7:05 ` NeilBrown
2012-12-14 9:04 ` anish kumar
2012-12-19 22:20 ` Grant Likely
2013-02-05 19:47 ` Kevin Hilman
2012-09-10 4:10 ` NeilBrown
2012-09-10 18:17 ` Kevin Hilman
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=20120906130510.32b0b877@notabene.brown \
--to=neilb@suse.de \
--cc=Cousson@suse.de \
--cc=b-cousson@ti.com \
--cc=balbi@ti.com \
--cc=grant.likely@secretlab.ca \
--cc=jon-hunter@ti.com \
--cc=khilman@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=rjw@sisk.pl \
--cc=santosh.shilimkar@ti.com \
--cc=tarun.kanti@ti.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).