ep93xx driver problem
I am using ep93xx_ts.c driver for my touchscreen device. It is a very old version of the file.
In my project we are using FLTK + nano-X as our graphics library. Recently we upgraded to higher version of both library. After up gradation we saw a dramatic fall in performance. After lot of debugging we were able to trace it to our driver.
The driver code in its read function strangely goes to sleep for 10 mili second when ever there is a pen up condition. This sleep occurs within a spin lock which to me is more surprising.
Once I removed the 10 mili second sleep the performance improved significantly.
Can somebody please tell me why the sleep is put there? I am unable to figure out the usefulness of the sleep. I am copying the relevant part of the code below:
The code is form the file ep93xx_ts.c
static ssize_t ep93xx_ts_read(struct file *filp, char *buf, size_t count, loff_t *l)
unsigned short data;
int iReturn = 0;
static int lala=0;
if( bFreshTouchData && (lala++ > 9) )
DPRINTK("%4d, %4d - range [%4d to %4d],[%4d to %4d]\n",
f, currentY, iMinX, iMaxX, iMinY, iMaxY );
lala = 0;
if(count >= sizeof(data))
data = (unsigned short) gSample.currentX;
data = (unsigned short) gSample.currentY;
data = 0;
data = 1024;
bFreshTouchData = 0;
if (copy_to_user(buf, data, sizeof(data)))
count -= sizeof(data);
/* return the # of bytes that got read */
iReturn = sizeof(data);