* ads7846: clean up, fix pressure reporting
@ 2009-08-07 18:09 Pavel Machek
2009-08-09 10:21 ` Stanislav Brabec
2009-08-09 10:51 ` Mark Brown
0 siblings, 2 replies; 5+ messages in thread
From: Pavel Machek @ 2009-08-07 18:09 UTC (permalink / raw)
To: dtor, linux-input, rpurdie, lenz, kernel list, Dirk, arminlitzel,
Cyril Hrubis <met>
Fix pressure reporting, and clean up debug prints.
Signed-off-by: Pavel Machek <pavel@ucw.cz>
diff -ur touchscreen.ofic/ads7846.c touchscreen/ads7846.c
--- a/drivers/input/touchscreen/ads7846.c 2009-07-15 01:41:30.000000000 +0200
+++ b/drivers/input/touchscreen/ads7846.c 2009-07-15 10:49:00.000000000 +0200
@@ -29,10 +29,14 @@
#include <linux/spi/ads7846.h>
#include <asm/irq.h>
+#ifndef VERBOSE
+#undef dev_dbg
+#define dev_dbg(...) do {} while(0)
+#endif
/*
* This code has been heavily tested on a Nokia 770, and lightly
- * tested on other ads7846 devices (OSK/Mistral, Lubbock).
+ * tested on other ads7846 devices (OSK/Mistral, Lubbock, Spitz).
* TSC2046 is just newer ads7846 silicon.
* Support for ads7843 tested on Atmel at91sam926x-EK.
* Support for ads7845 has only been stubbed in.
@@ -43,7 +47,7 @@
* have to maintain our own SW IRQ disabled status. This should be
* removed as soon as the affected platform's IRQ handling is fixed.
*
- * app note sbaa036 talks in more detail about accurate sampling...
+ * App note sbaa036 talks in more detail about accurate sampling...
* that ought to help in situations like LCDs inducing noise (which
* can also be helped by using synch signals) and more generally.
* This driver tries to utilize the measures described in the app
@@ -566,10 +570,8 @@
* once more the measurement
*/
if (packet->tc.ignore || Rt > ts->pressure_max) {
-#ifdef VERBOSE
- pr_debug("%s: ignored %d pressure %d\n",
- dev_name(&ts->spi->dev), packet->tc.ignore, Rt);
-#endif
+ dev_dbg(&ts->spi->dev, "ignored %d pressure %d\n",
+ packet->tc.ignore, Rt);
hrtimer_start(&ts->timer, ktime_set(0, TS_POLL_PERIOD),
HRTIMER_MODE_REL);
return;
@@ -584,10 +586,11 @@
Rt = 0;
}
- /* NOTE: We can't rely on the pressure to determine the pen down
- * state, even this controller has a pressure sensor. The pressure
- * value can fluctuate for quite a while after lifting the pen and
- * in some cases may not even settle at the expected value.
+ /* NOTE: We can't rely on the pressure to determine the pen
+ * down state, not even if this controller has a pressure
+ * sensor. The pressure value can fluctuate for quite a while
+ * after lifting the pen and in some cases may not even settle
+ * at the expected value.
*
* The only safe way to check for the pen up condition is in the
* timer by reading the pen signal state (it's a GPIO _and_ IRQ).
@@ -598,9 +601,7 @@
if (!ts->pendown) {
input_report_key(input, BTN_TOUCH, 1);
ts->pendown = 1;
-#ifdef VERBOSE
dev_dbg(&ts->spi->dev, "DOWN\n");
-#endif
}
if (ts->swap_xy)
@@ -608,12 +609,10 @@
input_report_abs(input, ABS_X, x);
input_report_abs(input, ABS_Y, y);
- input_report_abs(input, ABS_PRESSURE, Rt);
+ input_report_abs(input, ABS_PRESSURE, ts->pressure_max-Rt);
input_sync(input);
-#ifdef VERBOSE
dev_dbg(&ts->spi->dev, "%4d/%4d/%4d\n", x, y, Rt);
-#endif
}
hrtimer_start(&ts->timer, ktime_set(0, TS_POLL_PERIOD),
@@ -723,9 +722,7 @@
input_sync(input);
ts->pendown = 0;
-#ifdef VERBOSE
dev_dbg(&ts->spi->dev, "UP\n");
-#endif
}
/* measurement cycle ended */
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: ads7846: clean up, fix pressure reporting
2009-08-07 18:09 ads7846: clean up, fix pressure reporting Pavel Machek
@ 2009-08-09 10:21 ` Stanislav Brabec
2009-08-10 21:10 ` Richard Purdie
2009-08-09 10:51 ` Mark Brown
1 sibling, 1 reply; 5+ messages in thread
From: Stanislav Brabec @ 2009-08-09 10:21 UTC (permalink / raw)
To: Pavel Machek
Cc: dtor, linux-input, rpurdie, lenz, kernel list, Dirk, arminlitzel,
Cyril Hrubis, thommycheck, linux-arm-kernel, dbaryshkov,
omegamoon, eric.miao
Pavel Machek wrote:
> Fix pressure reporting, and clean up debug prints.
Thanks.
I see much bigger problem with both the old driver and the new ads7846
driver (2.6.30): They are very noisy on my spitz. When you tap to one
place, keep stylus pressed and just read values, you get 20-200 pixels
long pointer motion trip each second.
According to Cyril Hrubiš, it is caused by the electrical noise that
originates in the LCD display. The driver needs to read data
synchronously with the LCD refresh. He already made the fix for collie
several years ago.
The pointer test application in the PROM diagnostic utility does not
seem to exhibit any noise.
________________________________________________________________________
Stanislav Brabec
http://www.penguin.cz/~utx/zaurus
-------------------------------------------------------------------
List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel
FAQ: http://www.arm.linux.org.uk/mailinglists/faq.php
Etiquette: http://www.arm.linux.org.uk/mailinglists/etiquette.php
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: ads7846: clean up, fix pressure reporting
2009-08-07 18:09 ads7846: clean up, fix pressure reporting Pavel Machek
2009-08-09 10:21 ` Stanislav Brabec
@ 2009-08-09 10:51 ` Mark Brown
2009-08-09 10:54 ` Pavel Machek
1 sibling, 1 reply; 5+ messages in thread
From: Mark Brown @ 2009-08-09 10:51 UTC (permalink / raw)
To: Pavel Machek
Cc: dtor, linux-input, rpurdie, lenz, kernel list, Dirk, arminlitzel,
Cyril Hrubis, thommycheck, linux-arm-kernel, dbaryshkov,
omegamoon, eric.miao, utx
On Fri, Aug 07, 2009 at 08:09:41PM +0200, Pavel Machek wrote:
> +#ifndef VERBOSE
> +#undef dev_dbg
> +#define dev_dbg(...) do {} while(0)
> +#endif
Better to convert the offending dev_dbg()s to dev_vdbg() instead, I'd
have thought.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: ads7846: clean up, fix pressure reporting
2009-08-09 10:51 ` Mark Brown
@ 2009-08-09 10:54 ` Pavel Machek
0 siblings, 0 replies; 5+ messages in thread
From: Pavel Machek @ 2009-08-09 10:54 UTC (permalink / raw)
To: Mark Brown
Cc: dtor, linux-input, rpurdie, lenz, kernel list, Dirk, arminlitzel,
Cyril Hrubis, thommycheck, linux-arm-kernel, dbaryshkov,
omegamoon, eric.miao, utx
On Sun 2009-08-09 11:51:13, Mark Brown wrote:
> On Fri, Aug 07, 2009 at 08:09:41PM +0200, Pavel Machek wrote:
>
> > +#ifndef VERBOSE
> > +#undef dev_dbg
> > +#define dev_dbg(...) do {} while(0)
> > +#endif
>
> Better to convert the offending dev_dbg()s to dev_vdbg() instead, I'd
> have thought.
Ok, yes, I could do that, but... I believe current patch is already
better than what is there and modifying patch on zaurus is quite
painful...
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: ads7846: clean up, fix pressure reporting
2009-08-09 10:21 ` Stanislav Brabec
@ 2009-08-10 21:10 ` Richard Purdie
0 siblings, 0 replies; 5+ messages in thread
From: Richard Purdie @ 2009-08-10 21:10 UTC (permalink / raw)
To: Stanislav Brabec
Cc: Pavel Machek, dtor, linux-input, lenz, kernel list, Dirk,
arminlitzel, Cyril Hrubis, thommycheck, linux-arm-kernel,
dbaryshkov, omegamoon, eric.miao
On Sun, 2009-08-09 at 12:21 +0200, Stanislav Brabec wrote:
> Pavel Machek wrote:
> > Fix pressure reporting, and clean up debug prints.
>
> Thanks.
>
> I see much bigger problem with both the old driver and the new ads7846
> driver (2.6.30): They are very noisy on my spitz. When you tap to one
> place, keep stylus pressed and just read values, you get 20-200 pixels
> long pointer motion trip each second.
>
> According to Cyril Hrubiš, it is caused by the electrical noise that
> originates in the LCD display. The driver needs to read data
> synchronously with the LCD refresh. He already made the fix for collie
> several years ago.
This is what I've been led to believe as well. There was code in the old
driver to try and avoid this by only taking touchscreen readings when
the LCD wasn't electrically active but it sounds like this has become
broken :(.
Cheers,
Richard
--
Richard Purdie
Intel Open Source Technology Centre
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-08-10 21:10 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-07 18:09 ads7846: clean up, fix pressure reporting Pavel Machek
2009-08-09 10:21 ` Stanislav Brabec
2009-08-10 21:10 ` Richard Purdie
2009-08-09 10:51 ` Mark Brown
2009-08-09 10:54 ` Pavel Machek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox