• Hans de Goede's avatar
    Input: soc_button_array - work around DSDTs which modify the irqflags · 78a5b53e
    Hans de Goede authored
    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: default avatarHans de Goede <hdegoede@redhat.com>
    Link: https://lore.kernel.org/r/20200906122016.4628-2-hdegoede@redhat.comSigned-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
    78a5b53e
soc_button_array.c 15.5 KB