Re: [RFC PATCH 2/2] Input: gpio-keys: implemented support for enabling/disabling gpios

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 11, 2009 at 03:37:38PM +0100, ext Ferenc Wagner wrote:
> Mika Westerberg <ext-mika.1.westerberg@xxxxxxxxx> writes:
> 
> > +	for (i = 0; i < pdata->nbuttons; i++) {
> > +		struct gpio_keys_button *button = &pdata->buttons[i];
> > +		struct gpio_button_data *bdata = &ddata->data[i];
> > +
> > +		if (button->code == st->code && button->type == st->type) {
> > +			switch (st->state) {
> > +			case EVENT_STATE_DISABLE:
> > +				if (bdata->state == EVENT_STATE_ENABLE) {
> > +					bdata->state = EVENT_STATE_DISABLE;
> > +					/*
> > +					 * Disable physical irq line.  This is
> > +					 * enough also for keeping device from
> > +					 * waking up during sleep so no need
> > +					 * to change wakeup flags for this irq.
> > +					 */
> > +					disable_irq(gpio_to_irq(button->gpio));
> 
> Hi Mika,
> 
> Did you consider what would happen when several GPIO buttons share a
> single IRQ?  The current code does not support this (it uses IRQF_SHARED
> for a different reason), but this is very much possible: see for example
> http://thread.gmane.org/gmane.linux.kernel.input/8775 for a related
> thread which unfortunately died off without conclusion (but the patch
> went in).

Good point!  I didn't consider that at all. 

Maybe we disable irq only when it is not shared with anything else (even
with other GPIO button) and otherwise return -EINVAL or something like
that?

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

[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux