diff options
author | gituser | 2022-06-24 13:06:10 +0200 |
---|---|---|
committer | gituser | 2022-06-24 13:06:10 +0200 |
commit | 6ac6dbd0c572ee732c4a55fbb0b1bb1208dd9c65 (patch) | |
tree | a1b104d0f321459b44d880db36a15a0cf6d73460 | |
parent | 10aff3cb71bc69395d8c60e209aa179f9a47e7a7 (diff) | |
download | aur-6ac6dbd0c572ee732c4a55fbb0b1bb1208dd9c65.tar.gz |
sync with linux 5.18
-rw-r--r-- | .SRCINFO | 10 | ||||
-rw-r--r-- | PKGBUILD | 10 | ||||
-rw-r--r-- | goodix.c | 95 | ||||
-rw-r--r-- | goodix.h | 1 | ||||
-rw-r--r-- | goodix_fwupload.c | 1 |
5 files changed, 59 insertions, 58 deletions
@@ -1,7 +1,7 @@ pkgbase = goodix-gpdwin3-dkms pkgdesc = Goodix touchscreen driver hack for GPD WIN3 - pkgver = 1.1 - pkgrel = 3 + pkgver = 1.2 + pkgrel = 1 arch = any license = GPL2 depends = dkms @@ -11,9 +11,9 @@ pkgbase = goodix-gpdwin3-dkms source = dkms.conf source = Makefile source = goodixgpdw3.conf - md5sums = 6ef1b9c306d7996e7bfdb9cc50677f81 - md5sums = 7543431323fd4a1efb2d381b69886ef9 - md5sums = 616b595d278b52a265156c2fa68a740c + md5sums = 99ff84de79c1f5191f3838c517a9b57c + md5sums = aec7f644a9a305c4102665137c7f248b + md5sums = 190deba40c822b9d4f89672bc4e610e9 md5sums = f514c2a1d6de0f50ea5ebc112447ff7d md5sums = aa21936d9b3341c25761f7c4a827f39d md5sums = 1505740dffca34d8119f3798a0624ebc @@ -2,8 +2,8 @@ _pkgbase=goodix-gpdwin3 pkgname=${_pkgbase}-dkms -pkgver=1.1 -pkgrel=3 +pkgver=1.2 +pkgrel=1 pkgdesc="Goodix touchscreen driver hack for GPD WIN3" arch=('any') license=('GPL2') @@ -16,9 +16,9 @@ source=( "Makefile" "goodixgpdw3.conf" ) -md5sums=('6ef1b9c306d7996e7bfdb9cc50677f81' - '7543431323fd4a1efb2d381b69886ef9' - '616b595d278b52a265156c2fa68a740c' +md5sums=('99ff84de79c1f5191f3838c517a9b57c' + 'aec7f644a9a305c4102665137c7f248b' + '190deba40c822b9d4f89672bc4e610e9' 'f514c2a1d6de0f50ea5ebc112447ff7d' 'aa21936d9b3341c25761f7c4a827f39d' '1505740dffca34d8119f3798a0624ebc') @@ -18,6 +18,7 @@ #include <linux/delay.h> #include <linux/irq.h> #include <linux/interrupt.h> +#include <linux/platform_data/x86/soc.h> #include <linux/slab.h> #include <linux/acpi.h> #include <linux/of.h> @@ -315,32 +316,17 @@ static int goodix_ts_read_input_report(struct goodix_ts_data *ts, u8 *data) return -ENOMSG; } -static struct input_dev *goodix_create_pen_input(struct goodix_ts_data *ts) +static int goodix_create_pen_input(struct goodix_ts_data *ts) { struct device *dev = &ts->client->dev; struct input_dev *input; input = devm_input_allocate_device(dev); if (!input) - return NULL; - - input_alloc_absinfo(input); - if (!input->absinfo) { - input_free_device(input); - return NULL; - } - - input->absinfo[ABS_X] = ts->input_dev->absinfo[ABS_MT_POSITION_X]; - input->absinfo[ABS_Y] = ts->input_dev->absinfo[ABS_MT_POSITION_Y]; - __set_bit(ABS_X, input->absbit); - __set_bit(ABS_Y, input->absbit); - input_set_abs_params(input, ABS_PRESSURE, 0, 255, 0, 0); + return -ENOMEM; - input_set_capability(input, EV_KEY, BTN_TOUCH); - input_set_capability(input, EV_KEY, BTN_TOOL_PEN); - input_set_capability(input, EV_KEY, BTN_STYLUS); - input_set_capability(input, EV_KEY, BTN_STYLUS2); - __set_bit(INPUT_PROP_DIRECT, input->propbit); + input_copy_abs(input, ABS_X, ts->input_dev, ABS_MT_POSITION_X); + input_copy_abs(input, ABS_Y, ts->input_dev, ABS_MT_POSITION_Y); /* * The resolution of these touchscreens is about 10 units/mm, the actual * resolution does not matter much since we set INPUT_PROP_DIRECT. @@ -348,6 +334,13 @@ static struct input_dev *goodix_create_pen_input(struct goodix_ts_data *ts) */ input_abs_set_res(input, ABS_X, 10); input_abs_set_res(input, ABS_Y, 10); + input_set_abs_params(input, ABS_PRESSURE, 0, 255, 0, 0); + + input_set_capability(input, EV_KEY, BTN_TOUCH); + input_set_capability(input, EV_KEY, BTN_TOOL_PEN); + input_set_capability(input, EV_KEY, BTN_STYLUS); + input_set_capability(input, EV_KEY, BTN_STYLUS2); + __set_bit(INPUT_PROP_DIRECT, input->propbit); input->name = "Goodix Active Pen"; input->phys = "input/pen"; @@ -357,25 +350,23 @@ static struct input_dev *goodix_create_pen_input(struct goodix_ts_data *ts) input->id.product = 0x1001; input->id.version = ts->version; - if (input_register_device(input) != 0) { - input_free_device(input); - return NULL; - } - - return input; + ts->input_pen = input; + return 0; } static void goodix_ts_report_pen_down(struct goodix_ts_data *ts, u8 *data) { - int input_x, input_y, input_w; + int input_x, input_y, input_w, error; u8 key_value; - if (!ts->input_pen) { - ts->input_pen = goodix_create_pen_input(ts); - if (!ts->input_pen) - return; + if (!ts->pen_input_registered) { + error = input_register_device(ts->input_pen); + ts->pen_input_registered = (error == 0) ? 1 : error; } + if (ts->pen_input_registered < 0) + return; + if (ts->contact_size == 9) { input_x = get_unaligned_le16(&data[4]); input_y = get_unaligned_le16(&data[6]); @@ -823,21 +814,6 @@ static int goodix_reset(struct goodix_ts_data *ts) } #ifdef ACPI_GPIO_SUPPORT -#include <asm/cpu_device_id.h> -#include <asm/intel-family.h> - -static const struct x86_cpu_id baytrail_cpu_ids[] = { - { X86_VENDOR_INTEL, 6, INTEL_FAM6_ATOM_SILVERMONT, X86_FEATURE_ANY, }, - {} -}; - -static inline bool is_byt(void) -{ - const struct x86_cpu_id *id = x86_match_cpu(baytrail_cpu_ids); - - return !!id; -} - static const struct acpi_gpio_params first_gpio = { 0, 0, false }; static const struct acpi_gpio_params second_gpio = { 1, 0, false }; @@ -896,7 +872,7 @@ static int goodix_add_acpi_gpio_mappings(struct goodix_ts_data *ts) const struct acpi_gpio_mapping *gpio_mapping = NULL; struct device *dev = &ts->client->dev; LIST_HEAD(resources); - int ret; + int irq, ret; ts->gpio_count = 0; ts->gpio_int_idx = -1; @@ -909,6 +885,20 @@ static int goodix_add_acpi_gpio_mappings(struct goodix_ts_data *ts) acpi_dev_free_resource_list(&resources); + /* + * CHT devices should have a GpioInt + a regular GPIO ACPI resource. + * Some CHT devices have a bug (where the also is bogus Interrupt + * resource copied from a previous BYT based generation). i2c-core-acpi + * will use the non-working Interrupt resource, fix this up. + */ + if (soc_intel_is_cht() && ts->gpio_count == 2 && ts->gpio_int_idx != -1) { + irq = acpi_dev_gpio_irq_get(ACPI_COMPANION(dev), 0); + if (irq > 0 && irq != ts->client->irq) { + dev_warn(dev, "Overriding IRQ %d -> %d\n", ts->client->irq, irq); + ts->client->irq = irq; + } + } + if (ts->gpio_count == 2 && ts->gpio_int_idx == 0) { ts->irq_pin_access_method = IRQ_PIN_ACCESS_ACPI_GPIO; gpio_mapping = acpi_goodix_int_first_gpios; @@ -921,7 +911,7 @@ static int goodix_add_acpi_gpio_mappings(struct goodix_ts_data *ts) dev_info(dev, "Using ACPI INTI and INTO methods for IRQ pin access\n"); ts->irq_pin_access_method = IRQ_PIN_ACCESS_ACPI_METHOD; gpio_mapping = acpi_goodix_reset_only_gpios; - } else if (is_byt() && ts->gpio_count == 2 && ts->gpio_int_idx == -1) { + } else if (soc_intel_is_byt() && ts->gpio_count == 2 && ts->gpio_int_idx == -1) { 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; @@ -1233,6 +1223,17 @@ static int goodix_configure_dev(struct goodix_ts_data *ts) return error; } + /* + * Create the input_pen device before goodix_request_irq() calls + * devm_request_threaded_irq() so that the devm framework frees + * it after disabling the irq. + * Unfortunately there is no way to detect if the touchscreen has pen + * support, so registering the dev is delayed till the first pen event. + */ + error = goodix_create_pen_input(ts); + if (error) + return error; + ts->irq_flags = goodix_irq_flags[ts->int_trigger_type] | IRQF_ONESHOT; error = goodix_request_irq(ts); if (error) { @@ -94,6 +94,7 @@ struct goodix_ts_data { u16 version; bool reset_controller_at_probe; bool load_cfg_from_disk; + int pen_input_registered; struct completion firmware_loading_complete; unsigned long irq_flags; enum goodix_irq_pin_access_method irq_pin_access_method; diff --git a/goodix_fwupload.c b/goodix_fwupload.c index 046838be45a6..191d4f38d991 100644 --- a/goodix_fwupload.c +++ b/goodix_fwupload.c @@ -425,4 +425,3 @@ void goodix_save_bak_ref(struct goodix_ts_data *ts) ts->bak_ref[ts->bak_ref_len - 1] = 1; } } - |