Re: [PATCH v7 03/48] Input: atmel_mxt_ts - only read messages in mxt_acquire_irq() when necessary

From: Wang, Jiada
Date: Wed Mar 18 2020 - 09:02:53 EST


Hello Dmitry

On 2020/03/18 7:44, Dmitry Osipenko wrote:
12.02.2020 11:41, Jiada Wang ÐÐÑÐÑ:
From: Nick Dyer <nick.dyer@xxxxxxxxxxx>

The workaround of reading all messages until an invalid is received is a
way of forcing the CHG line high, which means that when using
edge-triggered interrupts the interrupt can be acquired.

With level-triggered interrupts the workaround is unnecessary.

Also, most recent maXTouch chips have a feature called RETRIGEN which, when
enabled, reasserts the interrupt line every cycle if there are messages
waiting. This also makes the workaround unnecessary.

Note: the RETRIGEN feature is only in some firmware versions/chips, it's
not valid simply to enable the bit.

...
+static int mxt_check_retrigen(struct mxt_data *data)
+{
+ struct i2c_client *client = data->client;
+ int error;
+ int val;
+
+ data->use_retrigen_workaround = false;
+
+ if (irq_get_trigger_type(data->irq) & IRQF_TRIGGER_LOW)
+ return 0;
+
+ if (data->T18_address) {
+ error = __mxt_read_reg(client,
+ data->T18_address + MXT_COMMS_CTRL,
+ 1, &val);
+ if (error)
+ return error;
+
+ if (val & MXT_COMMS_RETRIGEN)
+ return 0;
+ }
+
+ dev_warn(&client->dev, "Enabling RETRIGEN workaround\n");
+ data->use_retrigen_workaround = true;
+ return 0;
+}

Hello Jiada,

I'm seeing "Enabling RETRIGEN workaround" message with the following
device-tree entry:

touchscreen@4c {
compatible = "atmel,maxtouch";
reg = <0x4c>;

interrupt-parent = <&gpio>;
interrupts = <TEGRA_GPIO(V, 6) IRQ_TYPE_LEVEL_LOW>;

reset-gpios = <&gpio TEGRA_GPIO(Q, 7) GPIO_ACTIVE_HIGH>;
};

This happens because data->irq is NULL. Please fix it, thanks in advance.
Thanks for reporting this issue,
I will fix this issue in v8 patch-set

Thanks,
Jiada