summaryrefslogtreecommitdiff
path: root/src/mainboard/lenovo/t520
diff options
context:
space:
mode:
authorNicolas Reinecke <nr@das-labor.org>2014-10-17 15:06:29 +0200
committerVladimir Serbinenko <phcoder@gmail.com>2014-10-17 17:27:09 +0200
commit9ebb3f5efaf7ebf643210c8c0befadfcc47e24f1 (patch)
treeb6a65f80bead88b4933b0294659dba023eb20e34 /src/mainboard/lenovo/t520
parent85f2e12b4f1d66e723652a91e8765019e71f1c16 (diff)
downloadcoreboot-9ebb3f5efaf7ebf643210c8c0befadfcc47e24f1.tar.xz
lenovo/t520: Enable wake on LID and Fn key
Change-Id: Ieb23728ba171733820830e86e77a4c6d8e1cc57d Signed-off-by: Nicolas Reinecke <nr@das-labor.org> Reviewed-on: http://review.coreboot.org/7101 Tested-by: build bot (Jenkins) Reviewed-by: Vladimir Serbinenko <phcoder@gmail.com>
Diffstat (limited to 'src/mainboard/lenovo/t520')
-rw-r--r--src/mainboard/lenovo/t520/smihandler.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/mainboard/lenovo/t520/smihandler.c b/src/mainboard/lenovo/t520/smihandler.c
index f4ed367d8a..c81825e798 100644
--- a/src/mainboard/lenovo/t520/smihandler.c
+++ b/src/mainboard/lenovo/t520/smihandler.c
@@ -167,3 +167,23 @@ int mainboard_smi_apmc(u8 data)
}
return 0;
}
+
+void mainboard_smi_sleep(u8 slp_typ)
+{
+ if (slp_typ == 3) {
+ u8 ec_wake = ec_read(0x32);
+ /* If EC wake events are enabled, enable wake on EC WAKE GPE. */
+ if (ec_wake & 0x14) {
+ u32 gpe_rout;
+ u16 pmbase = pci_read_config16(PCI_DEV(0, 0x1f, 0), 0x40) & 0xfffc;
+
+ /* Enable EC WAKE GPE. */
+ outl(inl(pmbase + GPE0_EN) | (1 << 29), pmbase + GPE0_EN);
+ gpe_rout = pci_read_config32(PCI_DEV(0, 0x1f, 0), GPIO_ROUT);
+ /* Redirect EC WAKE GPE to SCI. */
+ gpe_rout &= ~(3 << 26);
+ gpe_rout |= (2 << 26);
+ pci_write_config32(PCI_DEV(0, 0x1f, 0), GPIO_ROUT, gpe_rout);
+ }
+ }
+}