linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: "Rafael J . Wysocki" <rafael@kernel.org>,
	Mark Gross <markgross@kernel.org>,
	Andy Shevchenko <andy@kernel.org>, Wolfram Sang <wsa@kernel.org>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	Rob Herring <robh@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jirislaby@kernel.org>
Cc: Hans de Goede <hdegoede@redhat.com>, Len Brown <lenb@kernel.org>,
	linux-acpi@vger.kernel.org, platform-driver-x86@vger.kernel.org,
	linux-i2c@vger.kernel.org, Stephan Gerhold <stephan@gerhold.net>,
	linux-serial@vger.kernel.org
Subject: [PATCH 12/12] platform/x86: x86-android-tablets: Add TM800A550L data
Date: Thu, 30 Dec 2021 00:14:31 +0100	[thread overview]
Message-ID: <20211229231431.437982-13-hdegoede@redhat.com> (raw)
In-Reply-To: <20211229231431.437982-1-hdegoede@redhat.com>

The whitelabel (sold as various brands) TM800A550L tablets's DSDT contains
a whole bunch of bogus ACPI I2C devices and the ACPI node describing
the touchscreen is bad (the IRQ is missing). Enumeration of these is
skipped through the acpi_quirk_skip_i2c_client_enumeration().

Add support for manually instantiating the (now) missing I2C devices by
adding the necessary device info to the x86-android-tablets module,
including instantiating an actually working i2c-client for
the touchscreen.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/platform/x86/x86-android-tablets.c | 90 ++++++++++++++++++++++
 1 file changed, 90 insertions(+)

diff --git a/drivers/platform/x86/x86-android-tablets.c b/drivers/platform/x86/x86-android-tablets.c
index fb257b5811d3..5f66fab6100e 100644
--- a/drivers/platform/x86/x86-android-tablets.c
+++ b/drivers/platform/x86/x86-android-tablets.c
@@ -534,6 +534,86 @@ static const struct x86_dev_info xiaomi_mipad2_info __initconst = {
 	.i2c_client_count = ARRAY_SIZE(xiaomi_mipad2_i2c_clients),
 };
 
+/*
+ * 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 fwnode has the wrong GPIOs.
+ */
+static const char * const whitelabel_tm800a550l_accel_mount_matrix[] = {
+	"-1", "0", "0",
+	"0", "1", "0",
+	"0", "0", "1"
+};
+
+static const struct property_entry whitelabel_tm800a550l_accel_props[] = {
+	PROPERTY_ENTRY_STRING_ARRAY("mount-matrix", whitelabel_tm800a550l_accel_mount_matrix),
+	{ }
+};
+
+static const struct software_node whitelabel_tm800a550l_accel_node = {
+	.properties = whitelabel_tm800a550l_accel_props,
+};
+
+static const struct property_entry whitelabel_tm800a550l_goodix_props[] = {
+	PROPERTY_ENTRY_STRING("firmware-name", "gt912-tm800a550l.fw"),
+	PROPERTY_ENTRY_STRING("goodix,config-name", "gt912-tm800a550l.cfg"),
+	PROPERTY_ENTRY_U32("goodix,main-clk", 54),
+	{ }
+};
+
+static const struct software_node whitelabel_tm800a550l_goodix_node = {
+	.properties = whitelabel_tm800a550l_goodix_props,
+};
+
+static const struct x86_i2c_client_info whitelabel_tm800a550l_i2c_clients[] __initconst = {
+	{
+		/* goodix touchscreen */
+		.board_info = {
+			.type = "GDIX1001:00",
+			.addr = 0x14,
+			.dev_name = "goodix_ts",
+			.swnode = &whitelabel_tm800a550l_goodix_node,
+		},
+		.adapter_path = "\\_SB_.I2C2",
+		.irq_data = {
+			.type = X86_ACPI_IRQ_TYPE_APIC,
+			.index = 0x44,
+			.trigger = ACPI_EDGE_SENSITIVE,
+			.polarity = ACPI_ACTIVE_HIGH,
+		},
+	}, {
+		/* kxcj91008 accel */
+		.board_info = {
+			.type = "kxcj91008",
+			.addr = 0x0f,
+			.dev_name = "kxcj91008",
+			.swnode = &whitelabel_tm800a550l_accel_node,
+		},
+		.adapter_path = "\\_SB_.I2C3",
+	},
+};
+
+static struct gpiod_lookup_table whitelabel_tm800a550l_goodix_gpios = {
+	.dev_id = "i2c-goodix_ts",
+	.table = {
+		GPIO_LOOKUP("INT33FC:01", 26, "reset", GPIO_ACTIVE_HIGH),
+		GPIO_LOOKUP("INT33FC:02", 3, "irq", GPIO_ACTIVE_HIGH),
+		{ }
+	},
+};
+
+static struct gpiod_lookup_table *whitelabel_tm800a550l_gpios[] = {
+	&whitelabel_tm800a550l_goodix_gpios,
+	NULL
+};
+
+static const struct x86_dev_info whitelabel_tm800a550l_info __initconst = {
+	.i2c_client_info = whitelabel_tm800a550l_i2c_clients,
+	.i2c_client_count = ARRAY_SIZE(whitelabel_tm800a550l_i2c_clients),
+	.gpiod_lookup_tables = whitelabel_tm800a550l_gpios,
+};
+
 static const struct dmi_system_id x86_android_tablet_ids[] __initconst = {
 	{
 		/* Asus MeMO Pad 7 ME176C */
@@ -568,6 +648,16 @@ static const struct dmi_system_id x86_android_tablet_ids[] __initconst = {
 		},
 		.driver_data = (void *)&xiaomi_mipad2_info,
 	},
+	{
+		/* Whitelabel (sold as various brands) TM800A550L */
+		.matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
+			DMI_MATCH(DMI_BOARD_NAME, "Aptio CRB"),
+			/* Above strings are too generic, also match on BIOS version */
+			DMI_MATCH(DMI_BIOS_VERSION, "ZY-8-BI-PX4S70VTR400-X423B-005-D"),
+		},
+		.driver_data = (void *)&whitelabel_tm800a550l_info,
+	},
 	{ }
 };
 MODULE_DEVICE_TABLE(dmi, x86_android_tablet_ids);
-- 
2.33.1


  parent reply	other threads:[~2021-12-29 23:15 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-29 23:14 [PATCH 00/12] ACPI / pdx86: Add support for x86 Android tablets with broken DSDTs Hans de Goede
2021-12-29 23:14 ` [PATCH 01/12] ACPI / x86: Add acpi_quirk_skip_[i2c_client|serdev]_enumeration() helpers Hans de Goede
2021-12-29 23:14 ` [PATCH 02/12] i2c: acpi: Do not instantiate I2C-clients on boards with known bogus DSDT entries Hans de Goede
2021-12-30 12:03   ` Mika Westerberg
2021-12-30 12:21   ` Wolfram Sang
2021-12-30 12:34     ` Hans de Goede
2021-12-29 23:14 ` [PATCH 03/12] serdev: Do not instantiate serdevs " Hans de Goede
2021-12-30 12:44   ` Greg Kroah-Hartman
2021-12-29 23:14 ` [PATCH 04/12] platform/x86: x86-android-tablets: Don't return -EPROBE_DEFER from a non probe() function Hans de Goede
2021-12-29 23:14 ` [PATCH 05/12] platform/x86: x86-android-tablets: Add support for PMIC interrupts Hans de Goede
2021-12-29 23:14 ` [PATCH 06/12] platform/x86: x86-android-tablets: Add support for instantiating platform-devs Hans de Goede
2021-12-29 23:14 ` [PATCH 07/12] platform/x86: x86-android-tablets: Add support for instantiating serdevs Hans de Goede
2021-12-29 23:14 ` [PATCH 08/12] platform/x86: x86-android-tablets: Add support for registering GPIO lookup tables Hans de Goede
2021-12-29 23:14 ` [PATCH 09/12] platform/x86: x86-android-tablets: Add support for preloading modules Hans de Goede
2021-12-29 23:14 ` [PATCH 10/12] platform/x86: x86-android-tablets: Add Asus TF103C data Hans de Goede
2021-12-29 23:14 ` [PATCH 11/12] platform/x86: x86-android-tablets: Add Asus MeMO Pad 7 ME176C data Hans de Goede
2021-12-29 23:14 ` Hans de Goede [this message]
2021-12-30 11:57 ` [PATCH 00/12] ACPI / pdx86: Add support for x86 Android tablets with broken DSDTs Wolfram Sang
2022-01-03 11:42 ` Hans de Goede

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=20211229231431.437982-13-hdegoede@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=andy@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=markgross@kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=robh@kernel.org \
    --cc=stephan@gerhold.net \
    --cc=wsa@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).