From 12a359c75e0c8837bab14670f34f26e14eee9fb5 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Tue, 3 Dec 2019 13:59:19 -0700 Subject: [PATCH] Add lid switch ACPI --- src/board/system76/galp3-c/acpi.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/board/system76/galp3-c/acpi.c b/src/board/system76/galp3-c/acpi.c index eb59bb0..f736e2b 100644 --- a/src/board/system76/galp3-c/acpi.c +++ b/src/board/system76/galp3-c/acpi.c @@ -5,6 +5,7 @@ #include static struct Gpio __code ACIN_N = GPIO(B, 6); +static struct Gpio __code LID_SW_N = GPIO(D, 1); uint8_t acpi_read(uint8_t addr) { uint8_t data = 0; @@ -23,6 +24,14 @@ uint8_t acpi_read(uint8_t addr) { ACPI_16((K) + 2, (V) >> 16) switch (addr) { + // Lid state and other flags + case 0x03: + if (gpio_get(&LID_SW_N)) { + // Lid is open + data |= 1 << 0; + } + break; + // Handle AC adapter and battery present case 0x10: if (!gpio_get(&ACIN_N)) { @@ -37,7 +46,7 @@ uint8_t acpi_read(uint8_t addr) { ACPI_16(0x1A, battery_full_capacity); ACPI_16(0x22, battery_design_voltage); - // Bypass status test in ACPI + // Bypass status test in ACPI - TODO case 0x26: data |= 1 << 1; break;