OSDN Git Service

Input: soc_button_array - work around DSDTs which modify the irqflags
authorHans de Goede <hdegoede@redhat.com>
Mon, 14 Sep 2020 06:07:27 +0000 (23:07 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Mon, 14 Sep 2020 06:08:48 +0000 (23:08 -0700)
commit78a5b53e9fb4d9a4437b6262b79278d2cd4669c9
treeeec132f9084820bf145db1ec35be6160acc29cea
parent4e5d9c198349233b2ba9eb41597a8fc9a662d608
Input: soc_button_array - work around DSDTs which modify the irqflags

Some 2-in-1s which use the soc_button_array driver have this ugly issue in
their DSDT where the _LID method modifies the irq-type settings of the
GPIOs used for the power and home buttons. The intend of this AML code is
to disable these buttons when the lid is closed.

The AML does this by directly poking the GPIO controllers registers. This
is problematic because when re-enabling the irq, which happens whenever
_LID gets called with the lid open (e.g. on boot and on resume), it sets
the irq-type to IRQ_TYPE_LEVEL_LOW. Where as the gpio-keys driver programs
the type to, and expects it to be, IRQ_TYPE_EDGE_BOTH.

This commit adds a workaround for this which (on affected devices) does
not set gpio_keys_button.gpio on these 2-in-1s, instead it gets the irq for
the GPIO, configures it as IRQ_TYPE_LEVEL_LOW (to match how the _LID AML
code configures it) and passes the irq in gpio_keys_button.irq.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20200906122016.4628-2-hdegoede@redhat.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/misc/soc_button_array.c