public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: tony@atomide•com (Tony Lindgren)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH V3 3/3] mfd: palmas: Add support for optional wakeup
Date: Fri, 14 Nov 2014 09:08:17 -0800	[thread overview]
Message-ID: <20141114170816.GW26481@atomide.com> (raw)
In-Reply-To: <20141114161901.GG11538@saruman>

* Felipe Balbi <balbi@ti•com> [141114 08:20]:
> On Thu, Nov 13, 2014 at 09:40:31AM -0800, Tony Lindgren wrote:
> > +/**
> > + *	handle_wakeirq_thread - call device runtime pm calls on wake-up interrupt
> > + *	@wakeirq: device specific wake-up interrupt
> > + *	@dev_id: struct device entry
> > + */
> > +irqreturn_t handle_wakeirq_thread(int wakeirq, void *dev_id)
> > +{
> > +	struct device *dev = dev_id;
> > +	irqreturn_t ret = IRQ_NONE;
> > +
> > +	if (pm_runtime_suspended(dev)) {
> > +		pm_runtime_mark_last_busy(dev);
> > +		pm_request_resume(dev);
> 
> this assumes that every driver's ->resume() callback has a:
> 
> 	if (pending)
> 		handle_pending_irqs();
> 
> which might not be very nice. I'd rather follow what Thomas suggested
> and always pass device irq so this can mark it pending. Keep in mind
> that we *don't* need a pm_runtime_get_sync() in every IRQ handler
> because of that. Adding it is but the easiest way to get things working
> and, quite frankly, very silly.
> 
> what we want is rather:
> 
> 	irqreturn_t my_handler(int irq, void *dev_id)
> 	{
> 		struct device *dev = dev_id;
> 
> 		if (pm_runtime_suspended(dev)) {
> 			pending_irqs_to_be_handled_from_runtime_resume = true;
> 			pm_runtime_get(dev);
> 			clear_irq_source(dev);
> 			return IRQ_HANDLED;
> 		}
> 	}
> 
> or something similar.

Yeah I'll take a look.
 
> > +		ret = IRQ_HANDLED;
> > +	}
> 
> you're not masking the wake irq here which means that when this handler
> returns, wake irq will be unmasked by core IRQ subsystem leaving it
> unmasked after ->resume().

It currently assumes the consumer driver takes care of it. But I get
your point, we should be able to automate this further.

And right now there's also a dependency on dev->power.irq_safe so
RPM_ASYNC is not set. And this all should ideally work even with runtime
PM not set as it's also needed for resume from suspend.
 
> you *know* you'll pass a NULL top half handler, why don't you just force
> IRQF_ONESHOT instead of erroring out ? Just add:
> 
> 	wakeflags |= IRQF_ONESHOT;
> 
> and get it over with :-)

Good point :)
 
Regards,

Tony

  reply	other threads:[~2014-11-14 17:08 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-18 19:04 [PATCH V3 0/3] mfd: palmas: add optional wakeup irq Nishanth Menon
2014-09-18 19:04 ` [PATCH V3 1/3] Documentation: dt-bindings: mfd: palmas: Fix example style of i2c peripheral Nishanth Menon
2014-09-18 19:04 ` [PATCH V3 2/3] Documentation: dt-bindings: mfd: palmas: document optional wakeup IRQ Nishanth Menon
2014-09-18 19:04 ` [PATCH V3 3/3] mfd: palmas: Add support for optional wakeup Nishanth Menon
2014-09-19  0:57   ` Thomas Gleixner
2014-09-19  3:03     ` Nishanth Menon
2014-09-19 15:37       ` Thomas Gleixner
2014-09-19 16:19         ` Nishanth Menon
2014-09-19 17:36           ` Thomas Gleixner
2014-09-19 19:16             ` Tony Lindgren
2014-09-19 19:46               ` Thomas Gleixner
2014-09-19 19:57                 ` Tony Lindgren
2014-09-20  2:07                   ` Thomas Gleixner
2014-09-20 14:07                     ` Tony Lindgren
2014-10-02  3:43                 ` Tony Lindgren
2014-11-06 20:46                   ` Tony Lindgren
2014-11-13 10:03                     ` Thomas Gleixner
2014-11-13 17:40                       ` Tony Lindgren
2014-11-13 22:25                         ` Thomas Gleixner
2014-11-13 23:45                           ` Tony Lindgren
2014-11-14 16:19                         ` Felipe Balbi
2014-11-14 17:08                           ` Tony Lindgren [this message]
2014-11-14 17:21                             ` Felipe Balbi

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=20141114170816.GW26481@atomide.com \
    --to=tony@atomide$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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