← Back to team overview

ubuntu-phone team mailing list archive

Re: Ubuntu Touch Audio stack for 13.10 release

 

Regarding to Jack, my test result on n4 with 20130827.2. also confirm same
result with the following extra information

1. I first use iphone earphone (4 polarity earjack here after) immediate
with clean flash 20130827.2.
    No sound comes out from earphone at all.The kernel message is
"insert_headset: 4 polarity earjack"
2. I plug-in a normal earphone ("3 polarity earjack") Then the audio comes
from only the left side of the earphone
3. After the audio successfully comes out from normal earphone, I unplug
and re-plug 4 polarity earphone, then
    the audio come out from lef side of the 4 polarity earphone. Even I
reboot, I can hear audio comes out from
    4 polarity earphone without need to plug 3 polarity earjack first.

I install android on the n4 and test both earphone and confirm that the
hardware is fine. Audio
can comes out from both side.

I use android on n4 to test ringtone, maybe as designed, the audio comes
out from the phone body and
earphone at the same time as earphone is plugged. As I use audio player to
play wav file, the audio only
comes out from earphone as it's plugged. (This is the expected behaviors).

Best, YC


2013/8/28 David Henningsson <david.henningsson@xxxxxxxxxxxxx>

> On 08/28/2013 01:52 AM, Ricardo Salveti de Araujo wrote:
> > My test results:
> >
> > Nexus 4:
> > - Indicator
> >   - Mute working
> >   - Volume working
> > - Aplay works
> > - Video with software decoding works
> > - Music Player works fine with wav and mp3 (but for mp3 you need to
> > install gstreamer0.10-plugins-ugly)
> > - Phone:
> >   - Receive works
> >   - Making call works
> >   - Ringtone works
> >   - Speakerphone works
> >   - Unecessary setmode INCALL/NORMAL when declining a call :
> > http://paste.ubuntu.com/6034445/
> > - Jack detection:
> >   - Working but sound coming from both jack and speaker (also just
> > coming sound from the left side, not stereo, but might be my cable)
>
> I'll flash my device with the latest image and see what I can reproduce
> of the above.
>
> Btw, did you make the android-platform-headers change that's necessary
> for the headset mic to work?
>
> > Galaxy Nexus:
> > - Boot, exception stack when starting pulse:
> http://paste.ubuntu.com/6034603/
>
> This seems to be the most serious error at the moment. First, does it
> happen at every restart of PulseAudio, or just at boot time?
>
> And regardless of which, could you try editing /etc/pulse/default.pa,
> and just above the line that calls "load-module module-udev-detect", add
> a "set-log-level 4". That will make PulseAudio's verbose log go to
> syslog, and with some luck it won't get ratelimited before we get the
> crash, so that we'll get PulseAudio's log correctly interleaved with the
> crash.
>
> > - Indicator
> >   - Mute working
> >   - Volume working
> > - Aplay working, but very low volume by default (handsfree, earpiece
> > and headset volume seems to be 0% by default, in alsamixer)
>
> I think I already found the error in the UCM file for this. PulseAudio
> does not (yet) support hw volume control when used together when UCM,
> and UCM specifies this as a hw volume control.
>
> > - Phone:
> >   - Make and Receiving fails: http://paste.ubuntu.com/6034612/
>
> This is surprising, given that we have other people confirming that it
> was in fact working. Could you be more specific about "fails"?
>
> >     - Not necessarily related, but opened
> > https://bugs.launchpad.net/ubuntu/+source/linux-maguro/+bug/1217618
> >   - Ringtone works (low volume)
> >
> > So it seems that with Maguro we might still need some UCM changes, but
> > also need to identify why the kernel is giving the exception stacks at
> > every boot.
>
> Yes. I wonder if the exception stack has anything to do with bug 1217072
> (which was reported on the PulseAudio image)?
>
> >
> > Thanks,
> >
> > Ricardo
> >
> > On Tue, Aug 27, 2013 at 9:14 AM, David Henningsson
> > <david.henningsson@xxxxxxxxxxxxx> wrote:
> >> Up until now, we've been using Android's AudioFlinger for playing back
> >> and recording audio. Starting with tomorrow's image, that is no longer
> >> true. Instead we're talking directly from PulseAudio to ALSA, or the
> >> Android audio HAL when necessary.
> >>
> >> In short, here's how PulseAudio now works:
> >>  * For normal playback and recording, PulseAudio talks directly to
> >> alsa-lib, just as on the desktop.
> >>  * For detecting whether a headphone/headset is plugged in or not,
> >> PulseAudio now has code for reading that from the Android kernel,
> >> through the "switch" interface [1].
> >>  * For normal mixer setup, we use ALSA UCM [2] mixer files.
> >>  * For setting up voice calls, we talk to the Android Audio HAL through
> >> a PulseAudio module.
> >>
> >> This provides somewhat of a compromise between features and porting
> >> effort: By using the ALSA library whenever we can, we can access
> >> PulseAudio's timer scheduling and dynamic latency features. Having the
> >> straightest path possible for playing back music should help efficiency
> >> (and in extension, battery life). At least in theory - we haven't
> >> actually done measurements.
> >>
> >> Using the Audio HAL for everything mixer related would have been
> >> optimal, but it turns out that the audio HAL is too smart: it refuses to
> >> set up the mixer, unless PCM data is also sent to it, which is what we
> >> wanted to avoid. So then we had to set up the mixer manually too.
> >> However, we still could not avoid using the Audio HAL altogether: when
> >> starting and stopping voice calls, the Audio HAL talks to the modem and
> >> other components in the kernel to route the voice call between the modem
> >> and the sound card. Hence we ended up with this compromise approach.
> >>
> >>  == Current status ==
> >>
> >> At the time of this writing, this is working best on Nexus 4. The Galaxy
> >> Nexus works for the most part, except for bug 1217072. I intend to add
> >> Nexus 7 support shortly. If anyone wants to help testing Nexus 10, let
> >> me know.
> >>
> >>  == For porters: if you need to do the same ==
> >>
> >> Unfortunately, this means some additional work for porters, because you
> >> need to write UCM mixer files. What's worse, UCM is lacking good
> >> documentation. For that reason, I hesitated somewhat before deciding to
> >> actually use UCM at all, but it's the closest we have to a standard for
> >> setting up mixers on embedded devices right now.
> >>
> >> But to give you a two-minute crash course in UCM and how it's used in
> >> Ubuntu Touch - start by having a look in
> >> /usr/share/alsa/ucm/apq8064-tabla-snd-card/ directory (shipped with
> >> alsa-lib). You'll need to create a similar directory for your device.
> >> You'll find the right directory name if you look in /proc/asound/cards.
> >>
> >> Second, look at apq8064-tabla-snd-card.conf. Rename and copy into your
> >> own UCM directory. If you're making a tablet image (that can't make
> >> voice calls), you can remove the VoiceCall part (and the corresponding
> >> file).
> >>
> >> Third, look at the HiFi file. This is where all fun happens. Notice the
> >> device names, which are hardcoded into telepathy-ofono and need to
> >> match: "Speaker", "Earpiece" and "Headphone" for playback, plus
> >> "Handset" and "Headset" for recording.
> >>
> >> Fourth, if you need voice calls, also look at the VoiceCall file. Btw,
> >> the verb names "HiFi" and "VoiceCall" also need to match.) This is
> >> largely empty, because the mixer setup is handled by the Audio HAL, but
> >> there is a twist here that took a while to get right: For PulseAudio's
> >> UCM to work, it needs to open a PCM device. However, at the time where
> >> UCM tests this, the voice call is not yet set up. So, you might need to
> >> set up the mixer just a little, so that the PCM can open. (On desktops,
> >> PCM can always open, regardless of mixer state. This is not always true
> >> on embedded devices, that are using ASoC.) It's a bonus if you can find
> >> a PCM that actually plays back audio, because then you can get
> >> notification sounds while on the phone.
> >>
> >> And this concludes the two minute crash course - happy porting!
> >>
> >> (Side note: This has also been posted on my blog, but the blog link [3]
> >> currently leads you to a blank page. I've reported the bug to the
> >> relevant team in Canonical, but at the time of this posting, they have
> >> not yet fixed it.)
> >>
> >> --
> >> David Henningsson, Canonical Ltd.
> >> https://launchpad.net/~diwic
> >>
> >> [1] http://lwn.net/Articles/493302/
> >> [2] http://www.alsa-project.org/main/index.php/Use_Case_Manager
> >> [3]
> >>
> http://voices.canonical.com/david.henningsson/2013/08/27/ubuntu-touch-audio-stack-for-13-10-release/
> >>
> >> --
> >> Mailing list: https://launchpad.net/~ubuntu-phone
> >> Post to     : ubuntu-phone@xxxxxxxxxxxxxxxxxxx
> >> Unsubscribe : https://launchpad.net/~ubuntu-phone
> >> More help   : https://help.launchpad.net/ListHelp
> >
> >
> >
>
>
>
> --
> David Henningsson, Canonical Ltd.
> https://launchpad.net/~diwic
>
> --
> Mailing list: https://launchpad.net/~ubuntu-phone
> Post to     : ubuntu-phone@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~ubuntu-phone
> More help   : https://help.launchpad.net/ListHelp
>

References