From f1114d891865e70ae1f2ba58844fec11d055ae3a Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Tue, 14 Nov 2017 19:00:20 +0100 Subject: ec/lenovo/h8/acpi: Add BDC interface * Add SSDT generator to add dynamic ACPI code. * Implement GBDC and SBDC for thinkpad_acpi kernel module. Required for BDC power control from userspace. Tested on Lenovo T430: The bluetooth module is detected and can be powercycled using network manager. Change-Id: Ida825196650966194a883945896a038b0790fe45 Signed-off-by: Patrick Rudolph Reviewed-on: https://review.coreboot.org/20985 Tested-by: build bot (Jenkins) Reviewed-by: Alexander Couzens Reviewed-by: Patrick Georgi --- src/ec/lenovo/h8/acpi/thinkpad.asl | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'src/ec/lenovo/h8/acpi') diff --git a/src/ec/lenovo/h8/acpi/thinkpad.asl b/src/ec/lenovo/h8/acpi/thinkpad.asl index eb5b60e705..de2fe68192 100644 --- a/src/ec/lenovo/h8/acpi/thinkpad.asl +++ b/src/ec/lenovo/h8/acpi/thinkpad.asl @@ -153,4 +153,41 @@ Device (HKEY) { Return (\_SB.PCI0.LPCB.EC.GSTS) } + + /* + * Returns the current state: + * Bit 0: BT HW present + * Bit 1: BT radio enabled + * Bit 2: BT state at resume + */ + Method (GBDC, 0) + { + If (HBDC) { + Store(One, Local0) + If(\_SB.PCI0.LPCB.EC.BTEB) + { + Or(Local0, 2, Local0) + } + /* FIXME: Implement state at resume, for now Enabled */ + Or(Local0, 4, Local0) + Return (Local0) + } Else { + Return (0) + } + } + + /* + * Set the current state: + * Bit 1: BT radio enabled + * Bit 2: BT state at resume + */ + Method (SBDC, 1) + { + If (HBDC) { + ShiftRight (And(Arg0, 2), 1, Local0) + Store (Local0, \_SB.PCI0.LPCB.EC.BTEB) + + /* FIXME: Store state at resume */ + } + } } -- cgit v1.2.3