diff mbox

Revert "Input: atmel_mxt_ts - disable interrupt for 50ms after reset"

Message ID 570822DA.9090203@itdev.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Nick Dyer April 8, 2016, 9:30 p.m. UTC
On 2016-04-08 13:39, Tom Rini wrote:
>>>> I have a Pixel 2 here - can you advise how to reproduce?
>>>
>>> I (and a bunch of other folks, the linux-samus people now point people
>>> at using mxt-app every boot to reset the device) see this every time I
>>> either suspend the laptop or do a warm boot into a new kernel (I didn't
>>> try kexec but it too is probably broken).  Note that I'm not using
>>> mainline to boot ChromeOS but I've got a regular Linux distro in ROOT-C.
>>
>> OK. I will try it. My Pixel is running Ubuntu with a mainline kernel, so
>> should be able to repro.
> 
> Thanks.  Happy to test patches when you get there and feel free to shoot
> me patches to have more info get dumped out or whatever if needed.

Could you try the below patch to correctly acquire the IRQ after soft reset on
systems using IRQF_TRIGGER_FALLING.

Appears to work correctly on my Pixel 2 during a brief test.

A workaround also seems to be to reconfig T18 COMMSCONFIG to enable
the RETRIGEN bit using mxt-app:
    mxt-app -W -T18 44
    mxt-app --backup
---
 drivers/input/touchscreen/atmel_mxt_ts.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Tom Rini April 8, 2016, 11:30 p.m. UTC | #1
On Fri, Apr 08, 2016 at 10:30:02PM +0100, Nick Dyer wrote:
> On 2016-04-08 13:39, Tom Rini wrote:
> >>>> I have a Pixel 2 here - can you advise how to reproduce?
> >>>
> >>> I (and a bunch of other folks, the linux-samus people now point people
> >>> at using mxt-app every boot to reset the device) see this every time I
> >>> either suspend the laptop or do a warm boot into a new kernel (I didn't
> >>> try kexec but it too is probably broken).  Note that I'm not using
> >>> mainline to boot ChromeOS but I've got a regular Linux distro in ROOT-C.
> >>
> >> OK. I will try it. My Pixel is running Ubuntu with a mainline kernel, so
> >> should be able to repro.
> > 
> > Thanks.  Happy to test patches when you get there and feel free to shoot
> > me patches to have more info get dumped out or whatever if needed.
> 
> Could you try the below patch to correctly acquire the IRQ after soft reset on
> systems using IRQF_TRIGGER_FALLING.
> 
> Appears to work correctly on my Pixel 2 during a brief test.

This also works for me so:

Tested-by: Tom Rini <trini@konsulko.com>

... and adding in the linux-samus github project person so it can get
fixed there too.

On an unrelated note and since you have a Pixel 2 as well, the
touchscreen doesn't work for input after suspend (before and after this
patch) but is fine on cold and warm reboots.  Any chance you can debug
that one as well?  Thanks!

> 
> A workaround also seems to be to reconfig T18 COMMSCONFIG to enable
> the RETRIGEN bit using mxt-app:
>     mxt-app -W -T18 44
>     mxt-app --backup
> ---
>  drivers/input/touchscreen/atmel_mxt_ts.c | 28 ++++++++++++++--------------
>  1 file changed, 14 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
> index 2160512e..5af7907 100644
> --- a/drivers/input/touchscreen/atmel_mxt_ts.c
> +++ b/drivers/input/touchscreen/atmel_mxt_ts.c
> @@ -1093,6 +1093,19 @@ static int mxt_t6_command(struct mxt_data *data, u16 cmd_offset,
>  	return 0;
>  }
>  
> +static int mxt_acquire_irq(struct mxt_data *data)
> +{
> +	int error;
> +
> +	enable_irq(data->irq);
> +
> +	error = mxt_process_messages_until_invalid(data);
> +	if (error)
> +		return error;
> +
> +	return 0;
> +}
> +
>  static int mxt_soft_reset(struct mxt_data *data)
>  {
>  	struct device *dev = &data->client->dev;
> @@ -1111,7 +1124,7 @@ static int mxt_soft_reset(struct mxt_data *data)
>  	/* Ignore CHG line for 100ms after reset */
>  	msleep(100);
>  
> -	enable_irq(data->irq);
> +	mxt_acquire_irq(data);
>  
>  	ret = mxt_wait_for_completion(data, &data->reset_completion,
>  				      MXT_RESET_TIMEOUT);
> @@ -1466,19 +1479,6 @@ static int mxt_update_cfg(struct mxt_data *data, const struct firmware *cfg)
>  	return ret;
>  }
>  
> -static int mxt_acquire_irq(struct mxt_data *data)
> -{
> -	int error;
> -
> -	enable_irq(data->irq);
> -
> -	error = mxt_process_messages_until_invalid(data);
> -	if (error)
> -		return error;
> -
> -	return 0;
> -}
> -
>  static int mxt_get_info(struct mxt_data *data)
>  {
>  	struct i2c_client *client = data->client;
diff mbox

Patch

diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c
index 2160512e..5af7907 100644
--- a/drivers/input/touchscreen/atmel_mxt_ts.c
+++ b/drivers/input/touchscreen/atmel_mxt_ts.c
@@ -1093,6 +1093,19 @@  static int mxt_t6_command(struct mxt_data *data, u16 cmd_offset,
 	return 0;
 }
 
+static int mxt_acquire_irq(struct mxt_data *data)
+{
+	int error;
+
+	enable_irq(data->irq);
+
+	error = mxt_process_messages_until_invalid(data);
+	if (error)
+		return error;
+
+	return 0;
+}
+
 static int mxt_soft_reset(struct mxt_data *data)
 {
 	struct device *dev = &data->client->dev;
@@ -1111,7 +1124,7 @@  static int mxt_soft_reset(struct mxt_data *data)
 	/* Ignore CHG line for 100ms after reset */
 	msleep(100);
 
-	enable_irq(data->irq);
+	mxt_acquire_irq(data);
 
 	ret = mxt_wait_for_completion(data, &data->reset_completion,
 				      MXT_RESET_TIMEOUT);
@@ -1466,19 +1479,6 @@  static int mxt_update_cfg(struct mxt_data *data, const struct firmware *cfg)
 	return ret;
 }
 
-static int mxt_acquire_irq(struct mxt_data *data)
-{
-	int error;
-
-	enable_irq(data->irq);
-
-	error = mxt_process_messages_until_invalid(data);
-	if (error)
-		return error;
-
-	return 0;
-}
-
 static int mxt_get_info(struct mxt_data *data)
 {
 	struct i2c_client *client = data->client;