From d26558cf5b03074687b604937efa2ecdb0b1ac81 Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Thu, 14 Nov 2013 18:56:45 +0100 Subject: Lenovo hotkeys support Implement proprietary lenovo ACPI hotkeys Change-Id: I36a6d3a280b0ac76d9ea063cdc10197a57e306f9 Signed-off-by: Vladimir Serbinenko Reviewed-on: http://review.coreboot.org/4055 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich --- src/ec/lenovo/h8/acpi/ec.asl | 201 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 197 insertions(+), 4 deletions(-) (limited to 'src/ec/lenovo/h8') diff --git a/src/ec/lenovo/h8/acpi/ec.asl b/src/ec/lenovo/h8/acpi/ec.asl index db3712d7eb..0f7312fdc8 100644 --- a/src/ec/lenovo/h8/acpi/ec.asl +++ b/src/ec/lenovo/h8/acpi/ec.asl @@ -2,6 +2,7 @@ * This file is part of the coreboot project. * * Copyright (c) 2011 Sven Schnelle + * Copyright (c) 2013 Vladimir Serbinenko * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -92,9 +93,28 @@ Device(EC) /* Sleep Button pressed */ Method(_Q13, 0, NotSerialized) { - Notify(\_SB.PCI0.LPCB.EC.SLPB, 0x80) + Notify(^SLPB, 0x80) } +#if IS_ENABLED (CONFIG_BOARD_LENOVO_X201) + /* Brightness up GPE */ + Method(_Q14, 0, NotSerialized) + { + \_SB.PCI0.GFX0.LCD0.INCB() + } + + /* Brightness down GPE */ + Method(_Q15, 0, NotSerialized) + { + \_SB.PCI0.GFX0.LCD0.DECB() + } + + /* Next display GPE */ + Method(_Q16, 0, NotSerialized) + { + Notify (\_SB.PCI0.GFX0, 0x82) + } +#else /* Brightness up GPE */ Method(_Q14, 0, NotSerialized) { @@ -106,7 +126,7 @@ Device(EC) { \DSPC.BRTD() } - +#endif /* AC status change: present */ Method(_Q26, 0, NotSerialized) { @@ -122,14 +142,187 @@ Device(EC) Method(_Q2A, 0, NotSerialized) { - Notify(\_SB.PCI0.LPCB.EC.LID, 0x80) + Notify(^LID, 0x80) } Method(_Q2B, 0, NotSerialized) { - Notify(\_SB.PCI0.LPCB.EC.LID, 0x80) + Notify(^LID, 0x80) + } + + + /* IBM proprietary buttons. */ + + Method (_Q10, 0, NotSerialized) + { + ^HKEY.RHK (0x01) + } + + Method (_Q11, 0, NotSerialized) + { + ^HKEY.RHK (0x02) + } + + Method (_Q12, 0, NotSerialized) + { + ^HKEY.RHK (0x03) + } + + Method (_Q64, 0, NotSerialized) + { + ^HKEY.RHK (0x05) + } + + Method (_Q65, 0, NotSerialized) + { + ^HKEY.RHK (0x06) + } + + Method (_Q17, 0, NotSerialized) + { + ^HKEY.RHK (0x08) + } + + Method (_Q66, 0, NotSerialized) + { + ^HKEY.RHK (0x0A) } + Method (_Q6A, 0, NotSerialized) + { + ^HKEY.RHK (0x1B) + } + + Method (_Q1A, 0, NotSerialized) + { + ^HKEY.RHK (0x0B) + } + + Method (_Q1B, 0, NotSerialized) + { + ^HKEY.RHK (0x0C) + } + + Method (_Q62, 0, NotSerialized) + { + ^HKEY.RHK (0x0D) + } + + Method (_Q60, 0, NotSerialized) + { + ^HKEY.RHK (0x0E) + } + + Method (_Q61, 0, NotSerialized) + { + ^HKEY.RHK (0x0F) + } + + Method (_Q1F, 0, NotSerialized) + { + ^HKEY.RHK (0x12) + } + + Method (_Q67, 0, NotSerialized) + { + ^HKEY.RHK (0x13) + } + + Method (_Q63, 0, NotSerialized) + { + ^HKEY.RHK (0x14) + } + + Method (_Q19, 0, NotSerialized) + { + ^HKEY.RHK (0x18) + } + +#if CONFIG_BOARD_LENOVO_X201 + Method (_Q1C, 0, NotSerialized) + { + ^HKEY.RHK (0x19) + } + + Method (_Q1D, 0, NotSerialized) + { + ^HKEY.RHK (0x1A) + } +#endif + + Device (HKEY) + { + Name (_HID, EisaId ("IBM0068")) + Name (BTN, 0) + /* MASK */ + Name (DHKN, 0x080C) + /* Effective Mask */ + Name (EMSK, 0) + /* Device enabled. */ + Name (EN, 0) + Method (_STA, 0, NotSerialized) + { + Return (0x0F) + } + /* Retrieve event. */ + Method (MHKP, 0, NotSerialized) + { + Store (BTN, Local0) + If (LEqual (Local0, Zero)) { + Return (Zero) + } + Store (Zero, BTN) + Add (Local0, 0x1000, Local0) + Return (Local0) + } + /* Report event */ + Method (RHK, 1, NotSerialized) { + ShiftLeft (One, Subtract (Arg0, 1), Local0) + If (And (EMSK, Local0)) { + Store (Arg0, BTN) + Notify (HKEY, 0x80) + } + } + /* Enable/disable all events. */ + Method (MHKC, 1, NotSerialized) { + If (Arg0) { + Store (DHKN, EMSK) + } + Else + { + Store (Zero, EMSK) + } + Store (Arg0, EN) + } + /* Enable/disable event. */ + Method (MHKM, 2, NotSerialized) { + If (LLessEqual (Arg0, 0x20)) { + ShiftLeft (One, Subtract (Arg0, 1), Local0) + If (Arg1) + { + Or (DHKN, Local0, DHKN) + } + Else + { + And (DHKN, Not (Local0), DHKN) + } + If (EN) + { + Store (DHKN, EMSK) + } + } + } + /* Mask hotkey all. */ + Method (MHKA, 0, NotSerialized) + { + Return (0x07FFFFFF) + } + /* Version */ + Method (MHKV, 0, NotSerialized) + { + Return (0x0100) + } + } #include "ac.asl" #include "battery.asl" -- cgit v1.2.3