linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>, linux-input@vger.kernel.org
Cc: "Linus Walleij" <linus.walleij@linaro.org>,
	"Andre Müller" <andre.muller@web.de>,
	"Nick Dyer" <nick.dyer@itdev.co.uk>,
	"Jiada Wang" <jiada_wang@mentor.com>,
	stable@vger.kernel.org
Subject: [PATCH v3] Input: atmel_mxt_ts - Fix lost interrupts
Date: Tue,  1 Dec 2020 13:30:26 +0100	[thread overview]
Message-ID: <20201201123026.1416743-1-linus.walleij@linaro.org> (raw)

After commit 74d905d2d38a devices requiring the workaround
for edge triggered interrupts stopped working.

The hardware needs the quirk to be used before even
proceeding to check if the quirk is needed because
mxt_acquire_irq() is called before mxt_check_retrigen()
is called and at this point pending IRQs need to be
checked, and if the workaround is not active, all
interrupts will be lost from this point.

Solve this by switching the calls around.

Cc: Andre Müller <andre.muller@web.de>
Cc: Nick Dyer <nick.dyer@itdev.co.uk>
Cc: Jiada Wang <jiada_wang@mentor.com>
Cc: stable@vger.kernel.org
Reported-by: Andre Müller <andre.muller@web.de>
Tested-by: Andre Müller <andre.muller@web.de>
Suggested-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Fixes: 74d905d2d38a ("Input: atmel_mxt_ts - only read messages in mxt_acquire_irq() when necessary")
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLog v2->v3:
- Make the simpler fix suggested by Dmitry.
- Collect Andre's Tested-by.
ChangeLog v1->v2:
- Explicitly disable the retrig workaround also if the
  IRQ descriptor says we have a level triggered interrupt.
- Drop the second explicit assigning of "true" to the
  use_retrigen_workaround bool, it is already enabled.
- Augment debug text to say that we leave it enabled
  rather than enable it.
---
 drivers/input/touchscreen/atmel_mxt_ts.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index e34984388791..109655547477 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -2185,11 +2185,11 @@ static int mxt_initialize(struct mxt_data *data)
 		msleep(MXT_FW_RESET_TIME);
 	}
 
-	error = mxt_acquire_irq(data);
+	error = mxt_check_retrigen(data);
 	if (error)
 		return error;
 
-	error = mxt_check_retrigen(data);
+	error = mxt_acquire_irq(data);
 	if (error)
 		return error;
 
-- 
2.26.2


             reply	other threads:[~2020-12-01 12:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-01 12:30 Linus Walleij [this message]
2020-12-01 17:56 ` [PATCH v3] Input: atmel_mxt_ts - Fix lost interrupts Dmitry Torokhov

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=20201201123026.1416743-1-linus.walleij@linaro.org \
    --to=linus.walleij@linaro.org \
    --cc=andre.muller@web.de \
    --cc=dmitry.torokhov@gmail.com \
    --cc=jiada_wang@mentor.com \
    --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).