2010-08-26 07:33:12     Issue with tslib and CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ

Document created by Aaronwu Employee on Aug 23, 2013
Version 1Show Document
  • View in full screen mode

2010-08-26 07:33:12     Issue with tslib and CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ

Yathindran P (INDIA)

Message: 92804   


When CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ = 400 is set in kernel config file, tslib returns multiple release events (i.e pressure value becomes 0) even when finger is not removed from touch screen. The occurrence of this issue is less frequent when value of CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ is reduced (say CONFIG_I2C_BLACKFIN_TWI_CLK = 100) but the issue is still present(happens on giving touch events continuously for longer duration).


CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ has to be set to 400 for some functionalities to work properly. So kinda struck here! Would be great if someone can throw some light on this








2010-08-26 08:40:14     Re: Issue with tslib and CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ

Yathindran P (INDIA)

Message: 92806   


Just to add to info above, i tried it in BF527




2010-08-26 11:18:57     Re: Issue with tslib and CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ

Mike Frysinger (UNITED STATES)

Message: 92811   


what touchscreen part exactly are you using ?  have you looked to see if it is violating timing specs ?


what version of software are you using (kernel/toolchain) ?




2010-08-26 15:03:49     Re: Issue with tslib and CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ

Yathindran P (INDIA)

Message: 92816   


Hey Mike,


This is my Kernel Version Linux version


I am using AD7879 Touch screen part. I just looked at the timing specs as u suggested. The limit is 400 kHz for touch screen. I am still getting the issue when CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ = 100. Is that because i am also using other functions which might potentially use i2c ? I have pasted timing specs below.




TA = −40°C to +85°C; VCC = 1.6 V to 3.6 V, unless otherwise noted. Sample tested at 25°C to ensure compliance. All input signals are timed from a voltage level of 1.4 V.




Parameter1             Limit                  Unit                    Description


fSCLK                  400                     kHz max


t1                               0.6                     μs min               Start condition hold time, tHD; STA


t2                               1.3                     μs min               Clock low period, tLOW


t3                               0.6                     μs min               Clock high period, tHIGH


t4                               100                    ns min               Data setup time, tSU; DAT


t5                              300                     ns min               Data hold time, tHD; DAT


t6                              0.6                      μs min                Stop condition setup time, tSU; STO


t7                              0.6                      μs min                Start condition setup time, tSU; STA


t8                              1.3                      μs min                Bus free time between stop and start conditions, tBUF


tR                            300                       ns max                 Clock/data rise time


tF                             300                      ns max                 Clock/data fall time









2010-08-27 06:02:24     Re: Issue with tslib andCONFIG_I2C_BLACKFIN_TWI_CLK_KHZ

Michael Hennerich (GERMANY)

Message: 92864    I'll have a look.





2010-08-27 06:45:43     Re: Issue with tslibandCONFIG_I2C_BLACKFIN_TWI_CLK_KHZ

Michael Hennerich (GERMANY)

Message: 92866    Linux version (michael@mhenneri-D02) (gcc version 4.3.5 (ADI-trunk/svn-4790) ) #4134 Fri Aug 27 12:29:16 CEST 0

input: adp5520-keys as /devices/platform/i2c-bfin-twi.0/i2c-0/0-0032/adp5520-keys.5520/input/input0

input: AD7879 Touchscreen as /devices/platform/i2c-bfin-twi.0/i2c-0/0-002c/input/input1


/bin # ./event_test /dev/input/event1 | grep Touch

Input device name: "AD7879 Touchscreen"

Event code 330 (Touch)

Event: time 186996.692000, type 1 (Key), code 330 (Touch), value 1

Event: time 186998.540000, type 1 (Key), code 330 (Touch), value 0

Event: time 186998.608000, type 1 (Key), code 330 (Touch), value 1

Event: time 187002.880000, type 1 (Key), code 330 (Touch), value 0

Event: time 187002.944000, type 1 (Key), code 330 (Touch), value 1

Event: time 187008.820000, type 1 (Key), code 330 (Touch), value 0

Event: time 187009.764000, type 1 (Key), code 330 (Touch), value 1

Event: time 187011.660000, type 1 (Key), code 330 (Touch), value 0

Event: time 187012.424000, type 1 (Key), code 330 (Touch), value 1

Event: time 187013.004000, type 1 (Key), code 330 (Touch), value 0

Event: time 187013.468000, type 1 (Key), code 330 (Touch), value 1

Event: time 187023.656000, type 1 (Key), code 330 (Touch), value 0

Event: time 187032.816000, type 1 (Key), code 330 (Touch), value 1


Works perfectly for me at max I2C speed.

While touching and moving the finger I don't get up events.


We recently changed the way ABS_PRESSURE and BTN_TOUCH are reported.

Can you try the driver from trunk?


In case you are already using trunk - you might want to try to increase


#define TS_PEN_UP_TIMEOUT msecs_to_jiffies(50)






2010-08-30 04:20:28     Re: Issue with tslibandCONFIG_I2C_BLACKFIN_TWI_CLK_KHZ

Yathindran P (INDIA)

Message: 92926   


Hi Michael,


Thanks for the input,


The drivers in the trunk is not compatible with my kernel(  , the drivers in trunk uses request_threaded_irq() but I just use request_irq(). So now i will just try to port the changes related to ABS_PRESSURE and BTN_TOUCH to my driver files and get back to you.


Regarding  #define TS_PEN_UP_TIMEOUT msecs_to_jiffies(50), i did try to increase the value till 2000 but still i get multiple penup events but in this case the events are delayed as the time out is high.


Thanks and Regards








2010-08-30 08:06:57     Re: Issue withtslibandCONFIG_I2C_BLACKFIN_TWI_CLK_KHZ

Michael Hennerich (GERMANY)

Message: 92928    I see - the improvement was that we don't schedule a pen up event once we receive

invalid finger position data. When I first tested the driver I never seen those.


But in a noisy environment this can happen.




2010-10-08 09:16:52     Re: Issue withtslibandCONFIG_I2C_BLACKFIN_TWI_CLK_KHZ

Yathindran P (INDIA)

Message: 94338   


Hi Michael,




This is what i observed which potentially maybe the cause of receiving multiple release events when  CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ=400




ad7879_irq() schedules the work , when the work is schdeuled, the work flow is pending for more than 1 second in ad7879_collect(). Because of that the timer set by previous work is triggered and release event is given. Now the current work which is pending gets over and sets a timer to expire which expires and release event is given once again. This happens only during long continuous press for more than 5 or 6 seconds when CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ = 100( and workflow pends for few milliseconds not seconds) but happens for a small tap when CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ = 400(pends for more than 1 sec in ad7879_collect).




is there anyway to avoid/overcome where touch system is pending in ad7879_collect() ?










2010-10-11 04:03:06     Re: IssuewithtslibandCONFIG_I2C_BLACKFIN_TWI_CLK_KHZ

Michael Hennerich (GERMANY)

Message: 94397    >

This sounds pretty much like a bug in the Blackfin TWI bus driver.

I think I reported this issue as an Bug before. Sometimes an TWI interrupt

is lost. The 1sec delay then comes from an 1HZ timeout in the Blackfin TWI bus driver.