[Gta04-owner] Detecting headset plug: twl4030-madc IRQ issue

Dr. H. Nikolaus Schaller hns at goldelico.com
Thu May 24 14:24:03 CEST 2012

Hi Paul,

Am 22.05.2012 um 20:54 schrieb PaulK:

> After bringing audio output to Replicant on GTA04, I'm back to work on
> headset plug detect. For now, I'm going with hw-validation kernel just
> to make sure the ADCs are handled correctly. 
> So apparently, ADC7 is MICSENSE (no headset / short / headset) [1],
> exactly what I need. After trying some user-space madc code [2], it
> seems that ADC7 reports pretty-much the same value (around raw=10)
> regardless of headset plug state. 
> What am I missing here? Any help would be greatly appreciated!

The circuit at MICSENSE tries to measure the resistance between ring 1
(the extra ring for a 4 pin headset) and 2. This should be different if there
is no headset (no current), a headset with microphone (ca. 2 kOhm), or
a 3 pin headset (short circuit) or some remote control unit with a switchable
resistor ladder.

So far the theory.

In practice I have checked the voltage VHSMIC.OUT the the current sensor
chip U710 and by default it is switched off. Therefore, the voltage at MICENSE
is 0 and raw=10 may just show some offset of the ADC.

So step 1 is to enable VHSMIC.OUT. I think by default it is enabled only
if you select the microphone start some arecord. This is to save some power.

According to


it should be

echo 0 >/sys/devices/virtual/gpio/gpio23/value  # switch off video out
amixer set 'Analog Left Headset Mic' cap

This switches VHSMIC.OUT to 2.2V (with no headset).

I have tried to measure some MICSENSE voltages (not very precisely
and completely) and I did see 0.13V (no headset) and 0.85V (some headset).7

So you should be able to see different voltages on ADC7 (I have not tried that).

Hope this helps to get you to a reliable solution.

Please share any further observations.


> [1]: http://projects.goldelico.com/p/gta04-kernel/page/Devices-Overview/
> [2]: https://github.com/scottellis/madc
> -- 
> Paul Kocialkowski, Replicant developer
> Replicant is a fully free Android distribution
> Website:        http://www.replicant.us
> Wiki/Tracker:   http://redmine.replicant.us
> _______________________________________________
> Gta04-owner mailing list
> Gta04-owner at goldelico.com
> http://lists.goldelico.com/mailman/listinfo/gta04-owner

More information about the Gta04-owner mailing list