The Xiaomi Mi Pad 2 ships in both Windows and Android variants and the BIOS detects the OS by looking at the EFI executable the efibootmgr entry points to. If this executable is not the original Android bootloader (signed with Xiaomi's own keys) it detects the OS as Windows and sets the OSID variable used in the DSDT to "1". This causes the following problems when running Linux: 1. Like many other CHT based tablets the Xiaomi Mi Pad 2 does not have a properly working ACPI battery interface instead we need to load a native driver for the fuel-gauge, but the TXN27520 ACPI device for the fuel-gauge gets hidden when OSID == "1". 2. There are backlit LEDs behind the capacitive menu, home, back buttons below the screen which are controlled by the second PWM controller of the CHT SoC, this gets hidden when OSID == "1". 3. There is an I2C attached KTD2026 RGB LED controller for the notification LED, this gets hidden when OSID != "4". Add always_present_ids table entries for these devices so that they are always seen as present independent of the OSID value. Note the TXN27520 ACPI device does not have a UID set, so add support for matching devices with no UID. Signed-off-by: Hans de Goede <hdegoede@xxxxxxxxxx> --- drivers/acpi/x86/utils.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/x86/utils.c b/drivers/acpi/x86/utils.c index f22f23933063..831949fda492 100644 --- a/drivers/acpi/x86/utils.c +++ b/drivers/acpi/x86/utils.c @@ -58,6 +58,11 @@ static const struct always_present_id always_present_ids[] = { ENTRY("80862289", "2", X86_MATCH(ATOM_AIRMONT), { DMI_MATCH(DMI_PRODUCT_NAME, "Lenovo YB1-X9"), }), + /* The Xiaomi Mi Pad 2 uses PWM2 for touchkeys backlight control */ + ENTRY("80862289", "2", X86_MATCH(ATOM_AIRMONT), { + DMI_MATCH(DMI_SYS_VENDOR, "Xiaomi Inc"), + DMI_MATCH(DMI_PRODUCT_NAME, "Mipad2"), + }), /* * The INT0002 device is necessary to clear wakeup interrupt sources * on Cherry Trail devices, without it we get nobody cared IRQ msgs. @@ -107,6 +112,24 @@ static const struct always_present_id always_present_ids[] = { DMI_MATCH(DMI_PRODUCT_NAME, "Default string"), DMI_MATCH(DMI_BIOS_DATE, "05/25/2017") }), + /* + * The Xiaomi Mi Pad 2 does not use the ACPI battery interface + * instead we need to load a native driver for the fuel-gauge, + * but if the BIOS thinks we are Windows rather then Android, + * the fuel-gauge ACPI device is hidden. + */ + ENTRY("TXN27520", NULL, X86_MATCH(ATOM_AIRMONT), { + DMI_MATCH(DMI_SYS_VENDOR, "Xiaomi Inc"), + DMI_MATCH(DMI_PRODUCT_NAME, "Mipad2"), + }), + /* + * The Xiaomi Mi Pad 2 has a RGB LED controller for its notifcation + * LED which is hidden when the BIOS thinks we are Windows, unhide it. + */ + ENTRY("KTD20260", "1", X86_MATCH(ATOM_AIRMONT), { + DMI_MATCH(DMI_SYS_VENDOR, "Xiaomi Inc"), + DMI_MATCH(DMI_PRODUCT_NAME, "Mipad2"), + }), }; bool acpi_device_always_present(struct acpi_device *adev) @@ -118,8 +141,8 @@ bool acpi_device_always_present(struct acpi_device *adev) if (acpi_match_device_ids(adev, always_present_ids[i].hid)) continue; - if (!adev->pnp.unique_id || - strcmp(adev->pnp.unique_id, always_present_ids[i].uid)) + if (always_present_ids[i].uid && (!adev->pnp.unique_id || + strcmp(adev->pnp.unique_id, always_present_ids[i].uid))) continue; if (!x86_match_cpu(always_present_ids[i].cpu_ids)) -- 2.31.1