On Wed, Nov 11, 2009 at 06:08:49PM +0100, ext Dmitry Torokhov wrote: > On Wed, Nov 11, 2009 at 04:52:06PM +0200, Mika Westerberg wrote: > > 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? > > > > How could a driver know if it is [going to] share irq with another > driver. Dmitry's (the other one ;) ) patch was needed because he wanted > to share IRQ with another device entirely. Ah, it seems that there is no such API in the kernel :( How about specifying whether some GPIO button allows sharing of the IRQ in board files (e.g amend gpio_keys_button struct)? Then we can disable only those GPIO buttons where IRQ line is not shared. 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