linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ezequiel Garcia <ezequiel@collabora.com>
To: Sebastian Reichel <sebastian.reichel@collabora.co.uk>,
	Nick Dyer <nick@shmanahar.org>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	linux-input@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, kernel@collabora.com
Subject: Re: [PATCH] Input: atmel_mxt_ts - fix reset-gpio for level based irqs
Date: Fri, 20 Apr 2018 14:44:02 -0300	[thread overview]
Message-ID: <7b4976b0a8a642767bd4e0a5e9d7fb6c9dc86ec9.camel@collabora.com> (raw)
In-Reply-To: <20180420172408.26164-1-sebastian.reichel@collabora.co.uk>

Hi Sebastian,

On Fri, 2018-04-20 at 19:24 +0200, Sebastian Reichel wrote:
> The current reset-gpio support triggers an interrupt storm on platforms
> using the maxtouch with level based interrupt. The Motorola Droid 4,
> which I used for some of the tests is not affected, since it uses a level
> based interrupt.
> 

I found this confusing. Interrupt storm happen with level-based interrupts,
but the Droid4 is not affected?

> This change avoids the interrupt storm by enabling the device while
> its interrupt is disabled. The following mxt_initialize() requires,
> that the device is responsive (at least mxt224E is unresponsive for
> ~22ms), so we wait some time. We don't wait for leaving bootloader
> mode anymore, since mxt_initialize() checks for it anyways.
> 

IMHO, having some more or less arbritrary sleeps is almost
always a problem. This value might be enough for some platform,
might be too short for some other, and then it might get too large
for someone else.

> This fixes a boot problem on GE PPD (watchdog kills device) and also
> has been tested on the Droid 4.
> 
> Fixes: f657b00df22e ("Input: atmel_mxt_ts - add support for reset line")
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
> ---
>  drivers/input/touchscreen/atmel_mxt_ts.c | 15 +++++----------
>  1 file changed, 5 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
> index 5d9699fe1b55..f8a9f2a47e78 100644
> --- a/drivers/input/touchscreen/atmel_mxt_ts.c
> +++ b/drivers/input/touchscreen/atmel_mxt_ts.c
> @@ -194,6 +194,7 @@ enum t100_type {
>  
>  /* Delay times */
>  #define MXT_BACKUP_TIME		50	/* msec */
> +#define MXT_RESET_GPIO_TIME	20	/* msec */
>  #define MXT_RESET_TIME		200	/* msec */
>  #define MXT_RESET_TIMEOUT	3000	/* msec */
>  #define MXT_CRC_TIMEOUT		1000	/* msec */
> @@ -3167,20 +3168,14 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id)
>  		return error;
>  	}
>  
> +	disable_irq(client->irq);
> +
>  	if (data->reset_gpio) {
> -		data->in_bootloader = true;
> -		msleep(MXT_RESET_TIME);
> -		reinit_completion(&data->bl_completion);
> +		msleep(MXT_RESET_GPIO_TIME);
>  		gpiod_set_value(data->reset_gpio, 1);

Can't we enable the IRQ here, just before the wait...

> -		error = mxt_wait_for_completion(data, &data->bl_completion,
> -						MXT_RESET_TIMEOUT);

... and then disable it back afterwards?

> -		if (error)
> -			return error;
> -		data->in_bootloader = false;
> +		msleep(MXT_RESET_TIME);

>  	}
>  
> -	disable_irq(client->irq);
> -
>  	error = mxt_initialize(data);
>  	if (error)
>  		return error;
> -- 
> 2.17.0
> 
> 

  reply	other threads:[~2018-04-20 17:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-20 17:24 [PATCH] Input: atmel_mxt_ts - fix reset-gpio for level based irqs Sebastian Reichel
2018-04-20 17:44 ` Ezequiel Garcia [this message]
2018-04-20 19:42   ` Sebastian Reichel
2018-04-21 20:11     ` Nick Dyer
2018-04-23 11:43       ` Sebastian Reichel
2018-04-23 11:58 ` [PATCHv2] " Sebastian Reichel
2018-05-03  9:15   ` Sebastian Reichel
2018-05-09 14:25   ` Pavel Machek
2018-05-09 14:40     ` Sebastian Reichel
2018-05-24 16:35   ` 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=7b4976b0a8a642767bd4e0a5e9d7fb6c9dc86ec9.camel@collabora.com \
    --to=ezequiel@collabora.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=kernel@collabora.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nick@shmanahar.org \
    --cc=sebastian.reichel@collabora.co.uk \
    /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).