Bug 116001

Summary: _REV override - Dell XPS 13 (early 2015) lid button events not fired after suspend
Product: ACPI Reporter: Sebastian Pleschko (sebastian.pleschko)
Component: OtherAssignee: Lv Zheng (lv.zheng)
Status: CLOSED INSUFFICIENT_DATA    
Severity: normal CC: aaron.lu, kai.heng.feng, lenb, rui.zhang, tm, yu.c.chen
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 4.4.5, 4.5.1, 4.5.2, 4.5.3 Subsystem:
Regression: Yes Bisected commit-id:
Attachments: ACPI dump output
ec boot log
ec before suspend
ec after suspend
ec-boot.log
ec-before-suspend.log
[PATCH] ACPI / EC: Add PM operations to handle special requirement
ec-boot.log with ACPI/EC patch applied
ec-before-suspend.log with ACPI/EC patch applied

Description Sebastian Pleschko 2016-04-07 07:13:56 UTC
After update to kernel 4.4 from 4.3 lid button events aren't fired after a suspend-resume cycle.

Right after boot acpi_listen shows the lid events when closing/opening. After a suspend (via systemctl suspend), the events don't show up anymore.

/proc/acpi/button/lid/LID0/state does however show the correct state (so my current workaround is a regular check on that state).

uname -a                                                               ⏎
Linux arch_xps13 4.4.5-1-ARCH #1 SMP PREEMPT Thu Mar 10 07:38:19 CET 2016 x86_64 GNU/Linux
Comment 1 Sebastian Pleschko 2016-04-24 06:03:07 UTC
The problem persists in kernel 4.5.1
Comment 2 Len Brown 2016-04-25 23:18:12 UTC
please attach the output from acpidump

please show the results of this command before and after suspend:

grep . /sys/firmware/acpi/interrupts/*

If you can bisect the regression to show where the failure started, that would be ideal.
Comment 3 Sebastian Pleschko 2016-04-26 08:21:13 UTC
Before Suspend:

/sys/firmware/acpi/interrupts/error:       0
/sys/firmware/acpi/interrupts/ff_gbl_lock:       0   enabled
/sys/firmware/acpi/interrupts/ff_pmtimer:       0   invalid
/sys/firmware/acpi/interrupts/ff_pwr_btn:       0   enabled
/sys/firmware/acpi/interrupts/ff_rt_clk:       0   disabled
/sys/firmware/acpi/interrupts/ff_slp_btn:       0   invalid
/sys/firmware/acpi/interrupts/gpe00:       0   disabled
/sys/firmware/acpi/interrupts/gpe01:       0   invalid
/sys/firmware/acpi/interrupts/gpe02:       0   invalid
/sys/firmware/acpi/interrupts/gpe03:       0   invalid
/sys/firmware/acpi/interrupts/gpe04:       0   invalid
/sys/firmware/acpi/interrupts/gpe05:       0   invalid
/sys/firmware/acpi/interrupts/gpe06:       0   invalid
/sys/firmware/acpi/interrupts/gpe07:       0   invalid
/sys/firmware/acpi/interrupts/gpe08:       0   enabled
/sys/firmware/acpi/interrupts/gpe09:       0   disabled
/sys/firmware/acpi/interrupts/gpe0A:       0   invalid
/sys/firmware/acpi/interrupts/gpe0B:       0   invalid
/sys/firmware/acpi/interrupts/gpe0C:       0   invalid
/sys/firmware/acpi/interrupts/gpe0D:       0   invalid
/sys/firmware/acpi/interrupts/gpe0E:       0   disabled
/sys/firmware/acpi/interrupts/gpe0F:       0   invalid
/sys/firmware/acpi/interrupts/gpe10:       0   invalid
/sys/firmware/acpi/interrupts/gpe11:       0   invalid
/sys/firmware/acpi/interrupts/gpe12:       0   invalid
/sys/firmware/acpi/interrupts/gpe13:       0   invalid
/sys/firmware/acpi/interrupts/gpe14:       0   invalid
/sys/firmware/acpi/interrupts/gpe15:       0   invalid
/sys/firmware/acpi/interrupts/gpe16:       0   invalid
/sys/firmware/acpi/interrupts/gpe17:       0   invalid
/sys/firmware/acpi/interrupts/gpe18:       0   invalid
/sys/firmware/acpi/interrupts/gpe19:       0   invalid
/sys/firmware/acpi/interrupts/gpe1A:       0   invalid
/sys/firmware/acpi/interrupts/gpe1B:       0   invalid
/sys/firmware/acpi/interrupts/gpe1C:       0   invalid
/sys/firmware/acpi/interrupts/gpe1D:       0   invalid
/sys/firmware/acpi/interrupts/gpe1E:       0   invalid
/sys/firmware/acpi/interrupts/gpe1F:       0   invalid
/sys/firmware/acpi/interrupts/gpe20:       0   invalid
/sys/firmware/acpi/interrupts/gpe21:       0   invalid
/sys/firmware/acpi/interrupts/gpe22:       0   invalid
/sys/firmware/acpi/interrupts/gpe23:       0   invalid
/sys/firmware/acpi/interrupts/gpe24:       0   invalid
/sys/firmware/acpi/interrupts/gpe25:       0   invalid
/sys/firmware/acpi/interrupts/gpe26:       0   invalid
/sys/firmware/acpi/interrupts/gpe27:     726   enabled
/sys/firmware/acpi/interrupts/gpe28:       0   invalid
/sys/firmware/acpi/interrupts/gpe29:       0   invalid
/sys/firmware/acpi/interrupts/gpe2A:       0   invalid
/sys/firmware/acpi/interrupts/gpe2B:       0   invalid
/sys/firmware/acpi/interrupts/gpe2C:       0   invalid
/sys/firmware/acpi/interrupts/gpe2D:       0   invalid
/sys/firmware/acpi/interrupts/gpe2E:       0   invalid
/sys/firmware/acpi/interrupts/gpe2F:       0   invalid
/sys/firmware/acpi/interrupts/gpe30:       0   invalid
/sys/firmware/acpi/interrupts/gpe31:       0   invalid
/sys/firmware/acpi/interrupts/gpe32:       0   invalid
/sys/firmware/acpi/interrupts/gpe33:       0   invalid
/sys/firmware/acpi/interrupts/gpe34:       0   invalid
/sys/firmware/acpi/interrupts/gpe35:       0   invalid
/sys/firmware/acpi/interrupts/gpe36:       0   invalid
/sys/firmware/acpi/interrupts/gpe37:       0   invalid
/sys/firmware/acpi/interrupts/gpe38:       0   invalid
/sys/firmware/acpi/interrupts/gpe39:       0   invalid
/sys/firmware/acpi/interrupts/gpe3A:       0   invalid
/sys/firmware/acpi/interrupts/gpe3B:       0   invalid
/sys/firmware/acpi/interrupts/gpe3C:       0   invalid
/sys/firmware/acpi/interrupts/gpe3D:       0   invalid
/sys/firmware/acpi/interrupts/gpe3E:       0   invalid
/sys/firmware/acpi/interrupts/gpe3F:       0   invalid
/sys/firmware/acpi/interrupts/gpe40:       0   invalid
/sys/firmware/acpi/interrupts/gpe41:       0   invalid
/sys/firmware/acpi/interrupts/gpe42:       0   invalid
/sys/firmware/acpi/interrupts/gpe43:       0   invalid
/sys/firmware/acpi/interrupts/gpe44:       0   invalid
/sys/firmware/acpi/interrupts/gpe45:       0   invalid
/sys/firmware/acpi/interrupts/gpe46:       0   invalid
/sys/firmware/acpi/interrupts/gpe47:       0   invalid
/sys/firmware/acpi/interrupts/gpe48:       0   invalid
/sys/firmware/acpi/interrupts/gpe49:       0   invalid
/sys/firmware/acpi/interrupts/gpe4A:       0   invalid
/sys/firmware/acpi/interrupts/gpe4B:       0   invalid
/sys/firmware/acpi/interrupts/gpe4C:       0   invalid
/sys/firmware/acpi/interrupts/gpe4D:       0   invalid
/sys/firmware/acpi/interrupts/gpe4E:       0   invalid
/sys/firmware/acpi/interrupts/gpe4F:       0   invalid
/sys/firmware/acpi/interrupts/gpe50:       0   invalid
/sys/firmware/acpi/interrupts/gpe51:       0   invalid
/sys/firmware/acpi/interrupts/gpe52:       0   invalid
/sys/firmware/acpi/interrupts/gpe53:       0   invalid
/sys/firmware/acpi/interrupts/gpe54:       0   invalid
/sys/firmware/acpi/interrupts/gpe55:       0   invalid
/sys/firmware/acpi/interrupts/gpe56:       0   invalid
/sys/firmware/acpi/interrupts/gpe57:       0   invalid
/sys/firmware/acpi/interrupts/gpe58:       0   invalid
/sys/firmware/acpi/interrupts/gpe59:       0   invalid
/sys/firmware/acpi/interrupts/gpe5A:       0   invalid
/sys/firmware/acpi/interrupts/gpe5B:       0   invalid
/sys/firmware/acpi/interrupts/gpe5C:       0   invalid
/sys/firmware/acpi/interrupts/gpe5D:       0   invalid
/sys/firmware/acpi/interrupts/gpe5E:       0   invalid
/sys/firmware/acpi/interrupts/gpe5F:       0   invalid
/sys/firmware/acpi/interrupts/gpe60:       0   invalid
/sys/firmware/acpi/interrupts/gpe61:       0   enabled
/sys/firmware/acpi/interrupts/gpe62:       0   enabled
/sys/firmware/acpi/interrupts/gpe63:       0   invalid
/sys/firmware/acpi/interrupts/gpe64:       0   invalid
/sys/firmware/acpi/interrupts/gpe65:       0   invalid
/sys/firmware/acpi/interrupts/gpe66:       5   enabled
/sys/firmware/acpi/interrupts/gpe67:       0   invalid
/sys/firmware/acpi/interrupts/gpe68:       0   invalid
/sys/firmware/acpi/interrupts/gpe69:       0   disabled
/sys/firmware/acpi/interrupts/gpe6A:       0   invalid
/sys/firmware/acpi/interrupts/gpe6B:       0   invalid
/sys/firmware/acpi/interrupts/gpe6C:       0   invalid
/sys/firmware/acpi/interrupts/gpe6D:       0   disabled
/sys/firmware/acpi/interrupts/gpe6E:       0   invalid
/sys/firmware/acpi/interrupts/gpe6F:       0   invalid
/sys/firmware/acpi/interrupts/gpe70:       0   invalid
/sys/firmware/acpi/interrupts/gpe71:       0   invalid
/sys/firmware/acpi/interrupts/gpe72:       0   invalid
/sys/firmware/acpi/interrupts/gpe73:       0   invalid
/sys/firmware/acpi/interrupts/gpe74:       0   invalid
/sys/firmware/acpi/interrupts/gpe75:       0   invalid
/sys/firmware/acpi/interrupts/gpe76:       0   invalid
/sys/firmware/acpi/interrupts/gpe77:       0   invalid
/sys/firmware/acpi/interrupts/gpe78:       0   invalid
/sys/firmware/acpi/interrupts/gpe79:       0   invalid
/sys/firmware/acpi/interrupts/gpe7A:       0   invalid
/sys/firmware/acpi/interrupts/gpe7B:       0   invalid
/sys/firmware/acpi/interrupts/gpe7C:       0   invalid
/sys/firmware/acpi/interrupts/gpe7D:       0   invalid
/sys/firmware/acpi/interrupts/gpe7E:       0   invalid
/sys/firmware/acpi/interrupts/gpe7F:       0   invalid
/sys/firmware/acpi/interrupts/gpe_all:     731
/sys/firmware/acpi/interrupts/sci:     731
/sys/firmware/acpi/interrupts/sci_not:       1

After suspend:

/sys/firmware/acpi/interrupts/error:       0
/sys/firmware/acpi/interrupts/ff_gbl_lock:       0   disabled
/sys/firmware/acpi/interrupts/ff_pmtimer:       0   invalid
/sys/firmware/acpi/interrupts/ff_pwr_btn:       0   enabled
/sys/firmware/acpi/interrupts/ff_rt_clk:       0   disabled
/sys/firmware/acpi/interrupts/ff_slp_btn:       0   invalid
/sys/firmware/acpi/interrupts/gpe00:       0   disabled
/sys/firmware/acpi/interrupts/gpe01:       0   invalid
/sys/firmware/acpi/interrupts/gpe02:       0   invalid
/sys/firmware/acpi/interrupts/gpe03:       0   invalid
/sys/firmware/acpi/interrupts/gpe04:       0   invalid
/sys/firmware/acpi/interrupts/gpe05:       0   invalid
/sys/firmware/acpi/interrupts/gpe06:       0   invalid
/sys/firmware/acpi/interrupts/gpe07:       0   invalid
/sys/firmware/acpi/interrupts/gpe08:       0   enabled
/sys/firmware/acpi/interrupts/gpe09:       0   disabled
/sys/firmware/acpi/interrupts/gpe0A:       0   invalid
/sys/firmware/acpi/interrupts/gpe0B:       0   invalid
/sys/firmware/acpi/interrupts/gpe0C:       0   invalid
/sys/firmware/acpi/interrupts/gpe0D:       0   invalid
/sys/firmware/acpi/interrupts/gpe0E:       0   disabled
/sys/firmware/acpi/interrupts/gpe0F:       0   invalid
/sys/firmware/acpi/interrupts/gpe10:       0   invalid
/sys/firmware/acpi/interrupts/gpe11:       0   invalid
/sys/firmware/acpi/interrupts/gpe12:       0   invalid
/sys/firmware/acpi/interrupts/gpe13:       0   invalid
/sys/firmware/acpi/interrupts/gpe14:       0   invalid
/sys/firmware/acpi/interrupts/gpe15:       0   invalid
/sys/firmware/acpi/interrupts/gpe16:       0   invalid
/sys/firmware/acpi/interrupts/gpe17:       0   invalid
/sys/firmware/acpi/interrupts/gpe18:       0   invalid
/sys/firmware/acpi/interrupts/gpe19:       0   invalid
/sys/firmware/acpi/interrupts/gpe1A:       0   invalid
/sys/firmware/acpi/interrupts/gpe1B:       0   invalid
/sys/firmware/acpi/interrupts/gpe1C:       0   invalid
/sys/firmware/acpi/interrupts/gpe1D:       0   invalid
/sys/firmware/acpi/interrupts/gpe1E:       0   invalid
/sys/firmware/acpi/interrupts/gpe1F:       0   invalid
/sys/firmware/acpi/interrupts/gpe20:       0   invalid
/sys/firmware/acpi/interrupts/gpe21:       0   invalid
/sys/firmware/acpi/interrupts/gpe22:       0   invalid
/sys/firmware/acpi/interrupts/gpe23:       0   invalid
/sys/firmware/acpi/interrupts/gpe24:       0   invalid
/sys/firmware/acpi/interrupts/gpe25:       0   invalid
/sys/firmware/acpi/interrupts/gpe26:       0   invalid
/sys/firmware/acpi/interrupts/gpe27:    1177   enabled
/sys/firmware/acpi/interrupts/gpe28:       0   invalid
/sys/firmware/acpi/interrupts/gpe29:       0   invalid
/sys/firmware/acpi/interrupts/gpe2A:       0   invalid
/sys/firmware/acpi/interrupts/gpe2B:       0   invalid
/sys/firmware/acpi/interrupts/gpe2C:       0   invalid
/sys/firmware/acpi/interrupts/gpe2D:       0   invalid
/sys/firmware/acpi/interrupts/gpe2E:       0   invalid
/sys/firmware/acpi/interrupts/gpe2F:       0   invalid
/sys/firmware/acpi/interrupts/gpe30:       0   invalid
/sys/firmware/acpi/interrupts/gpe31:       0   invalid
/sys/firmware/acpi/interrupts/gpe32:       0   invalid
/sys/firmware/acpi/interrupts/gpe33:       0   invalid
/sys/firmware/acpi/interrupts/gpe34:       0   invalid
/sys/firmware/acpi/interrupts/gpe35:       0   invalid
/sys/firmware/acpi/interrupts/gpe36:       0   invalid
/sys/firmware/acpi/interrupts/gpe37:       0   invalid
/sys/firmware/acpi/interrupts/gpe38:       0   invalid
/sys/firmware/acpi/interrupts/gpe39:       0   invalid
/sys/firmware/acpi/interrupts/gpe3A:       0   invalid
/sys/firmware/acpi/interrupts/gpe3B:       0   invalid
/sys/firmware/acpi/interrupts/gpe3C:       0   invalid
/sys/firmware/acpi/interrupts/gpe3D:       0   invalid
/sys/firmware/acpi/interrupts/gpe3E:       0   invalid
/sys/firmware/acpi/interrupts/gpe3F:       0   invalid
/sys/firmware/acpi/interrupts/gpe40:       0   invalid
/sys/firmware/acpi/interrupts/gpe41:       0   invalid
/sys/firmware/acpi/interrupts/gpe42:       0   invalid
/sys/firmware/acpi/interrupts/gpe43:       0   invalid
/sys/firmware/acpi/interrupts/gpe44:       0   invalid
/sys/firmware/acpi/interrupts/gpe45:       0   invalid
/sys/firmware/acpi/interrupts/gpe46:       0   invalid
/sys/firmware/acpi/interrupts/gpe47:       0   invalid
/sys/firmware/acpi/interrupts/gpe48:       0   invalid
/sys/firmware/acpi/interrupts/gpe49:       0   invalid
/sys/firmware/acpi/interrupts/gpe4A:       0   invalid
/sys/firmware/acpi/interrupts/gpe4B:       0   invalid
/sys/firmware/acpi/interrupts/gpe4C:       0   invalid
/sys/firmware/acpi/interrupts/gpe4D:       0   invalid
/sys/firmware/acpi/interrupts/gpe4E:       0   invalid
/sys/firmware/acpi/interrupts/gpe4F:       0   invalid
/sys/firmware/acpi/interrupts/gpe50:       0   invalid
/sys/firmware/acpi/interrupts/gpe51:       0   invalid
/sys/firmware/acpi/interrupts/gpe52:       0   invalid
/sys/firmware/acpi/interrupts/gpe53:       0   invalid
/sys/firmware/acpi/interrupts/gpe54:       0   invalid
/sys/firmware/acpi/interrupts/gpe55:       0   invalid
/sys/firmware/acpi/interrupts/gpe56:       0   invalid
/sys/firmware/acpi/interrupts/gpe57:       0   invalid
/sys/firmware/acpi/interrupts/gpe58:       0   invalid
/sys/firmware/acpi/interrupts/gpe59:       0   invalid
/sys/firmware/acpi/interrupts/gpe5A:       0   invalid
/sys/firmware/acpi/interrupts/gpe5B:       0   invalid
/sys/firmware/acpi/interrupts/gpe5C:       0   invalid
/sys/firmware/acpi/interrupts/gpe5D:       0   invalid
/sys/firmware/acpi/interrupts/gpe5E:       0   invalid
/sys/firmware/acpi/interrupts/gpe5F:       0   invalid
/sys/firmware/acpi/interrupts/gpe60:       0   invalid
/sys/firmware/acpi/interrupts/gpe61:       0   enabled
/sys/firmware/acpi/interrupts/gpe62:       0   enabled
/sys/firmware/acpi/interrupts/gpe63:       0   invalid
/sys/firmware/acpi/interrupts/gpe64:       0   invalid
/sys/firmware/acpi/interrupts/gpe65:       0   invalid
/sys/firmware/acpi/interrupts/gpe66:      12   enabled
/sys/firmware/acpi/interrupts/gpe67:       0   invalid
/sys/firmware/acpi/interrupts/gpe68:       0   invalid
/sys/firmware/acpi/interrupts/gpe69:       0   disabled
/sys/firmware/acpi/interrupts/gpe6A:       0   invalid
/sys/firmware/acpi/interrupts/gpe6B:       0   invalid
/sys/firmware/acpi/interrupts/gpe6C:       0   invalid
/sys/firmware/acpi/interrupts/gpe6D:       0   disabled
/sys/firmware/acpi/interrupts/gpe6E:       0   invalid
/sys/firmware/acpi/interrupts/gpe6F:       0   invalid
/sys/firmware/acpi/interrupts/gpe70:       0   invalid
/sys/firmware/acpi/interrupts/gpe71:       0   invalid
/sys/firmware/acpi/interrupts/gpe72:       0   invalid
/sys/firmware/acpi/interrupts/gpe73:       0   invalid
/sys/firmware/acpi/interrupts/gpe74:       0   invalid
/sys/firmware/acpi/interrupts/gpe75:       0   invalid
/sys/firmware/acpi/interrupts/gpe76:       0   invalid
/sys/firmware/acpi/interrupts/gpe77:       0   invalid
/sys/firmware/acpi/interrupts/gpe78:       0   invalid
/sys/firmware/acpi/interrupts/gpe79:       0   invalid
/sys/firmware/acpi/interrupts/gpe7A:       0   invalid
/sys/firmware/acpi/interrupts/gpe7B:       0   invalid
/sys/firmware/acpi/interrupts/gpe7C:       0   invalid
/sys/firmware/acpi/interrupts/gpe7D:       0   invalid
/sys/firmware/acpi/interrupts/gpe7E:       0   invalid
/sys/firmware/acpi/interrupts/gpe7F:       0   invalid
/sys/firmware/acpi/interrupts/gpe_all:    1189
/sys/firmware/acpi/interrupts/sci:    1189
/sys/firmware/acpi/interrupts/sci_not:       1


I'm afraid I don't have the time right now to bisect the regression...
Comment 4 Len Brown 2016-05-02 23:16:22 UTC
please attach the output from acpidump
so we can make sense of the interrupts output

also, does the power button work after the resume
as well as it did before the suspend?

(eg. does the ACPI SCI work for *anything* after the resume,
you can check with...

grep acpi /proc/interrupts
Comment 5 Sebastian Pleschko 2016-05-04 07:22:25 UTC
Created attachment 215251 [details]
ACPI dump output

Attached output from acpidump

As for other events, I'm not entirely sure. Running acpi_listen, I can't see the power button press, even before the Lid buttons stop working. I can see the media control buttons though, before and after a suspend.

~ ❯❯❯ acpi_listen
button/lid LID close
button/lid LID open
battery PNP0C0A:00 00000081 00000001
^C
~ ❯❯❯ acpi_listen                                                                                                                                           ⏎
button/volumedown VOLDN 00000080 00000000 K
button/volumeup VOLUP 00000080 00000000 K
cd/prev CDPREV 00000080 00000000 K
^C
~ ❯❯❯
Comment 6 Sebastian Pleschko 2016-05-11 10:48:20 UTC
The bug persists in 4.5.2 and 4.5.3
Comment 7 Lv Zheng 2016-05-12 02:37:44 UTC
1. Let's factors that could affect the lid status change notifications:

By searching the "Notify (LID0, 0x80)”
I got:
bugs\116001\dsdt.dsl (4 hits)
	Line 19407:                 Notify (LID0, 0x80)
	Line 19445:                         Notify (LID0, 0x80)
	Line 19448:                         Notify (LID0, 0x80)
	Line 21039:                     Notify (LID0, 0x80)

They are implemented in:
\_SB.PCI0.GFX0.ILID
\_SB.PCI0.GFX0.IVD2
\_SB.BTNV

They are invoked in the following way:
\_GPE._L08
  \EV6
    \_SB.BTNV
    \_SB.PCI0.GFX0.ILDE
      \_SB.PCI0.GFX0.ILID
\_SB.PCI0.LPCB.ECDV._Q66
  \NEVT
    \EV6
      \_SB.BTNV
      \_SB.PCI0.GFX0.ILDE
        \_SB.PCI0.GFX0.ILID
    \SMIE
      \EV8
        \_SB.PCI0.GFX0.IVD2
\_WAK
  \RWAK
    \EV2
      \_SB.PCI0.GFX0.IVD3
        \_SB.PCI0.GFX0.ILID

It looks, GPE 08 and EC query 66 can trigger lid status change, but the functionality requires GPU to work.

2. Let's check which triggering source is responsible for this.

According to the GPE output, the GPE08 has never been triggered.
Thus the triggering source should be EC query 66.

3. Let's check if EC driver is working after suspend:

I can see EC GPE (GPE27) is fired after resuming.
So EC interrupt is running, this can also be proven by the facts that after resuming, /proc/acpi/button/lid/LID0/state can return correct value because the _LID control method is implemented via EC:
                Method (_LID, 0, NotSerialized)  // _LID: Lid Status
                {
                    Store (ECG3 (), Local0)
                    Return (Local0)
                }

4. So what we need to figure out is if this is caused by EC query 66 loss or is GPU specific.

Let me think about it.

Thanks
-Lv
Comment 8 Lv Zheng 2016-05-12 02:48:38 UTC
Let's check the EC log first.

1. If you have dynamic debugging (CONFIG_DYNAMIC_DEBUG) enabled during build, please enable it for the EC driver
# mount -t debugfs none /sys/kernel/debug
# echo -n "file ec.c +p" > /sys/kernel/debug/dynamic_debug/control

2. # dmesg -T -c > ec-boot.log
3. close/open lid then
   # dmesg -T -c > ec-before-suspend.log
4. after suspend/resume cycle, close/open lid then
   # dmesg -T -c > ec-after-suspend.log

Please upload the 3 logs here.

Thanks
-Lv
Comment 9 Sebastian Pleschko 2016-05-12 10:53:23 UTC
Created attachment 216061 [details]
ec boot log
Comment 10 Sebastian Pleschko 2016-05-12 10:53:53 UTC
Created attachment 216071 [details]
ec before suspend
Comment 11 Sebastian Pleschko 2016-05-12 10:54:15 UTC
Created attachment 216081 [details]
ec after suspend
Comment 12 Sebastian Pleschko 2016-05-12 10:55:44 UTC
the log files where created on a stock arch linux 4.5.3 kernel
Comment 13 Lv Zheng 2016-05-13 01:42:39 UTC
It looks to me the attachment 216071 [details] also contains post-resume logs

Before suspend, I can see Query(66) triggered by EC GPE:
[Thu May 12 10:01:18 2016] ACPI : EC: EC_SC(R) = 0x20 SCI_EVT=1 BURST=0 CMD=0 IBF=0 OBF=0
...
[Thu May 12 10:01:18 2016] ACPI : EC: Query(0x66) scheduled

After resume, I can still see Query(66) triggered by EC GPE:
[Thu May 12 10:01:18 2016] ACPI : EC: EC_SC(R) = 0x20 SCI_EVT=1 BURST=0 CMD=0 IBF=0 OBF=0
...
[Thu May 12 10:01:18 2016] ACPI : EC: Query(0x66) scheduled
And EC IRQ is working after resuming:
[Thu May 12 10:01:19 2016] ACPI : EC: IRQ (0)

Looks no serious problem unless the known EC PM noirq requirement to me.
We have plan to tune EC polling/interrupt mode switch to be smarter.
I was planning to do this after sorting ECDT stuff.
Now it is the right timing to proceed.
The improvement should be able to fix this issue.
I'll also prepare a regression fix in the series.

Please wait a few days.

Thanks and best regards
-Lv
Comment 14 Zhang Rui 2016-05-15 13:02:39 UTC
please show the results of this command before and after suspend:

grep . /sys/firmware/acpi/interrupts/*

in good kernel, say 4.3.
Comment 15 Zhang Rui 2016-05-16 02:26:07 UTC
(In reply to Sebastian Pleschko from comment #0)
> After update to kernel 4.4 from 4.3 lid button events aren't fired after a
> suspend-resume cycle.
> 
> Right after boot acpi_listen shows the lid events when closing/opening.
> After a suspend (via systemctl suspend), the events don't show up anymore.
> 
so, using this good kernel, let's get the output of "grep . /sys/firmware/acpi/interrupts/*" when
1. right after boot
2. after lid closing/opening and the lid events are shown in acpi_listen
3. right after suspend
4. after lid closing/opening again
Comment 16 Lv Zheng 2016-05-16 21:51:49 UTC
Hi, Rui

This is a known EC driver regression.
Right after resuming, it is expected to just enable the EC transactions while disable the EC event query handling.
After fully resumed, re-enable EC event handling, just like the early boot requirement.

Originally, it was achieved by blocking the event query handling with PENDING flag set. That was removed because we were able to poll the EC events at any time.

This bug reminds us that we may not enable it so early before drivers' fully resuming.

It's still a good idea to get the commit bisected so that we could generate a simple regression fix for the stable kernels according to the bisected commit.

Further improvement could be done against this by implementing the logic via noirq callbacks. Where we can split the driver into 2 stages, during the early stage, only enable the transaction handling and use the GPE polling mode, during the late stage, enable the event handling and use the GPE interrupt mode.

Thanks and best regards
-Lv
Comment 17 Lv Zheng 2016-05-25 04:49:15 UTC
But I'm not sure if the regression is related to the known issue mentioned by me.
It looks there is an EC _Q66 triggered after resume and handled by the EC driver.
However it is handled a bit early and I don't know if that could result in the lid driver issue..

Could you perform a bisection to get the culprit commit out?

Thanks
-Lv
Comment 18 Lv Zheng 2016-06-02 02:41:37 UTC
Ping Sebastian.

After an internal discussion, we think the EC known issue may not be related.
This bug is still not root caused.

Possibly we could do another test here.

1. configure the kernel with CONFIG_ACPI_DEBUG/CONFIG_DYNAMIC_DEBUG enabled;
2. boot the built kernel with the following command line:
   acpi.trace_state=method acpi.trace_method_name=_SB.PCI0.LPCB.ECDV._Q66
3. enable EC dynamic debugging after boot:
   # mount -t debugfs none /sys/kernel/debug
   # echo -n "file ec.c +p" > /sys/kernel/debug/dynamic_debug/control
4. perform the lid test:
   1. # dmesg -T -c > ec-boot.log
   2. close/open lid then
      # dmesg -T -c > ec-before-suspend.log
   3. after suspend/resume cycle, close/open lid then
      # dmesg -T -c > ec-after-suspend.log
Please upload the 3 log files here.

Thanks and best regards
-Lv
Comment 19 Zhang Rui 2016-06-06 07:07:45 UTC
No response from Sebastian since 12 May.
ping ...
Comment 20 Tiziano Müller 2016-06-12 14:51:30 UTC
Created attachment 219591 [details]
ec-boot.log

since I can reproduce it using kernel 4.6.1 on my Dell XPS 9343, here come the requested logs.
Comment 21 Tiziano Müller 2016-06-12 14:51:59 UTC
Created attachment 219601 [details]
ec-before-suspend.log
Comment 22 Tiziano Müller 2016-06-12 14:55:38 UTC
... the ec-after-suspend.log is empty.
Comment 23 Lv Zheng 2016-06-13 07:21:49 UTC
(In reply to Tiziano Müller from comment #22)
> ... the ec-after-suspend.log is empty.

I'm not sure what does this mean.
It should contain at least the suspend/resume logs.
Comment 24 Lv Zheng 2016-06-13 07:24:09 UTC
Created attachment 219691 [details]
[PATCH] ACPI / EC: Add PM operations to handle special requirement

If someone is waiting for the patch mentioned in comment 13.
Here it is.

Can you redo the test after applying the patch to help to confirm if this is the related root cause?

Thanks
-Lv
Comment 25 Tiziano Müller 2016-06-13 07:55:57 UTC
(In reply to Lv Zheng from comment #23)
> (In reply to Tiziano Müller from comment #22)
> > ... the ec-after-suspend.log is empty.
> 
> I'm not sure what does this mean.
> It should contain at least the suspend/resume logs.

My system does not fire the lid-close events after a first suspend.
Maybe I don't have exactly the same hardware as Sebastian and I should use a different acpi.trace_method_name instead?
Comment 26 Tiziano Müller 2016-06-13 08:17:10 UTC
Created attachment 219701 [details]
ec-boot.log with ACPI/EC patch applied
Comment 27 Tiziano Müller 2016-06-13 08:17:59 UTC
Created attachment 219711 [details]
ec-before-suspend.log with ACPI/EC patch applied
Comment 28 Tiziano Müller 2016-06-13 08:27:06 UTC
(In reply to Lv Zheng from comment #24)
> Created attachment 219691 [details]
> [PATCH] ACPI / EC: Add PM operations to handle special requirement
> 
> If someone is waiting for the patch mentioned in comment 13.
> Here it is.
> 
> Can you redo the test after applying the patch to help to confirm if this is
> the related root cause?
> 
> Thanks
> -Lv

The patch does not change anything here and ec-after-suspend.log is still empty (no lid event, no suspend).

And yes, all hardware buttons except the ones wired via the sound hardware are dead after the suspend. To be precise: media- and volume-control buttons always work, brightness and power button are dead after the first suspend, as is the lid-switch.
Comment 29 Lv Zheng 2016-06-14 07:06:46 UTC
Hi

For your machine, could you also upload the acpidump/dmidecode here?

So, after all, we are entirely not so confident if this is an ACPI bug.
Could you guys help to do the git bisect. Here is a manual that might help:
http://www.landley.net/writing/git-bisect-howto.html

Thanks and best regards
-Lv
Comment 30 Zhang Rui 2016-06-27 05:23:33 UTC
First of all, I can not see if the bug raised by Tiziano is exactly the same issue reported by Sebastian, and the debug info from Tiziano would be misleading as it is not the same model.
So close the bug report as there is no response from the original bug reporter.
Please feel free to re-open it if Sebastian can provide the information required.

Tiziano, please file a new bug report, together with the detailed description about the symptom of the issue, the acpidump/dmidecode output, and git bisect result if possible.
Comment 31 Lv Zheng 2016-06-28 08:21:58 UTC
Hi, Rui

For the issue reported by Sebastian, we can see EC query, and this is not related to the event handling order. So it is not an EC issue. It's better to have the commit bisected out.

For Tiziano issue, it looks the platform isn't correctly suspended/resumed.

So I'm moving this bug out of EC category.

Thanks
-Lv
Comment 32 Kai-Heng Feng 2016-09-23 20:23:20 UTC
Arch Linux unset "CONFIG_ACPI_REV_OVERRIDE_POSSIBLE=y" in 4.4, that's why 4.3 works.

Set "CONFIG_ACPI_REV_OVERRIDE_POSSIBLE=y" can make power button, brightness hotkey and battery status work again. So looks like it uses _REV to do some magic.

Is there any chance to solve the problem with "CONFIG_ACPI_REV_OVERRIDE_POSSIBLE=n" ?
Comment 33 Kai-Heng Feng 2016-09-23 20:25:26 UTC
FWIW, I tested on Linux 4.8 with "CONFIG_ACPI_REV_OVERRIDE_POSSIBLE=y".