linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* AM335x touchscreen issues
@ 2015-05-26 18:11 Michael Welling
  2015-05-26 18:37 ` Felipe Balbi
  0 siblings, 1 reply; 16+ messages in thread
From: Michael Welling @ 2015-05-26 18:11 UTC (permalink / raw)
  To: dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w, vigneshr-l0cyMroinI0,
	bgriffis-l0cyMroinI0, jic23-DgEjT+Ai2ygdnm+yROfE0A,
	wsa-z923LK4zBo2bacvFa/9K2g, balbi-l0cyMroinI0,
	linux-input-u79uwXL29TY76Z2rM5mHXA
  Cc: GWilson-+8BKOH/0X5NWk0Htik3J/w, linux-iio-u79uwXL29TY76Z2rM5mHXA

Greetings,

I have been porting Linux to a new AM3554 based SoM and have found issues
with the touchscreen reporting touch releases repeatedly to userspace
without actually touching the screen when running ts_calibrate, ts_test
or other graphical touchscreen applications.

This started happening after updating pulling recent changes.

It has also been confirmed to be happening on the beagle bone black:
http://www.spinics.net/lists/linux-iio/msg18580.html

If you look further into this thread you will see a workaround patch that
I came up with:
http://www.spinics.net/lists/linux-iio/msg18583.html

Though this fix stops the reported events in userspace, interrupts are
still occuring repeatedly.

Does anyone have any suggestions beyond what I have done to remedy this
issue?

Regards,

Michael

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

* Re: AM335x touchscreen issues
  2015-05-26 18:11 AM335x touchscreen issues Michael Welling
@ 2015-05-26 18:37 ` Felipe Balbi
       [not found]   ` <20150526183713.GU26599-HgARHv6XitJaoMGHk7MhZQC/G2K4zDHf@public.gmane.org>
  0 siblings, 1 reply; 16+ messages in thread
From: Felipe Balbi @ 2015-05-26 18:37 UTC (permalink / raw)
  To: Michael Welling, Franklin Cooper Jr.
  Cc: dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w, vigneshr-l0cyMroinI0,
	bgriffis-l0cyMroinI0, jic23-DgEjT+Ai2ygdnm+yROfE0A,
	wsa-z923LK4zBo2bacvFa/9K2g, balbi-l0cyMroinI0,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	GWilson-+8BKOH/0X5NWk0Htik3J/w, linux-iio-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 1119 bytes --]

Hi,

On Tue, May 26, 2015 at 01:11:57PM -0500, Michael Welling wrote:
> Greetings,
> 
> I have been porting Linux to a new AM3554 based SoM and have found issues
> with the touchscreen reporting touch releases repeatedly to userspace
> without actually touching the screen when running ts_calibrate, ts_test
> or other graphical touchscreen applications.
> 
> This started happening after updating pulling recent changes.

Can you bisect and find the offending commit ? Which recent changes are
you talking about ?

> It has also been confirmed to be happening on the beagle bone black:
> http://www.spinics.net/lists/linux-iio/msg18580.html
> 
> If you look further into this thread you will see a workaround patch that
> I came up with:
> http://www.spinics.net/lists/linux-iio/msg18583.html
> 
> Though this fix stops the reported events in userspace, interrupts are
> still occuring repeatedly.
> 
> Does anyone have any suggestions beyond what I have done to remedy this
> issue?

yeah, it sounds similar to what Franklin has been working on.

Franklin, any comments ?

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: AM335x touchscreen issues
       [not found]   ` <20150526183713.GU26599-HgARHv6XitJaoMGHk7MhZQC/G2K4zDHf@public.gmane.org>
@ 2015-05-26 20:53     ` Michael Welling
  2015-05-26 21:15       ` Cooper Jr., Franklin
  0 siblings, 1 reply; 16+ messages in thread
From: Michael Welling @ 2015-05-26 20:53 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Franklin Cooper Jr., dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
	vigneshr-l0cyMroinI0, bgriffis-l0cyMroinI0,
	jic23-DgEjT+Ai2ygdnm+yROfE0A, wsa-z923LK4zBo2bacvFa/9K2g,
	linux-input-u79uwXL29TY76Z2rM5mHXA,
	GWilson-+8BKOH/0X5NWk0Htik3J/w, linux-iio-u79uwXL29TY76Z2rM5mHXA

On Tue, May 26, 2015 at 01:37:13PM -0500, Felipe Balbi wrote:
> Hi,
> 
> On Tue, May 26, 2015 at 01:11:57PM -0500, Michael Welling wrote:
> > Greetings,
> > 
> > I have been porting Linux to a new AM3554 based SoM and have found issues
> > with the touchscreen reporting touch releases repeatedly to userspace
> > without actually touching the screen when running ts_calibrate, ts_test
> > or other graphical touchscreen applications.
> > 
> > This started happening after updating pulling recent changes.
> 
> Can you bisect and find the offending commit ? Which recent changes are
> you talking about ?

Sorry that it took so long to find the offending commit, it appears that
the issue occurs on my 4.3" display but not on my 7" display. I first
performed the git bisect on the 7" display which ended up being fruitless.

Then I switched over the the 4.3" display and found the commit which starts
having the issue.

michael@deathray:~/projects/linux/linux-torvalds$ git bisect start HEAD v3.18 -- drivers/input/touchscreen/ti_am335x_tsc.c
.
.
michael@deathray:~/projects/linux/linux-torvalds$ git bisect bad
344d635b9a41b19837ccf8083a99ea688027019c is the first bad commit
commit 344d635b9a41b19837ccf8083a99ea688027019c
Author: Brad Griffis <bgriffis-l0cyMroinI0@public.gmane.org>
Date:   Tue Feb 3 11:44:12 2015 -0800

    Input: ti_am335x_tsc - remove udelay in interrupt handler
    
    TSC interrupt handler had udelay to avoid reporting of false pen-up
    interrupt to user space. This patch implements workaround suggesting in
    Advisory 1.0.31 of silicon errata for am335x, thus eliminating udelay and
    touchscreen lag. This also improves performance of touchscreen and
    eliminates sudden jump of cursor at touch release.
    
    IDLECONFIG and CHARGECONFIG registers are to be configured with same values
    in order to eliminate false pen-up events. This workaround may result in
    false pen-down to be detected, hence considerable charge step delay needs
    to be added. The charge delay is set to 0xB000 (in terms of ADC clock
    cycles) by default.
    
    TSC steps are disabled at the end of every sampling cycle and EOS bit is
    set. Once the EOS bit is set, the TSC steps need to be re-enabled to begin
    next sampling cycle.
    
    Signed-off-by: Brad Griffis <bgriffis-l0cyMroinI0@public.gmane.org>
    [vigneshr-l0cyMroinI0@public.gmane.org: Ported the patch from v3.12 to v3.19rc1]
    Signed-off-by: Vignesh R <vigneshr-l0cyMroinI0@public.gmane.org>
    Signed-off-by: Dmitry Torokhov <dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Hope this sheds some light.

> 
> > It has also been confirmed to be happening on the beagle bone black:
> > http://www.spinics.net/lists/linux-iio/msg18580.html
> > 
> > If you look further into this thread you will see a workaround patch that
> > I came up with:
> > http://www.spinics.net/lists/linux-iio/msg18583.html
> > 
> > Though this fix stops the reported events in userspace, interrupts are
> > still occuring repeatedly.
> > 
> > Does anyone have any suggestions beyond what I have done to remedy this
> > issue?
> 
> yeah, it sounds similar to what Franklin has been working on.
> 
> Franklin, any comments ?
> 
> -- 
> balbi

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

* RE: AM335x touchscreen issues
  2015-05-26 20:53     ` Michael Welling
@ 2015-05-26 21:15       ` Cooper Jr., Franklin
       [not found]         ` <8F29D6B095ED194EA1980491A5E029710C89C445-CXzTdvP5/9qIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
  0 siblings, 1 reply; 16+ messages in thread
From: Cooper Jr., Franklin @ 2015-05-26 21:15 UTC (permalink / raw)
  To: Michael Welling, Balbi, Felipe
  Cc: dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	R, Vignesh, Griffis, Brad,
	jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org,
	linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	GWilson-+8BKOH/0X5NWk0Htik3J/w@public.gmane.org,
	linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org



> -----Original Message-----
> From: Michael Welling [mailto:mwelling79-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org] On Behalf Of Michael
> Welling
> Sent: Tuesday, May 26, 2015 3:53 PM
> To: Balbi, Felipe
> Cc: Cooper Jr., Franklin; dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; R, Vignesh; Griffis,
> Brad; jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org; wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org; linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org;
> GWilson-+8BKOH/0X5NWk0Htik3J/w@public.gmane.org; linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Subject: Re: AM335x touchscreen issues
> 
> On Tue, May 26, 2015 at 01:37:13PM -0500, Felipe Balbi wrote:
> > Hi,
> >
> > On Tue, May 26, 2015 at 01:11:57PM -0500, Michael Welling wrote:
> > > Greetings,
> > >
> > > I have been porting Linux to a new AM3554 based SoM and have found
> > > issues with the touchscreen reporting touch releases repeatedly to
> > > userspace without actually touching the screen when running
> > > ts_calibrate, ts_test or other graphical touchscreen applications.
> > >
> > > This started happening after updating pulling recent changes.
> >
> > Can you bisect and find the offending commit ? Which recent changes
> > are you talking about ?
> 
> Sorry that it took so long to find the offending commit, it appears that the
> issue occurs on my 4.3" display but not on my 7" display. I first performed the
> git bisect on the 7" display which ended up being fruitless.
> 
> Then I switched over the the 4.3" display and found the commit which starts
> having the issue.
> 
> michael@deathray:~/projects/linux/linux-torvalds$ git bisect start HEAD
> v3.18 -- drivers/input/touchscreen/ti_am335x_tsc.c
> .
> .
> michael@deathray:~/projects/linux/linux-torvalds$ git bisect bad
> 344d635b9a41b19837ccf8083a99ea688027019c is the first bad commit commit
> 344d635b9a41b19837ccf8083a99ea688027019c
> Author: Brad Griffis <bgriffis-l0cyMroinI0@public.gmane.org>
> Date:   Tue Feb 3 11:44:12 2015 -0800
> 
>     Input: ti_am335x_tsc - remove udelay in interrupt handler
> 
>     TSC interrupt handler had udelay to avoid reporting of false pen-up
>     interrupt to user space. This patch implements workaround suggesting in
>     Advisory 1.0.31 of silicon errata for am335x, thus eliminating udelay and
>     touchscreen lag. This also improves performance of touchscreen and
>     eliminates sudden jump of cursor at touch release.
> 
>     IDLECONFIG and CHARGECONFIG registers are to be configured with same
> values
>     in order to eliminate false pen-up events. This workaround may result in
>     false pen-down to be detected, hence considerable charge step delay
> needs
>     to be added. The charge delay is set to 0xB000 (in terms of ADC clock
>     cycles) by default.
> 
>     TSC steps are disabled at the end of every sampling cycle and EOS bit is
>     set. Once the EOS bit is set, the TSC steps need to be re-enabled to begin
>     next sampling cycle.
> 
>     Signed-off-by: Brad Griffis <bgriffis-l0cyMroinI0@public.gmane.org>
>     [vigneshr-l0cyMroinI0@public.gmane.org: Ported the patch from v3.12 to v3.19rc1]
>     Signed-off-by: Vignesh R <vigneshr-l0cyMroinI0@public.gmane.org>
>     Signed-off-by: Dmitry Torokhov <dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> 
> Hope this sheds some light.
> 
> >
> > > It has also been confirmed to be happening on the beagle bone black:
> > > http://www.spinics.net/lists/linux-iio/msg18580.html
> > >
> > > If you look further into this thread you will see a workaround patch
> > > that I came up with:
> > > http://www.spinics.net/lists/linux-iio/msg18583.html
> > >
> > > Though this fix stops the reported events in userspace, interrupts
> > > are still occuring repeatedly.
> > >
> > > Does anyone have any suggestions beyond what I have done to remedy
> > > this issue?
> >
> > yeah, it sounds similar to what Franklin has been working on.
> >
> > Franklin, any comments ?
[Franklin]
Michael,

Can you send me the output of ts_test_raw after you done a 5 or so touch down and touch up events? In the output let me know at which point in the log that the issue you observed has occurred. Please try to avoid moving your finger since I want to see the full output of that program but I'm not interested any unnecessary pen down events.

I recently encountered several touchscreen problems that I am working on submitting to mainline. Below are the variety of issues I discovered and fixed but its currently based on 3.14 kernel.

1. The x and y location right before a penup event is usually incorrect. Visibly the causes the cursor to jump right before a touchup. So I implemented a way to ignore that incorrect event.
2. I discovered that for some reason a series of touch up events are sent back to back. So I added something to ignore consecutive pen up events.
3. Sometimes a pen down event is reported with a pressure of 0. I noticed applications like ts_lib looked at the pressure and thought a pressure of 0 means a finger was lifted. So I added a patch that ignored 0 pressure pen down events. This prevented premature touchups.
4. I added debouncing. Essentially the driver didn't report any touch events for a user specified number of ms after a pen up occured. It was noticed especially during touchscreen calibration that after a person lifted their finger after touching the screen a combination of pen up and pen down events were incorrectly detected.

Most likely a combination of 2-4 is your problem. I think the udelay acted like an unintentional debounce which is probably why it wasn't discovered sooner.
> >
> > --
> > balbi
> 

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

* Re: AM335x touchscreen issues
       [not found]         ` <8F29D6B095ED194EA1980491A5E029710C89C445-CXzTdvP5/9qIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
@ 2015-05-26 21:28           ` Michael Welling
  2015-05-26 21:34             ` Cooper Jr., Franklin
  0 siblings, 1 reply; 16+ messages in thread
From: Michael Welling @ 2015-05-26 21:28 UTC (permalink / raw)
  To: Cooper Jr., Franklin
  Cc: Balbi, Felipe,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	R, Vignesh, Griffis, Brad,
	jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org,
	linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	GWilson-+8BKOH/0X5NWk0Htik3J/w@public.gmane.org,
	linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

On Tue, May 26, 2015 at 09:15:53PM +0000, Cooper Jr., Franklin wrote:
> Michael,
> 
> Can you send me the output of ts_test_raw after you done a 5 or so touch down and touch up events? In the output let me know at which point in the log that the issue you observed has occurred. Please try to avoid moving your finger since I want to see the full output of that program but I'm not interested any unnecessary pen down events.
>

Oddly the repeated pen up and down events do not occur when running ts_print_raw:
root@som3517-som200:~# ts_print_raw 
1418169393.147827:   1648   2075    206
1418169393.229976:   1725   1983    240
1418169393.312154:   1731   1980    240
1418169393.394333:   1706   2043    239
1418169393.476523:   1703   2028    241
1418169393.558708:   1714   2041    240
1418169393.640888:   1704   2041    240
1418169393.721556:      0      0      0
1418169395.283096:   2889   2512    192
1418169395.365236:   2947   2486    210
1418169395.447413:   2949   2470    211
1418169395.529606:   2943   2497    211
1418169395.611759:   2922   2506    211
1418169395.693935:   2866   2474    213
1418169395.776135:   2858   2481    214
1418169395.858305:   2861   2451    213
1418169395.938972:      0      0      0
1418169397.482867:   1083   1981    236
1418169397.565026:   1157   1832    254
1418169397.647217:   1161   1856    256
1418169397.729412:   1158   1883    255
1418169397.811583:   1159   1841    255
1418169397.893760:   1159   1864    256
1418169397.975947:   1158   1893    256
1418169398.056605:      0      0      0
1418169399.690290:   2299   2372    178
1418169399.772432:   2388   2160    221
1418169399.854611:   2391   2190    223
1418169399.936802:   2379   2207    223
1418169400.018966:   2389   2184    223
1418169400.101146:   2383   2208    224
1418169400.183338:   2381   2203    223
1418169400.264012:      0      0      0
1418169402.073266:   1230   2381    212
1418169402.155413:   1301   2097    247
1418169402.237590:   1313   2077    248
1418169402.319772:   1307   2126    248
1418169402.401948:   1304   2096    248
1418169402.484127:   4078   2155     58
1418169402.564801:      0      0      0

Here is what the output of ts_test looks like without even touching the screen:
root@som3517-som200:~# ts_test               
1418169549.722957:    816     17     58
1418169549.803604:    816     17      0
1418169549.817757:    816     25     58
1418169549.898411:    816     25      0
1418169549.912828:    816     41     59
1418169549.993463:    816     41      0
1418169550.007771:    816     28     58
1418169550.088404:    816     28      0
1418169550.102828:    816     33     58
1418169550.183486:    816     33      0
1418169550.197767:    816     42     59
1418169550.278401:    816     42      0
1418169550.292970:    816     23     58
1418169550.373604:    816     23      0
1418169550.387773:    816     28     58
1418169550.468404:    816     28      0
1418169550.482955:    816     32     59
1418169550.563600:    816     32      0
1418169550.577773:    816     25     58
1418169550.658406:    816     25      0
1418169550.672827:    816     35     59
1418169550.753464:    816     35      0
1418169550.767761:    816     42     59
1418169550.848407:    816     42      0
1418169550.862826:    816     41     59
1418169550.943462:    816     41      0
1418169550.958013:    816     37     59
1418169551.038655:    816     37      0
1418169551.052824:    816     41     59
1418169551.133475:    816     41      0
1418169551.147774:    816     28     58
1418169551.228406:    816     28      0
.
.

> I recently encountered several touchscreen problems that I am working on submitting to mainline. Below are the variety of issues I discovered and fixed but its currently based on 3.14 kernel.
> 
> 1. The x and y location right before a penup event is usually incorrect. Visibly the causes the cursor to jump right before a touchup. So I implemented a way to ignore that incorrect event.
> 2. I discovered that for some reason a series of touch up events are sent back to back. So I added something to ignore consecutive pen up events.
> 3. Sometimes a pen down event is reported with a pressure of 0. I noticed applications like ts_lib looked at the pressure and thought a pressure of 0 means a finger was lifted. So I added a patch that ignored 0 pressure pen down events. This prevented premature touchups.
> 4. I added debouncing. Essentially the driver didn't report any touch events for a user specified number of ms after a pen up occured. It was noticed especially during touchscreen calibration that after a person lifted their finger after touching the screen a combination of pen up and pen down events were incorrectly detected.
> 
> Most likely a combination of 2-4 is your problem. I think the udelay acted like an unintentional debounce which is probably why it wasn't discovered sooner.
> > >
> > > --
> > > balbi
> > 
> 

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

* RE: AM335x touchscreen issues
  2015-05-26 21:28           ` Michael Welling
@ 2015-05-26 21:34             ` Cooper Jr., Franklin
       [not found]               ` <8F29D6B095ED194EA1980491A5E029710C89C4E0-CXzTdvP5/9qIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
  2015-05-26 21:41               ` Michael Welling
  0 siblings, 2 replies; 16+ messages in thread
From: Cooper Jr., Franklin @ 2015-05-26 21:34 UTC (permalink / raw)
  To: Michael Welling
  Cc: Balbi, Felipe, dmitry.torokhov@gmail.com, R, Vignesh,
	Griffis, Brad, jic23@kernel.org, wsa@the-dreams.de,
	linux-input@vger.kernel.org, GWilson@sakuraus.com,
	linux-iio@vger.kernel.org



> -----Original Message-----
> From: Michael Welling [mailto:mwelling79@gmail.com] On Behalf Of Michael
> Welling
> Sent: Tuesday, May 26, 2015 4:29 PM
> To: Cooper Jr., Franklin
> Cc: Balbi, Felipe; dmitry.torokhov@gmail.com; R, Vignesh; Griffis, Brad;
> jic23@kernel.org; wsa@the-dreams.de; linux-input@vger.kernel.org;
> GWilson@sakuraus.com; linux-iio@vger.kernel.org
> Subject: Re: AM335x touchscreen issues
> 
> On Tue, May 26, 2015 at 09:15:53PM +0000, Cooper Jr., Franklin wrote:
> > Michael,
> >
> > Can you send me the output of ts_test_raw after you done a 5 or so touch
> down and touch up events? In the output let me know at which point in the
> log that the issue you observed has occurred. Please try to avoid moving your
> finger since I want to see the full output of that program but I'm not
> interested any unnecessary pen down events.
> >
> 
> Oddly the repeated pen up and down events do not occur when running
> ts_print_raw:
> root@som3517-som200:~# ts_print_raw
> 1418169393.147827:   1648   2075    206
> 1418169393.229976:   1725   1983    240
> 1418169393.312154:   1731   1980    240
> 1418169393.394333:   1706   2043    239
> 1418169393.476523:   1703   2028    241
> 1418169393.558708:   1714   2041    240
> 1418169393.640888:   1704   2041    240
> 1418169393.721556:      0      0      0
> 1418169395.283096:   2889   2512    192
> 1418169395.365236:   2947   2486    210
> 1418169395.447413:   2949   2470    211
> 1418169395.529606:   2943   2497    211
> 1418169395.611759:   2922   2506    211
> 1418169395.693935:   2866   2474    213
> 1418169395.776135:   2858   2481    214
> 1418169395.858305:   2861   2451    213
> 1418169395.938972:      0      0      0
> 1418169397.482867:   1083   1981    236
> 1418169397.565026:   1157   1832    254
> 1418169397.647217:   1161   1856    256
> 1418169397.729412:   1158   1883    255
> 1418169397.811583:   1159   1841    255
> 1418169397.893760:   1159   1864    256
> 1418169397.975947:   1158   1893    256
> 1418169398.056605:      0      0      0
> 1418169399.690290:   2299   2372    178
> 1418169399.772432:   2388   2160    221
> 1418169399.854611:   2391   2190    223
> 1418169399.936802:   2379   2207    223
> 1418169400.018966:   2389   2184    223
> 1418169400.101146:   2383   2208    224
> 1418169400.183338:   2381   2203    223
> 1418169400.264012:      0      0      0
> 1418169402.073266:   1230   2381    212
> 1418169402.155413:   1301   2097    247
> 1418169402.237590:   1313   2077    248
> 1418169402.319772:   1307   2126    248
> 1418169402.401948:   1304   2096    248
> 1418169402.484127:   4078   2155     58
> 1418169402.564801:      0      0      0
> 
> Here is what the output of ts_test looks like without even touching the
> screen:
> root@som3517-som200:~# ts_test
> 1418169549.722957:    816     17     58
> 1418169549.803604:    816     17      0
> 1418169549.817757:    816     25     58
> 1418169549.898411:    816     25      0
> 1418169549.912828:    816     41     59
> 1418169549.993463:    816     41      0
> 1418169550.007771:    816     28     58
> 1418169550.088404:    816     28      0
> 1418169550.102828:    816     33     58
> 1418169550.183486:    816     33      0
> 1418169550.197767:    816     42     59
> 1418169550.278401:    816     42      0
> 1418169550.292970:    816     23     58
> 1418169550.373604:    816     23      0
> 1418169550.387773:    816     28     58
> 1418169550.468404:    816     28      0
> 1418169550.482955:    816     32     59
> 1418169550.563600:    816     32      0
> 1418169550.577773:    816     25     58
> 1418169550.658406:    816     25      0
> 1418169550.672827:    816     35     59
> 1418169550.753464:    816     35      0
> 1418169550.767761:    816     42     59
> 1418169550.848407:    816     42      0
> 1418169550.862826:    816     41     59
> 1418169550.943462:    816     41      0
> 1418169550.958013:    816     37     59
> 1418169551.038655:    816     37      0
> 1418169551.052824:    816     41     59
> 1418169551.133475:    816     41      0
> 1418169551.147774:    816     28     58
> 1418169551.228406:    816     28      0
[Franklin] So your saying the above ts_test is being ran and you never touched the screen? Looking at the mailing list post you sent earlier it seems like the goal is for the ADC to be used at the same time. Is that the case when you ran both ts_test and ts_print_raw?


> .
> .
> 
> > I recently encountered several touchscreen problems that I am working on
> submitting to mainline. Below are the variety of issues I discovered and fixed
> but its currently based on 3.14 kernel.
> >
> > 1. The x and y location right before a penup event is usually incorrect.
> Visibly the causes the cursor to jump right before a touchup. So I
> implemented a way to ignore that incorrect event.
> > 2. I discovered that for some reason a series of touch up events are sent
> back to back. So I added something to ignore consecutive pen up events.
> > 3. Sometimes a pen down event is reported with a pressure of 0. I noticed
> applications like ts_lib looked at the pressure and thought a pressure of 0
> means a finger was lifted. So I added a patch that ignored 0 pressure pen
> down events. This prevented premature touchups.
> > 4. I added debouncing. Essentially the driver didn't report any touch events
> for a user specified number of ms after a pen up occured. It was noticed
> especially during touchscreen calibration that after a person lifted their finger
> after touching the screen a combination of pen up and pen down events
> were incorrectly detected.
> >
> > Most likely a combination of 2-4 is your problem. I think the udelay acted
> like an unintentional debounce which is probably why it wasn't discovered
> sooner.
> > > >
> > > > --
> > > > balbi
> > >
> >

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

* RE: AM335x touchscreen issues
       [not found]               ` <8F29D6B095ED194EA1980491A5E029710C89C4E0-CXzTdvP5/9qIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
@ 2015-05-26 21:36                 ` Griffis, Brad
       [not found]                   ` <912A29987EAE174BA6CF187D7CDFA9CE270A8C43-YmePFLaaepqIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
  0 siblings, 1 reply; 16+ messages in thread
From: Griffis, Brad @ 2015-05-26 21:36 UTC (permalink / raw)
  To: Cooper Jr., Franklin, Michael Welling
  Cc: Balbi, Felipe,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	R, Vignesh, jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org,
	linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	GWilson-+8BKOH/0X5NWk0Htik3J/w@public.gmane.org,
	linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org


> -----Original Message-----
> From: Cooper Jr., Franklin
> > -----Original Message-----
> > From: Michael Welling [mailto:mwelling79-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org] On Behalf Of
> > Michael Welling
> > Sent: Tuesday, May 26, 2015 4:29 PM
> > To: Cooper Jr., Franklin
> > Cc: Balbi, Felipe; dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; R, Vignesh; Griffis,
> > Brad; jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org; wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org;
> > linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; GWilson-+8BKOH/0X5NWk0Htik3J/w@public.gmane.org;
> > linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> > Subject: Re: AM335x touchscreen issues
> >
> > On Tue, May 26, 2015 at 09:15:53PM +0000, Cooper Jr., Franklin wrote:
> > > Michael,
> > >
> > > Can you send me the output of ts_test_raw after you done a 5 or so
> > > touch
> > down and touch up events? In the output let me know at which point in
> > the log that the issue you observed has occurred. Please try to avoid
> > moving your finger since I want to see the full output of that program
> > but I'm not interested any unnecessary pen down events.
> > >
> >
> > Oddly the repeated pen up and down events do not occur when running
> > ts_print_raw:
> > root@som3517-som200:~# ts_print_raw
> > 1418169393.147827:   1648   2075    206
> > 1418169393.229976:   1725   1983    240
> > 1418169393.312154:   1731   1980    240
> > 1418169393.394333:   1706   2043    239
> > 1418169393.476523:   1703   2028    241
> > 1418169393.558708:   1714   2041    240
> > 1418169393.640888:   1704   2041    240
> > 1418169393.721556:      0      0      0
> > 1418169395.283096:   2889   2512    192
> > 1418169395.365236:   2947   2486    210
> > 1418169395.447413:   2949   2470    211
> > 1418169395.529606:   2943   2497    211
> > 1418169395.611759:   2922   2506    211
> > 1418169395.693935:   2866   2474    213
> > 1418169395.776135:   2858   2481    214
> > 1418169395.858305:   2861   2451    213
> > 1418169395.938972:      0      0      0
> > 1418169397.482867:   1083   1981    236
> > 1418169397.565026:   1157   1832    254
> > 1418169397.647217:   1161   1856    256
> > 1418169397.729412:   1158   1883    255
> > 1418169397.811583:   1159   1841    255
> > 1418169397.893760:   1159   1864    256
> > 1418169397.975947:   1158   1893    256
> > 1418169398.056605:      0      0      0
> > 1418169399.690290:   2299   2372    178
> > 1418169399.772432:   2388   2160    221
> > 1418169399.854611:   2391   2190    223
> > 1418169399.936802:   2379   2207    223
> > 1418169400.018966:   2389   2184    223
> > 1418169400.101146:   2383   2208    224
> > 1418169400.183338:   2381   2203    223
> > 1418169400.264012:      0      0      0
> > 1418169402.073266:   1230   2381    212
> > 1418169402.155413:   1301   2097    247
> > 1418169402.237590:   1313   2077    248
> > 1418169402.319772:   1307   2126    248
> > 1418169402.401948:   1304   2096    248
> > 1418169402.484127:   4078   2155     58
> > 1418169402.564801:      0      0      0
> >
> > Here is what the output of ts_test looks like without even touching
> > the
> > screen:
> > root@som3517-som200:~# ts_test
> > 1418169549.722957:    816     17     58
> > 1418169549.803604:    816     17      0
> > 1418169549.817757:    816     25     58
> > 1418169549.898411:    816     25      0
> > 1418169549.912828:    816     41     59
> > 1418169549.993463:    816     41      0
> > 1418169550.007771:    816     28     58
> > 1418169550.088404:    816     28      0
> > 1418169550.102828:    816     33     58
> > 1418169550.183486:    816     33      0
> > 1418169550.197767:    816     42     59
> > 1418169550.278401:    816     42      0
> > 1418169550.292970:    816     23     58
> > 1418169550.373604:    816     23      0
> > 1418169550.387773:    816     28     58
> > 1418169550.468404:    816     28      0
> > 1418169550.482955:    816     32     59
> > 1418169550.563600:    816     32      0
> > 1418169550.577773:    816     25     58
> > 1418169550.658406:    816     25      0
> > 1418169550.672827:    816     35     59
> > 1418169550.753464:    816     35      0
> > 1418169550.767761:    816     42     59
> > 1418169550.848407:    816     42      0
> > 1418169550.862826:    816     41     59
> > 1418169550.943462:    816     41      0
> > 1418169550.958013:    816     37     59
> > 1418169551.038655:    816     37      0
> > 1418169551.052824:    816     41     59
> > 1418169551.133475:    816     41      0
> > 1418169551.147774:    816     28     58
> > 1418169551.228406:    816     28      0
> [Franklin] So your saying the above ts_test is being ran and you never
> touched the screen? Looking at the mailing list post you sent earlier it seems
> like the goal is for the ADC to be used at the same time. Is that the case when
> you ran both ts_test and ts_print_raw?

I was also wondering if this relates to raw ADC samples being captured.  The TSCADC should not be capturing anything at all if the screen is not touched.  You need the pen-down event to initiate the capture sequence.  I'm curious what the state of the pins is during this occurrence, i.e. are we actually seeing some kind of event on the lines?  I suspect that something is misconfigured somewhere, perhaps resulting in a change of state in the pins that registers as a pen-down.

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

* Re: AM335x touchscreen issues
  2015-05-26 21:34             ` Cooper Jr., Franklin
       [not found]               ` <8F29D6B095ED194EA1980491A5E029710C89C4E0-CXzTdvP5/9qIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
@ 2015-05-26 21:41               ` Michael Welling
  1 sibling, 0 replies; 16+ messages in thread
From: Michael Welling @ 2015-05-26 21:41 UTC (permalink / raw)
  To: Cooper Jr., Franklin
  Cc: Balbi, Felipe, dmitry.torokhov@gmail.com, R, Vignesh,
	Griffis, Brad, jic23@kernel.org, wsa@the-dreams.de,
	linux-input@vger.kernel.org, GWilson@sakuraus.com,
	linux-iio@vger.kernel.org

On Tue, May 26, 2015 at 09:34:10PM +0000, Cooper Jr., Franklin wrote:
> 
> 
> > -----Original Message-----
> > From: Michael Welling [mailto:mwelling79@gmail.com] On Behalf Of Michael
> > Welling
> > Sent: Tuesday, May 26, 2015 4:29 PM
> > To: Cooper Jr., Franklin
> > Cc: Balbi, Felipe; dmitry.torokhov@gmail.com; R, Vignesh; Griffis, Brad;
> > jic23@kernel.org; wsa@the-dreams.de; linux-input@vger.kernel.org;
> > GWilson@sakuraus.com; linux-iio@vger.kernel.org
> > Subject: Re: AM335x touchscreen issues
> > 
> > On Tue, May 26, 2015 at 09:15:53PM +0000, Cooper Jr., Franklin wrote:
> > > Michael,
> > >
> > > Can you send me the output of ts_test_raw after you done a 5 or so touch
> > down and touch up events? In the output let me know at which point in the
> > log that the issue you observed has occurred. Please try to avoid moving your
> > finger since I want to see the full output of that program but I'm not
> > interested any unnecessary pen down events.
> > >
> > 
> > Oddly the repeated pen up and down events do not occur when running
> > ts_print_raw:
> > root@som3517-som200:~# ts_print_raw
> > 1418169393.147827:   1648   2075    206
> > 1418169393.229976:   1725   1983    240
> > 1418169393.312154:   1731   1980    240
> > 1418169393.394333:   1706   2043    239
> > 1418169393.476523:   1703   2028    241
> > 1418169393.558708:   1714   2041    240
> > 1418169393.640888:   1704   2041    240
> > 1418169393.721556:      0      0      0
> > 1418169395.283096:   2889   2512    192
> > 1418169395.365236:   2947   2486    210
> > 1418169395.447413:   2949   2470    211
> > 1418169395.529606:   2943   2497    211
> > 1418169395.611759:   2922   2506    211
> > 1418169395.693935:   2866   2474    213
> > 1418169395.776135:   2858   2481    214
> > 1418169395.858305:   2861   2451    213
> > 1418169395.938972:      0      0      0
> > 1418169397.482867:   1083   1981    236
> > 1418169397.565026:   1157   1832    254
> > 1418169397.647217:   1161   1856    256
> > 1418169397.729412:   1158   1883    255
> > 1418169397.811583:   1159   1841    255
> > 1418169397.893760:   1159   1864    256
> > 1418169397.975947:   1158   1893    256
> > 1418169398.056605:      0      0      0
> > 1418169399.690290:   2299   2372    178
> > 1418169399.772432:   2388   2160    221
> > 1418169399.854611:   2391   2190    223
> > 1418169399.936802:   2379   2207    223
> > 1418169400.018966:   2389   2184    223
> > 1418169400.101146:   2383   2208    224
> > 1418169400.183338:   2381   2203    223
> > 1418169400.264012:      0      0      0
> > 1418169402.073266:   1230   2381    212
> > 1418169402.155413:   1301   2097    247
> > 1418169402.237590:   1313   2077    248
> > 1418169402.319772:   1307   2126    248
> > 1418169402.401948:   1304   2096    248
> > 1418169402.484127:   4078   2155     58
> > 1418169402.564801:      0      0      0
> > 
> > Here is what the output of ts_test looks like without even touching the
> > screen:
> > root@som3517-som200:~# ts_test
> > 1418169549.722957:    816     17     58
> > 1418169549.803604:    816     17      0
> > 1418169549.817757:    816     25     58
> > 1418169549.898411:    816     25      0
> > 1418169549.912828:    816     41     59
> > 1418169549.993463:    816     41      0
> > 1418169550.007771:    816     28     58
> > 1418169550.088404:    816     28      0
> > 1418169550.102828:    816     33     58
> > 1418169550.183486:    816     33      0
> > 1418169550.197767:    816     42     59
> > 1418169550.278401:    816     42      0
> > 1418169550.292970:    816     23     58
> > 1418169550.373604:    816     23      0
> > 1418169550.387773:    816     28     58
> > 1418169550.468404:    816     28      0
> > 1418169550.482955:    816     32     59
> > 1418169550.563600:    816     32      0
> > 1418169550.577773:    816     25     58
> > 1418169550.658406:    816     25      0
> > 1418169550.672827:    816     35     59
> > 1418169550.753464:    816     35      0
> > 1418169550.767761:    816     42     59
> > 1418169550.848407:    816     42      0
> > 1418169550.862826:    816     41     59
> > 1418169550.943462:    816     41      0
> > 1418169550.958013:    816     37     59
> > 1418169551.038655:    816     37      0
> > 1418169551.052824:    816     41     59
> > 1418169551.133475:    816     41      0
> > 1418169551.147774:    816     28     58
> > 1418169551.228406:    816     28      0
> [Franklin] So your saying the above ts_test is being ran and you never touched the screen?
Yes.

> Looking at the mailing list post you sent earlier it seems like the goal is for the ADC to be used at the same time. 
> Is that the case when you ran both ts_test and ts_print_raw?

No. I am not sampling the ADC. 

This happening without any interaction with the screen.

> 
> 
> > .
> > .
> > 
> > > I recently encountered several touchscreen problems that I am working on
> > submitting to mainline. Below are the variety of issues I discovered and fixed
> > but its currently based on 3.14 kernel.
> > >
> > > 1. The x and y location right before a penup event is usually incorrect.
> > Visibly the causes the cursor to jump right before a touchup. So I
> > implemented a way to ignore that incorrect event.
> > > 2. I discovered that for some reason a series of touch up events are sent
> > back to back. So I added something to ignore consecutive pen up events.
> > > 3. Sometimes a pen down event is reported with a pressure of 0. I noticed
> > applications like ts_lib looked at the pressure and thought a pressure of 0
> > means a finger was lifted. So I added a patch that ignored 0 pressure pen
> > down events. This prevented premature touchups.
> > > 4. I added debouncing. Essentially the driver didn't report any touch events
> > for a user specified number of ms after a pen up occured. It was noticed
> > especially during touchscreen calibration that after a person lifted their finger
> > after touching the screen a combination of pen up and pen down events
> > were incorrectly detected.
> > >
> > > Most likely a combination of 2-4 is your problem. I think the udelay acted
> > like an unintentional debounce which is probably why it wasn't discovered
> > sooner.
> > > > >
> > > > > --
> > > > > balbi
> > > >
> > >

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

* Re: AM335x touchscreen issues
       [not found]                   ` <912A29987EAE174BA6CF187D7CDFA9CE270A8C43-YmePFLaaepqIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
@ 2015-05-26 21:50                     ` Michael Welling
  2015-05-26 22:25                       ` Griffis, Brad
  2015-05-26 22:31                       ` Cooper Jr., Franklin
  0 siblings, 2 replies; 16+ messages in thread
From: Michael Welling @ 2015-05-26 21:50 UTC (permalink / raw)
  To: Griffis, Brad
  Cc: Cooper Jr., Franklin, Balbi, Felipe,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	R, Vignesh, jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org,
	linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	GWilson-+8BKOH/0X5NWk0Htik3J/w@public.gmane.org,
	linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

On Tue, May 26, 2015 at 09:36:57PM +0000, Griffis, Brad wrote:
> 
> > -----Original Message-----
> > From: Cooper Jr., Franklin
> > > -----Original Message-----
> > > From: Michael Welling [mailto:mwelling79-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org] On Behalf Of
> > > Michael Welling
> > > Sent: Tuesday, May 26, 2015 4:29 PM
> > > To: Cooper Jr., Franklin
> > > Cc: Balbi, Felipe; dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; R, Vignesh; Griffis,
> > > Brad; jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org; wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org;
> > > linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; GWilson-+8BKOH/0X5NWk0Htik3J/w@public.gmane.org;
> > > linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> > > Subject: Re: AM335x touchscreen issues
> > >
> > > On Tue, May 26, 2015 at 09:15:53PM +0000, Cooper Jr., Franklin wrote:
> > > > Michael,
> > > >
> > > > Can you send me the output of ts_test_raw after you done a 5 or so
> > > > touch
> > > down and touch up events? In the output let me know at which point in
> > > the log that the issue you observed has occurred. Please try to avoid
> > > moving your finger since I want to see the full output of that program
> > > but I'm not interested any unnecessary pen down events.
> > > >
> > >
> > > Oddly the repeated pen up and down events do not occur when running
> > > ts_print_raw:
> > > root@som3517-som200:~# ts_print_raw
> > > 1418169393.147827:   1648   2075    206
> > > 1418169393.229976:   1725   1983    240
> > > 1418169393.312154:   1731   1980    240
> > > 1418169393.394333:   1706   2043    239
> > > 1418169393.476523:   1703   2028    241
> > > 1418169393.558708:   1714   2041    240
> > > 1418169393.640888:   1704   2041    240
> > > 1418169393.721556:      0      0      0
> > > 1418169395.283096:   2889   2512    192
> > > 1418169395.365236:   2947   2486    210
> > > 1418169395.447413:   2949   2470    211
> > > 1418169395.529606:   2943   2497    211
> > > 1418169395.611759:   2922   2506    211
> > > 1418169395.693935:   2866   2474    213
> > > 1418169395.776135:   2858   2481    214
> > > 1418169395.858305:   2861   2451    213
> > > 1418169395.938972:      0      0      0
> > > 1418169397.482867:   1083   1981    236
> > > 1418169397.565026:   1157   1832    254
> > > 1418169397.647217:   1161   1856    256
> > > 1418169397.729412:   1158   1883    255
> > > 1418169397.811583:   1159   1841    255
> > > 1418169397.893760:   1159   1864    256
> > > 1418169397.975947:   1158   1893    256
> > > 1418169398.056605:      0      0      0
> > > 1418169399.690290:   2299   2372    178
> > > 1418169399.772432:   2388   2160    221
> > > 1418169399.854611:   2391   2190    223
> > > 1418169399.936802:   2379   2207    223
> > > 1418169400.018966:   2389   2184    223
> > > 1418169400.101146:   2383   2208    224
> > > 1418169400.183338:   2381   2203    223
> > > 1418169400.264012:      0      0      0
> > > 1418169402.073266:   1230   2381    212
> > > 1418169402.155413:   1301   2097    247
> > > 1418169402.237590:   1313   2077    248
> > > 1418169402.319772:   1307   2126    248
> > > 1418169402.401948:   1304   2096    248
> > > 1418169402.484127:   4078   2155     58
> > > 1418169402.564801:      0      0      0
> > >
> > > Here is what the output of ts_test looks like without even touching
> > > the
> > > screen:
> > > root@som3517-som200:~# ts_test
> > > 1418169549.722957:    816     17     58
> > > 1418169549.803604:    816     17      0
> > > 1418169549.817757:    816     25     58
> > > 1418169549.898411:    816     25      0
> > > 1418169549.912828:    816     41     59
> > > 1418169549.993463:    816     41      0
> > > 1418169550.007771:    816     28     58
> > > 1418169550.088404:    816     28      0
> > > 1418169550.102828:    816     33     58
> > > 1418169550.183486:    816     33      0
> > > 1418169550.197767:    816     42     59
> > > 1418169550.278401:    816     42      0
> > > 1418169550.292970:    816     23     58
> > > 1418169550.373604:    816     23      0
> > > 1418169550.387773:    816     28     58
> > > 1418169550.468404:    816     28      0
> > > 1418169550.482955:    816     32     59
> > > 1418169550.563600:    816     32      0
> > > 1418169550.577773:    816     25     58
> > > 1418169550.658406:    816     25      0
> > > 1418169550.672827:    816     35     59
> > > 1418169550.753464:    816     35      0
> > > 1418169550.767761:    816     42     59
> > > 1418169550.848407:    816     42      0
> > > 1418169550.862826:    816     41     59
> > > 1418169550.943462:    816     41      0
> > > 1418169550.958013:    816     37     59
> > > 1418169551.038655:    816     37      0
> > > 1418169551.052824:    816     41     59
> > > 1418169551.133475:    816     41      0
> > > 1418169551.147774:    816     28     58
> > > 1418169551.228406:    816     28      0
> > [Franklin] So your saying the above ts_test is being ran and you never
> > touched the screen? Looking at the mailing list post you sent earlier it seems
> > like the goal is for the ADC to be used at the same time. Is that the case when
> > you ran both ts_test and ts_print_raw?
> 
> I was also wondering if this relates to raw ADC samples being captured.  The TSCADC should not be capturing anything at all if the screen is not touched.  You need the pen-down event to initiate the capture sequence.  I'm curious what the state of the pins is during this occurrence, i.e. are we actually seeing some kind of event on the lines?  I suspect that something is misconfigured somewhere, perhaps resulting in a change of state in the pins that registers as a pen-down.

Then why would reverting a commit make the problem go away?

It seems to have something to do with the characteristic of the touchscreen
as this does not happen on my 7" display.

Looking at the datasheet these pin are dedicated analogs and cannot be
MUX'd otherwise.

http://www.ti.com/lit/ds/symlink/am3354.pdf 
page 20

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

* RE: AM335x touchscreen issues
  2015-05-26 21:50                     ` Michael Welling
@ 2015-05-26 22:25                       ` Griffis, Brad
       [not found]                         ` <912A29987EAE174BA6CF187D7CDFA9CE270A8D48-YmePFLaaepqIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
  2015-05-26 22:31                       ` Cooper Jr., Franklin
  1 sibling, 1 reply; 16+ messages in thread
From: Griffis, Brad @ 2015-05-26 22:25 UTC (permalink / raw)
  To: Michael Welling
  Cc: Cooper Jr., Franklin, Balbi, Felipe,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	R, Vignesh, jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org,
	linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	GWilson-+8BKOH/0X5NWk0Htik3J/w@public.gmane.org,
	linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

> -----Original Message-----
> From: Michael Welling [mailto:mwelling79-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org] On Behalf Of Michael
> Welling
> 
> It seems to have something to do with the characteristic of the touchscreen
> as this does not happen on my 7" display.
> 
> Looking at the datasheet these pin are dedicated analogs and cannot be
> MUX'd otherwise.
> 
> http://www.ti.com/lit/ds/symlink/am3354.pdf
> page 20

Let me please re-ask a previously asked question just to be certain we're on the same page, because I think it is an extremely important question.

As background, the analog pins you mention belong to the "TSCADC" peripheral.  This peripheral, as the name suggests, has two purposes:

1. It's a touchscreen controller.  For example, you might use 4 of the 8 analog inputs for the purpose of a touchscreen.
2. It's a general purpose A/D converter.  The remaining unused analog inputs can be used for general purposes such as checking a battery voltage, reading a thermistor, etc.

What I would like to know is how many of those 8 pins are being used.  Are you only using 4 pins for a resistive touchscreen, or are some other pins being used for general purpose ADC?

Let me also provide more background on why I'm asking...  The patch set I created was originally developed on a 3.12 kernel.  On the 3.14 kernel there were some pretty major changes done with regard to how the general purpose ADC samples are collected.  So far, all the problematic areas I've bumped into with respect to integrating these patches in newer kernels have been in scenarios where there is ADC collection happening simultaneously.  So I'm trying to understand if your issue falls into that bucket or is something completely different.

It would be useful to probe the touchscreen signals during your test, particularly AIN0 which controls the pen-down interrupt.  Fundamentally I want to understand how it's possible that you're getting a pen-down interrupt when nothing is touching the screen.  I agree it's odd that you don't see the issue without my patch, though if you want to get to the heart of the issue we will need to make some observations to understand what's happening.  I'm afraid we're moving in the wrong direction by just adding extra checks and filters into the kernel code.  In other words, I think that's a more of a workaround than a solution, but it's hard to know for sure without some additional data points.

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

* RE: AM335x touchscreen issues
  2015-05-26 21:50                     ` Michael Welling
  2015-05-26 22:25                       ` Griffis, Brad
@ 2015-05-26 22:31                       ` Cooper Jr., Franklin
       [not found]                         ` <8F29D6B095ED194EA1980491A5E029710C89C70D-CXzTdvP5/9qIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
  1 sibling, 1 reply; 16+ messages in thread
From: Cooper Jr., Franklin @ 2015-05-26 22:31 UTC (permalink / raw)
  To: Michael Welling, Griffis, Brad
  Cc: Balbi, Felipe, dmitry.torokhov@gmail.com, R, Vignesh,
	jic23@kernel.org, wsa@the-dreams.de, linux-input@vger.kernel.org,
	GWilson@sakuraus.com, linux-iio@vger.kernel.org



> -----Original Message-----
> From: Michael Welling [mailto:mwelling79@gmail.com] On Behalf Of Michael
> Welling
> Sent: Tuesday, May 26, 2015 4:51 PM
> To: Griffis, Brad
> Cc: Cooper Jr., Franklin; Balbi, Felipe; dmitry.torokhov@gmail.com; R,
> Vignesh; jic23@kernel.org; wsa@the-dreams.de; linux-
> input@vger.kernel.org; GWilson@sakuraus.com; linux-iio@vger.kernel.org
> Subject: Re: AM335x touchscreen issues
> 
> On Tue, May 26, 2015 at 09:36:57PM +0000, Griffis, Brad wrote:
> >
> > > -----Original Message-----
> > > From: Cooper Jr., Franklin
> > > > -----Original Message-----
> > > > From: Michael Welling [mailto:mwelling79@gmail.com] On Behalf Of
> > > > Michael Welling
> > > > Sent: Tuesday, May 26, 2015 4:29 PM
> > > > To: Cooper Jr., Franklin
> > > > Cc: Balbi, Felipe; dmitry.torokhov@gmail.com; R, Vignesh; Griffis,
> > > > Brad; jic23@kernel.org; wsa@the-dreams.de;
> > > > linux-input@vger.kernel.org; GWilson@sakuraus.com;
> > > > linux-iio@vger.kernel.org
> > > > Subject: Re: AM335x touchscreen issues
> > > >
> > > > On Tue, May 26, 2015 at 09:15:53PM +0000, Cooper Jr., Franklin wrote:
> > > > > Michael,
> > > > >
> > > > > Can you send me the output of ts_test_raw after you done a 5 or
> > > > > so touch
> > > > down and touch up events? In the output let me know at which point
> > > > in the log that the issue you observed has occurred. Please try to
> > > > avoid moving your finger since I want to see the full output of
> > > > that program but I'm not interested any unnecessary pen down events.
> > > > >
> > > >
> > > > Oddly the repeated pen up and down events do not occur when
> > > > running
> > > > ts_print_raw:
> > > > root@som3517-som200:~# ts_print_raw
> > > > 1418169393.147827:   1648   2075    206
> > > > 1418169393.229976:   1725   1983    240
> > > > 1418169393.312154:   1731   1980    240
> > > > 1418169393.394333:   1706   2043    239
> > > > 1418169393.476523:   1703   2028    241
> > > > 1418169393.558708:   1714   2041    240
> > > > 1418169393.640888:   1704   2041    240
> > > > 1418169393.721556:      0      0      0
> > > > 1418169395.283096:   2889   2512    192
> > > > 1418169395.365236:   2947   2486    210
> > > > 1418169395.447413:   2949   2470    211
> > > > 1418169395.529606:   2943   2497    211
> > > > 1418169395.611759:   2922   2506    211
> > > > 1418169395.693935:   2866   2474    213
> > > > 1418169395.776135:   2858   2481    214
> > > > 1418169395.858305:   2861   2451    213
> > > > 1418169395.938972:      0      0      0
> > > > 1418169397.482867:   1083   1981    236
> > > > 1418169397.565026:   1157   1832    254
> > > > 1418169397.647217:   1161   1856    256
> > > > 1418169397.729412:   1158   1883    255
> > > > 1418169397.811583:   1159   1841    255
> > > > 1418169397.893760:   1159   1864    256
> > > > 1418169397.975947:   1158   1893    256
> > > > 1418169398.056605:      0      0      0
> > > > 1418169399.690290:   2299   2372    178
> > > > 1418169399.772432:   2388   2160    221
> > > > 1418169399.854611:   2391   2190    223
> > > > 1418169399.936802:   2379   2207    223
> > > > 1418169400.018966:   2389   2184    223
> > > > 1418169400.101146:   2383   2208    224
> > > > 1418169400.183338:   2381   2203    223
> > > > 1418169400.264012:      0      0      0
> > > > 1418169402.073266:   1230   2381    212
> > > > 1418169402.155413:   1301   2097    247
> > > > 1418169402.237590:   1313   2077    248
> > > > 1418169402.319772:   1307   2126    248
> > > > 1418169402.401948:   1304   2096    248
> > > > 1418169402.484127:   4078   2155     58
> > > > 1418169402.564801:      0      0      0
> > > >
> > > > Here is what the output of ts_test looks like without even
> > > > touching the
> > > > screen:
> > > > root@som3517-som200:~# ts_test
> > > > 1418169549.722957:    816     17     58
> > > > 1418169549.803604:    816     17      0
> > > > 1418169549.817757:    816     25     58
> > > > 1418169549.898411:    816     25      0
> > > > 1418169549.912828:    816     41     59
> > > > 1418169549.993463:    816     41      0
> > > > 1418169550.007771:    816     28     58
> > > > 1418169550.088404:    816     28      0
> > > > 1418169550.102828:    816     33     58
> > > > 1418169550.183486:    816     33      0
> > > > 1418169550.197767:    816     42     59
> > > > 1418169550.278401:    816     42      0
> > > > 1418169550.292970:    816     23     58
> > > > 1418169550.373604:    816     23      0
> > > > 1418169550.387773:    816     28     58
> > > > 1418169550.468404:    816     28      0
> > > > 1418169550.482955:    816     32     59
> > > > 1418169550.563600:    816     32      0
> > > > 1418169550.577773:    816     25     58
> > > > 1418169550.658406:    816     25      0
> > > > 1418169550.672827:    816     35     59
> > > > 1418169550.753464:    816     35      0
> > > > 1418169550.767761:    816     42     59
> > > > 1418169550.848407:    816     42      0
> > > > 1418169550.862826:    816     41     59
> > > > 1418169550.943462:    816     41      0
> > > > 1418169550.958013:    816     37     59
> > > > 1418169551.038655:    816     37      0
> > > > 1418169551.052824:    816     41     59
> > > > 1418169551.133475:    816     41      0
> > > > 1418169551.147774:    816     28     58
> > > > 1418169551.228406:    816     28      0
> > > [Franklin] So your saying the above ts_test is being ran and you
> > > never touched the screen? Looking at the mailing list post you sent
> > > earlier it seems like the goal is for the ADC to be used at the same
> > > time. Is that the case when you ran both ts_test and ts_print_raw?
> >
> > I was also wondering if this relates to raw ADC samples being captured.
> The TSCADC should not be capturing anything at all if the screen is not
> touched.  You need the pen-down event to initiate the capture sequence.
> I'm curious what the state of the pins is during this occurrence, i.e. are we
> actually seeing some kind of event on the lines?  I suspect that something is
> misconfigured somewhere, perhaps resulting in a change of state in the pins
> that registers as a pen-down.
> 
> Then why would reverting a commit make the problem go away?
> 
> It seems to have something to do with the characteristic of the touchscreen
> as this does not happen on my 7" display.
> 
> Looking at the datasheet these pin are dedicated analogs and cannot be
> MUX'd otherwise.
> 
> http://www.ti.com/lit/ds/symlink/am3354.pdf
> page 20

[Franklin] The general purpose ADC and touchscreen are handled by the same piece of IP (http://processors.wiki.ti.com/index.php/Sitara_ADC/Touchscreen_Overview) . So the ADC and touchscreen ISR will both trigger when a hardware interrupt is fired. The appropriate driver ISR should return immediately if it determines that the interrupt isn't meant for it. For the touchscreen that means either FIFO0 (only used by the touchscreen) is met or a pen up event has occurred. 

So like Brad mention nothing on the touchscreen side should randomly trigger and interrupted other than pen up and a FIFO0 threshold being met. To me it sounds like maybe some noise is hitting the touchscreen pins. However, it doesn't make sense that you don't see this issue with ts_print_raw. Ts_print_raw should output the raw values that the touchscreen driver is sending to userspace ignoring any kind of calibration. Instead of running ts_test what do you see when you run ts_print? Do you see those ghost touch events still? If so the difference between ts_print and ts_print_raw is that ts_print incorporated calibration and I believe filtering values via ts_lib to the touchscreen events it receives.

The constant X value and pretty consistent pressure of 58/59 alternating with 0 makes things even more suspicious especially if your saying that you're not running the standalone adc. 

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

* Re: AM335x touchscreen issues
       [not found]                         ` <912A29987EAE174BA6CF187D7CDFA9CE270A8D48-YmePFLaaepqIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
@ 2015-05-26 22:46                           ` Michael Welling
  0 siblings, 0 replies; 16+ messages in thread
From: Michael Welling @ 2015-05-26 22:46 UTC (permalink / raw)
  To: Griffis, Brad
  Cc: Cooper Jr., Franklin, Balbi, Felipe,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	R, Vignesh, jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org,
	linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	GWilson-+8BKOH/0X5NWk0Htik3J/w@public.gmane.org,
	linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

On Tue, May 26, 2015 at 10:25:01PM +0000, Griffis, Brad wrote:
> > -----Original Message-----
> > From: Michael Welling [mailto:mwelling79-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org] On Behalf Of Michael
> > Welling
> > 
> > It seems to have something to do with the characteristic of the touchscreen
> > as this does not happen on my 7" display.
> > 
> > Looking at the datasheet these pin are dedicated analogs and cannot be
> > MUX'd otherwise.
> > 
> > http://www.ti.com/lit/ds/symlink/am3354.pdf
> > page 20
> 
> Let me please re-ask a previously asked question just to be certain we're on the same page, because I think it is an extremely important question.
> 
> As background, the analog pins you mention belong to the "TSCADC" peripheral.  This peripheral, as the name suggests, has two purposes:
> 
> 1. It's a touchscreen controller.  For example, you might use 4 of the 8 analog inputs for the purpose of a touchscreen.
> 2. It's a general purpose A/D converter.  The remaining unused analog inputs can be used for general purposes such as checking a battery voltage, reading a thermistor, etc.
> 
> What I would like to know is how many of those 8 pins are being used.  Are you only using 4 pins for a resistive touchscreen, or are some other pins being used for general purpose ADC?
>

Here is my device tree registration:
&tscadc {
	status = "okay";
	tsc {
		ti,wires = <4>;
		ti,x-plate-resistance = <200>;
		ti,coordinate-readouts = <5>;
		ti,wire-config = <0x00 0x11 0x22 0x33>;
		ti,charge-delay = <0x4000>;
	};

	adc {
		ti,adc-channels = <4 5 6 7>;
	};
};

The adc channel are not being sampled but they are being configured in the
device tree.

I commented out the adc section and it had no effect on the behavior.

> Let me also provide more background on why I'm asking...  The patch set I created was originally developed on a 3.12 kernel.  On the 3.14 kernel there were some pretty major changes done with regard to how the general purpose ADC samples are collected.  So far, all the problematic areas I've bumped into with respect to integrating these patches in newer kernels have been in scenarios where there is ADC collection happening simultaneously.  So I'm trying to understand if your issue falls into that bucket or is something completely different.
>

I am not sampling the ADCs.

> It would be useful to probe the touchscreen signals during your test, particularly AIN0 which controls the pen-down interrupt.  Fundamentally I want to understand how it's possible that you're getting a pen-down interrupt when nothing is touching the screen.  I agree it's odd that you don't see the issue without my patch, though if you want to get to the heart of the issue we will need to make some observations to understand what's happening.  I'm afraid we're moving in the wrong direction by just adding extra checks and filters into the kernel code.  In other words, I think that's a more of a workaround than a solution, but it's hard to know for sure without some additional data points.

I am travelling and do not have my oscilloscope with me. It will be next
week before I can make any measurements.

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

* Re: AM335x touchscreen issues
       [not found]                         ` <8F29D6B095ED194EA1980491A5E029710C89C70D-CXzTdvP5/9qIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
@ 2015-05-26 23:06                           ` Michael Welling
  2015-05-26 23:37                             ` Cooper Jr., Franklin
  2015-05-27  4:06                             ` Vignesh R
  0 siblings, 2 replies; 16+ messages in thread
From: Michael Welling @ 2015-05-26 23:06 UTC (permalink / raw)
  To: Cooper Jr., Franklin
  Cc: Griffis, Brad, Balbi, Felipe,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	R, Vignesh, jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org,
	linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	GWilson-+8BKOH/0X5NWk0Htik3J/w@public.gmane.org,
	linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

On Tue, May 26, 2015 at 10:31:32PM +0000, Cooper Jr., Franklin wrote:
> 
> 
> > -----Original Message-----
> > From: Michael Welling [mailto:mwelling79-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org] On Behalf Of Michael
> > Welling
> > Sent: Tuesday, May 26, 2015 4:51 PM
> > To: Griffis, Brad
> > Cc: Cooper Jr., Franklin; Balbi, Felipe; dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; R,
> > Vignesh; jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org; wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org; linux-
> > input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; GWilson-+8BKOH/0X5NWk0Htik3J/w@public.gmane.org; linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> > Subject: Re: AM335x touchscreen issues
> > 
> > On Tue, May 26, 2015 at 09:36:57PM +0000, Griffis, Brad wrote:
> > >
> > > > -----Original Message-----
> > > > From: Cooper Jr., Franklin
> > > > > -----Original Message-----
> > > > > From: Michael Welling [mailto:mwelling79-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org] On Behalf Of
> > > > > Michael Welling
> > > > > Sent: Tuesday, May 26, 2015 4:29 PM
> > > > > To: Cooper Jr., Franklin
> > > > > Cc: Balbi, Felipe; dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; R, Vignesh; Griffis,
> > > > > Brad; jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org; wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org;
> > > > > linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; GWilson-+8BKOH/0X5NWk0Htik3J/w@public.gmane.org;
> > > > > linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> > > > > Subject: Re: AM335x touchscreen issues
> > > > >
> > > > > On Tue, May 26, 2015 at 09:15:53PM +0000, Cooper Jr., Franklin wrote:
> > > > > > Michael,
> > > > > >
> > > > > > Can you send me the output of ts_test_raw after you done a 5 or
> > > > > > so touch
> > > > > down and touch up events? In the output let me know at which point
> > > > > in the log that the issue you observed has occurred. Please try to
> > > > > avoid moving your finger since I want to see the full output of
> > > > > that program but I'm not interested any unnecessary pen down events.
> > > > > >
> > > > >
> > > > > Oddly the repeated pen up and down events do not occur when
> > > > > running
> > > > > ts_print_raw:
> > > > > root@som3517-som200:~# ts_print_raw
> > > > > 1418169393.147827:   1648   2075    206
> > > > > 1418169393.229976:   1725   1983    240
> > > > > 1418169393.312154:   1731   1980    240
> > > > > 1418169393.394333:   1706   2043    239
> > > > > 1418169393.476523:   1703   2028    241
> > > > > 1418169393.558708:   1714   2041    240
> > > > > 1418169393.640888:   1704   2041    240
> > > > > 1418169393.721556:      0      0      0
> > > > > 1418169395.283096:   2889   2512    192
> > > > > 1418169395.365236:   2947   2486    210
> > > > > 1418169395.447413:   2949   2470    211
> > > > > 1418169395.529606:   2943   2497    211
> > > > > 1418169395.611759:   2922   2506    211
> > > > > 1418169395.693935:   2866   2474    213
> > > > > 1418169395.776135:   2858   2481    214
> > > > > 1418169395.858305:   2861   2451    213
> > > > > 1418169395.938972:      0      0      0
> > > > > 1418169397.482867:   1083   1981    236
> > > > > 1418169397.565026:   1157   1832    254
> > > > > 1418169397.647217:   1161   1856    256
> > > > > 1418169397.729412:   1158   1883    255
> > > > > 1418169397.811583:   1159   1841    255
> > > > > 1418169397.893760:   1159   1864    256
> > > > > 1418169397.975947:   1158   1893    256
> > > > > 1418169398.056605:      0      0      0
> > > > > 1418169399.690290:   2299   2372    178
> > > > > 1418169399.772432:   2388   2160    221
> > > > > 1418169399.854611:   2391   2190    223
> > > > > 1418169399.936802:   2379   2207    223
> > > > > 1418169400.018966:   2389   2184    223
> > > > > 1418169400.101146:   2383   2208    224
> > > > > 1418169400.183338:   2381   2203    223
> > > > > 1418169400.264012:      0      0      0
> > > > > 1418169402.073266:   1230   2381    212
> > > > > 1418169402.155413:   1301   2097    247
> > > > > 1418169402.237590:   1313   2077    248
> > > > > 1418169402.319772:   1307   2126    248
> > > > > 1418169402.401948:   1304   2096    248
> > > > > 1418169402.484127:   4078   2155     58
> > > > > 1418169402.564801:      0      0      0
> > > > >
> > > > > Here is what the output of ts_test looks like without even
> > > > > touching the
> > > > > screen:
> > > > > root@som3517-som200:~# ts_test
> > > > > 1418169549.722957:    816     17     58
> > > > > 1418169549.803604:    816     17      0
> > > > > 1418169549.817757:    816     25     58
> > > > > 1418169549.898411:    816     25      0
> > > > > 1418169549.912828:    816     41     59
> > > > > 1418169549.993463:    816     41      0
> > > > > 1418169550.007771:    816     28     58
> > > > > 1418169550.088404:    816     28      0
> > > > > 1418169550.102828:    816     33     58
> > > > > 1418169550.183486:    816     33      0
> > > > > 1418169550.197767:    816     42     59
> > > > > 1418169550.278401:    816     42      0
> > > > > 1418169550.292970:    816     23     58
> > > > > 1418169550.373604:    816     23      0
> > > > > 1418169550.387773:    816     28     58
> > > > > 1418169550.468404:    816     28      0
> > > > > 1418169550.482955:    816     32     59
> > > > > 1418169550.563600:    816     32      0
> > > > > 1418169550.577773:    816     25     58
> > > > > 1418169550.658406:    816     25      0
> > > > > 1418169550.672827:    816     35     59
> > > > > 1418169550.753464:    816     35      0
> > > > > 1418169550.767761:    816     42     59
> > > > > 1418169550.848407:    816     42      0
> > > > > 1418169550.862826:    816     41     59
> > > > > 1418169550.943462:    816     41      0
> > > > > 1418169550.958013:    816     37     59
> > > > > 1418169551.038655:    816     37      0
> > > > > 1418169551.052824:    816     41     59
> > > > > 1418169551.133475:    816     41      0
> > > > > 1418169551.147774:    816     28     58
> > > > > 1418169551.228406:    816     28      0
> > > > [Franklin] So your saying the above ts_test is being ran and you
> > > > never touched the screen? Looking at the mailing list post you sent
> > > > earlier it seems like the goal is for the ADC to be used at the same
> > > > time. Is that the case when you ran both ts_test and ts_print_raw?
> > >
> > > I was also wondering if this relates to raw ADC samples being captured.
> > The TSCADC should not be capturing anything at all if the screen is not
> > touched.  You need the pen-down event to initiate the capture sequence.
> > I'm curious what the state of the pins is during this occurrence, i.e. are we
> > actually seeing some kind of event on the lines?  I suspect that something is
> > misconfigured somewhere, perhaps resulting in a change of state in the pins
> > that registers as a pen-down.
> > 
> > Then why would reverting a commit make the problem go away?
> > 
> > It seems to have something to do with the characteristic of the touchscreen
> > as this does not happen on my 7" display.
> > 
> > Looking at the datasheet these pin are dedicated analogs and cannot be
> > MUX'd otherwise.
> > 
> > http://www.ti.com/lit/ds/symlink/am3354.pdf
> > page 20
> 
> [Franklin] The general purpose ADC and touchscreen are handled by the same piece of IP (http://processors.wiki.ti.com/index.php/Sitara_ADC/Touchscreen_Overview) . So the ADC and touchscreen ISR will both trigger when a hardware interrupt is fired. The appropriate driver ISR should return immediately if it determines that the interrupt isn't meant for it. For the touchscreen that means either FIFO0 (only used by the touchscreen) is met or a pen up event has occurred. 
> 
> So like Brad mention nothing on the touchscreen side should randomly trigger and interrupted other than pen up and a FIFO0 threshold being met. To me it sounds like maybe some noise is hitting the touchscreen pins. However, it doesn't make sense that you don't see this issue with ts_print_raw. Ts_print_raw should output the raw values that the touchscreen driver is sending to userspace ignoring any kind of calibration. Instead of running ts_test what do you see when you run ts_print? Do you see those ghost touch events still? If so the difference between ts_print and ts_print_raw is that ts_print incorporated calibration and I believe filtering values via ts_lib to the touchscreen events it receives.
>

The problem only occurs when using the graphical apps: ts_calibrate and ts_test

ts_print does not present the ghost touch events.

Perhaps there is coupling between the LCD lines and the ADC lines?
 
> The constant X value and pretty consistent pressure of 58/59 alternating with 0 makes things even more suspicious especially if your saying that you're not running the standalone adc. 

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

* Re: AM335x touchscreen issues
  2015-05-26 23:06                           ` Michael Welling
@ 2015-05-26 23:37                             ` Cooper Jr., Franklin
  2015-05-27  4:06                             ` Vignesh R
  1 sibling, 0 replies; 16+ messages in thread
From: Cooper Jr., Franklin @ 2015-05-26 23:37 UTC (permalink / raw)
  To: Michael Welling
  Cc: Griffis, Brad, Balbi, Felipe,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	R, Vignesh, jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org,
	linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	GWilson-+8BKOH/0X5NWk0Htik3J/w@public.gmane.org,
	linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org




> On May 26, 2015, at 6:07 PM, Michael Welling <mwelling-EkmVulN54Sk@public.gmane.org> wrote:
> 
>> On Tue, May 26, 2015 at 10:31:32PM +0000, Cooper Jr., Franklin wrote:
>> 
>> 
>>> -----Original Message-----
>>> From: Michael Welling [mailto:mwelling79-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org] On Behalf Of Michael
>>> Welling
>>> Sent: Tuesday, May 26, 2015 4:51 PM
>>> To: Griffis, Brad
>>> Cc: Cooper Jr., Franklin; Balbi, Felipe; dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; R,
>>> Vignesh; jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org; wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org; linux-
>>> input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; GWilson-+8BKOH/0X5NWk0Htik3J/w@public.gmane.org; linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>>> Subject: Re: AM335x touchscreen issues
>>> 
>>>> On Tue, May 26, 2015 at 09:36:57PM +0000, Griffis, Brad wrote:
>>>> 
>>>>> -----Original Message-----
>>>>> From: Cooper Jr., Franklin
>>>>>> -----Original Message-----
>>>>>> From: Michael Welling [mailto:mwelling79-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org] On Behalf Of
>>>>>> Michael Welling
>>>>>> Sent: Tuesday, May 26, 2015 4:29 PM
>>>>>> To: Cooper Jr., Franklin
>>>>>> Cc: Balbi, Felipe; dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org; R, Vignesh; Griffis,
>>>>>> Brad; jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org; wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org;
>>>>>> linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org; GWilson-+8BKOH/0X5NWk0Htik3J/w@public.gmane.org;
>>>>>> linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
>>>>>> Subject: Re: AM335x touchscreen issues
>>>>>> 
>>>>>>> On Tue, May 26, 2015 at 09:15:53PM +0000, Cooper Jr., Franklin wrote:
>>>>>>> Michael,
>>>>>>> 
>>>>>>> Can you send me the output of ts_test_raw after you done a 5 or
>>>>>>> so touch
>>>>>> down and touch up events? In the output let me know at which point
>>>>>> in the log that the issue you observed has occurred. Please try to
>>>>>> avoid moving your finger since I want to see the full output of
>>>>>> that program but I'm not interested any unnecessary pen down events.
>>>>>> 
>>>>>> Oddly the repeated pen up and down events do not occur when
>>>>>> running
>>>>>> ts_print_raw:
>>>>>> root@som3517-som200:~# ts_print_raw
>>>>>> 1418169393.147827:   1648   2075    206
>>>>>> 1418169393.229976:   1725   1983    240
>>>>>> 1418169393.312154:   1731   1980    240
>>>>>> 1418169393.394333:   1706   2043    239
>>>>>> 1418169393.476523:   1703   2028    241
>>>>>> 1418169393.558708:   1714   2041    240
>>>>>> 1418169393.640888:   1704   2041    240
>>>>>> 1418169393.721556:      0      0      0
>>>>>> 1418169395.283096:   2889   2512    192
>>>>>> 1418169395.365236:   2947   2486    210
>>>>>> 1418169395.447413:   2949   2470    211
>>>>>> 1418169395.529606:   2943   2497    211
>>>>>> 1418169395.611759:   2922   2506    211
>>>>>> 1418169395.693935:   2866   2474    213
>>>>>> 1418169395.776135:   2858   2481    214
>>>>>> 1418169395.858305:   2861   2451    213
>>>>>> 1418169395.938972:      0      0      0
>>>>>> 1418169397.482867:   1083   1981    236
>>>>>> 1418169397.565026:   1157   1832    254
>>>>>> 1418169397.647217:   1161   1856    256
>>>>>> 1418169397.729412:   1158   1883    255
>>>>>> 1418169397.811583:   1159   1841    255
>>>>>> 1418169397.893760:   1159   1864    256
>>>>>> 1418169397.975947:   1158   1893    256
>>>>>> 1418169398.056605:      0      0      0
>>>>>> 1418169399.690290:   2299   2372    178
>>>>>> 1418169399.772432:   2388   2160    221
>>>>>> 1418169399.854611:   2391   2190    223
>>>>>> 1418169399.936802:   2379   2207    223
>>>>>> 1418169400.018966:   2389   2184    223
>>>>>> 1418169400.101146:   2383   2208    224
>>>>>> 1418169400.183338:   2381   2203    223
>>>>>> 1418169400.264012:      0      0      0
>>>>>> 1418169402.073266:   1230   2381    212
>>>>>> 1418169402.155413:   1301   2097    247
>>>>>> 1418169402.237590:   1313   2077    248
>>>>>> 1418169402.319772:   1307   2126    248
>>>>>> 1418169402.401948:   1304   2096    248
>>>>>> 1418169402.484127:   4078   2155     58
>>>>>> 1418169402.564801:      0      0      0
>>>>>> 
>>>>>> Here is what the output of ts_test looks like without even
>>>>>> touching the
>>>>>> screen:
>>>>>> root@som3517-som200:~# ts_test
>>>>>> 1418169549.722957:    816     17     58
>>>>>> 1418169549.803604:    816     17      0
>>>>>> 1418169549.817757:    816     25     58
>>>>>> 1418169549.898411:    816     25      0
>>>>>> 1418169549.912828:    816     41     59
>>>>>> 1418169549.993463:    816     41      0
>>>>>> 1418169550.007771:    816     28     58
>>>>>> 1418169550.088404:    816     28      0
>>>>>> 1418169550.102828:    816     33     58
>>>>>> 1418169550.183486:    816     33      0
>>>>>> 1418169550.197767:    816     42     59
>>>>>> 1418169550.278401:    816     42      0
>>>>>> 1418169550.292970:    816     23     58
>>>>>> 1418169550.373604:    816     23      0
>>>>>> 1418169550.387773:    816     28     58
>>>>>> 1418169550.468404:    816     28      0
>>>>>> 1418169550.482955:    816     32     59
>>>>>> 1418169550.563600:    816     32      0
>>>>>> 1418169550.577773:    816     25     58
>>>>>> 1418169550.658406:    816     25      0
>>>>>> 1418169550.672827:    816     35     59
>>>>>> 1418169550.753464:    816     35      0
>>>>>> 1418169550.767761:    816     42     59
>>>>>> 1418169550.848407:    816     42      0
>>>>>> 1418169550.862826:    816     41     59
>>>>>> 1418169550.943462:    816     41      0
>>>>>> 1418169550.958013:    816     37     59
>>>>>> 1418169551.038655:    816     37      0
>>>>>> 1418169551.052824:    816     41     59
>>>>>> 1418169551.133475:    816     41      0
>>>>>> 1418169551.147774:    816     28     58
>>>>>> 1418169551.228406:    816     28      0
>>>>> [Franklin] So your saying the above ts_test is being ran and you
>>>>> never touched the screen? Looking at the mailing list post you sent
>>>>> earlier it seems like the goal is for the ADC to be used at the same
>>>>> time. Is that the case when you ran both ts_test and ts_print_raw?
>>>> 
>>>> I was also wondering if this relates to raw ADC samples being captured.
>>> The TSCADC should not be capturing anything at all if the screen is not
>>> touched.  You need the pen-down event to initiate the capture sequence.
>>> I'm curious what the state of the pins is during this occurrence, i.e. are we
>>> actually seeing some kind of event on the lines?  I suspect that something is
>>> misconfigured somewhere, perhaps resulting in a change of state in the pins
>>> that registers as a pen-down.
>>> 
>>> Then why would reverting a commit make the problem go away?
>>> 
>>> It seems to have something to do with the characteristic of the touchscreen
>>> as this does not happen on my 7" display.
>>> 
>>> Looking at the datasheet these pin are dedicated analogs and cannot be
>>> MUX'd otherwise.
>>> 
>>> http://www.ti.com/lit/ds/symlink/am3354.pdf
>>> page 20
>> 
>> [Franklin] The general purpose ADC and touchscreen are handled by the same piece of IP (http://processors.wiki.ti.com/index.php/Sitara_ADC/Touchscreen_Overview) . So the ADC and touchscreen ISR will both trigger when a hardware interrupt is fired. The appropriate driver ISR should return immediately if it determines that the interrupt isn't meant for it. For the touchscreen that means either FIFO0 (only used by the touchscreen) is met or a pen up event has occurred. 
>> 
>> So like Brad mention nothing on the touchscreen side should randomly trigger and interrupted other than pen up and a FIFO0 threshold being met. To me it sounds like maybe some noise is hitting the touchscreen pins. However, it doesn't make sense that you don't see this issue with ts_print_raw. Ts_print_raw should output the raw values that the touchscreen driver is sending to userspace ignoring any kind of calibration. Instead of running ts_test what do you see when you run ts_print? Do you see those ghost touch events still? If so the difference between ts_print and ts_print_raw is that ts_print incorporated calibration and I believe filtering values via ts_lib to the touchscreen events it receives.
> 
> The problem only occurs when using the graphical apps: ts_calibrate and ts_test
> 
> ts_print does not present the ghost touch events.
> 
> Perhaps there is coupling between the LCD lines and the ADC lines?
Sounds like something else is going on since from the driver perspective there should be no difference between ts_print and ts_test.

So technically if your getting these ghost events they should be occurring all the time not only when tslib apps are running

What I would do is add trace_printks and print something anytime the driver is getting a pen up or pen down event.
For the pen down event make sure you also print the x,y and pressure.

Also are you running the same steps for each of your test?

I would recommend doing the following for each test.

Power down the board.
Power it on
after the board is booted for 30 sec or so log 
the output of trace_printk
Delete whatever the saved ts calibration file is called
Run program xxx
Touch the 5 points on the screen mimicking calibration
Clear trace_printk buffer
Let the board sit for another 30 sec and log the output of trace_printk.


I would do this for both ts_print,ts_calibrate. Compare the output.

If your test procedure is the same then the tslib app being ran shouldn't matter.



> 
>> The constant X value and pretty consistent pressure of 58/59 alternating with 0 makes things even more suspicious especially if your saying that you're not running the standalone adc. 

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

* Re: AM335x touchscreen issues
  2015-05-26 23:06                           ` Michael Welling
  2015-05-26 23:37                             ` Cooper Jr., Franklin
@ 2015-05-27  4:06                             ` Vignesh R
  2015-05-27 17:29                               ` Michael Welling
  1 sibling, 1 reply; 16+ messages in thread
From: Vignesh R @ 2015-05-27  4:06 UTC (permalink / raw)
  To: Michael Welling, Cooper Jr., Franklin
  Cc: Griffis, Brad, Balbi, Felipe,
	dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org,
	linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	GWilson-+8BKOH/0X5NWk0Htik3J/w@public.gmane.org,
	linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

Hi Michael,

On Wednesday 27 May 2015 04:36 AM, Michael Welling wrote:
> On Tue, May 26, 2015 at 10:31:32PM +0000, Cooper Jr., Franklin wrote:
>>

[snip]

> 
> Perhaps there is coupling between the LCD lines and the ADC lines?

On Beaglebone Black with BB-View 4.3" Cape from Farnell, the LCD lines
and TSCADC lines are placed close to one another, hence the analog
signals are affected by digital LCD signals, leading to above issue.

This was reported when I submitted the patches in question. Please see
http://thread.gmane.org/gmane.linux.kernel.iio/14710/focus=121321
http://thread.gmane.org/gmane.linux.kernel.iio/14710/focus=15242

I did document this in my cover letter. Please see
http://thread.gmane.org/gmane.linux.kernel.iio/15583

I think its the same issue that you are facing.

Regards
Vignesh

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

* Re: AM335x touchscreen issues
  2015-05-27  4:06                             ` Vignesh R
@ 2015-05-27 17:29                               ` Michael Welling
  0 siblings, 0 replies; 16+ messages in thread
From: Michael Welling @ 2015-05-27 17:29 UTC (permalink / raw)
  To: Vignesh R
  Cc: Cooper Jr., Franklin, Griffis, Brad, Balbi, Felipe,
	dmitry.torokhov@gmail.com, jic23@kernel.org, wsa@the-dreams.de,
	linux-input@vger.kernel.org, GWilson@sakuraus.com,
	linux-iio@vger.kernel.org

On Wed, May 27, 2015 at 09:36:35AM +0530, Vignesh R wrote:
> Hi Michael,
> 
> On Wednesday 27 May 2015 04:36 AM, Michael Welling wrote:
> > On Tue, May 26, 2015 at 10:31:32PM +0000, Cooper Jr., Franklin wrote:
> >>
> 
> [snip]
> 
> > 
> > Perhaps there is coupling between the LCD lines and the ADC lines?
> 
> On Beaglebone Black with BB-View 4.3" Cape from Farnell, the LCD lines
> and TSCADC lines are placed close to one another, hence the analog
> signals are affected by digital LCD signals, leading to above issue.
> 
> This was reported when I submitted the patches in question. Please see
> http://thread.gmane.org/gmane.linux.kernel.iio/14710/focus=121321
> http://thread.gmane.org/gmane.linux.kernel.iio/14710/focus=15242
> 
> I did document this in my cover letter. Please see
> http://thread.gmane.org/gmane.linux.kernel.iio/15583
> 
> I think its the same issue that you are facing.

Sounds like it.

The threads above mention adding decoupling capacitors to the ADC lines.

Is this the suggested workaround for the workaround?

Isn't the capacitor only needed on the ADC0 line to avoid the unwanted
trigger?

Please advise.

I wish I saw this before spending a whole bunch of time debugging.
Perhaps some annotation in the driver would help people in the future.
> 
> Regards
> Vignesh

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

end of thread, other threads:[~2015-05-27 17:30 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-26 18:11 AM335x touchscreen issues Michael Welling
2015-05-26 18:37 ` Felipe Balbi
     [not found]   ` <20150526183713.GU26599-HgARHv6XitJaoMGHk7MhZQC/G2K4zDHf@public.gmane.org>
2015-05-26 20:53     ` Michael Welling
2015-05-26 21:15       ` Cooper Jr., Franklin
     [not found]         ` <8F29D6B095ED194EA1980491A5E029710C89C445-CXzTdvP5/9qIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2015-05-26 21:28           ` Michael Welling
2015-05-26 21:34             ` Cooper Jr., Franklin
     [not found]               ` <8F29D6B095ED194EA1980491A5E029710C89C4E0-CXzTdvP5/9qIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2015-05-26 21:36                 ` Griffis, Brad
     [not found]                   ` <912A29987EAE174BA6CF187D7CDFA9CE270A8C43-YmePFLaaepqIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2015-05-26 21:50                     ` Michael Welling
2015-05-26 22:25                       ` Griffis, Brad
     [not found]                         ` <912A29987EAE174BA6CF187D7CDFA9CE270A8D48-YmePFLaaepqIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2015-05-26 22:46                           ` Michael Welling
2015-05-26 22:31                       ` Cooper Jr., Franklin
     [not found]                         ` <8F29D6B095ED194EA1980491A5E029710C89C70D-CXzTdvP5/9qIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2015-05-26 23:06                           ` Michael Welling
2015-05-26 23:37                             ` Cooper Jr., Franklin
2015-05-27  4:06                             ` Vignesh R
2015-05-27 17:29                               ` Michael Welling
2015-05-26 21:41               ` Michael Welling

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).