All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hans de Goede <hansg@kernel.org>
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
	"Arnd Bergmann" <arnd@kernel.org>
Cc: Hans de Goede <hansg@kernel.org>, platform-driver-x86@vger.kernel.org
Subject: [PATCH v4 17/20] platform/x86: x86-android-tablets: Add support for Acer A1-840 tablet
Date: Sat, 20 Sep 2025 22:07:10 +0200	[thread overview]
Message-ID: <20250920200713.20193-18-hansg@kernel.org> (raw)
In-Reply-To: <20250920200713.20193-1-hansg@kernel.org>

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>
---
Changes in v3:
- Rebase on top of Dmitry's GPIO software node reference series and
  use GPIO swnode references instead of GPIO lookup tables
- Use the new swnode_group register mechanism to simplify init() and exit()
---
 .../platform/x86/x86-android-tablets/acer.c   | 160 ++++++++++++++++++
 .../platform/x86/x86-android-tablets/dmi.c    |  10 ++
 .../x86-android-tablets/x86-android-tablets.h |   1 +
 3 files changed, 171 insertions(+)

diff --git a/drivers/platform/x86/x86-android-tablets/acer.c b/drivers/platform/x86/x86-android-tablets/acer.c
index e5850da8037a..d48c70ffd992 100644
--- a/drivers/platform/x86/x86-android-tablets/acer.c
+++ b/drivers/platform/x86/x86-android-tablets/acer.c
@@ -16,6 +16,166 @@
 #include "shared-psy-info.h"
 #include "x86-android-tablets.h"
 
+/* Acer Iconia One 8 A1-840 (non FHD version) */
+static const struct property_entry acer_a1_840_bq24190_props[] = {
+	PROPERTY_ENTRY_REF("monitored-battery", &generic_lipo_4v2_battery_node),
+	PROPERTY_ENTRY_BOOL("omit-battery-class"),
+	PROPERTY_ENTRY_BOOL("disable-reset"),
+	{ }
+};
+
+static const struct software_node acer_a1_840_bq24190_node = {
+	.properties = acer_a1_840_bq24190_props,
+};
+
+static const struct property_entry acer_a1_840_touchscreen_props[] = {
+	PROPERTY_ENTRY_U32("touchscreen-size-x", 800),
+	PROPERTY_ENTRY_U32("touchscreen-size-y", 1280),
+	PROPERTY_ENTRY_GPIO("reset-gpios", &baytrail_gpiochip_nodes[1], 26, GPIO_ACTIVE_LOW),
+	{ }
+};
+
+static const struct software_node acer_a1_840_touchscreen_node = {
+	.properties = acer_a1_840_touchscreen_props,
+};
+
+static const struct x86_i2c_client_info acer_a1_840_i2c_clients[] __initconst = {
+	{
+		/* BQ24297 charger IC */
+		.board_info = {
+			.type = "bq24297",
+			.addr = 0x6b,
+			.dev_name = "bq24297",
+			.swnode = &acer_a1_840_bq24190_node,
+			.platform_data = &bq24190_pdata,
+		},
+		.adapter_path = "\\_SB_.I2C1",
+		.irq_data = {
+			.type = X86_ACPI_IRQ_TYPE_GPIOINT,
+			.chip = "INT33FC:02",
+			.index = 2,
+			.trigger = ACPI_EDGE_SENSITIVE,
+			.polarity = ACPI_ACTIVE_LOW,
+			.con_id = "bq24297_irq",
+		},
+	}, {
+		/* MPU6515 sensors */
+		.board_info = {
+			.type = "mpu6515",
+			.addr = 0x69,
+			.dev_name = "mpu6515",
+		},
+		.adapter_path = "\\_SB_.I2C3",
+		.irq_data = {
+			.type = X86_ACPI_IRQ_TYPE_APIC,
+			.index = 0x47,
+			.trigger = ACPI_EDGE_SENSITIVE,
+			.polarity = ACPI_ACTIVE_HIGH,
+		},
+	}, {
+		/* FT5416 touchscreen controller */
+		.board_info = {
+			.type = "edt-ft5x06",
+			.addr = 0x38,
+			.dev_name = "ft5416",
+			.swnode = &acer_a1_840_touchscreen_node,
+		},
+		.adapter_path = "\\_SB_.I2C4",
+		.irq_data = {
+			.type = X86_ACPI_IRQ_TYPE_APIC,
+			.index = 0x45,
+			.trigger = ACPI_EDGE_SENSITIVE,
+			.polarity = ACPI_ACTIVE_HIGH,
+		},
+	}
+};
+
+static const struct property_entry acer_a1_840_int3496_props[] __initconst = {
+	PROPERTY_ENTRY_GPIO("mux-gpios", &baytrail_gpiochip_nodes[2], 1, GPIO_ACTIVE_HIGH),
+	PROPERTY_ENTRY_GPIO("id-gpios", &baytrail_gpiochip_nodes[2], 18, GPIO_ACTIVE_HIGH),
+	{ }
+};
+
+static const struct platform_device_info acer_a1_840_pdevs[] __initconst = {
+	{
+		/* For micro USB ID pin handling */
+		.name = "intel-int3496",
+		.id = PLATFORM_DEVID_NONE,
+		.properties = acer_a1_840_int3496_props,
+	},
+};
+
+/* Properties for the Dollar Cove TI PMIC battery MFD child used as fuel-gauge */
+static const struct property_entry acer_a1_840_fg_props[] = {
+	PROPERTY_ENTRY_REF("monitored-battery", &generic_lipo_4v2_battery_node),
+	PROPERTY_ENTRY_STRING_ARRAY_LEN("supplied-from", bq24190_psy, 1),
+	PROPERTY_ENTRY_GPIO("charged-gpios", &baytrail_gpiochip_nodes[2], 10, GPIO_ACTIVE_HIGH),
+	{ }
+};
+
+static struct device *acer_a1_840_fg_dev;
+static struct fwnode_handle *acer_a1_840_fg_node;
+
+static int __init acer_a1_840_init(struct device *dev)
+{
+	int ret;
+
+	acer_a1_840_fg_dev = bus_find_device_by_name(&platform_bus_type, NULL, "chtdc_ti_battery");
+	if (!acer_a1_840_fg_dev)
+		return dev_err_probe(dev, -EPROBE_DEFER, "getting chtdc_ti_battery dev\n");
+
+	acer_a1_840_fg_node = fwnode_create_software_node(acer_a1_840_fg_props, NULL);
+	if (IS_ERR(acer_a1_840_fg_node)) {
+		ret = PTR_ERR(acer_a1_840_fg_node);
+		goto err_put;
+	}
+
+	ret = device_add_software_node(acer_a1_840_fg_dev,
+				       to_software_node(acer_a1_840_fg_node));
+	if (ret)
+		goto err_put;
+
+	return 0;
+
+err_put:
+	fwnode_handle_put(acer_a1_840_fg_node);
+	acer_a1_840_fg_node = NULL;
+	put_device(acer_a1_840_fg_dev);
+	acer_a1_840_fg_dev = NULL;
+	return ret;
+}
+
+static void acer_a1_840_exit(void)
+{
+	device_remove_software_node(acer_a1_840_fg_dev);
+	/*
+	 * Skip fwnode_handle_put(acer_a1_840_fg_node), instead leak the node.
+	 * The intel_dc_ti_battery driver may still reference the strdup-ed
+	 * "supplied-from" string. This string will be free-ed if the node
+	 * is released.
+	 */
+	acer_a1_840_fg_node = NULL;
+	put_device(acer_a1_840_fg_dev);
+	acer_a1_840_fg_dev = NULL;
+}
+
+static const char * const acer_a1_840_modules[] __initconst = {
+	"bq24190_charger",	/* For the Vbus regulator for intel-int3496 */
+	NULL
+};
+
+const struct x86_dev_info acer_a1_840_info __initconst = {
+	.i2c_client_info = acer_a1_840_i2c_clients,
+	.i2c_client_count = ARRAY_SIZE(acer_a1_840_i2c_clients),
+	.pdev_info = acer_a1_840_pdevs,
+	.pdev_count = ARRAY_SIZE(acer_a1_840_pdevs),
+	.gpiochip_type = X86_GPIOCHIP_BAYTRAIL,
+	.swnode_group = generic_lipo_4v2_battery_swnodes,
+	.modules = acer_a1_840_modules,
+	.init = acer_a1_840_init,
+	.exit = acer_a1_840_exit,
+};
+
 /* Acer Iconia One 7 B1-750 has an Android factory image with everything hardcoded */
 static const char * const acer_b1_750_mount_matrix[] = {
 	"-1", "0", "0",
diff --git a/drivers/platform/x86/x86-android-tablets/dmi.c b/drivers/platform/x86/x86-android-tablets/dmi.c
index ebba7400d5c9..4a5720d6fc1d 100644
--- a/drivers/platform/x86/x86-android-tablets/dmi.c
+++ b/drivers/platform/x86/x86-android-tablets/dmi.c
@@ -16,6 +16,16 @@
 #include "x86-android-tablets.h"
 
 const struct dmi_system_id x86_android_tablet_ids[] __initconst = {
+	{
+		/* Acer Iconia One 8 A1-840 (non FHD version) */
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "BayTrail"),
+			/* Above strings are too generic also match BIOS date */
+			DMI_MATCH(DMI_BIOS_DATE, "04/01/2014"),
+		},
+		.driver_data = (void *)&acer_a1_840_info,
+	},
 	{
 		/* Acer Iconia One 7 B1-750 */
 		.matches = {
diff --git a/drivers/platform/x86/x86-android-tablets/x86-android-tablets.h b/drivers/platform/x86/x86-android-tablets/x86-android-tablets.h
index 8e7d04bcb3f8..2498390958ad 100644
--- a/drivers/platform/x86/x86-android-tablets/x86-android-tablets.h
+++ b/drivers/platform/x86/x86-android-tablets/x86-android-tablets.h
@@ -111,6 +111,7 @@ extern const struct software_node cherryview_gpiochip_nodes[];
  * Extern declarations of x86_dev_info structs so there can be a single
  * MODULE_DEVICE_TABLE(dmi, ...), while splitting the board descriptions.
  */
+extern const struct x86_dev_info acer_a1_840_info;
 extern const struct x86_dev_info acer_b1_750_info;
 extern const struct x86_dev_info advantech_mica_071_info;
 extern const struct x86_dev_info asus_me176c_info;
-- 
2.51.0


  parent reply	other threads:[~2025-09-20 20:07 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-20 20:06 [PATCH v4 00/20] x86-android-tablets: convert to use GPIO references + Acer A1-840 support Hans de Goede
2025-09-20 20:06 ` [PATCH v4 01/20] platform/x86: x86-android-tablets: convert Goodix devices to GPIO references Hans de Goede
2026-02-08 23:32   ` Yauhen Kharuzhy
2026-02-09  8:08     ` Andy Shevchenko
2026-02-09 11:52       ` Bartosz Golaszewski
2026-02-09 14:00         ` Hans de Goede
2026-02-09 14:18           ` Hans de Goede
2026-02-09 23:13             ` Yauhen Kharuzhy
2026-02-10 10:46               ` Hans de Goede
2026-02-10 17:18                 ` Yauhen Kharuzhy
2026-02-09 14:36           ` Bartosz Golaszewski
2026-02-09 14:46             ` Dmitry Torokhov
2026-02-09 16:30               ` Bartosz Golaszewski
2026-02-09 16:40                 ` Dmitry Torokhov
2026-02-09 16:45                   ` Bartosz Golaszewski
2026-02-09 17:25                     ` Dmitry Torokhov
2026-02-09 14:41           ` Dmitry Torokhov
2026-02-09 15:13             ` Arnd Bergmann
2026-02-09 15:22               ` Andy Shevchenko
2026-02-14  0:29               ` Dmitry Torokhov
2026-02-09 15:50             ` Bartosz Golaszewski
2026-02-09 16:25             ` Bartosz Golaszewski
2026-02-09 17:23               ` Dmitry Torokhov
2026-02-09 20:24                 ` Bartosz Golaszewski
2026-02-09 20:41                   ` Dmitry Torokhov
2026-02-10  9:53                     ` Bartosz Golaszewski
2026-02-12  3:44                       ` Dmitry Torokhov
2026-02-12 10:01                         ` Bartosz Golaszewski
2026-02-12 10:24                           ` Bartosz Golaszewski
2026-02-12 10:28                           ` Andy Shevchenko
2026-02-12 15:49                             ` Dmitry Torokhov
2026-02-12 16:12                               ` Andy Shevchenko
2026-02-12 16:14                                 ` Andy Shevchenko
2026-02-12 16:50                                   ` Dmitry Torokhov
2026-02-12 17:07                                     ` Bartosz Golaszewski
2026-02-12 17:18                                       ` Dmitry Torokhov
2026-02-13 13:41                                         ` Bartosz Golaszewski
2026-02-13 14:03                                           ` Arnd Bergmann
2026-02-13 16:05                                           ` Hans de Goede
2026-02-13 16:18                                             ` Bartosz Golaszewski
2026-02-12 10:25                         ` Andy Shevchenko
2025-09-20 20:06 ` [PATCH v4 02/20] platform/x86: x86-android-tablets: convert Wacom " Hans de Goede
2025-09-20 20:06 ` [PATCH v4 03/20] platform/x86: x86-android-tablets: convert HiDeep " Hans de Goede
2025-09-20 20:06 ` [PATCH v4 04/20] platform/x86: x86-android-tablets: convert Novatek " Hans de Goede
2025-09-20 20:06 ` [PATCH v4 05/20] platform/x86: x86-android-tablets: convert EDT " Hans de Goede
2025-09-20 20:06 ` [PATCH v4 06/20] platform/x86: x86-android-tablets: convert int3496 " Hans de Goede
2025-09-20 20:07 ` [PATCH v4 07/20] platform/x86: x86-android-tablets: convert wm1502 " Hans de Goede
2025-09-20 20:07 ` [PATCH v4 08/20] platform/x86: x86-android-tablets: convert HID-I2C " Hans de Goede
2025-09-20 20:07 ` [PATCH v4 09/20] platform/x86: x86-android-tablets: convert Yoga Tab2 fast charger " Hans de Goede
2025-09-20 20:07 ` [PATCH v4 10/20] platform/x86: x86-android-tablets: remove support for GPIO lookup tables Hans de Goede
2025-09-20 20:07 ` [PATCH v4 11/20] platform/x86: x86-android-tablets: convert gpio_keys devices to GPIO references Hans de Goede
2025-09-20 20:07 ` [PATCH v4 12/20] platform/x86: x86-android-tablets: replace bat_swnode with swnode_group Hans de Goede
2025-09-20 20:07 ` [PATCH v4 13/20] platform/x86: x86-android-tablets: use swnode_group instead of manual registering Hans de Goede
2025-09-20 20:07 ` [PATCH v4 14/20] platform/x86: x86-android-tablets: Simplify node-group [un]registration Hans de Goede
2025-09-21 19:37   ` Andy Shevchenko
2025-09-20 20:07 ` [PATCH v4 15/20] platform/x86: x86-android-tablets: Update my email address Hans de Goede
2025-09-20 20:07 ` [PATCH v4 16/20] platform/x86: x86-android-tablets: Move Acer info to its own file Hans de Goede
2025-09-20 20:07 ` Hans de Goede [this message]
2025-09-20 20:07 ` [PATCH v4 18/20] platform/x86: x86-android-tablets: Simplify lenovo_yoga_tab2_830_1050_exit() Hans de Goede
2025-09-20 20:07 ` [PATCH v4 19/20] platform/x86: x86-android-tablets: Fix modules lists for Lenovo devices Hans de Goede
2025-09-20 20:07 ` [PATCH v4 20/20] platform/x86: x86-android-tablets: Stop using EPROBE_DEFER Hans de Goede
2025-09-24 12:58 ` [PATCH v4 00/20] x86-android-tablets: convert to use GPIO references + Acer A1-840 support Ilpo Järvinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250920200713.20193-18-hansg@kernel.org \
    --to=hansg@kernel.org \
    --cc=andy@kernel.org \
    --cc=arnd@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.