Skip to contentSkip to conversation

Input: smtpe-ts: Use msecs_to_jiffies() instead of HZ

PATCH Applied Marek Vasut 3 participants 12 messages May 8, 2015 – May 24, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Input: smtpe-ts: Use msecs_to_jiffies() instead of HZ

Use msecs_to_jiffies(20) instead of plain (HZ / 50), as the former is much more explicit about it's behavior. We want to schedule the task 20 mS from now, so make it explicit in the code.

Cc Vipul Kumar Samar <[email protected]>
Cc Viresh Kumar <[email protected]>
Cc Dmitry Torokhov <[email protected]>
---
 drivers/input/touchscreen/stmpe-ts.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/touchscreen/stmpe-ts.c +1 -1
index 42ce31a..9e5c880 100644
@@ -164,7 +164,7 @@ static irqreturn_t stmpe_ts_handler(int irq, void *data)
 			STMPE_TSC_CTRL_TSC_EN, STMPE_TSC_CTRL_TSC_EN);
 
 	/* start polling for touch_det to detect release */
-	schedule_delayed_work(&ts->work, HZ / 50);
+	schedule_delayed_work(&ts->work, msecs_to_jiffies(20));
 
 	return IRQ_HANDLED;
 }
Signature · 1 line
2.1.4
#1 lore raw

PATCH 2/2 Input: smtpe-ts: Wait 50mS until polling for pen-up

Wait a little bit longer, 50mS instead of 20mS, until the driver starts polling for pen-up. The problematic behavior before this patch is applied is as follows. The behavior was observed on the STMPE610QTR controller.

Upon a physical pen-down event, the touchscreen reports one set of x-y-p coordinates and a pen-down event. After that, the pen-up polling is triggered and since the controller is not ready yet, the polling mistakenly detects a pen-up event while the physical state is still such that the pen is down on the touch surface.

The pen-up handling flushes the controller FIFO, so after that, all the samples in the controller are discarded. The controller becomes ready shortly after this bogus pen-up handling and does generate again a pen-down interrupt. This time, the controller contains x-y-p samples which all read as zero. Since pressure value is zero, this set of samples is effectively ignored by userland.

In the end, the driver just bounces between pen-down and bogus pen-up handling, generating no useful results. Fix this by giving the controller a bit more time before polling it for pen-up.

Cc Vipul Kumar Samar <[email protected]>
Cc Viresh Kumar <[email protected]>
Cc Dmitry Torokhov <[email protected]>
---
 drivers/input/touchscreen/stmpe-ts.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/touchscreen/stmpe-ts.c +1 -1
index 9e5c880..a8f5ea7 100644
@@ -164,7 +164,7 @@ static irqreturn_t stmpe_ts_handler(int irq, void *data)
 			STMPE_TSC_CTRL_TSC_EN, STMPE_TSC_CTRL_TSC_EN);
 
 	/* start polling for touch_det to detect release */
-	schedule_delayed_work(&ts->work, msecs_to_jiffies(20));
+	schedule_delayed_work(&ts->work, msecs_to_jiffies(50));
 
 	return IRQ_HANDLED;
 }
Signature · 1 line
2.1.4
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] Input: smtpe-ts: Wait 50mS until polling for pen-up

Quoted 23 lines · Marek Vasut

Wait a little bit longer, 50mS instead of 20mS, until the driver starts polling for pen-up. The problematic behavior before this patch is applied is as follows. The behavior was observed on the STMPE610QTR controller.

Upon a physical pen-down event, the touchscreen reports one set of x-y-p coordinates and a pen-down event. After that, the pen-up polling is triggered and since the controller is not ready yet, the polling mistakenly detects a pen-up event while the physical state is still such that the pen is down on the touch surface.

The pen-up handling flushes the controller FIFO, so after that, all the samples in the controller are discarded. The controller becomes ready shortly after this bogus pen-up handling and does generate again a pen-down interrupt. This time, the controller contains x-y-p samples which all read as zero. Since pressure value is zero, this set of samples is effectively ignored by userland.

In the end, the driver just bounces between pen-down and bogus pen-up handling, generating no useful results. Fix this by giving the controller a bit more time before polling it for pen-up.

Quoted 7 lines
Cc Vipul Kumar Samar <[email protected]>
Cc Viresh Kumar <[email protected]>
Cc Dmitry Torokhov <[email protected]>
---
 drivers/input/touchscreen/stmpe-ts.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by on v1 1/2
#3 lore raw
In reply to Marek Vasut
Quoted 5 lines · Marek Vasut

Use msecs_to_jiffies(20) instead of plain (HZ / 50), as the former is much more explicit about it's behavior. We want to schedule the task 20 mS from now, so make it explicit in the code.

Quoted 7 lines
Cc Vipul Kumar Samar <[email protected]>
Cc Viresh Kumar <[email protected]>
Cc Dmitry Torokhov <[email protected]>
---
 drivers/input/touchscreen/stmpe-ts.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
maintainer Applied
#4 lore raw
Quoted 14 lines · Viresh Kumar
Quoted 5 lines · Marek Vasut

Use msecs_to_jiffies(20) instead of plain (HZ / 50), as the former is much more explicit about it's behavior. We want to schedule the task 20 mS from now, so make it explicit in the code.

Quoted 7 lines
Cc Vipul Kumar Samar <[email protected]>
Cc Viresh Kumar <[email protected]>
Cc Dmitry Torokhov <[email protected]>
---
 drivers/input/touchscreen/stmpe-ts.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 1 line

Applied both, thank you.

Signature · 1 line
Dmitry
#5 lore raw
Quoted 13 lines · Dmitry Torokhov
Quoted 12 lines · Viresh Kumar
Quoted 11 lines · Marek Vasut

Use msecs_to_jiffies(20) instead of plain (HZ / 50), as the former is much more explicit about it's behavior. We want to schedule the task 20 mS from now, so make it explicit in the code.

Cc Vipul Kumar Samar <[email protected]>
Cc Viresh Kumar <[email protected]>
Cc Dmitry Torokhov <[email protected]>

---

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
 drivers/input/touchscreen/stmpe-ts.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied both, thank you.

Thank you! Shall I submit them for -stable as well please ?

Best regards,
Marek Vasut

maintainer
#6 lore raw
Quoted 14 lines · Marek Vasut
Quoted 13 lines · Dmitry Torokhov
Quoted 12 lines · Viresh Kumar
Quoted 11 lines · Marek Vasut

Use msecs_to_jiffies(20) instead of plain (HZ / 50), as the former is much more explicit about it's behavior. We want to schedule the task 20 mS from now, so make it explicit in the code.

Cc Vipul Kumar Samar <[email protected]>
Cc Viresh Kumar <[email protected]>
Cc Dmitry Torokhov <[email protected]>

---

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
 drivers/input/touchscreen/stmpe-ts.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied both, thank you.

Thank you! Shall I submit them for -stable as well please ?

Please.

Signature · 1 line
Dmitry
#7 lore raw
Quoted 18 lines · Dmitry Torokhov
Quoted 17 lines · Marek Vasut
Quoted 16 lines · Dmitry Torokhov
Quoted 15 lines · Viresh Kumar
Quoted 13 lines · Marek Vasut

Use msecs_to_jiffies(20) instead of plain (HZ / 50), as the former is much more explicit about it's behavior. We want to schedule the task 20 mS from now, so make it explicit in the code.

Cc Vipul Kumar Samar <[email protected]>
Cc Viresh Kumar <[email protected]>
Cc Dmitry Torokhov <[email protected]>

---

 drivers/input/touchscreen/stmpe-ts.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Applied both, thank you.

Thank you! Shall I submit them for -stable as well please ?

Please.

Hi,

these patches still didn't make it for Linus's tree. I cannot submit to -stable unless they hit Linus's tree to my knowledge. Shall I wait some more please ?

Thank you!

Best regards,
Marek Vasut

maintainer
#8 lore raw
Quoted 25 lines · Marek Vasut
Quoted 24 lines · Dmitry Torokhov
Quoted 22 lines · Marek Vasut
Quoted 13 lines · Dmitry Torokhov
Quoted 12 lines · Viresh Kumar
Quoted 11 lines · Marek Vasut

Use msecs_to_jiffies(20) instead of plain (HZ / 50), as the former is much more explicit about it's behavior. We want to schedule the task 20 mS from now, so make it explicit in the code.

Cc Vipul Kumar Samar <[email protected]>
Cc Viresh Kumar <[email protected]>
Cc Dmitry Torokhov <[email protected]>

---

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
 drivers/input/touchscreen/stmpe-ts.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied both, thank you.

Thank you! Shall I submit them for -stable as well please ?

Quoted 7 lines
Quoted 1 line

Please.

Hi,

these patches still didn't make it for Linus's tree. I cannot submit to -stable unless they hit Linus's tree to my knowledge. Shall I wait some more please ?

They are in -next. I guess I could get them in 4.1...

Signature · 1 line
Dmitry
#9 lore raw
Quoted 28 lines · Dmitry Torokhov
Quoted 27 lines · Marek Vasut
Quoted 25 lines · Dmitry Torokhov
Quoted 14 lines · Marek Vasut
Quoted 13 lines · Dmitry Torokhov
Quoted 12 lines · Viresh Kumar
Quoted 11 lines · Marek Vasut

Use msecs_to_jiffies(20) instead of plain (HZ / 50), as the former is much more explicit about it's behavior. We want to schedule the task 20 mS from now, so make it explicit in the code.

Cc Vipul Kumar Samar <[email protected]>
Cc Viresh Kumar <[email protected]>
Cc Dmitry Torokhov <[email protected]>

---

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
 drivers/input/touchscreen/stmpe-ts.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied both, thank you.

Thank you! Shall I submit them for -stable as well please ?

Please.

Quoted 7 lines
Quoted 5 lines

Hi,

these patches still didn't make it for Linus's tree. I cannot submit to -stable unless they hit Linus's tree to my knowledge. Shall I wait some more please ?

They are in -next. I guess I could get them in 4.1...

In case it's not much of a hassle for everyone involved, it would be nice. Otherwise, I will just wait for 4.2 merge window to open and submit for stable after that. Just let me know what you prefer and I will do so.

Best regards,
Marek Vasut

maintainer
#10 lore raw
Quoted 35 lines · Marek Vasut
Quoted 34 lines · Dmitry Torokhov
Quoted 32 lines · Marek Vasut
Quoted 18 lines · Dmitry Torokhov
Quoted 17 lines · Marek Vasut
Quoted 16 lines · Dmitry Torokhov
Quoted 15 lines · Viresh Kumar
Quoted 13 lines · Marek Vasut

Use msecs_to_jiffies(20) instead of plain (HZ / 50), as the former is much more explicit about it's behavior. We want to schedule the task 20 mS from now, so make it explicit in the code.

Cc Vipul Kumar Samar <[email protected]>
Cc Viresh Kumar <[email protected]>
Cc Dmitry Torokhov <[email protected]>

---

 drivers/input/touchscreen/stmpe-ts.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Applied both, thank you.

Thank you! Shall I submit them for -stable as well please ?

Please.

Hi,

these patches still didn't make it for Linus's tree. I cannot submit to -stable unless they hit Linus's tree to my knowledge. Shall I wait some more please ?

Quoted 5 lines
Quoted 1 line

They are in -next. I guess I could get them in 4.1...

In case it's not much of a hassle for everyone involved, it would be nice. Otherwise, I will just wait for 4.2 merge window to open and submit for stable after that. Just let me know what you prefer and I will do so.

I sent pull request to Linus, so let's see.

Thanks.

Signature · 1 line
Dmitry
#11 lore raw

On Saturday, May 23, 2015 at 01:30:48 AM, Dmitry Torokhov wrote:

[...]

Quoted 6 lines
Quoted 4 lines

In case it's not much of a hassle for everyone involved, it would be nice. Otherwise, I will just wait for 4.2 merge window to open and submit for stable after that. Just let me know what you prefer and I will do so.

I sent pull request to Linus, so let's see.

Hi!

Thank you very much !

Best regards,
Marek Vasut