Patrick Rudolph has uploaded this change for review. ( https://review.coreboot.org/21002
Change subject: ec/lenovo/h8/ssdt: Add keyboard backlight interface ......................................................................
ec/lenovo/h8/ssdt: Add keyboard backlight interface
Add methods MLCG and MLCS for thinkpad_acpi kernel module.
Change-Id: Ia65e770e772936c9c32be33c30839a2dee2a107c Signed-off-by: Patrick Rudolph siro@das-labor.org --- M src/ec/lenovo/h8/ssdt.c 1 file changed, 72 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/02/21002/1
diff --git a/src/ec/lenovo/h8/ssdt.c b/src/ec/lenovo/h8/ssdt.c index 0c68b2b..26c0d84 100644 --- a/src/ec/lenovo/h8/ssdt.c +++ b/src/ec/lenovo/h8/ssdt.c @@ -168,6 +168,77 @@ acpigen_pop_len(); /* Method */ }
+/* Generate ACPI methods MLCG and MLCS */ +static void h8_dsdt_keyboard_backlight(struct device *dev) +{ + struct ec_lenovo_h8_config *conf = dev->chip_info; + if (!conf) + return; + + const bool has_kbbl = conf->has_keyboard_backlight; + + /* Method (MLCG, 1) */ + acpigen_write_method("MLCG", 1); + /* Store(Zero, Local0) */ + acpigen_write_store_ops(ZERO_OP, LOCAL0_OP); + if (has_kbbl) { + /* Keyboard backlight present */ + /* Or(Local0, (1 << 9), Local0) */ + acpigen_emit_byte(OR_OP); + acpigen_emit_byte(LOCAL0_OP); + acpigen_write_integer((1 << 9)); + acpigen_emit_byte(LOCAL0_OP); + + /* If(LEqual(_SB.PCI0.LPCB.EC.KBLT, One)) */ + acpigen_write_if(); + acpigen_emit_byte(LEQUAL_OP); + acpigen_emit_namestring(h8_dsdt_scope(dev, "KBLT")); + acpigen_emit_byte(ONE_OP); + + /* Or(Local0, 1, Local0) */ + acpigen_write_or(LOCAL0_OP, ONE_OP, LOCAL0_OP); + acpigen_pop_len(); /* If */ + } + /* Return(Local0) */ + acpigen_emit_byte(RETURN_OP); + acpigen_emit_byte(LOCAL0_OP); + acpigen_pop_len(); /* Method */ + + /* Method (MLCS, 1) */ + acpigen_write_method("MLCS", 1); + if (has_kbbl) { + /* And(Arg0, 3, Local0) */ + acpigen_emit_byte(AND_OP); + acpigen_emit_byte(ARG0_OP); + acpigen_write_integer(3); + acpigen_emit_byte(LOCAL0_OP); + + /* If(LGREATER_OP(Local0, 0)) */ + acpigen_write_if(); + acpigen_emit_byte(LGREATER_OP); + acpigen_emit_byte(LOCAL0_OP); + acpigen_emit_byte(ZERO_OP); + + /* FIXME: Support 2bit brightness control */ + /* Store(One, _SB.PCI0.LPCB.EC.KBLT) */ + acpigen_write_store(); + acpigen_emit_byte(ONE_OP); + acpigen_emit_namestring(h8_dsdt_scope(dev, "KBLT")); + acpigen_pop_len(); /* If */ + /* Else */ + acpigen_write_else(); + /* Store(Zero, _SB.PCI0.LPCB.EC.KBLT) */ + acpigen_write_store(); + acpigen_emit_byte(ZERO_OP); + acpigen_emit_namestring(h8_dsdt_scope(dev, "KBLT")); + acpigen_pop_len(); /* Else */ + } + /* Return(Zero) */ + acpigen_emit_byte(RETURN_OP); + acpigen_emit_byte(ZERO_OP); + acpigen_pop_len(); /* Method */ +} + /* * Generates EC SSDT. */ @@ -184,6 +255,7 @@ /* Used by thinkpad_acpi */ h8_dsdt_bluetooth(dev); h8_dsdt_wwan(dev); + h8_dsdt_keyboard_backlight(dev);
acpigen_pop_len(); /* Scope HKEY */ }