All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Input: stmfts: set IRQ_NOAUTOEN to the irq flag
       [not found] <CGME20170927125843epcas2p3a703ab81e165bdaf5bfd100dc08f9ae1@epcas2p3.samsung.com>
@ 2017-09-27 12:58 ` Andi Shyti
  2018-01-23  1:37   ` Dmitry Torokhov
  0 siblings, 1 reply; 2+ messages in thread
From: Andi Shyti @ 2017-09-27 12:58 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input, linux-kernel, Andi Shyti, Andi Shyti

The interrupt is requested before the device is powered on and
it's value in some cases cannot be reliable. It happens on some
devices that an interrupt is generated as soon as requested
before having the chance to disable the irq.

Set the irq flag as IRQ_NOAUTOEN before requesting it.

This patch mutes the error:

  stmfts 2-0049: failed to read events: -11

received sometimes during boot time.

Signed-off-by: Andi Shyti <andi.shyti@samsung.com>
---
 drivers/input/touchscreen/stmfts.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/input/touchscreen/stmfts.c b/drivers/input/touchscreen/stmfts.c
index 2351199189a4..362de0001b33 100644
--- a/drivers/input/touchscreen/stmfts.c
+++ b/drivers/input/touchscreen/stmfts.c
@@ -689,6 +689,14 @@ static int stmfts_probe(struct i2c_client *client,
 
 	input_set_drvdata(sdata->input, sdata);
 
+	/*
+	 * stmfts_power_on expects interrupt to be disabled, but
+	 * at this point the device is still off and I do not trust
+	 * the status of the irq line that can generate some spurious
+	 * interrupts. To be on the safe side it's better to not enable
+	 * the interrupts during their request.
+	 */
+	irq_set_status_flags(client->irq, IRQ_NOAUTOEN);
 	err = devm_request_threaded_irq(&client->dev, client->irq,
 					NULL, stmfts_irq_handler,
 					IRQF_ONESHOT,
@@ -696,9 +704,6 @@ static int stmfts_probe(struct i2c_client *client,
 	if (err)
 		return err;
 
-	/* stmfts_power_on expects interrupt to be disabled */
-	disable_irq(client->irq);
-
 	dev_dbg(&client->dev, "initializing ST-Microelectronics FTS...\n");
 
 	err = stmfts_power_on(sdata);
-- 
2.14.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Input: stmfts: set IRQ_NOAUTOEN to the irq flag
  2017-09-27 12:58 ` [PATCH] Input: stmfts: set IRQ_NOAUTOEN to the irq flag Andi Shyti
@ 2018-01-23  1:37   ` Dmitry Torokhov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2018-01-23  1:37 UTC (permalink / raw)
  To: Andi Shyti; +Cc: linux-input, linux-kernel, Andi Shyti

On Wed, Sep 27, 2017 at 09:58:31PM +0900, Andi Shyti wrote:
> The interrupt is requested before the device is powered on and
> it's value in some cases cannot be reliable. It happens on some
> devices that an interrupt is generated as soon as requested
> before having the chance to disable the irq.
> 
> Set the irq flag as IRQ_NOAUTOEN before requesting it.
> 
> This patch mutes the error:
> 
>   stmfts 2-0049: failed to read events: -11
> 
> received sometimes during boot time.
> 
> Signed-off-by: Andi Shyti <andi.shyti@samsung.com>

Applied, thank you.

> ---
>  drivers/input/touchscreen/stmfts.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/input/touchscreen/stmfts.c b/drivers/input/touchscreen/stmfts.c
> index 2351199189a4..362de0001b33 100644
> --- a/drivers/input/touchscreen/stmfts.c
> +++ b/drivers/input/touchscreen/stmfts.c
> @@ -689,6 +689,14 @@ static int stmfts_probe(struct i2c_client *client,
>  
>  	input_set_drvdata(sdata->input, sdata);
>  
> +	/*
> +	 * stmfts_power_on expects interrupt to be disabled, but
> +	 * at this point the device is still off and I do not trust
> +	 * the status of the irq line that can generate some spurious
> +	 * interrupts. To be on the safe side it's better to not enable
> +	 * the interrupts during their request.
> +	 */
> +	irq_set_status_flags(client->irq, IRQ_NOAUTOEN);
>  	err = devm_request_threaded_irq(&client->dev, client->irq,
>  					NULL, stmfts_irq_handler,
>  					IRQF_ONESHOT,
> @@ -696,9 +704,6 @@ static int stmfts_probe(struct i2c_client *client,
>  	if (err)
>  		return err;
>  
> -	/* stmfts_power_on expects interrupt to be disabled */
> -	disable_irq(client->irq);
> -
>  	dev_dbg(&client->dev, "initializing ST-Microelectronics FTS...\n");
>  
>  	err = stmfts_power_on(sdata);
> -- 
> 2.14.2
> 

-- 
Dmitry

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-01-23  1:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20170927125843epcas2p3a703ab81e165bdaf5bfd100dc08f9ae1@epcas2p3.samsung.com>
2017-09-27 12:58 ` [PATCH] Input: stmfts: set IRQ_NOAUTOEN to the irq flag Andi Shyti
2018-01-23  1:37   ` Dmitry Torokhov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.