On Wed, Dec 08, 2010 at 10:55:08AM -0600, Olaya, Margarita wrote:
case TWL6040_PLUGINT:
/* Debounce */
msleep(200);
Hrm. We're blocking the interrupt thread for an extended period, and since we don't re-read the status after the debounce period the debounce effectiveness will be substantially reduced, and may go very wrong if we also get a removal interrupt queued up in the meantime as the removal IRQ would then get processed even if the jack was actually inserted.
Scheduling a work item which checks the jack status (like hs_jack_detect below does) for both plug and unplug IRQs would deal with this - the work will get deferred each time we bounce, and the final status will be whatever it stabalises at.
report = jack->report;
/*
* Early interrupt, CODEC driver cannot report jack status
* since jack is not registered yet. MACHINE driver will
* register jack and report status thru twl6040_hs_jack_detect
*/
if (jack->jack)
snd_soc_jack_report(jack->jack, report, jack->report);
The jack API should handle null jacks happily.
+struct twl6040_setup_data {
- void (*codec_enable)(int enable);
- void *jack;
+};
The jack doesn't look to be used in this, and I guess the codec enable belongs with something else?