On Fri, May 04, 2018 at 12:18:46PM +0100, Carlo Caione wrote: > From: Carlo Caione <carlo@xxxxxxxxxxxx> > > This code is not for inclusion, it's just an ugly patch to sparkle the > discussion on how to properly fix this issue. > > We have a problem with a Cherrytrail laptop (x5-Z8350) that is waking up > from s2idle after a few seconds without any external input. > > This laptop doesn't support (apparently) S3 and the Low Power Idle S0 > _DSM interface is missing functions 5 and 6. > > >From '/sys/power/pm_wakeup_irq' we know that the IRQ waking up the > laptop is coming from the GPIO controller and that the IRQ is handled as > ACPI event: > > 115: 0 0 0 94 chv-gpio 5 ACPI:Event > > This IRQ is being triggered every few seconds, when it is received in > s2idle, this is causing the laptop to wake up. > > Looking in the DSDT table (full dump at [0]) we have: > > Method (_AEI, 0, NotSerialized) // _AEI: ACPI Event Interrupts > { > Name (RBUF, ResourceTemplate () > { > GpioInt (Edge, ActiveBoth, ExclusiveAndWake, PullUp, 0x0000, > "\\_SB.GPO1", 0x00, ResourceConsumer, , > ) > { // Pin list > 0x0005 > } > }) > Return (RBUF) /* \_SB_.GPO1._AEI.RBUF */ > } > > Method (_E05, 0, NotSerialized) // _Exx: Edge-Triggered GPE > { > Local0 = Zero > If (CondRefOf (\_SB.PCI0.I2C3.BATC, Local1)) > { > Local0 = ^^PCI0.I2C3.BATC.INTR () > If (0xFF == Local0) > { > ADBG ("INTR RD FAIL") > Return (Zero) > } > > If (Zero == Local0) > { > Return (Zero) > } > > ADBG ("ULPMC INTR") > ADBG (Local0) > } > ... > > So, the IRQ is basically probing the battery status every few seconds > but since the GpioInt has argument ExclusiveAndWake, this is waking up > the laptop after a few seconds. > > The patch in this RFC gets the idea from commit 76380636280b4 ("ACPI / > EC: Add parameter to force disable the GPE on suspend") adding a quirk > to disable the IRQ (and then the GPE) triggered by a specific GPIO/pin. Since this is not specific to the cherryview driver, I wonder if it makes more sense to handle this in gpiolib-acpi.c::acpi_gpiochip_request_interrupt()? if (agpio->wake_capable == ACPI_WAKE_CAPABLE && !dmi_check_system(acpi_gpio_event_ignore_wake)) enable_irq_wake(irq); -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html