[PATCH] fix-jack-debounce.patch

Andy Green andy at openmoko.com
Fri Apr 11 12:56:51 CEST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Somebody in the thread at some point said:
| Hi,
|
| On 11/04/2008, Andy Green <andy at openmoko.com> wrote:
|> Headphone jack detection is bouncy, it can trigger multiple interrupts
|>  on insertion or removal.  This patch adds a workqueue that waits out the
|>  interrupt spew in 100ms units, and if it sees no more interrupts for
100ms
|>  only then samples and reports the jack state.
|
| 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.

- -Andy
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iEYEARECAAYFAkf/Q+sACgkQOjLpvpq7dMoNNgCffMZVa2eoD90eZw/UfDESotbx
FkAAn2jJ3dZvg3yBJUABc8pxGarPim4w
=0Nkm
-----END PGP SIGNATURE-----




More information about the openmoko-kernel mailing list