Patrick Rudolph has uploaded this change for review. ( https://review.coreboot.org/21003
Change subject: ec/lenovo/h8/ssdt: Add UWB ACPI interface ......................................................................
ec/lenovo/h8/ssdt: Add UWB ACPI interface
Add ACPI methods GUWB and SUWB for thinkpad_acpi.
Change-Id: I8f9a56e45c0d765b0e06b8d3600bd3575dd09491 Signed-off-by: Patrick Rudolph siro@das-labor.org --- M src/ec/lenovo/h8/acpi/ec.asl M src/ec/lenovo/h8/ssdt.c 2 files changed, 67 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/03/21003/1
diff --git a/src/ec/lenovo/h8/acpi/ec.asl b/src/ec/lenovo/h8/acpi/ec.asl index 085c9e2..9643102 100644 --- a/src/ec/lenovo/h8/acpi/ec.asl +++ b/src/ec/lenovo/h8/acpi/ec.asl @@ -42,6 +42,9 @@ Offset (0x30), , 6, ALMT, 1, /* Audio Mute + LED */ + Offset (0x31), + , 2, + UWBE, 1, /* Ultra Wideband enable */ Offset (0x3a), AMUT, 1, /* Audio Mute (internal use) */ , 3, diff --git a/src/ec/lenovo/h8/ssdt.c b/src/ec/lenovo/h8/ssdt.c index 26c0d84..7ed134b 100644 --- a/src/ec/lenovo/h8/ssdt.c +++ b/src/ec/lenovo/h8/ssdt.c @@ -239,6 +239,69 @@ acpigen_pop_len(); /* Method */ }
+/* Generate ACPI methods GUWB and SUWB */ +static void h8_dsdt_uwb(struct device *dev) +{ + struct ec_lenovo_h8_config *conf = dev->chip_info; + if (!conf) + return; + + const bool has_uwb = conf->has_uwb; + + /* Method (GUWB, 0) */ + acpigen_write_method("GUWB", 0); + /* Store(Zero, Local0) */ + acpigen_write_store_ops(ZERO_OP, LOCAL0_OP); + if (has_uwb) { + /* UWB present */ + /* Or(Local0, One, Local0) */ + acpigen_write_or(LOCAL0_OP, ONE_OP, LOCAL0_OP); + + /* If(LEqual(_SB.PCI0.LPCB.EC.UWBE, One)) */ + acpigen_write_if(); + acpigen_emit_byte(LEQUAL_OP); + acpigen_emit_namestring(h8_dsdt_scope(dev, "UWBE")); + acpigen_emit_byte(ONE_OP); + + /* Or(Local0, 2, Local0) */ + acpigen_emit_byte(OR_OP); + acpigen_emit_byte(LOCAL0_OP); + acpigen_write_integer(2); + acpigen_emit_byte(LOCAL0_OP); + acpigen_pop_len(); /* If */ + } + /* Return(Local0) */ + acpigen_emit_byte(RETURN_OP); + acpigen_emit_byte(LOCAL0_OP); + acpigen_pop_len(); /* Method */ + + /* Method (SUWB, 1) */ + acpigen_write_method("SUWB", 1); + if (has_uwb) { + /* And(Arg0, 2, Local0) */ + acpigen_emit_byte(AND_OP); + acpigen_emit_byte(ARG0_OP); + acpigen_write_integer(2); + acpigen_emit_byte(LOCAL0_OP); + /* If(Lequal(Local0, 2)) */ + acpigen_write_if_lequal_op_int(LOCAL0_OP, 2); + /* Store(One, _SB.PCI0.LPCB.EC.UWBE) */ + acpigen_write_store(); + acpigen_emit_byte(ONE_OP); + acpigen_emit_namestring(h8_dsdt_scope(dev, "UWBE")); + acpigen_pop_len(); /* If */ + /* Else */ + acpigen_write_else(); + /* Store(Zero, _SB.PCI0.LPCB.EC.UWBE) */ + acpigen_write_store(); + acpigen_emit_byte(ZERO_OP); + acpigen_emit_namestring(h8_dsdt_scope(dev, "UWBE")); + acpigen_pop_len(); /* Else */ + } + acpigen_pop_len(); /* Method */ +} + + /* * Generates EC SSDT. */ @@ -256,6 +319,7 @@ h8_dsdt_bluetooth(dev); h8_dsdt_wwan(dev); h8_dsdt_keyboard_backlight(dev); + h8_dsdt_uwb(dev);
acpigen_pop_len(); /* Scope HKEY */ }