diff mbox

[4/4,v2] Input: zforce - enable irq only if we are ready to process it

Message ID 1437396997-3182-5-git-send-email-dirk.behme@de.bosch.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dirk Behme July 20, 2015, 12:56 p.m. UTC
From: Oleksij Rempel <external.Oleksij.Rempel@de.bosch.com>

If zforce is not ready to process the interrupt, the touchscreen will
be lost forever. Make sure we enable the interrupt only if processing
is ready.

Signed-off-by: Oleksij Rempel <external.Oleksij.Rempel@de.bosch.com>
Signed-off-by: Dirk Behme <dirk.behme@de.bosch.com>
---
Changes in v2: No changes, just re-send

 drivers/input/touchscreen/zforce_ts.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Dirk Behme July 21, 2015, 8:47 a.m. UTC | #1
On 20.07.2015 14:56, Dirk Behme wrote:
> From: Oleksij Rempel <external.Oleksij.Rempel@de.bosch.com>
>
> If zforce is not ready to process the interrupt, the touchscreen will
> be lost forever. Make sure we enable the interrupt only if processing
> is ready.


Talking with Oleksij about the discussion in v1 of this patch I think 
the conclusion is that we can drop this patch from this series.

We'll revert this change in our local version, too, and see if it has 
any consequences. If so, we might come back, maybe with a better 
explanation, then ;)

Just for the logs, what's left open from this series are patch 2/4 and 
3/4, then.

Best regards

Dirk


> Signed-off-by: Oleksij Rempel <external.Oleksij.Rempel@de.bosch.com>
> Signed-off-by: Dirk Behme <dirk.behme@de.bosch.com>
> ---
> Changes in v2: No changes, just re-send
>
>   drivers/input/touchscreen/zforce_ts.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c
> index fdd00b1..fab1bb0 100644
> --- a/drivers/input/touchscreen/zforce_ts.c
> +++ b/drivers/input/touchscreen/zforce_ts.c
> @@ -22,6 +22,7 @@
>   #include <linux/slab.h>
>   #include <linux/input.h>
>   #include <linux/interrupt.h>
> +#include <linux/irq.h>
>   #include <linux/i2c.h>
>   #include <linux/delay.h>
>   #include <linux/gpio/consumer.h>
> @@ -755,6 +756,7 @@ static int zforce_probe(struct i2c_client *client,
>   	struct zforce_ts *ts;
>   	struct input_dev *input_dev;
>   	int ret;
> +	unsigned int irq;
>
>   	if (!pdata) {
>   		pdata = zforce_parse_dt(&client->dev);
> @@ -859,6 +861,7 @@ static int zforce_probe(struct i2c_client *client,
>
>   	init_completion(&ts->command_done);
>
> +	irq = client->irq;
>   	/*
>   	 * The zforce pulls the interrupt low when it has data ready.
>   	 * After it is triggered the isr thread runs until all the available
> @@ -866,7 +869,8 @@ static int zforce_probe(struct i2c_client *client,
>   	 * Therefore we can trigger the interrupt anytime it is low and do
>   	 * not need to limit it to the interrupt edge.
>   	 */
> -	ret = devm_request_threaded_irq(&client->dev, client->irq,
> +	irq_set_status_flags(irq, IRQ_NOAUTOEN);
> +	ret = devm_request_threaded_irq(&client->dev, irq,
>   					zforce_irq, zforce_irq_thread,
>   					IRQF_TRIGGER_LOW | IRQF_ONESHOT,
>   					input_dev->name, ts);
> @@ -879,6 +883,7 @@ static int zforce_probe(struct i2c_client *client,
>
>   	/* let the controller boot */
>   	zforce_reset_deassert(ts);
> +	enable_irq(irq);
>
>   	ts->command_waiting = NOTIFICATION_BOOTCOMPLETE;
>   	if (wait_for_completion_timeout(&ts->command_done, WAIT_TIMEOUT) == 0)
>


--
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
diff mbox

Patch

diff --git a/drivers/input/touchscreen/zforce_ts.c b/drivers/input/touchscreen/zforce_ts.c
index fdd00b1..fab1bb0 100644
--- a/drivers/input/touchscreen/zforce_ts.c
+++ b/drivers/input/touchscreen/zforce_ts.c
@@ -22,6 +22,7 @@ 
 #include <linux/slab.h>
 #include <linux/input.h>
 #include <linux/interrupt.h>
+#include <linux/irq.h>
 #include <linux/i2c.h>
 #include <linux/delay.h>
 #include <linux/gpio/consumer.h>
@@ -755,6 +756,7 @@  static int zforce_probe(struct i2c_client *client,
 	struct zforce_ts *ts;
 	struct input_dev *input_dev;
 	int ret;
+	unsigned int irq;
 
 	if (!pdata) {
 		pdata = zforce_parse_dt(&client->dev);
@@ -859,6 +861,7 @@  static int zforce_probe(struct i2c_client *client,
 
 	init_completion(&ts->command_done);
 
+	irq = client->irq;
 	/*
 	 * The zforce pulls the interrupt low when it has data ready.
 	 * After it is triggered the isr thread runs until all the available
@@ -866,7 +869,8 @@  static int zforce_probe(struct i2c_client *client,
 	 * Therefore we can trigger the interrupt anytime it is low and do
 	 * not need to limit it to the interrupt edge.
 	 */
-	ret = devm_request_threaded_irq(&client->dev, client->irq,
+	irq_set_status_flags(irq, IRQ_NOAUTOEN);
+	ret = devm_request_threaded_irq(&client->dev, irq,
 					zforce_irq, zforce_irq_thread,
 					IRQF_TRIGGER_LOW | IRQF_ONESHOT,
 					input_dev->name, ts);
@@ -879,6 +883,7 @@  static int zforce_probe(struct i2c_client *client,
 
 	/* let the controller boot */
 	zforce_reset_deassert(ts);
+	enable_irq(irq);
 
 	ts->command_waiting = NOTIFICATION_BOOTCOMPLETE;
 	if (wait_for_completion_timeout(&ts->command_done, WAIT_TIMEOUT) == 0)