• Hans de Goede's avatar
    pinctrl: cherryview: Do not allow the same interrupt line to be used by 2 pins · 07199dbf
    Hans de Goede authored
    It is impossible to use the same interrupt line for 2 pins, this will
    result in the interrupts only being delivered to the IRQ handler for
    the pin for which chv_gpio_irq_type() was called last.
    
    The pinctrl-cherryview.c code relies on the BIOS to correctly setup the
    interrupt line, but there is a BIOS bug on at least the Medion Akoya E1239T
    and the GPD win models where both INT33FF:02 pin 8, used by the powerbutton
    and INT33FF:02 pin 21 used as IRQ input for the accelerometer are mapped to
    interrupt line 0.
    
    This causes 2 problems:
    1. The accelerometer IRQ does not work, since the power button is probed
    later taking over the intr_lines[0] slot.
    
    2. Since the accelerometer IRQ is not marked as wakeup, interrupt line 0
    gets masked on suspend, causing the power button to not work to wake
    the system from suspend.
    
    Likewise on the Lenovo Yogabook, which has a touchscreen as keyboard
    and the keyboard half of the tablet also has a Wacom digitizer, the BIOS
    by default assigns the same interrupt line to the GPIOs used
    for their interrupts.
    
    Fix these problems by adding a check for this and assigning a new
    interrupt line to the 2nd pin for which chv_gpio_irq_type() gets called.
    
    With this fix in place the following 2 messages show up in dmesg on
    the Medion Akoya E1239T and the GPD win:
    
     cherryview-pinctrl INT33FF:02: interrupt line 0 is used by both pin 21 and pin 8
     cherryview-pinctrl INT33FF:02: changing the interrupt line for pin 8 to 15
    
    And the following gets logged on the Lenovo Yogabook:
    
     cherryview-pinctrl INT33FF:01: interrupt-line 0 is used by both pin 49 and pin 56
     cherryview-pinctrl INT33FF:01: changing the interrupt line for pin 56 to 7
    
    Note commit 9747070c ("Input: axp20x-pek - always register interrupt
    handlers") was added as a work around for the power button not being able
    to wakeup the system. This relies on using the PMIC's connection to the
    power button but that only works on systems with the AXP288 PMIC.
    Once this fix has been merged that workaround can be removed.
    
    Cc: Yauhen Kharuzhy <jekhor@gmail.com>
    Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
    Acked-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
    Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
    07199dbf
pinctrl-cherryview.c 53 KB