From 545d9992dc9cdfc06708019b4ecdbb75d2d06721 Mon Sep 17 00:00:00 2001 From: CoolStar Date: Wed, 28 Jun 2023 13:10:50 -0700 Subject: mb/google/link: rework TP/TS ACPI for new Windows I2C driver This supports a brand new I2C driver that is designed specifically for the Pixel 2013 chromebook (LINK). The GMBus interface on the IGPU is an i2c-compatible interface, but AFAIK only Link has touch devices attached in this way. On Windows, the PCIe device for the IGP is owned by the Intel proprietary driver, hence a separate ACPI device has to be added for the I2C driver arbitrator to attach to. The MMIO method is used instead of _CRS so that Windows does not try to assign ownership of the resource to our device (even though we're using the MMIO registers at the same time as the IGP driver). Even though in theory 2 drivers accessing the same MMIO may cause problems, in testing, there has been no issues with sleep/wake/hibernate, updating/installing/uninstalling the IGP driver, or changing display resolutions with the i2c driver attached. The arbitrator is necessary as well, since even though there are multiple i2c buses, the MMIO registers are shared. Hence a shared lock is required for i2c access across the buses. The original Sleep Button devices are preserved for Linux due to the completely custom and non-standard implementation of the Windows driver in order to work around the non-standard nature of Link's hardware. Change-Id: If7ee05d15bc17d335cf8c1a8e80bea62800de475 Signed-off-by: CoolStar Reviewed-on: https://review.coreboot.org/c/coreboot/+/76159 Tested-by: build bot (Jenkins) Reviewed-by: Nico Huber Reviewed-by: Eric Lai Reviewed-by: Matt DeVillier --- src/mainboard/google/link/acpi/mainboard.asl | 112 +++++++++++++++++++++++++-- src/mainboard/google/link/dsdt.asl | 4 +- src/mainboard/google/link/onboard.h | 4 + 3 files changed, 113 insertions(+), 7 deletions(-) (limited to 'src/mainboard') diff --git a/src/mainboard/google/link/acpi/mainboard.asl b/src/mainboard/google/link/acpi/mainboard.asl index 3e751bb795..28d6d34c76 100644 --- a/src/mainboard/google/link/acpi/mainboard.asl +++ b/src/mainboard/google/link/acpi/mainboard.asl @@ -11,9 +11,6 @@ Scope (\_SB) { // automatically enable it as a wake source Name(_HID, EisaId("PNP0C0E")) - // Trackpad Wake is GPIO12 - Name(_PRW, Package() { BOARD_TRACKPAD_WAKE_GPIO, 0x03 } ) - Name(_CRS, ResourceTemplate() { // PIRQE -> GSI20 @@ -35,9 +32,6 @@ Scope (\_SB) { // automatically enable it as a wake source Name(_HID, EisaId("PNP0C0E")) - // Touchscreen Wake is GPIO14 - Name(_PRW, Package(){0x1e, 0x03}) - Name(_CRS, ResourceTemplate() { // PIRQG -> GSI22 @@ -48,3 +42,109 @@ Scope (\_SB) { }) } } + + +Scope (\_SB.PCI0.GFX0) +{ + Device (GMBS){ + Name (_HID, "BOOT0001") + Method (_STA, 0, NotSerialized) // _STA: Status + { + Return (0x0F) + } + + Method (MMIO, 0, Serialized) + { + Local0 = BAR0 & 0xFFFFFFFFFFFFFFF0 + Return (Local0) + } + + Device (LVGA) { + Name (_HID, "BOOT0002") + Name (_UID, 0) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) {"coolstar,bus-number", GMBUS_PIN_VGADDC} + } + }) + + Method (_STA) + { + Return (0xF) + } + + Device (ATPD) + { + Name (_HID, "ATML0000") + Name (_DDN, "Atmel Touchpad") + Name (_UID, 0) + + Name (_CRS, ResourceTemplate() + { + I2cSerialBus ( + BOARD_TRACKPAD_I2C_ADDR, // SlaveAddress + ControllerInitiated, // SlaveMode + 100000, // ConnectionSpeed + AddressingMode7Bit, // AddressingMode + "\\_SB.PCI0.GFX0.GMBS.LVGA", // ResourceSource + ) + + Interrupt (ResourceConsumer, Level, ActiveLow) { BOARD_TRACKPAD_IRQ } + }) + + // Trackpad Wake is GPIO12 + Name(_PRW, Package() { BOARD_TRACKPAD_WAKE_GPIO, 0x03 } ) + + Method (_STA) + { + Return (0xF) + } + } + } + + Device (LPNL) { + Name (_HID, "BOOT0002") + Name (_UID, 1) + Name (_DSD, Package () { + ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), + Package () { + Package (2) {"coolstar,bus-number", GMBUS_PIN_PANEL} + } + }) + + Method (_STA) + { + Return (0xF) + } + + Device (ATSA) + { + Name (_HID, "ATML0001") + Name (_DDN, "Atmel TouchScreen") + Name (_UID, 0) + + Name (_CRS, ResourceTemplate() + { + I2cSerialBus ( + BOARD_TOUCHSCREEN_I2C_ADDR, // SlaveAddress + ControllerInitiated, // SlaveMode + 100000, // ConnectionSpeed + AddressingMode7Bit, // AddressingMode + "\\_SB.PCI0.GFX0.GMBS.LPNL", // ResourceSource + ) + + Interrupt (ResourceConsumer, Level, ActiveLow) { BOARD_TOUCHSCREEN_IRQ } + }) + + // Touchscreen Wake is GPIO14 + Name(_PRW, Package() { BOARD_TOUCHSCREEN_WAKE_GPIO, 0x03 } ) + + Method (_STA) + { + Return (0xF) + } + } + } + } +} diff --git a/src/mainboard/google/link/dsdt.asl b/src/mainboard/google/link/dsdt.asl index 81e30748ef..4e63f19845 100644 --- a/src/mainboard/google/link/dsdt.asl +++ b/src/mainboard/google/link/dsdt.asl @@ -14,7 +14,6 @@ DefinitionBlock( #include #include "acpi/platform.asl" - #include "acpi/mainboard.asl" // Thermal handler #include "acpi/thermal.asl" @@ -34,5 +33,8 @@ DefinitionBlock( } } + // Mainboard devices must be defined after _SB.PCI0.GFX0 as they're attached to the IGPU + #include "acpi/mainboard.asl" + #include } diff --git a/src/mainboard/google/link/onboard.h b/src/mainboard/google/link/onboard.h index efcda92ef9..27984a4b74 100644 --- a/src/mainboard/google/link/onboard.h +++ b/src/mainboard/google/link/onboard.h @@ -15,9 +15,13 @@ #define BOARD_TOUCHSCREEN_NAME "touchscreen" #define BOARD_TOUCHSCREEN_I2C_ADDR 0x4a #define BOARD_TOUCHSCREEN_IRQ 22 +#define BOARD_TOUCHSCREEN_WAKE_GPIO 0x1e #define GPIO_REC_MODE 9 #define GPIO_SPI_WP 57 +#define GMBUS_PIN_VGADDC 2 +#define GMBUS_PIN_PANEL 3 + #endif -- cgit v1.2.3