• Hans de Goede's avatar
    platform/x86: intel_int0002_vgpio: Only call enable_irq_wake() when using s2idle · b68e182a
    Hans de Goede authored
    Commit 871f1f2b ("platform/x86: intel_int0002_vgpio: Only implement
    irq_set_wake on Bay Trail") stopped passing irq_set_wake requests on to
    the parents IRQ because this was breaking suspend (causing immediate
    wakeups) on an Asus E202SA.
    
    This workaround for the Asus E202SA is causing wakeup by USB keyboard to
    not work on other devices with Airmont CPU cores such as the Medion Akoya
    E1239T. In hindsight the problem with the Asus E202SA has nothing to do
    with Silvermont vs Airmont CPU cores, so the differentiation between the
    2 types of CPU cores introduced by the previous fix is wrong.
    
    The real issue at hand is s2idle vs S3 suspend where the suspend is
    mostly handled by firmware. The parent IRQ for the INT0002 device is shared
    with the ACPI SCI and the real problem is that the INT0002 code should not
    be messing with the wakeup settings of that IRQ when suspend/resume is
    being handled by the firmware.
    
    Note that on systems which support both s2idle and S3 suspend, which
    suspend method to use can be changed at runtime.
    
    This patch fixes both the Asus E202SA spurious wakeups issue as well as
    the wakeup by USB keyboard not working on the Medion Akoya E1239T issue.
    
    These are both fixed by replacing the old workaround with delaying the
    enable_irq_wake(parent_irq) call till system-suspend time and protecting
    it with a !pm_suspend_via_firmware() check so that we still do not call
    it on devices using firmware-based (S3) suspend such as the Asus E202SA.
    
    Note rather then adding #ifdef CONFIG_PM_SLEEP, this commit simply adds
    a "depends on PM_SLEEP" to the Kconfig since this drivers whole purpose
    is to deal with wakeup events, so using it without CONFIG_PM_SLEEP makes
    no sense.
    
    Cc: Maxim Mikityanskiy <maxtram95@gmail.com>
    Fixes: 871f1f2b ("platform/x86: intel_int0002_vgpio: Only implement irq_set_wake on Bay Trail")
    Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
    Reviewed-by: default avatarAndy Shevchenko <andy.shevchenko@gmail.com>
    Reviewed-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    Link: https://lore.kernel.org/r/20210512125523.55215-2-hdegoede@redhat.com
    b68e182a
Kconfig 43 KB