On Tue, Feb 01, 2011 at 06:49:11PM +0530, Harsha, Priya wrote:
I think this is too minimal as an API for this. There's two things I'm missing here. The major one is that there's no handling of debounce - jack insertion is a very slow and very analogue process relative to CPUs so taking a single reading is likely to give false measurements.
I believe this should be part of codec driver that would make sure that it has determined the right adc value and then call the function to find the jack type.
This is not in general possible - there are generally AUXADCs in many devices, CPUs and PMICs both commonly have them, and the majority of them just take a reading when asked to do so. Generic software needs to be able to handle this.
In the sn95031 codec, this is handled in hardware with programmable debounce values. The default value takes care of ensuring that the adc value is read is for right jack event.
That's great, but we can't rely on this in generic code.
Later, I will add a kcontrol for the same to enable programming it.
Hrm?
I can add a field "system_micbias" field and the ranges fields to snd_soc_jack structure. The machine driver can set these details when it creates a jack. The new API can give the jack or button type based on this range. This way its scalable. Will this help? Let us know, if there is a better way
Probably.