summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Wang2024-02-04 04:18:43 -0600
committerNicholas Wang2024-02-04 04:21:02 -0600
commit4e70cad7989d22ef3a1e6fa01644d6c24e613776 (patch)
treee9eb1e8879b50c507f94ec8ea97f4b16090520f5
parentab11261fa2f4e97d0fe0235559b85373afa3121c (diff)
downloadaur-4e70cad7989d22ef3a1e6fa01644d6c24e613776.tar.gz
nicholascw initial commit
-rw-r--r--.SRCINFO22
-rw-r--r--Makefile4
-rw-r--r--PKGBUILD21
-rw-r--r--goodix.c133
-rw-r--r--goodixparam.conf (renamed from goodixgpdw3.conf)0
5 files changed, 91 insertions, 89 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 7d5b85620659..939dc56cabec 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,8 @@
-pkgbase = goodix-gpdwin3-dkms
- pkgdesc = Patched Goodix touchscreen driver for GPD WIN3
- pkgver = 6.2.1
+pkgbase = goodix-param-dkms
+ pkgdesc = Patched Goodix touchscreen with parameters
+ pkgver = 6.7.3
pkgrel = 1
+ url = https://github.com/nicholascw/aur-goodix-param-dkms
arch = any
license = GPL2
depends = dkms
@@ -10,12 +11,11 @@ pkgbase = goodix-gpdwin3-dkms
source = goodix_fwupload.c
source = dkms.conf
source = Makefile
- source = goodixgpdw3.conf
- md5sums = c0e99fdd6b2778ad43cf7a03a6063cb6
- md5sums = aec7f644a9a305c4102665137c7f248b
- md5sums = 190deba40c822b9d4f89672bc4e610e9
- md5sums = f514c2a1d6de0f50ea5ebc112447ff7d
- md5sums = aa21936d9b3341c25761f7c4a827f39d
- md5sums = 1505740dffca34d8119f3798a0624ebc
+ source = goodixparam.conf
+ md5sums = SKIP
+ md5sums = SKIP
+ md5sums = SKIP
+ md5sums = SKIP
+ md5sums = SKIP
-pkgname = goodix-gpdwin3-dkms
+pkgname = goodix-param-dkms
diff --git a/Makefile b/Makefile
index 3829d35333ea..ce7e82360bb7 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
BASE_NAME := goodix
-obj-m := goodix-gpdwin3.o
-goodix-gpdwin3-objs := $(BASE_NAME).o $(BASE_NAME)_fwupload.o
+obj-m := goodix-param.o
+goodix-param-objs := $(BASE_NAME).o $(BASE_NAME)_fwupload.o
all: modules
diff --git a/PKGBUILD b/PKGBUILD
index 5ccf81ec3153..c7b4a3c6b79f 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,10 +1,11 @@
-# Maintainer: kylon
+# Maintainer: Nicholas Wang <me at nicho1as dot wang>
-_pkgbase=goodix-gpdwin3
+_pkgbase=goodix-param
pkgname=${_pkgbase}-dkms
-pkgver=6.2.1
+pkgver=6.7.3
pkgrel=1
-pkgdesc="Patched Goodix touchscreen driver for GPD WIN3"
+pkgdesc="Patched Goodix touchscreen with parameters"
+url="https://github.com/nicholascw/aur-goodix-param-dkms"
arch=('any')
license=('GPL2')
depends=('dkms')
@@ -14,14 +15,10 @@ source=(
"goodix_fwupload.c"
"dkms.conf"
"Makefile"
- "goodixgpdw3.conf"
+ "goodixparam.conf"
)
-md5sums=('c0e99fdd6b2778ad43cf7a03a6063cb6'
- 'aec7f644a9a305c4102665137c7f248b'
- '190deba40c822b9d4f89672bc4e610e9'
- 'f514c2a1d6de0f50ea5ebc112447ff7d'
- 'aa21936d9b3341c25761f7c4a827f39d'
- '1505740dffca34d8119f3798a0624ebc')
+
+md5sums=('SKIP' 'SKIP' 'SKIP' 'SKIP' 'SKIP')
package() {
cd "$srcdir"
@@ -37,6 +34,6 @@ package() {
install -Dm644 goodix.h "${install_dir}/goodix.h"
install -Dm644 goodix_fwupload.c "${install_dir}/goodix_fwupload.c"
install -Dm644 Makefile "${install_dir}/Makefile"
- install -Dm644 goodixgpdw3.conf "${pkgdir}/etc/modprobe.d/goodixgpdw3.conf"
+ install -Dm644 goodixparam.conf "${pkgdir}/etc/modprobe.d/goodixparam.conf"
}
diff --git a/goodix.c b/goodix.c
index df5432f748b3..7f543bc1a6c5 100644
--- a/goodix.c
+++ b/goodix.c
@@ -121,31 +121,21 @@ static const unsigned long goodix_irq_flags[] = {
IRQ_TYPE_LEVEL_HIGH,
};
-#ifdef CONFIG_ACPI
-/*
- * Devices that need acpi_gpio_mapping to function correctly
- */
-static const struct dmi_system_id need_gpio_mapping[] = {
+static const struct dmi_system_id nine_bytes_report[] = {
#if defined(CONFIG_DMI) && defined(CONFIG_X86)
{
- .ident = "GPD WIN3",
+ /* Lenovo Yoga Book X90F / X90L */
.matches = {
- DMI_MATCH(DMI_SYS_VENDOR, "GPD"),
- DMI_MATCH(DMI_PRODUCT_NAME, "G1618-03")
- },
+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Intel Corporation"),
+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "CHERRYVIEW D1 PLATFORM"),
+ DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "YETI-11"),
+ }
},
-#endif
- {}
-};
-#endif
-
-static const struct dmi_system_id nine_bytes_report[] = {
-#if defined(CONFIG_DMI) && defined(CONFIG_X86)
{
- .ident = "Lenovo YogaBook",
- /* YB1-X91L/F and YB1-X90L/F */
+ /* Lenovo Yoga Book X91F / X91L */
.matches = {
- DMI_MATCH(DMI_PRODUCT_NAME, "Lenovo YB1-X9")
+ /* Non exact match to match F + L versions */
+ DMI_MATCH(DMI_PRODUCT_NAME, "Lenovo YB1-X91"),
}
},
#endif
@@ -168,6 +158,13 @@ static const struct dmi_system_id inverted_x_screen[] = {
{}
};
+static int invert_x = -1;
+module_param(invert_x,int,0440);
+static int invert_y = -1;
+module_param(invert_y,int,0440);
+static int swap_x_y = -1;
+module_param(swap_x_y,int,0440);
+
/**
* goodix_i2c_read - read data from a register of the i2c slave device.
*
@@ -894,7 +891,8 @@ static int goodix_add_acpi_gpio_mappings(struct goodix_ts_data *ts)
}
}
- if (ts->gpio_count == 2 && ts->gpio_int_idx == 0) {
+ /* Some devices with gpio_int_idx 0 list a third unused GPIO */
+ if ((ts->gpio_count == 2 || ts->gpio_count == 3) && ts->gpio_int_idx == 0) {
ts->irq_pin_access_method = IRQ_PIN_ACCESS_ACPI_GPIO;
gpio_mapping = acpi_goodix_int_first_gpios;
} else if (ts->gpio_count == 2 && ts->gpio_int_idx == 1) {
@@ -910,6 +908,25 @@ static int goodix_add_acpi_gpio_mappings(struct goodix_ts_data *ts)
dev_info(dev, "No ACPI GpioInt resource, assuming that the GPIO order is reset, int\n");
ts->irq_pin_access_method = IRQ_PIN_ACCESS_ACPI_GPIO;
gpio_mapping = acpi_goodix_int_last_gpios;
+ } else if (ts->gpio_count == 1 && ts->gpio_int_idx == 0) {
+ /*
+ * On newer devices there is only 1 GpioInt resource and _PS0
+ * does the whole reset sequence for us.
+ */
+ acpi_device_fix_up_power(ACPI_COMPANION(dev));
+
+ /*
+ * Before the _PS0 call the int GPIO may have been in output
+ * mode and the call should have put the int GPIO in input mode,
+ * but the GPIO subsys cached state may still think it is
+ * in output mode, causing gpiochip_lock_as_irq() failure.
+ *
+ * Add a mapping for the int GPIO to make the
+ * gpiod_int = gpiod_get(..., GPIOD_IN) call succeed,
+ * which will explicitly set the direction to input.
+ */
+ ts->irq_pin_access_method = IRQ_PIN_ACCESS_NONE;
+ gpio_mapping = acpi_goodix_int_first_gpios;
} else {
dev_warn(dev, "Unexpected ACPI resources: gpio_count %d, gpio_int_idx %d\n",
ts->gpio_count, ts->gpio_int_idx);
@@ -945,7 +962,6 @@ static int goodix_add_acpi_gpio_mappings(struct goodix_ts_data *ts)
*/
static int goodix_get_gpio_config(struct goodix_ts_data *ts)
{
- int error;
struct device *dev;
struct gpio_desc *gpiod;
bool added_acpi_mappings = false;
@@ -961,33 +977,20 @@ static int goodix_get_gpio_config(struct goodix_ts_data *ts)
ts->gpiod_rst_flags = GPIOD_IN;
ts->avdd28 = devm_regulator_get(dev, "AVDD28");
- if (IS_ERR(ts->avdd28)) {
- error = PTR_ERR(ts->avdd28);
- if (error != -EPROBE_DEFER)
- dev_err(dev,
- "Failed to get AVDD28 regulator: %d\n", error);
- return error;
- }
+ if (IS_ERR(ts->avdd28))
+ return dev_err_probe(dev, PTR_ERR(ts->avdd28), "Failed to get AVDD28 regulator\n");
ts->vddio = devm_regulator_get(dev, "VDDIO");
- if (IS_ERR(ts->vddio)) {
- error = PTR_ERR(ts->vddio);
- if (error != -EPROBE_DEFER)
- dev_err(dev,
- "Failed to get VDDIO regulator: %d\n", error);
- return error;
- }
+ if (IS_ERR(ts->vddio))
+ return dev_err_probe(dev, PTR_ERR(ts->vddio), "Failed to get VDDIO regulator\n");
retry_get_irq_gpio:
/* Get the interrupt GPIO pin number */
gpiod = devm_gpiod_get_optional(dev, GOODIX_GPIO_INT_NAME, GPIOD_IN);
- if (IS_ERR(gpiod)) {
- error = PTR_ERR(gpiod);
- if (error != -EPROBE_DEFER)
- dev_err(dev, "Failed to get %s GPIO: %d\n",
- GOODIX_GPIO_INT_NAME, error);
- return error;
- }
+ if (IS_ERR(gpiod))
+ return dev_err_probe(dev, PTR_ERR(gpiod), "Failed to get %s GPIO\n",
+ GOODIX_GPIO_INT_NAME);
+
if (!gpiod && has_acpi_companion(dev) && !added_acpi_mappings) {
added_acpi_mappings = true;
if (goodix_add_acpi_gpio_mappings(ts) == 0)
@@ -998,13 +1001,9 @@ retry_get_irq_gpio:
/* Get the reset line GPIO pin number */
gpiod = devm_gpiod_get_optional(dev, GOODIX_GPIO_RST_NAME, ts->gpiod_rst_flags);
- if (IS_ERR(gpiod)) {
- error = PTR_ERR(gpiod);
- if (error != -EPROBE_DEFER)
- dev_err(dev, "Failed to get %s GPIO: %d\n",
- GOODIX_GPIO_RST_NAME, error);
- return error;
- }
+ if (IS_ERR(gpiod))
+ return dev_err_probe(dev, PTR_ERR(gpiod), "Failed to get %s GPIO\n",
+ GOODIX_GPIO_RST_NAME);
ts->gpiod_rst = gpiod;
@@ -1219,6 +1218,24 @@ retry_read_config:
"Applying 'inverted x screen' quirk\n");
}
+ if (invert_x != -1) {
+ ts->prop.invert_x = invert_x;
+ dev_dbg(&ts->client->dev,
+ "'invert_x' overridden\n");
+ }
+
+ if (invert_y != -1) {
+ ts->prop.invert_y = invert_y;
+ dev_dbg(&ts->client->dev,
+ "'invert_y' overridden\n");
+ }
+
+ if (swap_x_y != -1) {
+ ts->prop.swap_x_y = swap_x_y;
+ dev_dbg(&ts->client->dev,
+ "'swap_x_y' overridden\n");
+ }
+
error = input_mt_init_slots(ts->input_dev, ts->max_touch_num,
INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED);
if (error) {
@@ -1302,9 +1319,6 @@ static void goodix_disable_regulators(void *arg)
static int goodix_ts_probe(struct i2c_client *client)
{
-#ifdef CONFIG_ACPI
- const struct dmi_system_id *dmi_match = dmi_first_match(need_gpio_mapping);
-#endif
struct goodix_ts_data *ts;
const char *cfg_name;
int error;
@@ -1325,17 +1339,6 @@ static int goodix_ts_probe(struct i2c_client *client)
init_completion(&ts->firmware_loading_complete);
ts->contact_size = GOODIX_CONTACT_SIZE;
-#ifdef CONFIG_ACPI
- if (dmi_match) {
- dev_info(&client->dev, "GPD GPIO mapping quirk applied.\n");
- devm_acpi_dev_add_driver_gpios(&client->dev, acpi_goodix_int_first_gpios);
-
- // set props
- ts->reset_controller_at_probe = 1;
- ts->irq_pin_access_method = IRQ_PIN_ACCESS_ACPI_GPIO;
- }
-#endif
-
error = goodix_get_gpio_config(ts);
if (error)
return error;
@@ -1541,6 +1544,7 @@ MODULE_DEVICE_TABLE(i2c, goodix_ts_id);
static const struct acpi_device_id goodix_acpi_match[] = {
{ "GDIX1001", 0 },
{ "GDIX1002", 0 },
+ { "GDX9110", 0 },
{ }
};
MODULE_DEVICE_TABLE(acpi, goodix_acpi_match);
@@ -1568,7 +1572,7 @@ MODULE_DEVICE_TABLE(of, goodix_of_match);
#endif
static struct i2c_driver goodix_ts_driver = {
- .probe_new = goodix_ts_probe,
+ .probe = goodix_ts_probe,
.remove = goodix_ts_remove,
.id_table = goodix_ts_id,
.driver = {
@@ -1582,5 +1586,6 @@ module_i2c_driver(goodix_ts_driver);
MODULE_AUTHOR("Benjamin Tissoires <benjamin.tissoires@gmail.com>");
MODULE_AUTHOR("Bastien Nocera <hadess@hadess.net>");
+MODULE_AUTHOR("Nicholas Wang <me@nicho1as.wang>");
MODULE_DESCRIPTION("Goodix touchscreen driver");
MODULE_LICENSE("GPL v2");
diff --git a/goodixgpdw3.conf b/goodixparam.conf
index c53a8d28c778..c53a8d28c778 100644
--- a/goodixgpdw3.conf
+++ b/goodixparam.conf