From: Rich.jiangyk Date: Sun, 19 Sep 2010 11:49:54 +0000 (+0800) Subject: fix bug in xpt2046_ts.c, move ahead data discard. X-Git-Tag: firefly_0821_release~11128 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=c1c8e506a9aced303b0bcc4eb2eaea4df66aef80;p=firefly-linux-kernel-4.4.55.git fix bug in xpt2046_ts.c, move ahead data discard. The configuration for XPT2046 TS driver with CALIBRATION is "XPT2046 based touchscreens: XPT2046 SPI Interface". In this modification, the first raw data is discarded before processed, so that it can work on IT50. --- diff --git a/drivers/input/touchscreen/xpt2046_ts.c b/drivers/input/touchscreen/xpt2046_ts.c index 3b2d2b84fc30..0bc38b8bc676 100755 --- a/drivers/input/touchscreen/xpt2046_ts.c +++ b/drivers/input/touchscreen/xpt2046_ts.c @@ -394,6 +394,14 @@ static int xpt2046_debounce(void *xpt, int data_idx, int *val) abs(ts->last_read - *val),ts->debounce_tol, ts->read_rep,ts->debounce_rep); + /* discard the first sample. */ + //on info_it50, the top-left area(1cmx1cm top-left square ) is not responding cause the first sample is invalid, @sep 17th + if(!ts->read_cnt) + { + //udelay(100); + ts->read_cnt++; + return XPT2046_FILTER_REPEAT; + } if(*val == 4095 || *val == 0) { ts->read_cnt = 0; @@ -403,11 +411,12 @@ static int xpt2046_debounce(void *xpt, int data_idx, int *val) return XPT2046_FILTER_IGNORE; } /* discard the first sample. */ - if(!ts->read_cnt) +/* if(!ts->read_cnt) { ts->read_cnt++; return XPT2046_FILTER_REPEAT; } +move discard ahead */ if (ts->read_cnt==1 || (abs(ts->last_read - *val) > ts->debounce_tol)) { /* Start over collecting consistent readings. */