ec/google/chromeec: Use either EC or MB lid switch state

With CB:16732, EC can provide default lid switch implementation(LID0
ACPI device). Up until that point, mainboard has been providing default
switch implementation. When EC provides lid switch implementation, the
lid switch state is read from EC either through MMAP or LPC interface.
Hence there is no need to keep mainboard's LIDS ACPI object in sync with
EC's lid switch state. Use only EC's lid switch state on boards using
EC's implementation. This paves the way to remove LIDS ACPI object on
those mainboards.

BUG=None
TEST=Build Skyrim BIOS image and boot to OS. Trigger lid open/close
events and ensure that they are detected properly through
/proc/acpi/button/lid/LID0/state.
localhost ~ # cat /proc/acpi/button/lid/LID0/state
state:      open
localhost ~ # cat /proc/acpi/button/lid/LID0/state
state:      closed

Ensure that the system behaves as expected based on powerd
configuration. After signin, system suspends/resumes for lid close/open.
On signin screen, system shuts down/boots for lid close/open.

Change-Id: I013574d7c21761f167ad38aeed27a419677b8000
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/74332
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Rob Barnes <robbarnes@google.com>
Reviewed-by: Tim Van Patten <timvp@google.com>
Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
This commit is contained in:
Karthikeyan Ramasubramanian 2023-04-10 14:10:37 -06:00 committed by Felix Held
parent ae4b184ee0
commit 8fc20c4961
1 changed files with 6 additions and 2 deletions

View File

@ -177,8 +177,10 @@ Device (EC0)
*/
\PNOT ()
#ifndef EC_ENABLE_LID_SWITCH
// Initialize LID switch state
\LIDS = LIDS
#endif
#if CONFIG(SOC_AMD_COMMON_BLOCK_ACPI_DPTC)
/*
@ -234,9 +236,10 @@ Device (EC0)
\_SB.DPTC()
}
#endif
\LIDS = LIDS
#ifdef EC_ENABLE_LID_SWITCH
Notify (LID0, 0x80)
#else
\LIDS = LIDS
#endif
}
@ -249,10 +252,11 @@ Device (EC0)
\_SB.DPTC()
}
#endif
\LIDS = LIDS
Notify (CREC, 0x2)
#ifdef EC_ENABLE_LID_SWITCH
Notify (LID0, 0x80)
#else
\LIDS = LIDS
#endif
}