Difference between revisions of "Research Pre Audio"

From WebOS Internals
Jump to navigation Jump to search
(start audio research page)
 
(add script to strace audiod)
 
(4 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
This side should cover the audio architecture used on the Palm Pre.
 
This side should cover the audio architecture used on the Palm Pre.
 +
 +
== Hardware ==
 +
 +
The used TWL4030 PMIC covers the audio part.
 +
TODO: datasheet available?
  
 
== Soundcards ==
 
== Soundcards ==
 
 
<pre>
 
<pre>
 
root@castle:/var/home/root# aplay -l     
 
root@castle:/var/home/root# aplay -l     
Line 12: Line 16:
 
   Subdevices: 1/1
 
   Subdevices: 1/1
 
   Subdevice #0: subdevice #0
 
   Subdevice #0: subdevice #0
 +
</pre>
 +
 +
== Scripts ==
 +
 +
Palm uses scripts to configure the lower levels of the sound system that are executed inside the kernel. Audiod triggers them over a sysfs interface.
 +
<pre>
 +
echo "#list" > /sys/devices/platform/twl4030_audio/scdebug
 +
</pre>
 +
for example lists you all available scripts over the kernel message output which you can view with dmesg. You can also try
 +
 +
<pre>
 +
#all
 +
#volume
 +
#init
 +
</pre>
 +
 +
These scripts can be triggered by writing is name as a string into
 +
 +
<pre>
 +
/sys/devices/platform/twl4030_audio/scrun
 +
</pre>
 +
 +
A good start to dive into this is sound/arm/omap-twl4030/script.c in the kernel patch from palm.
 +
 +
New scripts are inserted into the kernel list via:
 +
 +
<pre>
 +
/sys/devices/platform/twl4030_audio/scinit
 +
</pre>
 +
 +
This is also handled by audiod. The scripts can be found in /etc/audio
 +
 +
== strace audiod ==
 +
this script restarts the audiod with an attached strace which is saved in ./audio.log:
 +
 +
<pre>
 +
#!/bin/sh
 +
#Make sure audiod gets not restarted when we kill it
 +
mv /usr/sbin/audiod /usr/sbin/audiod-backup
 +
kill $(pidof audiod)
 +
 +
sleep 2
 +
 +
strace -x -s 10000 -f -F -o audio.log audiod-backup &
 +
echo "press any key to return to normal mode"
 +
read foo
 +
kill $(pidof audiod-backup)
 +
 +
sleep 2
 +
 +
#Bring the system into a useable state again         
 +
mv /usr/sbin/audiod-backup /usr/sbin/audiod
 +
sh /etc/event.d/audiod
 +
 +
 
</pre>
 
</pre>

Latest revision as of 22:17, 29 March 2010

This side should cover the audio architecture used on the Palm Pre.

Hardware

The used TWL4030 PMIC covers the audio part. TODO: datasheet available?

Soundcards

root@castle:/var/home/root# aplay -l    
**** List of PLAYBACK Hardware Devices ****
card 0: mcbsp2 [twl4030-i2s (mcbsp2)], device 0: omap-mcbsp-pcm [omap-mcbsp-pcm]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: mcbsp3 [btsco (mcbsp3)], device 0: omap-mcbsp-pcm [omap-mcbsp-pcm]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Scripts

Palm uses scripts to configure the lower levels of the sound system that are executed inside the kernel. Audiod triggers them over a sysfs interface.

echo "#list" > /sys/devices/platform/twl4030_audio/scdebug
for example lists you all available scripts over the kernel message output which you can view with dmesg. You can also try
#all
#volume
#init

These scripts can be triggered by writing is name as a string into

/sys/devices/platform/twl4030_audio/scrun

A good start to dive into this is sound/arm/omap-twl4030/script.c in the kernel patch from palm.

New scripts are inserted into the kernel list via:

/sys/devices/platform/twl4030_audio/scinit

This is also handled by audiod. The scripts can be found in /etc/audio

strace audiod

this script restarts the audiod with an attached strace which is saved in ./audio.log:

#!/bin/sh
#Make sure audiod gets not restarted when we kill it
mv /usr/sbin/audiod /usr/sbin/audiod-backup
kill $(pidof audiod)

sleep 2

strace -x -s 10000 -f -F -o audio.log audiod-backup &
echo "press any key to return to normal mode"
read foo
kill $(pidof audiod-backup)

sleep 2

#Bring the system into a useable state again           
mv /usr/sbin/audiod-backup /usr/sbin/audiod
sh /etc/event.d/audiod