[PATCH] fix-jack-debounce.patch

andrzej zaborowski balrogg at gmail.com
Fri Apr 11 13:07:42 CEST 2008

On 11/04/2008, Andy Green <andy at openmoko.com> wrote:
>  Somebody in the thread at some point said:
>  | If there are no spurious changes on the pin, only bouncing after a
>  | legal change, then it's fine to report the event on the first change
>  | and wait only if a previous state change was less than 100ms ago. (Not
>  | that it matter so much for jack detection)
>  The issue there is that the interrupt action from seeing an edge is
>  disconnected from the level sampling action that occured in the ISR.  So
>  we can see an initial edge that is correct as you say, but by the time
>  the interrupt is serviced and we sample the interrupt as GPIO level, it
>  may be bouncing and be the wrong level.  Waiting it out until the
>  bouncing is finished does not have this window for error.

Ah, now I see.  I wonder if it's ok to assume that an edge detected
more than 100ms after a previous interrupt is always the edge opposite
to that previous one, so as to avoid sampling the GPIO.  I should try
it out.


More information about the openmoko-kernel mailing list