Re: [PATCH v2 1/2] Input: gpio-keys - allow platform to specify exact irq flags

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

 



Mika Westerberg <ext-mika.1.westerberg@xxxxxxxxx> writes:

> On Thu, Nov 26, 2009 at 07:35:07AM +0100, ext Dmitry Torokhov wrote:
>> On Tue, Nov 24, 2009 at 07:39:28PM +0100, Ferenc Wagner wrote:
>>> Mika Westerberg <ext-mika.1.westerberg@xxxxxxxxx> writes:
>>> 
>>>> So I'll try to implement this gpio-keys muting so that it allows
>>>> also multiple buttons to share single IRQ line.
>>> 
>>> Thanks.  But you'd better wait for Dmitry's response, because I'm by no
>>> means authoritative in this business.
>> 
>> I would not refuse a reasonable patch as long as there is a use case for
>> it. The only think is that I would prefer to keep compatibility with the
>> current format of the platform data, otherwise we will screw up embedded
>> guys that are currently using the driver. But if compatibility results
>> in too ugly code then I reserve the right to invoke "out of tree drivers
>> - don't care" card ;)
>
> How about if we just add one field to struct gpio_keys_button?
> 	...
> 	bool can_disable;
>
> Then gpio_keys uses this field when it decides what irqflags it
> is going to pass to request_irq() (we don't allow platform data
> to pass exact flags). So in case of can_disable is set, we don't
> pass IRQF_SHARED to request_irq().
>
> When support for sharing single IRQ between multiple buttons arrives
> this field is still valid and we just need to take care of disable IRQ
> line only when all buttons that share it, are disabled.
>
> This won't break existing users of gpio_keys and allows future
> extension to support case of multiple buttons sharing single
> IRQ line, right?

Please don't shoot me, but I've got a different idea: what if we leave
this whole business to the generic kernel interrupt handling routines?
It would be as easy as requesting the IRQ on device open (I guess the
input layer can relay the open event down here) and freeing it on close.
The IRQ could stat shared all the time, and the kernel would
automatically disable it when all handlers are unregistered.  All this
means no need to extend the platform data, no need for a separate sysfs
interface, and still the application would have complete control of its
wakeup sources by opening/closing them as needed.  What do you think?
-- 
Regards,
Feri.
--
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