Skip to content

Commit 6564d3e

Browse files
Hans de Goedeij-intel
authored andcommitted
platform/x86: x86-android-tablets: Add support for Acer A1-840 tablet
Add support for the Acer Iconia One 8 A1-840 (non FHD version) tablet. This tablet has the usual issues for tablets shipped with Android as factory OS. The DSDT is broken in various ways, so i2c_clients for various devices as well as the INT3496 platform-device for OTG extcon handling need to be instantiated manually by x86-android-tablets. This tablet is special in that it is the first time a Bay Trail device has been found to use the Dollar Cove TI PMIC and the first time that the PMIC's Coulomb Counter is used as fuel-gauge. So far this PMIC has only been used together with Cherry Trail SoCs and always in combination with a separate full-featured fuel-gauge IC. Reviewed-by: Andy Shevchenko <andy@kernel.org> Signed-off-by: Hans de Goede <hansg@kernel.org> Link: https://patch.msgid.link/20250920200713.20193-18-hansg@kernel.org Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
1 parent d4bc149 commit 6564d3e

3 files changed

Lines changed: 171 additions & 0 deletions

File tree

drivers/platform/x86/x86-android-tablets/acer.c

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,166 @@
1616
#include "shared-psy-info.h"
1717
#include "x86-android-tablets.h"
1818

19+
/* Acer Iconia One 8 A1-840 (non FHD version) */
20+
static const struct property_entry acer_a1_840_bq24190_props[] = {
21+
PROPERTY_ENTRY_REF("monitored-battery", &generic_lipo_4v2_battery_node),
22+
PROPERTY_ENTRY_BOOL("omit-battery-class"),
23+
PROPERTY_ENTRY_BOOL("disable-reset"),
24+
{ }
25+
};
26+
27+
static const struct software_node acer_a1_840_bq24190_node = {
28+
.properties = acer_a1_840_bq24190_props,
29+
};
30+
31+
static const struct property_entry acer_a1_840_touchscreen_props[] = {
32+
PROPERTY_ENTRY_U32("touchscreen-size-x", 800),
33+
PROPERTY_ENTRY_U32("touchscreen-size-y", 1280),
34+
PROPERTY_ENTRY_GPIO("reset-gpios", &baytrail_gpiochip_nodes[1], 26, GPIO_ACTIVE_LOW),
35+
{ }
36+
};
37+
38+
static const struct software_node acer_a1_840_touchscreen_node = {
39+
.properties = acer_a1_840_touchscreen_props,
40+
};
41+
42+
static const struct x86_i2c_client_info acer_a1_840_i2c_clients[] __initconst = {
43+
{
44+
/* BQ24297 charger IC */
45+
.board_info = {
46+
.type = "bq24297",
47+
.addr = 0x6b,
48+
.dev_name = "bq24297",
49+
.swnode = &acer_a1_840_bq24190_node,
50+
.platform_data = &bq24190_pdata,
51+
},
52+
.adapter_path = "\\_SB_.I2C1",
53+
.irq_data = {
54+
.type = X86_ACPI_IRQ_TYPE_GPIOINT,
55+
.chip = "INT33FC:02",
56+
.index = 2,
57+
.trigger = ACPI_EDGE_SENSITIVE,
58+
.polarity = ACPI_ACTIVE_LOW,
59+
.con_id = "bq24297_irq",
60+
},
61+
}, {
62+
/* MPU6515 sensors */
63+
.board_info = {
64+
.type = "mpu6515",
65+
.addr = 0x69,
66+
.dev_name = "mpu6515",
67+
},
68+
.adapter_path = "\\_SB_.I2C3",
69+
.irq_data = {
70+
.type = X86_ACPI_IRQ_TYPE_APIC,
71+
.index = 0x47,
72+
.trigger = ACPI_EDGE_SENSITIVE,
73+
.polarity = ACPI_ACTIVE_HIGH,
74+
},
75+
}, {
76+
/* FT5416 touchscreen controller */
77+
.board_info = {
78+
.type = "edt-ft5x06",
79+
.addr = 0x38,
80+
.dev_name = "ft5416",
81+
.swnode = &acer_a1_840_touchscreen_node,
82+
},
83+
.adapter_path = "\\_SB_.I2C4",
84+
.irq_data = {
85+
.type = X86_ACPI_IRQ_TYPE_APIC,
86+
.index = 0x45,
87+
.trigger = ACPI_EDGE_SENSITIVE,
88+
.polarity = ACPI_ACTIVE_HIGH,
89+
},
90+
}
91+
};
92+
93+
static const struct property_entry acer_a1_840_int3496_props[] __initconst = {
94+
PROPERTY_ENTRY_GPIO("mux-gpios", &baytrail_gpiochip_nodes[2], 1, GPIO_ACTIVE_HIGH),
95+
PROPERTY_ENTRY_GPIO("id-gpios", &baytrail_gpiochip_nodes[2], 18, GPIO_ACTIVE_HIGH),
96+
{ }
97+
};
98+
99+
static const struct platform_device_info acer_a1_840_pdevs[] __initconst = {
100+
{
101+
/* For micro USB ID pin handling */
102+
.name = "intel-int3496",
103+
.id = PLATFORM_DEVID_NONE,
104+
.properties = acer_a1_840_int3496_props,
105+
},
106+
};
107+
108+
/* Properties for the Dollar Cove TI PMIC battery MFD child used as fuel-gauge */
109+
static const struct property_entry acer_a1_840_fg_props[] = {
110+
PROPERTY_ENTRY_REF("monitored-battery", &generic_lipo_4v2_battery_node),
111+
PROPERTY_ENTRY_STRING_ARRAY_LEN("supplied-from", bq24190_psy, 1),
112+
PROPERTY_ENTRY_GPIO("charged-gpios", &baytrail_gpiochip_nodes[2], 10, GPIO_ACTIVE_HIGH),
113+
{ }
114+
};
115+
116+
static struct device *acer_a1_840_fg_dev;
117+
static struct fwnode_handle *acer_a1_840_fg_node;
118+
119+
static int __init acer_a1_840_init(struct device *dev)
120+
{
121+
int ret;
122+
123+
acer_a1_840_fg_dev = bus_find_device_by_name(&platform_bus_type, NULL, "chtdc_ti_battery");
124+
if (!acer_a1_840_fg_dev)
125+
return dev_err_probe(dev, -EPROBE_DEFER, "getting chtdc_ti_battery dev\n");
126+
127+
acer_a1_840_fg_node = fwnode_create_software_node(acer_a1_840_fg_props, NULL);
128+
if (IS_ERR(acer_a1_840_fg_node)) {
129+
ret = PTR_ERR(acer_a1_840_fg_node);
130+
goto err_put;
131+
}
132+
133+
ret = device_add_software_node(acer_a1_840_fg_dev,
134+
to_software_node(acer_a1_840_fg_node));
135+
if (ret)
136+
goto err_put;
137+
138+
return 0;
139+
140+
err_put:
141+
fwnode_handle_put(acer_a1_840_fg_node);
142+
acer_a1_840_fg_node = NULL;
143+
put_device(acer_a1_840_fg_dev);
144+
acer_a1_840_fg_dev = NULL;
145+
return ret;
146+
}
147+
148+
static void acer_a1_840_exit(void)
149+
{
150+
device_remove_software_node(acer_a1_840_fg_dev);
151+
/*
152+
* Skip fwnode_handle_put(acer_a1_840_fg_node), instead leak the node.
153+
* The intel_dc_ti_battery driver may still reference the strdup-ed
154+
* "supplied-from" string. This string will be free-ed if the node
155+
* is released.
156+
*/
157+
acer_a1_840_fg_node = NULL;
158+
put_device(acer_a1_840_fg_dev);
159+
acer_a1_840_fg_dev = NULL;
160+
}
161+
162+
static const char * const acer_a1_840_modules[] __initconst = {
163+
"bq24190_charger", /* For the Vbus regulator for intel-int3496 */
164+
NULL
165+
};
166+
167+
const struct x86_dev_info acer_a1_840_info __initconst = {
168+
.i2c_client_info = acer_a1_840_i2c_clients,
169+
.i2c_client_count = ARRAY_SIZE(acer_a1_840_i2c_clients),
170+
.pdev_info = acer_a1_840_pdevs,
171+
.pdev_count = ARRAY_SIZE(acer_a1_840_pdevs),
172+
.gpiochip_type = X86_GPIOCHIP_BAYTRAIL,
173+
.swnode_group = generic_lipo_4v2_battery_swnodes,
174+
.modules = acer_a1_840_modules,
175+
.init = acer_a1_840_init,
176+
.exit = acer_a1_840_exit,
177+
};
178+
19179
/* Acer Iconia One 7 B1-750 has an Android factory image with everything hardcoded */
20180
static const char * const acer_b1_750_mount_matrix[] = {
21181
"-1", "0", "0",

drivers/platform/x86/x86-android-tablets/dmi.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@
1616
#include "x86-android-tablets.h"
1717

1818
const struct dmi_system_id x86_android_tablet_ids[] __initconst = {
19+
{
20+
/* Acer Iconia One 8 A1-840 (non FHD version) */
21+
.matches = {
22+
DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
23+
DMI_MATCH(DMI_PRODUCT_NAME, "BayTrail"),
24+
/* Above strings are too generic also match BIOS date */
25+
DMI_MATCH(DMI_BIOS_DATE, "04/01/2014"),
26+
},
27+
.driver_data = (void *)&acer_a1_840_info,
28+
},
1929
{
2030
/* Acer Iconia One 7 B1-750 */
2131
.matches = {

drivers/platform/x86/x86-android-tablets/x86-android-tablets.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ extern const struct software_node cherryview_gpiochip_nodes[];
111111
* Extern declarations of x86_dev_info structs so there can be a single
112112
* MODULE_DEVICE_TABLE(dmi, ...), while splitting the board descriptions.
113113
*/
114+
extern const struct x86_dev_info acer_a1_840_info;
114115
extern const struct x86_dev_info acer_b1_750_info;
115116
extern const struct x86_dev_info advantech_mica_071_info;
116117
extern const struct x86_dev_info asus_me176c_info;

0 commit comments

Comments
 (0)