Audio support

460 views
Skip to first unread message

Maxime Petazzoni

unread,
Nov 11, 2008, 10:53:30 PM11/11/08
to android-porting
Hi,

I believe most of the porting efforts on the various hardware platform
will soon get to the point (if not already) of a running system ; the
next step being making sure all the basic functionality is there.
Audio being one of the most important one, since telephony also
depends on it.

Without anything done on that front, we're facing the "using stubbed
audio hardware, no sound will be produced" warning message when Dalvik
starts.

From what I've read, Android relies on an hardware glue library
libaudio, providing AudioFlinger with the appropriate AudioInterface
implementation to output sound to whatever sound driver the hardware
uses. For example, on the HTC G1/MSM72xx hardware platform, Google
uses http://android.git.kernel.org/?p=platform/hardware/msm7k.git;a=summary

But I think most of the Androids ports are made on hardware that have
ALSA device drivers (OMAP for example). And before 20 different people
start implementing their own libaudio bridging to ALSA, maybe we
should coordinate this community effort. Starting by knowing if
anything has already been started by someone, somewhere :)

If not, I will most likely start working on one, and I foresee that
it's going to be tough, as the only real documentation is the msm7k
libaudio source code itself.

Ideas, comments, suggestions ... and help are most welcome!
- Maxime

PS: of course, if you got audio working without going through this
libaudio stuff, please share your discoveries !

Sean McNeil

unread,
Nov 11, 2008, 11:42:33 PM11/11/08
to android...@googlegroups.com
Hi Maxime,

Wind River is in the process of submitting an ALSA audio implementation.
That is what I use on the Openmoko Freerunner and what has been
successfully used on the TI OMAP Zoom reference platform.

Misael Lopez

unread,
Nov 12, 2008, 12:23:33 AM11/12/08
to android...@googlegroups.com
I have been working in that audio interface for ALSA in OMAP
processor, you can find our tree at:

http://git.omapzoom.org/?p=android/hardware/ti/omap3.git;a=summary

We have been successfully played and capture audio using TWL4030 chip
in OmapZoom board with that current version of the interface.
I'm working on bringing the control part, probably we can have that
part ready soon. It will be great if the community collaborates to
correct/improve current code.
You can find more information at www.omapzoom.org, particularly about
Android if you go to Projects->Android on OMAPZoom.

Misa


2008/11/11 Sean McNeil <seanm...@gmail.com>:

Maxime Petazzoni

unread,
Nov 12, 2008, 12:55:44 AM11/12/08
to android-porting
Thanks for your answers. It's nice to know that we'll have an
available reference ALSA backed libaudio to use with Android. I'm
looking forward to seeing this submitted. Please keep us posted Sean!

On 11 nov, 21:23, "Misael Lopez" <mesa...@gmail.com> wrote:
> I have been working in that audio interface for ALSA in OMAP
> processor, you can find our tree at:
>
> http://git.omapzoom.org/?p=android/hardware/ti/omap3.git;a=summary
>
> We have been successfully played and capture audio using TWL4030 chip
> in OmapZoom board with that current version of the interface.
> I'm working on bringing the control part, probably we can have that
> part ready soon. It will be great if the community collaborates to
> correct/improve current code.
> You can find more information atwww.omapzoom.org, particularly about
> Android if you go to Projects->Android on OMAPZoom.
>
> Misa
>
> 2008/11/11 Sean McNeil <seanmcne...@gmail.com>:
>
>
>
> > Hi Maxime,
>
> > Wind River is in the process of submitting an ALSA audio implementation.
> > That is what I use on the Openmoko Freerunner and what has been
> > successfully used on the TI OMAP Zoom reference platform.
>
> > Maxime Petazzoni wrote:
> >> Hi,
>
> >> I believe most of the porting efforts on the various hardware platform
> >> will soon get to the point (if not already) of a running system ; the
> >> next step being making sure all the basic functionality is there.
> >> Audio being one of the most important one, since telephony also
> >> depends on it.
>
> >> Without anything done on that front, we're facing the "using stubbed
> >> audio hardware, no sound will be produced" warning message when Dalvik
> >> starts.
>
> >> From what I've read, Android relies on an hardware glue library
> >> libaudio, providing AudioFlinger with the appropriate AudioInterface
> >> implementation to output sound to whatever sound driver the hardware
> >> uses. For example, on the HTC G1/MSM72xx hardware platform, Google
> >> useshttp://android.git.kernel.org/?p=platform/hardware/msm7k.git;a=summary

Yann Neveu

unread,
Nov 15, 2008, 7:09:54 AM11/15/08
to android-porting
Hi all an particulary Sean,
I'm trying to compile tree with Sean's freerunner patches.
I'm still lacking the libaudio. Is the Wind River's one available
somewhere?

On Nov 12, 6:55 am, Maxime Petazzoni <maxime.petazz...@gmail.com>
wrote:

Maxime Petazzoni

unread,
Nov 24, 2008, 4:51:46 AM11/24/08
to android-porting
Hi Sean,

Do you have more information to give us about when and how this code
is going to be available? The implementation proposed down here by
Misael looks nice too, but I'd like to have a peek about the code you
used for the Freerunner, and more importantly how you used it.

Thanks in advance,
- Maxime

On 12 nov, 05:42, Sean McNeil <seanmcne...@gmail.com> wrote:
> Hi Maxime,
>
> Wind River is in the process of submitting an ALSA audio implementation.
> That is what I use on the Openmoko Freerunner and what has been
> successfully used on the TI OMAP Zoom reference platform.
>
> Maxime Petazzoni wrote:
> > Hi,
>
> > I believe most of the porting efforts on the various hardware platform
> > will soon get to the point (if not already) of a running system ; the
> > next step being making sure all the basic functionality is there.
> > Audio being one of the most important one, since telephony also
> > depends on it.
>
> > Without anything done on that front, we're facing the "using stubbed
> > audio hardware, no sound will be produced" warning message when Dalvik
> > starts.
>
> > From what I've read, Android relies on an hardware glue library
> > libaudio, providing AudioFlinger with the appropriate AudioInterface
> > implementation to output sound to whatever sound driver the hardware
> > uses. For example, on the HTC G1/MSM72xx hardware platform, Google
> > useshttp://android.git.kernel.org/?p=platform/hardware/msm7k.git;a=summary

Maxime Petazzoni

unread,
Nov 25, 2008, 9:59:10 AM11/25/08
to android-porting
I managed to make Android build the libaudio shared library (taken
from omapzoom.org), which was then put where it should be in /system/
lib/. I also have BOARD_USE_GENERIC_AUDIO set to false, which should
make audioflinger use this libaudio instead of the generic
libaudiointerface, but I still get the error message:

W/AudioHardwareInterface( 665): Using stubbed audio hardware. No
sound will be produced.

Any idea what I could be missing here?

Thanks in advance,
- Maxime

On 12 nov, 06:23, "Misael Lopez" <mesa...@gmail.com> wrote:
> I have been working in that audio interface for ALSA in OMAP
> processor, you can find our tree at:
>
> http://git.omapzoom.org/?p=android/hardware/ti/omap3.git;a=summary
>
> We have been successfully played and capture audio using TWL4030 chip
> in OmapZoom board with that current version of the interface.
> I'm working on bringing the control part, probably we can have that
> part ready soon. It will be great if the community collaborates to
> correct/improve current code.
> You can find more information atwww.omapzoom.org, particularly about
> Android if you go to Projects->Android on OMAPZoom.
>
> Misa
>
> 2008/11/11 Sean McNeil <seanmcne...@gmail.com>:
>
>
>
> > Hi Maxime,
>
> > Wind River is in the process of submitting an ALSA audio implementation.
> > That is what I use on the Openmoko Freerunner and what has been
> > successfully used on the TI OMAP Zoom reference platform.
>
> > Maxime Petazzoni wrote:
> >> Hi,
>
> >> I believe most of the porting efforts on the various hardware platform
> >> will soon get to the point (if not already) of a running system ; the
> >> next step being making sure all the basic functionality is there.
> >> Audio being one of the most important one, since telephony also
> >> depends on it.
>
> >> Without anything done on that front, we're facing the "using stubbed
> >> audio hardware, no sound will be produced" warning message when Dalvik
> >> starts.
>
> >> From what I've read, Android relies on an hardware glue library
> >> libaudio, providing AudioFlinger with the appropriate AudioInterface
> >> implementation to output sound to whatever sound driver the hardware
> >> uses. For example, on the HTC G1/MSM72xx hardware platform, Google
> >> useshttp://android.git.kernel.org/?p=platform/hardware/msm7k.git;a=summary

Sangsu Park

unread,
Nov 25, 2008, 10:26:21 AM11/25/08
to android...@googlegroups.com
I had same problem with you.
But after clean build, audiofligner use the libaudio.
I think that android build system have some weakness.

But I have another problem.
When AudioHardwareOmap::openOutputStream() is called,
snd_pcm_open() is failed. Error message is like 'no device file'.
(I didn't remember exactly....)
I think that this is caused by no device file that time.
Who can you explain this situation? or solve?

Maxime Petazzoni

unread,
Nov 25, 2008, 11:29:40 AM11/25/08
to android-porting
Hi,

On 25 nov, 16:26, "Sangsu Park" <san...@gmail.com> wrote:
> I had same problem with you.
> But after clean build, audiofligner use the libaudio.
> I think that android build system have some weakness.

That makes sense. I will try from a clean build.

> But I have another problem.
> When AudioHardwareOmap::openOutputStream() is called,
> snd_pcm_open() is failed. Error message is like 'no device file'.
> (I didn't remember exactly....)
> I think that this is caused by no device file that time.
> Who can you explain this situation? or solve?

Maybe check your /dev/pcm* and /dev/control* device node permissions ?
Just a wild guess.

- Maxime

Dave Sparks

unread,
Nov 25, 2008, 7:49:26 PM11/25/08
to android-porting
AudioHardwareGeneric tries to open /dev/eac. If /dev/eac fails to open
or respond correctly to I/O requests (read/write,ioctl), the audio HAL
will fall back to AudioHardwareStub which is just a null output driver
that emulates timing using usleep() calls.

You can either write your own implementation of own
AudioHardwareInterface, or make your audio kernel driver respond to
the same I/O requests as /dev/eac.

On Nov 25, 8:29 am, Maxime Petazzoni <maxime.petazz...@gmail.com>
wrote:

Sangsu Park

unread,
Nov 25, 2008, 8:29:20 PM11/25/08
to android...@googlegroups.com
Thanks for your reply.
But I think that you had some misunderstanding about my article.
I now use own implementation which is called AudioHardwareOmap.
You can see them below url.

http://git.omapzoom.org/?p=android/hardware/ti/omap3.git;a=summary
 
I had some problem when snd_pcm_open is called in AudioHardwareOmap.
snd_pcm_open is failed because of no device node.
 
So I tried attaching below code into init.rc
But, the result is same. T.T
 
on early-init
       device /dev/pcmC0D0p 0666 root audio
 
Who can help me? :)

Michael Barabanov

unread,
Nov 25, 2008, 8:40:34 PM11/25/08
to android-porting
Wind River's ALSA code is now available in platform/hardware/
alsa_sound.git and external/alsa-lib.git.

Michael.

Dave Sparks

unread,
Nov 25, 2008, 9:03:26 PM11/25/08
to android-porting
Is your device show up in /dev? Have you checked permissions? Did you
add your device to the devperms table in system/core/init/devices.c?

On Nov 25, 5:29 pm, "Sangsu Park" <san...@gmail.com> wrote:
> Thanks for your reply.
> But I think that you had some misunderstanding about my article.
> I now use own implementation which is called AudioHardwareOmap.
> You can see them below url.
>
> http://git.omapzoom.org/?p=android/hardware/ti/omap3.git;a=summary
>
> I had some problem when snd_pcm_open is called in AudioHardwareOmap.
> snd_pcm_open is failed because of no device node.
>
> So I tried attaching below code into init.rc
> But, the result is same. T.T
>
> on early-init
> device /dev/pcmC0D0p 0666 root audio
>
> Who can help me? :)
>

Yang, Xiaopeng

unread,
Nov 26, 2008, 4:09:52 AM11/26/08
to android...@googlegroups.com
Hi Maxime,

The ALSA contribution from Wind River includes alsa-lib and
libaudio-alsa libraries, along with other patches for bionic and system/core.

Because alsa-lib and libaudio-alsa are new projects, they have been sent to
Google for integration, and may be available in the repositories soon.

The other modifications on bionic and system/core have been submitted to
Gerrit for review:

--------------------------------------------
[OK ] bionic/ default
http://review.source.android.com/r/fad1668b10d5
(as xiaope...@windriver.com)

[OK ] system/core/ default
http://review.source.android.com/r/e2ff04fb6804
(as xiaope...@windriver.com)


After above projects and patches have been integrated into andorid, you can
build android images with ALSA support. To that end, there are still two
things need to do:

1. A /etc/asound.conf is required for ALSA to work. Attached patch adds a
sample asound.conf for zoom board, copy this sample file to
system/core/rootdir/etc/asound.conf and make necessary changes to it
according to your hardware.

2. Add the following line into the BoardConfig.mk of your board:

BOARD_USES_ALSA_AUDIO := true

then rebuild android to see whether ALSA audio work.

Regards,
Xiaopeng

Maxime Petazzoni 写道:
sample_asound_conf.patch

Maxime Petazzoni

unread,
Nov 26, 2008, 5:41:08 AM11/26/08
to android-porting
Thanks for making all this work available to the community. I'm
building all this right now, and hope I will get it working :)

- Maxime

On 26 nov, 10:09, "Yang, Xiaopeng" <xiaopeng.y...@windriver.com>
wrote:
> Hi Maxime,
>
> The ALSA contribution from Wind River includes alsa-lib and
> libaudio-alsa libraries, along with other patches for bionic and system/core.
>
> Because alsa-lib and libaudio-alsa are new projects, they have been sent to
> Google for integration, and may be available in the repositories soon.
>
> The other modifications on bionic and system/core have been submitted to
> Gerrit for review:
>
> --------------------------------------------
> [OK ] bionic/ defaulthttp://review.source.android.com/r/fad1668b10d5
> (as xiaopeng.y...@windriver.com)
>
> [OK ] system/core/ defaulthttp://review.source.android.com/r/e2ff04fb6804
> (as xiaopeng.y...@windriver.com)
> sample_asound_conf.patch
> 3KAfficherTélécharger

Sangsu Park

unread,
Nov 26, 2008, 6:28:52 PM11/26/08
to android...@googlegroups.com
Thanks very much for your help :)
These are very helpful to my work.
Have a nice day ~~~ :-)

 

Maxime Petazzoni

unread,
Nov 27, 2008, 4:09:07 AM11/27/08
to android-porting
Hi,

I tried putting it all together. The end system has the device nodes
in the correct place with valid permissions, and I even get some
promising debug messages. But if I try to play any sound or change the
volume, the AudioFlinger service crashes (and is restarted endlessly).
And of course, no sound is produced. Apparently, it's looking for a
mixer device that does not exist :

D/AudioHardwareALSA( 665): mixer initialized.
E/ALSALib ( 665): external/alsa-lib/src/pcm/pcm.c:2144:
(snd_pcm_open_noupdate) Unknown PCM AndroidPlayback
E/ALSALib ( 665): external/alsa-lib/src/pcm/pcm.c:2144:
(snd_pcm_open_noupdate) Unknown PCM AndroidPlayback
E/ALSALib ( 665): external/alsa-lib/src/pcm/pcm.c:2144:
(snd_pcm_open_noupdate) Unknown PCM AndroidPlayback
I/AudioHardwareALSA( 665): Initialized ALSA PLAYBACK device
AndroidPlayback
D/AudioHardwareALSA( 665): Set PLAYBACK PCM format to S16_LE (Signed
16 bit Little Endian)
D/AudioHardwareALSA( 665): Using 2 channels for PLAYBACK.
D/AudioHardwareALSA( 665): Set PLAYBACK sample rate to 44100 HZ
E/ALSALib ( 665): external/alsa-lib/src/pcm/pcm.c:2144:
(snd_pcm_open_noupdate) Unknown PCM AndroidPlayback_Speaker_normal
E/ALSALib ( 665): external/alsa-lib/src/control/setup.c:555:
(add_elem) Cannot obtain info for CTL elem (MIXER,'T2 Master codec
configure Switch',0,0,0)
E/ALSALib ( 665): external/alsa-lib/src/pcm/pcm.c:2144:
(snd_pcm_open_noupdate) Unknown PCM AndroidPlayback
I/AudioHardwareALSA( 665): Initialized ALSA PLAYBACK device
AndroidPlayback
D/AudioHardwareALSA( 665): Set PLAYBACK PCM format to S16_LE (Signed
16 bit Little Endian)
D/AudioHardwareALSA( 665): Using 2 channels for PLAYBACK.
D/AudioHardwareALSA( 665): Set PLAYBACK sample rate to 44100 HZ
W/AudioFlinger( 813): write blocked for 179
msecs
W/AudioFlinger( 813): write blocked for 55
msecs
D/VolumePanel( 684): onVolumeChanged(streamType: 3, flags:
17)
D/VolumePanel( 684): onShowVolumeChanged(streamType: 3, flags: 17),
index:
12
I/DEBUG ( 662): *** *** *** *** *** *** *** *** *** *** *** *** ***
*** ***
***
I/DEBUG ( 662): Build fingerprint: 'generic/omap/omap/:1.0/MVA-RC1/
eng.mpetazzoni.20081126.111057:eng/test-
keys'
I/DEBUG ( 662): pid: 665, tid: 680 >>> /system/bin/mediaserver
<<<
I/DEBUG ( 662): signal 11 (SIGSEGV), fault addr
00000000


Could that be related to a mismatched ALSA driver for the TWL4030? Any
idea would help :)
Thanks!
- Maxime

mvniekerk

unread,
Nov 27, 2008, 4:54:19 AM11/27/08
to android-porting
Wow, you got that far. I followed the instructions as posted above and
the hardware throws out the following:

E/ALSALib ( 1610): external/alsa-lib/src/control/control.c:909:
(snd_ctl_open_noupdate) Invalid CTL AndroidPlayback

E/AudioHardwareALSA( 1610): Unable to attach mixer to device
AndroidPlayback: No such file or directory

E/ALSALib ( 1610): external/alsa-lib/src/control/control.c:909:
(snd_ctl_open_noupdate) Invalid CTL hw:00

E/AudioHardwareALSA( 1610): Unable to attach mixer to device default:
No such file or directory

E/ALSALib ( 1610): external/alsa-lib/src/control/control.c:909:
(snd_ctl_open_noupdate) Invalid CTL AndroidRecord

E/AudioHardwareALSA( 1610): Unable to attach mixer to device
AndroidRecord: No such file or directory

E/ALSALib ( 1610): external/alsa-lib/src/control/control.c:909:
(snd_ctl_open_noupdate) Invalid CTL hw:00

E/AudioHardwareALSA( 1610): Unable to attach mixer to device default:
No such file or directory

Is this missing files and/or wrong permissions?
This is code running from git code updated yesterday (26 Nov). All the
device files are listed at /dev/snd and /proc/asound is populated with
the right files. /etc/asound.conf is there with the right device names
(e.g. I've changed card TWL4030 to 0 and also tried MXC).

Please be so kind and attach your asound.conf file.


On Nov 27, 11:09 am, Maxime Petazzoni <maxime.petazz...@gmail.com>
wrote:

Sean McNeil

unread,
Nov 27, 2008, 5:01:02 AM11/27/08
to android...@googlegroups.com
There are a few things you can check:

1) Make sure you have an ALSA audio device enabled in your kernel.
2) Check from a shell if the directory /dev/snd is created and if there
is anything in it.
3) Provide your /system/etc/asound.conf file that you are using to
describe the audio devices.

Sean

mvniekerk

unread,
Nov 27, 2008, 5:16:01 AM11/27/08
to android-porting
I'm sorry to dump this on a mailing list, but here goes:

cd /proc/asound

# ls -l

lrwxrwxrwx root root 1970-01-01 00:00 PMICaudio ->
card0

dr-xr-xr-x root root 1970-01-01 00:00 card0

-r--r--r-- root root 0 1970-01-01 00:00 pcm

-r--r--r-- root root 0 1970-01-01 00:00 timers

-r--r--r-- root root 0 1970-01-01 00:00 cards

-r--r--r-- root root 0 1970-01-01 00:00 devices

-r--r--r-- root root 0 1970-01-01 00:00 version

dr-xr-xr-x root root 1970-01-01 00:00 oss

# cd card0

# ls -l

-rw-r--r-- root root 0 1970-01-01 00:00 oss_mixer

-r--r--r-- root root 0 1970-01-01 00:00 id

dr-xr-xr-x root root 1970-01-01 00:00 pcm2p

dr-xr-xr-x root root 1970-01-01 00:00 pcm1p

dr-xr-xr-x root root 1970-01-01 00:00 pcm0c

dr-xr-xr-x root root 1970-01-01 00:00 pcm0p

# cd ../

# ls -l

lrwxrwxrwx root root 1970-01-01 00:01 PMICaudio ->
card0

dr-xr-xr-x root root 1970-01-01 00:01 card0

-r--r--r-- root root 0 1970-01-01 00:01 pcm

-r--r--r-- root root 0 1970-01-01 00:01 timers

-r--r--r-- root root 0 1970-01-01 00:01 cards

-r--r--r-- root root 0 1970-01-01 00:01 devices

-r--r--r-- root root 0 1970-01-01 00:01 version

dr-xr-xr-x root root 1970-01-01 00:01 oss

# cat devices

0: [ 0] : control

16: [ 0- 0]: digital audio playback

17: [ 0- 1]: digital audio playback

18: [ 0- 2]: digital audio playback

24: [ 0- 0]: digital audio capture

33: : timer

# cd /dev/snd

# ls -l

crw-rw-r-- system audio 14, 0 1970-01-01 00:00 mixer

crw-rw-r-- system audio 116, 0 1970-01-01 00:00 controlC0

crw-rw-r-- system audio 14, 4 1970-01-01 00:00 audio

crw-rw-r-- system audio 14, 3 1970-01-01 00:00 dsp

crw-rw-r-- system audio 116, 24 1970-01-01 00:00 pcmC0D0c

crw-rw-r-- system audio 116, 16 1970-01-01 00:00 pcmC0D0p

crw-rw-r-- system audio 14, 12 1970-01-01 00:00 adsp

crw-rw-r-- system audio 116, 17 1970-01-01 00:00 pcmC0D1p

crw-rw-r-- system audio 116, 18 1970-01-01 00:00 pcmC0D2p

crw-rw-r-- system audio 116, 33 1970-01-01 00:00 timer

Here is the asound.conf file:
# cat /etc/asound.conf

# Android ALSA configuration file for OMAP2430SDP using the MXC audio.



##

## Mixer Devices

##



ctl.AndroidPlayback {

type hw

card 0

}



ctl.AndroidRecord {

type hw

card 0

}





##

## Playback Devices

##



pcm.AndroidPlayback_Speaker {

type hooks

slave.pcm {

type hw

card 0

device 0 # Must be of type "digital audio playback"

}

hooks.0 {

type ctl_elems

hook_args [

# Enable audio output from the DSP

{

name "T2 Master codec configure Switch"

lock false

preserve true

optional false

value true

}

{

name "T2 Master codec Sample Rate"

lock false

preserve true

optional true

value 48000

}

{

name "Playback Source"

lock false

preserve true

optional false

# Values are:

# 0 - 'Stereo Headset'

# 1 - 'Hands-free (Speakers)'

# 2 - 'Mono Handset'

# 3 'USB CarKit'

value 'Hands-free (Speakers)'

}



]

}

}



pcm.AndroidPlayback_Headset {

type hooks

slave.pcm {

type hw

card 0

device 0 # Must be of type "digital audio playback"

}

hooks.0 {

type ctl_elems

hook_args [

# Enable audio output from the DSP

{

name "T2 Master codec configure Switch"

value true

}

{

name "T2 Master codec Sample Rate"

value 48000

}

{

name "Playback Source"

value 'Stereo Headset'

}

]

}

}



pcm.AndroidPlayback_Earpiece {

type hooks

slave.pcm {

type hw

card 0

device 0 # Must be of type "digital audio playback"

}

hooks.0 {

type ctl_elems

hook_args [

# Enable audio output from the DSP

{

name "T2 Master codec configure Switch"

value true

}

{

name "T2 Master codec Sample Rate"

value 48000

}

{

name "Playback Source"

value 'Mono Handset'

}

]

}

}



# No bluetooth available. Send output to the bit bucket.

pcm.AndroidPlayback_Bluetooth {

type null

}





##

## Recording device

##



pcm.AndroidRecord_Microphone {

type hooks

slave.pcm {

type hw

card 0

device 0 # Must be of type "digital audio capture"

}

hooks.0 {

type ctl_elems

hook_args [

{

# MXC values for capture source:

# 0 - 'Headset Mic'

# 1 - 'Main Mic Sub Mic'

# 2 - 'Aux/FM'

# 3 - 'USB CarKit'

name "Capture Source"

lock false

preserve true

optional false

value 'Main Mic Sub Mic'

}

{

# Enable capture, range [0..100]

name "Mic Headset Capture Volume"

value [100 100]

}

{

name "Mic Headset Capture Switch"

value true

}

{

# MXC Capture volume, range [0..100]

name "Master Capture Volume"

value [60 60]

}

]

}

}

Sangsu Park

unread,
Nov 27, 2008, 8:37:19 AM11/27/08
to android...@googlegroups.com
Hi.
 
did you check if alsa-lib is working well?
I checked it using aplay.
It's very simple to compile into Android.
I refered to below site.
 

Maxime Petazzoni

unread,
Nov 27, 2008, 12:44:35 PM11/27/08
to android-porting
Hi Sean,

On Nov 27, 11:01 am, Sean McNeil <seanmcne...@gmail.com> wrote:
> There are a few things you can check:
>
> 1) Make sure you have an ALSA audio device enabled in your kernel.
> 2) Check from a shell if the directory /dev/snd is created and if there
> is anything in it.
> 3) Provide your /system/etc/asound.conf file that you are using to
> describe the audio devices.

Yes, I have all that. The TWL4030 device is discovered at boot time by
the kernel, and the corresponding devices are created in the /dev/snd
directory (with correct permissions).

The asound.conf file is included in the system, in its correct
location (/system/etc/).

As suggested by Sangsu, I will try aplay, but I don't have much hope.

Could you give more information about the ALSA driver you're using? Do
you have the mixer device called "T2 Master codec configure Switch"
defined in the sound/arm/omap/omap-alsa-twl4030-mixer.c file? I don't,
but I do have a "T2 Master codec Sample Rate" for example.

Thanks,
- Maxime

Sean McNeil

unread,
Nov 27, 2008, 10:02:44 PM11/27/08
to android...@googlegroups.com
Maxime Petazzoni wrote:
> Hi Sean,
>
> On Nov 27, 11:01 am, Sean McNeil <seanmcne...@gmail.com> wrote:
>
>> There are a few things you can check:
>>
>> 1) Make sure you have an ALSA audio device enabled in your kernel.
>> 2) Check from a shell if the directory /dev/snd is created and if there
>> is anything in it.
>> 3) Provide your /system/etc/asound.conf file that you are using to
>> describe the audio devices.
>>
>
> Yes, I have all that. The TWL4030 device is discovered at boot time by
> the kernel, and the corresponding devices are created in the /dev/snd
> directory (with correct permissions).
>
> The asound.conf file is included in the system, in its correct
> location (/system/etc/).
>

Where did you get the asound.conf? It must relate to your hardware and
kernel. It is very specific to a platform. The example version provided
relates to the OMAP zoom board with I think kernel 2.6.22 (not sure
about this, though). You'll have to use something like alsactl to save
off the states and see if they correspond to what is in asound.conf.


> As suggested by Sangsu, I will try aplay, but I don't have much hope.
>
> Could you give more information about the ALSA driver you're using? Do
> you have the mixer device called "T2 Master codec configure Switch"
> defined in the sound/arm/omap/omap-alsa-twl4030-mixer.c file? I don't,
> but I do have a "T2 Master codec Sample Rate" for example.
>

I don't have my zoom board available, so I can't check this for you.

Maxime Petazzoni

unread,
Nov 29, 2008, 10:44:52 PM11/29/08
to android-porting
Ok, after tweaking mixer control names in the asound.conf file, I have
sound. Kind of, because changing the volume makes the mediaserver
crash one out of three times. After it's crashed, sound still comes
out, but changing the volume is not possible until reboot.

Anyway, that's still a good start, I'll continue working on it next
week and stabilize all this.

Thanks for the help, and for the release of Windriver's code.

- Maxime
> ...
>
> read more >>

Anson

unread,
Nov 30, 2008, 10:51:57 AM11/30/08
to android...@googlegroups.com
about file permission,

Hi,
you should check the init.rc, the mediaservice run as `not` a root group ,  so the device file permission should
chown to that user group or change mode to 777 (a bad way)

you can submit you crash log to here,
because i know some compiler 's config can lead to a kernel send a  EBUS signal ,
you should check you kernel and ALSA lib 's gcc config ,
in default , android 's cross-compile will turn on  -fshort-enums, this will cause compile a enum in a sturct in to a shortest integers in you system (16bits in my environment),

if the ioctl 's third parameter is only a enum, this will cause a bus error.

you should check the volume adjust 's ioctl code in alsa lib.

2008/11/30 Maxime Petazzoni <maxime.p...@gmail.com>

mvniekerk

unread,
Dec 1, 2008, 7:14:58 AM12/1/08
to android-porting
I'm on the way of pulling my hair out.

1) iMX Alsa Kernel driver loads
i) PROCFS entries in /proc/asound are made
ii) /proc/asound/version says 1.0.15
iii) /proc/asound/card0 has all the right entries
iv) Special device files are made in /dev/snd/ (pcmC0D0p/c
mixer0 timer etc) with (forced by me) write permissions as 0777.
2) Alsa lib compiles in Android environment, identified as 1.0.16
3) AlsaAudioHardware code from Wind River compiles
4) Alsa utils compiled, identified as 1.0.16
5) /ets/asound.conf set up

aplayer cannot find any devices, nor does amixer (`aplayer -l`).
libaudio crashes the repeatedly, without even the Android interface
showing up, complaining of "Invalid CTL AndroidPlayback".

On Nov 27, 3:37 pm, "Sangsu Park" <san...@gmail.com> wrote:
> Hi.
>
> did you check if alsa-lib is working well?
> I checked it using aplay.
> It's very simple to compile into Android.
> I refered to below site.
>
> http://letsgoustc.spaces.live.com/Blog/cns!89AD27DFB5E249BA!404.entry
>

Sean McNeil

unread,
Dec 1, 2008, 9:25:47 PM12/1/08
to android...@googlegroups.com
asound.conf should go in /system/etc/asound.conf, not /etc. Most of the
time /etc is a symlink, so it doesn't matter.

You will probably have to go through your complete asound.conf to see if
it is correct for your hardware and kernel. The best suggestion I have
is to use something like "alsactl -f /tmp/xxx save" (sorry, I'm going by
memory here and it might not be accurate) to save the alsa control state
and then compare your switches.

mvniekerk

unread,
Dec 5, 2008, 2:33:18 AM12/5/08
to android-porting
I've sorted the problem.
If you go to line 2962 of alsa-lib/src/conf.c, I've changed it to the
following:
{
if (!configs) {
configs = ALSA_CONFIG_PATH_DEFAULT;
if (!configs)
configs = getenv(ALSA_CONFIG_PATH_VAR);
}
}

What happens is when the config is read, strace throws out EISDIR.
Thus the system wanted to get a file but instead found a directory.
Now I've changed it to the default config file path. Everything is
picked up nicely.
I know this is probably not the necessarily correct way of doing
things, but if it gets my sound working then I'll use it!
> ...
>
> read more »

Misael Lopez

unread,
Dec 8, 2008, 9:15:48 PM12/8/08
to android...@googlegroups.com
I did a 'repo init ...' and 'repo sync' but neither alsa-lib nor libaudio-alsa code is downloaded but they are showed in gitweb interface of android code. Why arent they downloaded with default manifest? Did you add entries for those projects in manifest file?
 
-Misa
2008/12/5 mvniekerk <mvni...@gmail.com>

Brian Code

unread,
Dec 9, 2008, 12:00:25 AM12/9/08
to android...@googlegroups.com
You will need to either download them separately using a git-clone operation, or by editing the platform/manifest.git default.xml file. We have added the ALSA stuff to the Openmoko Freerunner port at http://git.koolu.org . The example manifest git can be found there.

Regards,
Brian Code

Brian Swetland

unread,
Dec 9, 2008, 11:48:11 PM12/9/08
to android...@googlegroups.com
[Brian Code <brian...@koolu.com>]

> You will need to either download them separately using a git-clone
> operation, or by editing the platform/manifest.git default.xml file. We have
> added the ALSA stuff to the Openmoko Freerunner port at
> http://git.koolu.org. The example manifest git can be found there.

You can also use a local_manifest.xml to add or remove projects to the
baseline manifest.xml. There's an example of doing that here:

http://source.android.com/documentation/building-for-dream

Misael Lopez

unread,
Dec 10, 2008, 12:56:56 AM12/10/08
to android...@googlegroups.com
Thanks for the advice. In fact, I had to modify the main manifest in .repo directory and audio worked fine in my platform. But it's cleaner to use this local_manifest.xml method for additional projects.
 
-Misa

gougou

unread,
Dec 12, 2008, 1:45:20 AM12/12/08
to android-porting
Hi Yang

I am using WM97xx codec and has it's ALSA driver worked.
And I also integrated the alsa-lib into my source. Now the audio
working fine.

But the only thing I wanna know is :
How the asound.conf work and How to write this file. Now I skip this
config file and wite the configurations directly into my hardware.
Thanks



PS:
If sb get the error: no such device, please check the alsa-lib
---------- alsa-lib-1.0.13/include/config.h

#define ALSA_DEVICE_DIRECTORY "/dev/"

The old device path is /dev
if Andriod has below update, this value need to be /dev/snd
http://review.source.android.com/r/e2ff04fb6804



On 11月26日, 下午5时09分, "Yang, Xiaopeng" <xiaopeng.y...@windriver.com>
wrote:
> Hi Maxime,
>
> The ALSA contribution from Wind River includes alsa-lib and
> libaudio-alsa libraries, along with other patches for bionic and system/core.
>
> Because alsa-lib and libaudio-alsa are new projects, they have been sent to
> Google for integration, and may be available in the repositories soon.
>
> The other modifications on bionic and system/core have been submitted to
> Gerrit for review:
>
> --------------------------------------------
> sample_asound_conf.patch
> 3K查看下载- 隐藏被引用文字 -
>
> - 显示引用的文字 -

Daniel Youn

unread,
Dec 15, 2008, 12:16:41 AM12/15/08
to android...@googlegroups.com
Hi, gougou

I am also using WM9713 codec but I can't get sound driver working.

After reading this mailling list, I've check the following:

1) get source for /platform/external/alas-lib
2) get source for /platform/hardware/alsasound
3) modified BoardConfig.mk like this

#HAVE_HTC_AUDIO_DRIVER := true
#BOARD_USES_GENERIC_AUDIO := true
BOARD_USES_ALSA_AUDIO := true

4) add sample asound.conf file to /platform/system/core/rootdir/etc/ 

But, when the system starts up, there's some infinite loop like this log

>> I/ServiceManager(   42): Waiting for sevice media.audio_flinger...

and the cause is this log

>> E/AudioHardwareALSA(  123): Unable to attach mixer to device AndroidPlayback: No such file or directory
>> E/AudioHardwareALSA(  123): Unable to attach mixer to device default: No such file or directory
>> E/AudioHardwareALSA(  123): Unable to attach mixer to device AndroidRecord: No such file or directory
>> E/AudioHardwareALSA(  123): Unable to attach mixer to device default: No such file or directory


Do you guys have any idea, what's wrong?
Thanks for help in advance.

gougou

unread,
Dec 15, 2008, 9:44:53 PM12/15/08
to android-porting
Can you check your audio device files (like PCMC0D0 )in /dev/snd
or /dev
> > > - 显示引用的文字 -- 隐藏被引用文字 -
>
> - 显示引用的文字 -

Daniel Youn

unread,
Dec 16, 2008, 5:56:07 AM12/16/08
to android...@googlegroups.com
Hi, Gougou

I've checked /dev and /dev/snd directory.

There is PCMC0D0 and other device files in /dev not in /dev/snd.

It is curious, because a few days ago, I've patched system/core/init/devices.c file with this command:

>> repo download platform/system/core 4432/2

But system/core/init/devices.c file actually didn't modified at all. ( I don't know why )

So, I manually modified system/core/init/devices.c file.

And this time, PCMC0D0 and other device files located in /dev/snd.

As a result, now I can here sound on my android. :)

Thanks for advice.

Regards.
Daniel Yun.

mvniekerk

unread,
Dec 18, 2008, 2:37:34 AM12/18/08
to android-porting
Is there any iMX31 ADS/PDK developers here that got their sound
working with alsa?
Mine got to the point where it starts up the correct PMIC clocks,
pulls the TX pin high but there is no sound coming out. Any help would
be quite nice...

On Dec 16, 12:56 pm, "Daniel Youn" <youn.dan...@gmail.com> wrote:
> Hi, Gougou
>
> I've checked /dev and /dev/snd directory.
> There is PCMC0D0 and other device files in /dev not in /dev/snd.
>
> It is curious, because a few days ago, I've patched
> system/core/init/devices.c file with this command:
>
> >> repo download platform/system/core 4432/2
>
> But system/core/init/devices.c file actually didn't modified at all. ( I
> don't know why )
>
> So, I manually modified system/core/init/devices.c file.
>
> And this time, PCMC0D0 and other device files located in /dev/snd.
>
> As a result, now I can here sound on my android. :)
>
> Thanks for advice.
>
> Regards.
> Daniel Yun.
>

reedhuang

unread,
Jan 29, 2009, 1:33:11 AM1/29/09
to android-porting
Hi Daniel,

Could you paste or send me your asound.conf file? I am having the same
WM9713 codec and I have no idea how to get the correct values such as
type and card name for the AndroidPlayback device. Could you tell me
how you found that?

Thanks.
Reed

On Dec 16 2008, 6:56 pm, "Daniel Youn" <youn.dan...@gmail.com> wrote:
> Hi, Gougou
>
> I've checked /dev and /dev/snd directory.
> There is PCMC0D0 and other device files in /dev not in /dev/snd.
>
> It is curious, because a few days ago, I've patched
> system/core/init/devices.c file with this command:
>
> >> repo download platform/system/core 4432/2
>
> But system/core/init/devices.c file actually didn't modified at all. ( I
> don't know why )
>
> So, I manually modified system/core/init/devices.c file.
>
> And this time, PCMC0D0 and other device files located in /dev/snd.
>
> As a result, now I can here sound on my android. :)
>
> Thanks for advice.
>
> Regards.
> Daniel Yun.
>

Marco UK

unread,
Aug 2, 2011, 6:12:40 AM8/2/11
to android...@googlegroups.com
Hi Daniel and Reed,

can you please post the asound.conf for WM9713 to me too?

Cheers
Marco
Reply all
Reply to author
Forward
0 new messages