QtMoko audio state work

Neil Jerram neil at ossau.homelinux.net
Tue Jan 22 23:25:17 CET 2013

Radek Polak <psonek2 at seznam.cz> writes:

>> I've now reimplemented the GTA04 neoaudioplugin.cpp code so that it
>> moves between audio states by changing those 7 switches, instead of
>> using ALSA state files, and that seems to work well (including for
>> PhoneHeadset, subject to A3 software routing trouble).
> Nice, imo that's the way how it should work. Alsa states were easiest solution 
> - that's why i used it. Your code could work much better.

You can see that change at
and if you like try it out on your A4 too.

It works nicely for me on A3.  For A4 I've added code to set the 'Voice
route' control correctly, which should be equivalent to your recent 5mA
saving change (84fb56e), but I don't know if I've got it exactly right
because that code isn't executed on my A3.  Also for A4 it might be
necessary to switch the 'Codec Operation Mode' control between 'Option 1
(audio)' and 'Option 2 (voice/audio)', but I haven't written any code
for that yet, because

- the last email discussion about that didn't seem completely definitive
  about whether it is really needed

- the "Phone*.state" files in
  devices/gta04/src/plugins/audiohardware/neo/a4 were inconsistent on
  this point, i.e. PhoneEarpiece.state had 'Option 2 (voice/audio)' but
  PhoneSpeaker.state and PhoneHeadset.state had 'Option 1 (audio)'

- if we _do_ need to switch 'Codec Operation Mode', we probably need to
  do that inside pasuspender, so that would make it a bit trickier than
  the other controls.

Therefore it would be nice to know if my change works on A4.

>> One detail,
>> which is nice but slightly worrying, is that I used to always to get a
>> very audible click about 1s before, e.g., hearing the new message
>> arrival sound; and with the reimplementation I no longer get that click.
>> I _think_ the explanation for that was using pasuspender, and that I no
>> longer get it because I no longer need to use pasuspender
> pasuspender will still have to be used on A4 when switching to earpiece, 
> because you cant switch if some other program has sound card open.

Do you mean the switching of 'Codec Operation Mode' here?  Is that
actually needed for earpiece but not for speaker or headset?  If so that
would explain what I've described above as "inconsistent".

>> - but it's slightly worrying in case that's wrong, and in particular
>> in case it's because I'm leaving some circuit on more than before,
>> and hence drawing more current.  (I haven't seen any evidence for
>> drawing extra current.)
> Maybe it can be measured during suspend.

Since having this change in place, I've been seeing the same average
suspend currents as before.

>> The simplicity of
>> gta04-gsm-voice-routing is appealing, but I know from previous
>> experience that it sometimes fails completely.
> For me the problem was that some other program had soundcard open and gta04-
> gsm-voice-routing couldnt open it. If all programs use pulseadio then it can 
> be solved with pasuspender, but i wish that alsa had the same functionality. 
> Then we could get rid of pulseaudio. Maybe something like this could be 
> achieved using alsa plugins.

I'm pretty sure I saw some voice routing problems on a few occasions
even with pasuspender.

However, since moving back to gta04-gsm-voice-routing, and adding Neil
Brown's change to start the 2 capture streams at the same time, I've had
a few successful calls and no problems.  For the moment, therefore,
things are all working for me.


More information about the community mailing list