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

NeilBrown neilb at suse.de
Sun Apr 29 00:32:23 CEST 2012

On Sat, 28 Apr 2012 19:15:37 +0200 PaulK <paulk at paulk.fr> wrote:

> I am now working on adding sound to Replicant. Dealing with the controls
> seems very clear to me now, thanks to the docs on:
> http://projects.goldelico.com/p/gta04-kernel/doc/
> Currently, I am trying to get the twl4030-madc to report headset
> plug/unplug. If I read correctly the docs, ADC7 is MICSENSE. 
> Now the driver reports data through channels, so I guess what I'm
> looking for is chan 7. 
> A threaded IRQ is requested at probe and, if I got it correctly, is
> supposed to call the twl4030_madc_threaded_irq_handler function when the
> value of one ADC changes. Except that I didn't see that function getting
> called when the headset is plugged or unplugged. I even tried removing
> the battery (as it should report battery-related infos), it it didn't
> get called either. 
> Now there are a few confusing elements: there is a
> twl4030_madc_enable_irq function that could lead me to think that it is
> somehow disabled by default and the ADCs chip must somehow be told to
> make use of the IRQ line. 
> I have never dealt with IRQ interrupts before so I may be missing
> something obvious here. Though, I would appreciate help discovering what
> is actually going on and why this handler function never gets called.

I might be missing something, but I don't think you can get an interrupt when
the headset is plugged in.

All that ADC7 allows if for polling - you can ask it to measure the voltage
level and then it sends an interrupt when the voltage has been measured.
Then you can read it and interpret it.

The voltage is proportional to the current through R706.  To get current
through this resistor you need to set HSMICBIAS_EN so that VHSMIC.OUT is

When nothing is plugged in this will drive 2.2V through a resistor network of 
  R707 - 330
  R706 - 33
  R705 - 2K4
  R703 - 330

I assume they are all Kohms, so that is about 700Kohm so we get about 3.1
microamps so ADC7 sees about 0.3volts (10uA/V).

When 3-connector headset is plugged in, R703 is shorted, so the resistance
becomes 365K and we get 6uA, or 0.6 Volts.

When a 3-connector headset with a mic is plugged in ... I suspect we don't
see any DC current, just an AC current from the mic, so maybe ADC7 will see

In any case, it is possible to ask and find out what it connected, but I
cannot see any way to get an interrupt when that changes.

Is that right Nikolaus??

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 828 bytes
Desc: not available
URL: <http://lists.goldelico.com/pipermail/gta04-owner/attachments/20120429/3bb27834/attachment.bin>

More information about the Gta04-owner mailing list