// SPDX-License-Identifier: GPL-2.0-or-later /* * DMI based code to deal with broken DSDTs on X86 tablets which ship with * Android as (part of) the factory image. The factory kernels shipped on these * devices typically have a bunch of things hardcoded, rather than specified * in their DSDT. * * Copyright (C) 2021-2023 Hans de Goede <hdegoede@redhat.com>
*/
/* * Advantech MICA-071 * This is a standard Windows tablet, but it has an extra "quick launch" button * which is not described in the ACPI tables in anyway. * Use the x86-android-tablets infra to create a gpio-keys device for this.
*/ staticconststruct x86_gpio_button advantech_mica_071_button __initconst = {
.button = {
.code = KEY_PROG1,
.active_low = true,
.desc = "prog1_key",
.type = EV_KEY,
.wakeup = false,
.debounce_interval = 50,
},
.chip = "INT33FC:00",
.pin = 2,
};
/* * When booted with the BIOS set to Android mode the Chuwi Hi8 (CWI509) DSDT * contains a whole bunch of bogus ACPI I2C devices and is missing entries * for the touchscreen and the accelerometer.
*/ staticconststruct property_entry chuwi_hi8_gsl1680_props[] = {
PROPERTY_ENTRY_U32("touchscreen-size-x", 1665),
PROPERTY_ENTRY_U32("touchscreen-size-y", 1140),
PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
PROPERTY_ENTRY_BOOL("silead,home-button"),
PROPERTY_ENTRY_STRING("firmware-name", "gsl1680-chuwi-hi8.fw"),
{ }
};
staticint __init chuwi_hi8_init(struct device *dev)
{ /* * Avoid the acpi_unregister_gsi() call in x86_acpi_irq_helper_get() * breaking the touchscreen + logging various errors when the Windows * BIOS is used.
*/ if (acpi_dev_present("MSSL0001", NULL, 1)) return -ENODEV;
/* * Cyberbook T116 Android version * This comes in both Windows and Android versions and even on Android * the DSDT is mostly sane. This tablet has 2 extra general purpose buttons * in the button row with the power + volume-buttons labeled P and F. * Use the x86-android-tablets infra to create a gpio-keys device for these.
*/ staticconststruct x86_gpio_button cyberbook_t116_buttons[] __initconst = {
{
.button = {
.code = KEY_PROG1,
.active_low = true,
.desc = "prog1_key",
.type = EV_KEY,
.wakeup = false,
.debounce_interval = 50,
},
.chip = "INT33FF:00",
.pin = 30,
},
{
.button = {
.code = KEY_PROG2,
.active_low = true,
.desc = "prog2_key",
.type = EV_KEY,
.wakeup = false,
.debounce_interval = 50,
},
.chip = "INT33FF:03",
.pin = 48,
},
};
staticint __init czc_p10t_init(struct device *dev)
{ /* * The device boots up in "Windows 7" mode, when the home button sends a * Windows specific key sequence (Left Meta + D) and the second button * sends an unknown one while also toggling the Radio Kill Switch. * This is a surprising behavior when the second button is labeled "Back". * * The vendor-supplied Android-x86 build switches the device to a "Android" * mode by writing value 0x63 to the I/O port 0x68. This just seems to just * set bit 6 on address 0x96 in the EC region; switching the bit directly * seems to achieve the same result. It uses a "p10t_switcher" to do the * job. It doesn't seem to be able to do anything else, and no other use * of the port 0x68 is known. * * In the Android mode, the home button sends just a single scancode, * which can be handled in Linux userspace more reasonably and the back * button only sends a scancode without toggling the kill switch. * The scancode can then be mapped either to Back or RF Kill functionality * in userspace, depending on how the button is labeled on that particular * model.
*/
outb(CZC_EC_ANDROID_KEYS, CZC_EC_EXTRA_PORT); return 0;
}
/* Note the LCD panel is mounted upside down, this is correctly indicated in the VBT */ staticconststruct property_entry medion_lifetab_s10346_touchscreen_props[] = {
PROPERTY_ENTRY_BOOL("touchscreen-inverted-x"),
PROPERTY_ENTRY_BOOL("touchscreen-swapped-x-y"),
{ }
};
/* * Peaq C1010 * This is a standard Windows tablet, but it has a special Dolby button. * This button has a WMI interface, but that is broken. Instead of trying to * use the broken WMI interface, instantiate a gpio-keys device for this.
*/ staticconststruct x86_gpio_button peaq_c1010_button __initconst = {
.button = {
.code = KEY_SOUND,
.active_low = true,
.desc = "dolby_key",
.type = EV_KEY,
.wakeup = false,
.debounce_interval = 50,
},
.chip = "INT33FC:00",
.pin = 3,
};
/* Enable the Wifi module by setting the wifi_enable pin to 1 */
ret = x86_android_tablet_get_gpiod("INT33FC:02", 20, "wifi_enable", false, GPIOD_OUT_HIGH, NULL); if (ret) return ret;
/* Reprobe the SDIO controller to enumerate the now enabled Wifi module */
pdev = pci_get_domain_bus_and_slot(0, 0, PCI_DEVFN(0x11, 0)); if (!pdev) {
pr_warn("Could not get PCI SDIO at devfn 0x%02x\n", PCI_DEVFN(0x11, 0)); return 0;
}
ret = device_reprobe(&pdev->dev); if (ret)
pci_warn(pdev, "Reprobing error: %d\n", ret);
/* * The firmware node for ktd2026 on Xaomi pad2. It composed of a RGB LED node * with three subnodes for each color (B/G/R). The RGB LED node is named * "multi-led" to align with the name in the device tree.
*/
/* Main firmware node for ktd2026 */ staticconststruct software_node ktd2026_node = {
.name = "ktd2026",
};
/* * For the LEDs which backlight the Menu / Home / Back capacitive buttons on * the bottom bezel. These are attached to a TPS61158 LED controller which * is controlled by the "pwm_soc_lpss_2" PWM output.
*/ #define XIAOMI_MIPAD2_LED_PERIOD_NS 19200 #define XIAOMI_MIPAD2_LED_MAX_DUTY_NS 6000 /* From Android kernel */
staticstruct pwm_device *xiaomi_mipad2_led_pwm;
staticint xiaomi_mipad2_brightness_set(struct led_classdev *led_cdev, enum led_brightness val)
{ struct pwm_state state = {
.period = XIAOMI_MIPAD2_LED_PERIOD_NS,
.duty_cycle = XIAOMI_MIPAD2_LED_MAX_DUTY_NS * val / LED_FULL, /* Always set PWM enabled to avoid the pin floating */
.enabled = true,
};
/* * If the EFI bootloader is not Xiaomi's own signed Android loader, then the * Xiaomi Mi Pad 2 X86 tablet sets OSID in the DSDT to 1 (Windows), causing * a bunch of devices to be hidden. * * This takes care of instantiating the hidden devices manually.
*/ staticconststruct x86_i2c_client_info xiaomi_mipad2_i2c_clients[] __initconst = {
{ /* BQ27520 fuel-gauge */
.board_info = {
.type = "bq27520",
.addr = 0x55,
.dev_name = "bq27520",
.swnode = &fg_bq25890_supply_node,
},
.adapter_path = "\\_SB_.PCI0.I2C1",
}, { /* KTD2026 RGB notification LED controller */
.board_info = {
.type = "ktd2026",
.addr = 0x30,
.dev_name = "ktd2026",
.swnode = &ktd2026_node,
},
.adapter_path = "\\_SB_.PCI0.I2C3",
},
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.