linux/drivers/platform/x86/x86-android-tablets/other.c

// 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 <[email protected]>
 */

#include <linux/acpi.h>
#include <linux/gpio/machine.h>
#include <linux/input.h>
#include <linux/leds.h>
#include <linux/platform_device.h>
#include <linux/pwm.h>

#include <dt-bindings/leds/common.h>

#include "shared-psy-info.h"
#include "x86-android-tablets.h"

/* Acer Iconia One 7 B1-750 has an Android factory image with everything hardcoded */
static const char * const acer_b1_750_mount_matrix[] =;

static const struct property_entry acer_b1_750_bma250e_props[] =;

static const struct software_node acer_b1_750_bma250e_node =;

static const struct x86_i2c_client_info acer_b1_750_i2c_clients[] __initconst =;

static struct gpiod_lookup_table acer_b1_750_nvt_ts_gpios =;

static struct gpiod_lookup_table * const acer_b1_750_gpios[] =;

const struct x86_dev_info acer_b1_750_info __initconst =;

/*
 * 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.
 */
static const struct x86_gpio_button advantech_mica_071_button __initconst =;

const struct x86_dev_info advantech_mica_071_info __initconst =;

/*
 * 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.
 */
static const struct property_entry chuwi_hi8_gsl1680_props[] =;

static const struct software_node chuwi_hi8_gsl1680_node =;

static const char * const chuwi_hi8_mount_matrix[] =;

static const struct property_entry chuwi_hi8_bma250e_props[] =;

static const struct software_node chuwi_hi8_bma250e_node =;

static const struct x86_i2c_client_info chuwi_hi8_i2c_clients[] __initconst =;

static int __init chuwi_hi8_init(struct device *dev)
{}

const struct x86_dev_info chuwi_hi8_info __initconst =;

/*
 * 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.
 */
static const struct x86_gpio_button cyberbook_t116_buttons[] __initconst =;

const struct x86_dev_info cyberbook_t116_info __initconst =;

#define CZC_EC_EXTRA_PORT
#define CZC_EC_ANDROID_KEYS

static int __init czc_p10t_init(struct device *dev)
{}

const struct x86_dev_info czc_p10t __initconst =;

/* Medion Lifetab S10346 tablets have an Android factory image with everything hardcoded */
static const char * const medion_lifetab_s10346_accel_mount_matrix[] =;

static const struct property_entry medion_lifetab_s10346_accel_props[] =;

static const struct software_node medion_lifetab_s10346_accel_node =;

/* Note the LCD panel is mounted upside down, this is correctly indicated in the VBT */
static const struct property_entry medion_lifetab_s10346_touchscreen_props[] =;

static const struct software_node medion_lifetab_s10346_touchscreen_node =;

static const struct x86_i2c_client_info medion_lifetab_s10346_i2c_clients[] __initconst =;

static struct gpiod_lookup_table medion_lifetab_s10346_goodix_gpios =;

static struct gpiod_lookup_table * const medion_lifetab_s10346_gpios[] =;

const struct x86_dev_info medion_lifetab_s10346_info __initconst =;

/* Nextbook Ares 8 (BYT) tablets have an Android factory image with everything hardcoded */
static const char * const nextbook_ares8_accel_mount_matrix[] =;

static const struct property_entry nextbook_ares8_accel_props[] =;

static const struct software_node nextbook_ares8_accel_node =;

static const struct property_entry nextbook_ares8_touchscreen_props[] =;

static const struct software_node nextbook_ares8_touchscreen_node =;

static const struct x86_i2c_client_info nextbook_ares8_i2c_clients[] __initconst =;

static struct gpiod_lookup_table * const nextbook_ares8_gpios[] =;

const struct x86_dev_info nextbook_ares8_info __initconst =;

/* Nextbook Ares 8A (CHT) tablets have an Android factory image with everything hardcoded */
static const char * const nextbook_ares8a_accel_mount_matrix[] =;

static const struct property_entry nextbook_ares8a_accel_props[] =;

static const struct software_node nextbook_ares8a_accel_node =;

static const struct x86_i2c_client_info nextbook_ares8a_i2c_clients[] __initconst =;

static struct gpiod_lookup_table nextbook_ares8a_ft5416_gpios =;

static struct gpiod_lookup_table * const nextbook_ares8a_gpios[] =;

const struct x86_dev_info nextbook_ares8a_info __initconst =;

/*
 * 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.
 */
static const struct x86_gpio_button peaq_c1010_button __initconst =;

const struct x86_dev_info peaq_c1010_info __initconst =;

/*
 * Whitelabel (sold as various brands) TM800A550L tablets.
 * These tablet's DSDT contains a whole bunch of bogus ACPI I2C devices
 * (removed through acpi_quirk_skip_i2c_client_enumeration()) and
 * the touchscreen firmware node has the wrong GPIOs.
 */
static const char * const whitelabel_tm800a550l_accel_mount_matrix[] =;

static const struct property_entry whitelabel_tm800a550l_accel_props[] =;

static const struct software_node whitelabel_tm800a550l_accel_node =;

static const struct property_entry whitelabel_tm800a550l_goodix_props[] =;

static const struct software_node whitelabel_tm800a550l_goodix_node =;

static const struct x86_i2c_client_info whitelabel_tm800a550l_i2c_clients[] __initconst =;

static struct gpiod_lookup_table whitelabel_tm800a550l_goodix_gpios =;

static struct gpiod_lookup_table * const whitelabel_tm800a550l_gpios[] =;

const struct x86_dev_info whitelabel_tm800a550l_info __initconst =;

/*
 * 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 */
static const struct software_node ktd2026_node =;

static const struct property_entry ktd2026_rgb_led_props[] =;

static const struct software_node ktd2026_rgb_led_node =;

static const struct property_entry ktd2026_blue_led_props[] =;

static const struct software_node ktd2026_blue_led_node =;

static const struct property_entry ktd2026_green_led_props[] =;

static const struct software_node ktd2026_green_led_node =;

static const struct property_entry ktd2026_red_led_props[] =;

static const struct software_node ktd2026_red_led_node =;

static const struct software_node *ktd2026_node_group[] =;

/*
 * 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
#define XIAOMI_MIPAD2_LED_MAX_DUTY_NS

static struct pwm_device *xiaomi_mipad2_led_pwm;

static int xiaomi_mipad2_brightness_set(struct led_classdev *led_cdev,
					enum led_brightness val)
{}

static int __init xiaomi_mipad2_init(struct device *dev)
{}

static void xiaomi_mipad2_exit(void)
{}

/*
 * 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.
 */
static const struct x86_i2c_client_info xiaomi_mipad2_i2c_clients[] __initconst =;

const struct x86_dev_info xiaomi_mipad2_info __initconst =;