Created attachment 191021 [details] dmesg until failure On the Microsoft Surface 3, when you fold the type cover over the screen (or "close the lid"), the lid switch state does not change, and an ACPI error is thrown. The lid switch state always reports closed. [root@localhost ~]# cat /proc/acpi/button/lid/LID/state state: closed [ 1130.459896] ACPI Exception: AE_ERROR, Returned by Handler for [GeneralPurposeIo] (20150930/evregion-297) [ 1130.460061] ACPI Error: Method parse/execution failed [\_SB.GPO0._E4C] (Node ffff88013f4b4438), AE_ERROR (20150930/psparse-542) From the DSDT, this is the GPIO event handler that toggles the lid switch state.
Created attachment 191031 [details] acpidump
[ 1130.459896] ACPI Exception: AE_ERROR, Returned by Handler for [GeneralPurposeIo] (20150930/evregion-297) [ 1130.460061] ACPI Error: Method parse/execution failed [\_SB.GPO0._E4C] (Node ffff88013f4b4438), AE_ERROR (20150930/psparse-542) OperationRegion (GPOR, GeneralPurposeIo, Zero, One) Field (GPOR, ByteAcc, NoLock, Preserve) { Connection ( GpioIo (Shared, PullNone, 0x0000, 0x0000, IoRestrictionNone, "\\_SB.GPO0", 0x00, ResourceConsumer, , ) { // Pin list 0x004C } ), HELD, 1 } Method (_E4C, 0, Serialized) // _Exx: Edge-Triggered GPE { If ((HELD == One)) { ^^LID.LIDB = One } Else { ^^LID.LIDB = Zero Notify (LID, 0x80) // Status Change } Notify (^^PCI0.SPI1.NTRG, One) // Device Check } From the ASL code and the error message, it seems the GPIO handler to get the value of HELD failed. Mika, do you have any ideas?
Hit the save button too quick, forgot to add Mika. Mika, Please take a look at comment #2, thanks.
Looks like both the _AEI returned event and OpRegion access use the same GPIO (0x4c). This is not supported yet.
Created attachment 191461 [details] Allow reuse of the event GPIO
Stephen, can you try the attached patch?
The attached patch correctly allows the state of the lid switch to change by opening and closing the "lid". Thanks! ...now if only it didn't default to closed :) (http://thread.gmane.org/gmane.linux.acpi.devel/77428)
Thanks for testing. I just sent that patch out.
commit c103a10f690cc49054c52f493eeeff143d5f59e7 Author: Mika Westerberg <mika.westerberg@linux.intel.com> Date: Fri Oct 30 12:02:05 2015 +0200 gpio / ACPI: Allow shared GPIO event to be read via operation region for v4.4-rc1.
(In reply to Stephen Just from comment #7) > The attached patch correctly allows the state of the lid switch to change by > opening and closing the "lid". Thanks! > > ...now if only it didn't default to closed :) attachment 187171 [details] contains a full decompiled DSDT. Did you file a new bug about the initial state being wrong? Looking at GPO0 there, it seems that an edge-triggered event would make the NTRG device reprobe, and disable the touchscreen if the lid was closed. > (http://thread.gmane.org/gmane.linux.acpi.devel/77428) Is it possible that Microsoft stopped using the LID device on some machines (tablets with removable keyboards), checking for the availability of the touchscreen instead? Stephen, did you file a new bug about this?
See also bug 89211 which contains a patch.