File Index
Files and directories
Sign in
FILE

x86-android-tablets.h

File preview with syntax highlighting.

linux-6.19.14/drivers/platform/x86/x86-android-tablets/x86-android-tablets.h C
  1/* SPDX-License-Identifier: GPL-2.0-or-later
  2 *
  3 * DMI based code to deal with broken DSDTs on X86 tablets which ship with
  4 * Android as (part of) the factory image. The factory kernels shipped on these
  5 * devices typically have a bunch of things hardcoded, rather than specified
  6 * in their DSDT.
  7 *
  8 * Copyright (C) 2021-2023 Hans de Goede <hansg@kernel.org>
  9 */
 10#ifndef __PDX86_X86_ANDROID_TABLETS_H
 11#define __PDX86_X86_ANDROID_TABLETS_H
 12
 13#include <linux/gpio/consumer.h>
 14#include <linux/i2c.h>
 15#include <linux/irqdomain_defs.h>
 16#include <linux/spi/spi.h>
 17
 18struct gpio_desc;
 19struct platform_device_info;
 20struct software_node;
 21
 22/*
 23 * Helpers to get Linux IRQ numbers given a description of the IRQ source
 24 * (either IOAPIC index, or GPIO chip name + pin-number).
 25 */
 26enum x86_acpi_irq_type {
 27	X86_ACPI_IRQ_TYPE_NONE,
 28	X86_ACPI_IRQ_TYPE_APIC,
 29	X86_ACPI_IRQ_TYPE_GPIOINT,
 30	X86_ACPI_IRQ_TYPE_PMIC,
 31};
 32
 33enum x86_gpiochip_type {
 34	X86_GPIOCHIP_UNSPECIFIED = 0,
 35	X86_GPIOCHIP_BAYTRAIL,
 36	X86_GPIOCHIP_CHERRYVIEW,
 37};
 38
 39struct x86_acpi_irq_data {
 40	char *chip;   /* GPIO chip label (GPIOINT) or PMIC ACPI path (PMIC) */
 41	enum x86_acpi_irq_type type;
 42	enum irq_domain_bus_token domain;
 43	int index;
 44	int trigger;  /* ACPI_EDGE_SENSITIVE / ACPI_LEVEL_SENSITIVE */
 45	int polarity; /* ACPI_ACTIVE_HIGH / ACPI_ACTIVE_LOW / ACPI_ACTIVE_BOTH */
 46	bool free_gpio; /* Release GPIO after getting IRQ (for TYPE_GPIOINT) */
 47	const char *con_id;
 48};
 49
 50/* Structs to describe devices to instantiate */
 51struct x86_i2c_client_info {
 52	struct i2c_board_info board_info;
 53	char *adapter_path;
 54	struct x86_acpi_irq_data irq_data;
 55};
 56
 57struct x86_spi_dev_info {
 58	struct spi_board_info board_info;
 59	char *ctrl_path;
 60	struct x86_acpi_irq_data irq_data;
 61};
 62
 63struct x86_serdev_info {
 64	union {
 65		struct {
 66			const char *hid;
 67			const char *uid;
 68		} acpi;
 69		struct {
 70			unsigned int devfn;
 71		} pci;
 72	} ctrl;
 73	const char *ctrl_devname;
 74	/*
 75	 * ATM the serdev core only supports of or ACPI matching; and so far all
 76	 * Android x86 tablets DSDTs have usable serdev nodes, but sometimes
 77	 * under the wrong controller. So we just tie the existing serdev ACPI
 78	 * node to the right controller.
 79	 */
 80	const char *serdev_hid;
 81};
 82
 83struct x86_dev_info {
 84	const char * const *modules;
 85	const struct software_node **swnode_group;
 86	const struct x86_i2c_client_info *i2c_client_info;
 87	const struct x86_spi_dev_info *spi_dev_info;
 88	const struct platform_device_info *pdev_info;
 89	const struct x86_serdev_info *serdev_info;
 90	const struct software_node **gpio_button_swnodes;
 91	int i2c_client_count;
 92	int spi_dev_count;
 93	int pdev_count;
 94	int serdev_count;
 95	int (*init)(struct device *dev);
 96	void (*exit)(void);
 97	bool use_pci;
 98	enum x86_gpiochip_type gpiochip_type;
 99};
100
101int x86_android_tablet_get_gpiod(const char *chip, int pin, const char *con_id,
102				 bool active_low, enum gpiod_flags dflags,
103				 struct gpio_desc **desc);
104int x86_acpi_irq_helper_get(const struct x86_acpi_irq_data *data);
105
106/* Software nodes representing GPIO chips used by various tablets */
107extern const struct software_node baytrail_gpiochip_nodes[];
108extern const struct software_node cherryview_gpiochip_nodes[];
109
110/*
111 * Extern declarations of x86_dev_info structs so there can be a single
112 * MODULE_DEVICE_TABLE(dmi, ...), while splitting the board descriptions.
113 */
114extern const struct x86_dev_info acer_a1_840_info;
115extern const struct x86_dev_info acer_b1_750_info;
116extern const struct x86_dev_info advantech_mica_071_info;
117extern const struct x86_dev_info asus_me176c_info;
118extern const struct x86_dev_info asus_tf103c_info;
119extern const struct x86_dev_info chuwi_hi8_info;
120extern const struct x86_dev_info cyberbook_t116_info;
121extern const struct x86_dev_info czc_p10t;
122extern const struct x86_dev_info lenovo_yogabook_x90_info;
123extern const struct x86_dev_info lenovo_yogabook_x91_info;
124extern const struct x86_dev_info lenovo_yoga_tab2_830_1050_info;
125extern const struct x86_dev_info lenovo_yoga_tab2_1380_info;
126extern const struct x86_dev_info lenovo_yt3_info;
127extern const struct x86_dev_info medion_lifetab_s10346_info;
128extern const struct x86_dev_info nextbook_ares8_info;
129extern const struct x86_dev_info nextbook_ares8a_info;
130extern const struct x86_dev_info peaq_c1010_info;
131extern const struct x86_dev_info whitelabel_tm800a550l_info;
132extern const struct x86_dev_info vexia_edu_atla10_5v_info;
133extern const struct x86_dev_info vexia_edu_atla10_9v_info;
134extern const struct x86_dev_info xiaomi_mipad2_info;
135extern const struct dmi_system_id x86_android_tablet_ids[];
136
137#endif
~/ Read-only file preview.