linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-input@vger.kernel.org, Andre <andre.muller@web.de>,
	Nick Dyer <nick.dyer@itdev.co.uk>,
	Jiada Wang <jiada_wang@mentor.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH] Input: atmel_mxt_ts - Fix lost interrupts
Date: Sat, 28 Nov 2020 18:53:28 -0800	[thread overview]
Message-ID: <20201129025328.GH2034289@dtor-ws> (raw)
In-Reply-To: <20201128123720.929948-1-linus.walleij@linaro.org>

Hi Linus,

On Sat, Nov 28, 2020 at 01:37:20PM +0100, Linus Walleij wrote:
> After commit 74d905d2d38a devices requiring the workaround
> for edge triggered interrupts stopped working.
> 
> This is because the "data" state container defaults to
> *not* using the workaround, but the workaround gets used
> *before* the check of whether it is needed or not. This
> semantic is not obvious from just looking on the patch,
> but related to the program flow.
> 
> The hardware needs the quirk to be used before even
> proceeding to check if the quirk is needed.
> 
> This patch makes the quirk be used until we determine
> it is *not* needed.

Thank you very much for root-causing the issue!

> 
> Cc: Andre <andre.muller@web.de>
> Cc: Nick Dyer <nick.dyer@itdev.co.uk>
> Cc: Jiada Wang <jiada_wang@mentor.com>
> Cc: stable@vger.kernel.org
> Fixes: 74d905d2d38a ("Input: atmel_mxt_ts - only read messages in mxt_acquire_irq() when necessary")
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/input/touchscreen/atmel_mxt_ts.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
> index e34984388791..f25b2f6038a7 100644
> --- a/drivers/input/touchscreen/atmel_mxt_ts.c
> +++ b/drivers/input/touchscreen/atmel_mxt_ts.c
> @@ -1297,8 +1297,6 @@ static int mxt_check_retrigen(struct mxt_data *data)
>  	int val;
>  	struct irq_data *irqd;
>  
> -	data->use_retrigen_workaround = false;
> -

So this will result in data->use_retrigen_workaround staying "true" for
level interrupts, which is not needed, as with those we will never lose
an edge. So I think your patch can be reduced to simply setting
data->use_retrigen_workaround to true in mxt_probe() and leaving
mxt_check_retrigen() without any changes.

However I wonder if it would not be better to simply call
mxt_check_retrigen() before calling mxt_acquire_irq() in mxt_probe()
instead of after.

>  	irqd = irq_get_irq_data(data->irq);
>  	if (!irqd)
>  		return -EINVAL;
> @@ -1313,8 +1311,10 @@ static int mxt_check_retrigen(struct mxt_data *data)
>  		if (error)
>  			return error;
>  
> -		if (val & MXT_COMMS_RETRIGEN)
> +		if (val & MXT_COMMS_RETRIGEN) {
> +			data->use_retrigen_workaround = false;
>  			return 0;
> +		}
>  	}
>  
>  	dev_warn(&client->dev, "Enabling RETRIGEN workaround\n");
> @@ -3117,6 +3117,7 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id)
>  	data = devm_kzalloc(&client->dev, sizeof(struct mxt_data), GFP_KERNEL);
>  	if (!data)
>  		return -ENOMEM;
> +	data->use_retrigen_workaround = true;
>  
>  	snprintf(data->phys, sizeof(data->phys), "i2c-%u-%04x/input0",
>  		 client->adapter->nr, client->addr);
> -- 
> 2.26.2
> 

By the way, does your touchscreen work if you change interrupt trigger
to level in DTS?

Thanks.

-- 
Dmitry

  reply	other threads:[~2020-11-29  2:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-28 12:37 [PATCH] Input: atmel_mxt_ts - Fix lost interrupts Linus Walleij
2020-11-29  2:53 ` Dmitry Torokhov [this message]
2020-11-29 21:13   ` Linus Walleij
2020-11-30  8:01     ` Dmitry Torokhov
2020-11-30 20:18       ` Andre Muller
2020-12-01  6:31         ` Dmitry Torokhov
2020-12-01 12:31           ` Linus Walleij

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=20201129025328.GH2034289@dtor-ws \
    --to=dmitry.torokhov@gmail.com \
    --cc=andre.muller@web.de \
    --cc=jiada_wang@mentor.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-input@vger.kernel.org \
    --cc=nick.dyer@itdev.co.uk \
    --cc=stable@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 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).