linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Ferenc Wagner <wferi@niif.hu>
Cc: "Dmitry Eremin-Solenikov" <dbaryshkov@gmail.com>,
	linux-input@vger.kernel.org,
	"Uwe Kleine-König" <Uwe.Kleine-Koenig@digi.com>
Subject: Re: [PATCH] input: make gpio-keys use IRQF_SHARED
Date: Tue, 22 Sep 2009 09:41:36 -0700	[thread overview]
Message-ID: <20090922164136.GA22639@core.coreip.homeip.net> (raw)
In-Reply-To: <87hbuvggfl.fsf@tac.ki.iif.hu>

On Tue, Sep 22, 2009 at 05:14:22PM +0200, Ferenc Wagner wrote:
> Dmitry Torokhov <dmitry.torokhov@gmail.com> writes:
> 
> > On Wed, Sep 16, 2009 at 07:03:18PM +0400, Dmitry Eremin-Solenikov wrote:
> >> There is nothing that disallows gpio-keys to share it's IRQ line
> >> w/ other drivers. Make it use IRQF_SHARED in request_irq().
> >> 
> >> An example of other driver with which I'd like to share IRQ line
> >> for GPIO buttons is ledtrig-gpio.
> >> 
> >> Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
> >> ---
> >>  drivers/input/keyboard/gpio_keys.c |    1 +
> >>  1 files changed, 1 insertions(+), 0 deletions(-)
> >> 
> >> diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
> >> index efed0c9..9fc2fab 100644
> >> --- a/drivers/input/keyboard/gpio_keys.c
> >> +++ b/drivers/input/keyboard/gpio_keys.c
> >> @@ -147,6 +147,7 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
> >>  		}
> >>  
> >>  		error = request_irq(irq, gpio_keys_isr,
> >> +				    IRQF_SHARED |
> >>  				    IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
> >>  				    button->desc ? button->desc : "gpio_keys",
> >>  				    bdata);
> >
> > How will you determine which device generated the interrupt? Because you
> > can't return IRQ_HANDLED unconditionally and expect both devices work
> > reliably.
> 
> It would be possible, but commit
> da0d03fe6cecde837f113a8a587f5a872d0fade0 states that:
> 
>     The gpio_get_value function may sleep, so it should not be called in a
>     timer function.
> 
> But I don't see why it could sleep, is that really the case?

There are things like i2c gpio extenders that require access to slow
buses and can't sleep.

>  Because
> that makes acknowledging the interrupt very hard.  Actually, I need
> and tested interrupt sharing.  What are the "cansleep wrappers" in
> asm-generic/gpio.h if these function can sleep as well?  I'd be
> grateful for some explanation.  Also, commit
> 57ffe9d539e0eb741bb9ca8f2834d210e70ee2e3 removed the possibility of
> telling apart different keys, so that should be reverted during the
> process.  I already asked Uwe Kleine-König about the whys, but didn't
> get a reply.

I don't see why you say that... You request IRQ per button and you get
that button structure as argument in the interrupt handler.

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

  reply	other threads:[~2009-09-22 16:41 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-16 15:03 [PATCH] input: make gpio-keys use IRQF_SHARED Dmitry Eremin-Solenikov
2009-09-16 16:28 ` Dmitry Torokhov
2009-09-16 18:41   ` Dmitry Eremin-Solenikov
2009-09-18 11:44     ` Dmitry Eremin-Solenikov
2009-09-22 16:42       ` Dmitry Torokhov
2009-09-22 18:50         ` Ferenc Wagner
2009-09-22 15:14   ` Ferenc Wagner
2009-09-22 16:41     ` Dmitry Torokhov [this message]
2009-09-22 19:06       ` Ferenc Wagner
2009-09-28 17:03         ` Dmitry Torokhov
2009-10-01 14:02           ` Ferenc Wagner
2009-10-12 17:09             ` Ferenc Wagner
2009-10-14  8:04               ` Dmitry Torokhov
2009-10-14 11:03                 ` gpio_get_value in atomic context (was: make gpio-keys use IRQF_SHARED) Ferenc Wagner
2009-10-14 11:40                   ` Arve Hjønnevåg
2009-11-28  1:08                     ` David Brownell
2009-11-30 15:35                       ` gpio_get_value in atomic context Ferenc Wagner
2009-12-09 13:33                       ` Ferenc Wagner
2009-10-14 11:25                 ` [PATCH] input: make gpio-keys use IRQF_SHARED Ferenc Wagner

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=20090922164136.GA22639@core.coreip.homeip.net \
    --to=dmitry.torokhov@gmail.com \
    --cc=Uwe.Kleine-Koenig@digi.com \
    --cc=dbaryshkov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=wferi@niif.hu \
    /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).