1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Board info for Asus X86 tablets which ship with Android as the factory image
4 * and which have broken DSDT tables. The factory kernels shipped on these
5 * devices typically have a bunch of things hardcoded, rather than specified
8 * Copyright (C) 2021-2023 Hans de Goede <hdegoede@redhat.com>
11 #include <linux/gpio/machine.h>
12 #include <linux/input.h>
13 #include <linux/platform_device.h>
15 #include "shared-psy-info.h"
16 #include "x86-android-tablets.h"
18 /* Asus ME176C and TF103C tablets shared data */
19 static struct gpiod_lookup_table int3496_gpo2_pin22_gpios
= {
20 .dev_id
= "intel-int3496",
22 GPIO_LOOKUP("INT33FC:02", 22, "id", GPIO_ACTIVE_HIGH
),
27 static const struct x86_gpio_button asus_me176c_tf103c_lid __initconst
= {
34 .debounce_interval
= 50,
40 /* Asus ME176C tablets have an Android factory image with everything hardcoded */
41 static const char * const asus_me176c_accel_mount_matrix
[] = {
47 static const struct property_entry asus_me176c_accel_props
[] = {
48 PROPERTY_ENTRY_STRING_ARRAY("mount-matrix", asus_me176c_accel_mount_matrix
),
52 static const struct software_node asus_me176c_accel_node
= {
53 .properties
= asus_me176c_accel_props
,
56 static const struct property_entry asus_me176c_bq24190_props
[] = {
57 PROPERTY_ENTRY_STRING_ARRAY_LEN("supplied-from", tusb1211_chg_det_psy
, 1),
58 PROPERTY_ENTRY_REF("monitored-battery", &generic_lipo_hv_4v35_battery_node
),
59 PROPERTY_ENTRY_U32("ti,system-minimum-microvolt", 3600000),
60 PROPERTY_ENTRY_BOOL("omit-battery-class"),
61 PROPERTY_ENTRY_BOOL("disable-reset"),
65 static const struct software_node asus_me176c_bq24190_node
= {
66 .properties
= asus_me176c_bq24190_props
,
69 static const struct property_entry asus_me176c_ug3105_props
[] = {
70 PROPERTY_ENTRY_STRING_ARRAY_LEN("supplied-from", bq24190_psy
, 1),
71 PROPERTY_ENTRY_REF("monitored-battery", &generic_lipo_hv_4v35_battery_node
),
72 PROPERTY_ENTRY_U32("upisemi,rsns-microohm", 10000),
76 static const struct software_node asus_me176c_ug3105_node
= {
77 .properties
= asus_me176c_ug3105_props
,
80 static const struct x86_i2c_client_info asus_me176c_i2c_clients
[] __initconst
= {
82 /* bq24297 battery charger */
86 .dev_name
= "bq24297",
87 .swnode
= &asus_me176c_bq24190_node
,
88 .platform_data
= &bq24190_pdata
,
90 .adapter_path
= "\\_SB_.I2C1",
92 .type
= X86_ACPI_IRQ_TYPE_PMIC
,
93 .chip
= "\\_SB_.I2C7.PMIC",
94 .domain
= DOMAIN_BUS_WAKEUP
,
98 /* ug3105 battery monitor */
102 .dev_name
= "ug3105",
103 .swnode
= &asus_me176c_ug3105_node
,
105 .adapter_path
= "\\_SB_.I2C1",
107 /* ak09911 compass */
111 .dev_name
= "ak09911",
113 .adapter_path
= "\\_SB_.I2C5",
115 /* kxtj21009 accelerometer */
119 .dev_name
= "kxtj21009",
120 .swnode
= &asus_me176c_accel_node
,
122 .adapter_path
= "\\_SB_.I2C5",
124 .type
= X86_ACPI_IRQ_TYPE_APIC
,
126 .trigger
= ACPI_EDGE_SENSITIVE
,
127 .polarity
= ACPI_ACTIVE_LOW
,
130 /* goodix touchscreen */
132 .type
= "GDIX1001:00",
134 .dev_name
= "goodix_ts",
136 .adapter_path
= "\\_SB_.I2C6",
138 .type
= X86_ACPI_IRQ_TYPE_APIC
,
140 .trigger
= ACPI_EDGE_SENSITIVE
,
141 .polarity
= ACPI_ACTIVE_LOW
,
146 static const struct x86_serdev_info asus_me176c_serdevs
[] __initconst
= {
148 .ctrl_hid
= "80860F0A",
150 .ctrl_devname
= "serial0",
151 .serdev_hid
= "BCM2E3A",
155 static struct gpiod_lookup_table asus_me176c_goodix_gpios
= {
156 .dev_id
= "i2c-goodix_ts",
158 GPIO_LOOKUP("INT33FC:00", 60, "reset", GPIO_ACTIVE_HIGH
),
159 GPIO_LOOKUP("INT33FC:02", 28, "irq", GPIO_ACTIVE_HIGH
),
164 static struct gpiod_lookup_table
* const asus_me176c_gpios
[] = {
165 &int3496_gpo2_pin22_gpios
,
166 &asus_me176c_goodix_gpios
,
170 const struct x86_dev_info asus_me176c_info __initconst
= {
171 .i2c_client_info
= asus_me176c_i2c_clients
,
172 .i2c_client_count
= ARRAY_SIZE(asus_me176c_i2c_clients
),
173 .pdev_info
= int3496_pdevs
,
175 .serdev_info
= asus_me176c_serdevs
,
176 .serdev_count
= ARRAY_SIZE(asus_me176c_serdevs
),
177 .gpio_button
= &asus_me176c_tf103c_lid
,
178 .gpio_button_count
= 1,
179 .gpiod_lookup_tables
= asus_me176c_gpios
,
180 .bat_swnode
= &generic_lipo_hv_4v35_battery_node
,
181 .modules
= bq24190_modules
,
184 /* Asus TF103C tablets have an Android factory image with everything hardcoded */
185 static const char * const asus_tf103c_accel_mount_matrix
[] = {
191 static const struct property_entry asus_tf103c_accel_props
[] = {
192 PROPERTY_ENTRY_STRING_ARRAY("mount-matrix", asus_tf103c_accel_mount_matrix
),
196 static const struct software_node asus_tf103c_accel_node
= {
197 .properties
= asus_tf103c_accel_props
,
200 static const struct property_entry asus_tf103c_touchscreen_props
[] = {
201 PROPERTY_ENTRY_STRING("compatible", "atmel,atmel_mxt_ts"),
205 static const struct software_node asus_tf103c_touchscreen_node
= {
206 .properties
= asus_tf103c_touchscreen_props
,
209 static const struct property_entry asus_tf103c_battery_props
[] = {
210 PROPERTY_ENTRY_STRING("compatible", "simple-battery"),
211 PROPERTY_ENTRY_STRING("device-chemistry", "lithium-ion-polymer"),
212 PROPERTY_ENTRY_U32("precharge-current-microamp", 256000),
213 PROPERTY_ENTRY_U32("charge-term-current-microamp", 128000),
214 PROPERTY_ENTRY_U32("constant-charge-current-max-microamp", 2048000),
215 PROPERTY_ENTRY_U32("constant-charge-voltage-max-microvolt", 4208000),
216 PROPERTY_ENTRY_U32("factory-internal-resistance-micro-ohms", 150000),
220 static const struct software_node asus_tf103c_battery_node
= {
221 .properties
= asus_tf103c_battery_props
,
224 static const struct property_entry asus_tf103c_bq24190_props
[] = {
225 PROPERTY_ENTRY_STRING_ARRAY_LEN("supplied-from", tusb1211_chg_det_psy
, 1),
226 PROPERTY_ENTRY_REF("monitored-battery", &asus_tf103c_battery_node
),
227 PROPERTY_ENTRY_U32("ti,system-minimum-microvolt", 3600000),
228 PROPERTY_ENTRY_BOOL("omit-battery-class"),
229 PROPERTY_ENTRY_BOOL("disable-reset"),
233 static const struct software_node asus_tf103c_bq24190_node
= {
234 .properties
= asus_tf103c_bq24190_props
,
237 static const struct property_entry asus_tf103c_ug3105_props
[] = {
238 PROPERTY_ENTRY_STRING_ARRAY_LEN("supplied-from", bq24190_psy
, 1),
239 PROPERTY_ENTRY_REF("monitored-battery", &asus_tf103c_battery_node
),
240 PROPERTY_ENTRY_U32("upisemi,rsns-microohm", 5000),
244 static const struct software_node asus_tf103c_ug3105_node
= {
245 .properties
= asus_tf103c_ug3105_props
,
248 static const struct x86_i2c_client_info asus_tf103c_i2c_clients
[] __initconst
= {
250 /* bq24297 battery charger */
254 .dev_name
= "bq24297",
255 .swnode
= &asus_tf103c_bq24190_node
,
256 .platform_data
= &bq24190_pdata
,
258 .adapter_path
= "\\_SB_.I2C1",
260 .type
= X86_ACPI_IRQ_TYPE_PMIC
,
261 .chip
= "\\_SB_.I2C7.PMIC",
262 .domain
= DOMAIN_BUS_WAKEUP
,
266 /* ug3105 battery monitor */
270 .dev_name
= "ug3105",
271 .swnode
= &asus_tf103c_ug3105_node
,
273 .adapter_path
= "\\_SB_.I2C1",
275 /* ak09911 compass */
279 .dev_name
= "ak09911",
281 .adapter_path
= "\\_SB_.I2C5",
283 /* kxtj21009 accelerometer */
287 .dev_name
= "kxtj21009",
288 .swnode
= &asus_tf103c_accel_node
,
290 .adapter_path
= "\\_SB_.I2C5",
292 /* atmel touchscreen */
294 .type
= "atmel_mxt_ts",
296 .dev_name
= "atmel_mxt_ts",
297 .swnode
= &asus_tf103c_touchscreen_node
,
299 .adapter_path
= "\\_SB_.I2C6",
301 .type
= X86_ACPI_IRQ_TYPE_GPIOINT
,
302 .chip
= "INT33FC:02",
304 .trigger
= ACPI_EDGE_SENSITIVE
,
305 .polarity
= ACPI_ACTIVE_LOW
,
306 .con_id
= "atmel_mxt_ts_irq",
311 static struct gpiod_lookup_table
* const asus_tf103c_gpios
[] = {
312 &int3496_gpo2_pin22_gpios
,
316 const struct x86_dev_info asus_tf103c_info __initconst
= {
317 .i2c_client_info
= asus_tf103c_i2c_clients
,
318 .i2c_client_count
= ARRAY_SIZE(asus_tf103c_i2c_clients
),
319 .pdev_info
= int3496_pdevs
,
321 .gpio_button
= &asus_me176c_tf103c_lid
,
322 .gpio_button_count
= 1,
323 .gpiod_lookup_tables
= asus_tf103c_gpios
,
324 .bat_swnode
= &asus_tf103c_battery_node
,
325 .modules
= bq24190_modules
,