<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Technicalities &#187; alsa</title>
	<atom:link href="http://www.sirena.org.uk/log/tag/alsa/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sirena.org.uk/log</link>
	<description>Just another random blog</description>
	<lastBuildDate>Sat, 21 Jan 2012 23:41:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>ASoC updates in 2.6.39</title>
		<link>http://www.sirena.org.uk/log/2011/05/19/asoc-updates-in-2-6-39/</link>
		<comments>http://www.sirena.org.uk/log/2011/05/19/asoc-updates-in-2-6-39/#comments</comments>
		<pubDate>Thu, 19 May 2011 21:26:18 +0000</pubDate>
		<dc:creator>Mark Brown</dc:creator>
				<category><![CDATA[ASoC]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Planet Debian]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[2.6.37]]></category>
		<category><![CDATA[alsa]]></category>
		<category><![CDATA[Cirrus]]></category>
		<category><![CDATA[CS4271]]></category>
		<category><![CDATA[Freescale]]></category>
		<category><![CDATA[Intel]]></category>
		<category><![CDATA[LM4857]]></category>
		<category><![CDATA[MAX8950]]></category>
		<category><![CDATA[Maxim]]></category>
		<category><![CDATA[Medfield]]></category>
		<category><![CDATA[Natsemi]]></category>
		<category><![CDATA[release]]></category>
		<category><![CDATA[SGTL5000]]></category>
		<category><![CDATA[SN95031]]></category>
		<category><![CDATA[TI]]></category>
		<category><![CDATA[Visstrim M10]]></category>
		<category><![CDATA[WM8991]]></category>
		<category><![CDATA[Wolfson]]></category>

		<guid isPermaLink="false">http://www.sirena.org.uk/log/?p=344</guid>
		<description><![CDATA[Linux 2.6.39 was released earlier today. This release includes a few updates, the main user visible one being that machine drivers can now be registered as regular devices rather than using the soc-audio device. Support for registering machine drivers as first class devices rather than using the soc-audio device. Support for the soc-audio device will [...]]]></description>
			<content:encoded><![CDATA[<p>Linux 2.6.39 was released earlier today. This release includes a few updates, the main user visible one being that machine drivers can now be registered as regular devices rather than using the soc-audio device.</p>
<ul>
<li>Support for registering machine drivers as first class devices rather than using the soc-audio device. Support for the soc-audio device will be removed at some point in the future.</li>
<li>Support for ordering widget power changes within widget types, helping with large CODECs and multi-stage amplifiers.</li>
<li>Support for waiting for multiple slow events to complete during DAPM sequences, making it easier to handle things like DC offset correction on multiple outputs.</li>
<li>CPU support for Intel Medfield and nVidia Tegra2.</li>
<li>CODEC support for Cirrus CS4271, Freescale SGTL5000, Maxim MAX8950, National Semiconductors ﻿LM4857, TI SN95031 and Wolfson WM8991</li>
<li>Machine support for Intel Medfield MID reference platforms, nVidia Harmony, ﻿﻿and Visstrim M10.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.sirena.org.uk/log/2011/05/19/asoc-updates-in-2-6-39/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASoC updates in 2.6.38</title>
		<link>http://www.sirena.org.uk/log/2011/03/15/asoc-updates-in-2-6-38/</link>
		<comments>http://www.sirena.org.uk/log/2011/03/15/asoc-updates-in-2-6-38/#comments</comments>
		<pubDate>Tue, 15 Mar 2011 12:58:48 +0000</pubDate>
		<dc:creator>Mark Brown</dc:creator>
				<category><![CDATA[ASoC]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Planet Debian]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[ALC5621]]></category>
		<category><![CDATA[ALC5622]]></category>
		<category><![CDATA[ALC5623]]></category>
		<category><![CDATA[alsa]]></category>
		<category><![CDATA[Samsung]]></category>
		<category><![CDATA[WM8737]]></category>
		<category><![CDATA[WM8770]]></category>
		<category><![CDATA[WM8958]]></category>
		<category><![CDATA[Wolfson]]></category>

		<guid isPermaLink="false">http://www.sirena.org.uk/log/?p=325</guid>
		<description><![CDATA[Linux 2.6.38 was just released, with another big update to ASoC including: Enhancements to multi-component from Jarkko Nikula allowing multiple devices of the same type to be included in one system (and handling other overlaps between devices) and support cross device DAPM. Support from Dimitris Papastamos for compressing the register cache in memory using either [...]]]></description>
			<content:encoded><![CDATA[<p>Linux 2.6.38 was just released, with another big update to ASoC including:</p>
<ul>
<li>Enhancements to multi-component from <a href="http://bitmer.com/">Jarkko Nikula</a> allowing multiple devices of the same type to be included in one system (and handling other overlaps between devices) and support cross device DAPM.</li>
<li>Support from <a href="http://opensource.wolfsonmicro.com/">Dimitris Papastamos</a> for compressing the register cache in memory using either an rbtree or LZO, giving substantial memory savings on CODECs with large register maps, especially those that are sparse. This is especially beneficial to modern devices with integrated DSPs. This can be enabled by machine drivers, though CODECs can also provide defaults.</li>
<li>Addition of trace points around DAPM and register I/O operation, allowing very low overhead logging without interfering with the main system log, useful for collecting verbose diagnostics without interfering with system operation and for always enabled flight recorder style tracking for intermittent problems. I blogged about <a href="http://www.sirena.org.uk/log/2011/01/22/tracing-asoc-with-trace-points/">ASoC trace points</a> in more detail at the time.</li>
<li>Restructuring of the Samsung CPU support from <a href="http://www.samsung.com/">Jassi Brar</a>, including a number of really good usability improvements. This supports features of more modern CPUs such as the ability to run two audio streams to a single I2S port and includes a number of API simplifications which should also make developing drivers for Samsung systems much easier.</li>
<li>New CODEC drivers for ALC5621/2/3, WM8737, WM8770 and WM8958.</li>
<li>Machine support for HP iPAQ H1940, HP t5325 thin clients and OpenRC Ultimate.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.sirena.org.uk/log/2011/03/15/asoc-updates-in-2-6-38/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tracing ASoC with trace events</title>
		<link>http://www.sirena.org.uk/log/2011/01/22/tracing-asoc-with-trace-points/</link>
		<comments>http://www.sirena.org.uk/log/2011/01/22/tracing-asoc-with-trace-points/#comments</comments>
		<pubDate>Sat, 22 Jan 2011 16:21:50 +0000</pubDate>
		<dc:creator>Mark Brown</dc:creator>
				<category><![CDATA[ASoC]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Planet Debian]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[alsa]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[logging]]></category>
		<category><![CDATA[trace]]></category>

		<guid isPermaLink="false">http://www.sirena.org.uk/log/?p=330</guid>
		<description><![CDATA[Kernel 2.6.38 will add support for tracing ASoC using trace points. Previously all logging for ASoC had been done using printk(), meaning that changing the active logging required a kernel rebuild and that when trace was enabled the volume of trace could easily become very disruptive to other logging within the system. Trace points solve these [...]]]></description>
			<content:encoded><![CDATA[<p>Kernel 2.6.38 will add support for tracing ASoC using <a href="http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/trace/tracepoints.txt;h=c0e1ceed75a441b692bf447b3fcdc49d8abdd1cc;hb=refs/heads/master">trace points</a>. Previously all logging for ASoC had been done using printk(), meaning that changing the active logging required a kernel rebuild and that when trace was enabled the volume of trace could easily become very disruptive to other logging within the system. Trace points solve these problems by providing a framework for enabling and disabling individual traces dynamically and separate logging infrastructure designed for easy filtering and post-processing. When using trace points it&#8217;s reasonable to leave them enabled all the time, making life much easier especially when debugging intermittent problems.</p>
<p>There&#8217;s a bunch of existing documentation out there for the trace subsystem, including some in the kernel under <a href="http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=tree;f=Documentation/trace;hb=refs/heads/master">Documentation/trace</a>, which I won&#8217;t repeat here. The ASoC events are grouped together under &#8216;asoc&#8217;. The raw log can be viewed by looking at the file tracing/trace in debugfs. Here&#8217;s a sample output from starting playback of an MP3 on a Samsung SMDK6410 reference system using WM8580, a high performance six channel CODEC with a very simple software interface:</p>
<pre>mplayer-1673  [000]   183.920000: snd_soc_dapm_start: card=SMDK-I2S
mplayer-1673  [000]   183.920000: snd_soc_dapm_widget_power: widget=Rear val=1
mplayer-1673  [000]   183.920000: snd_soc_dapm_widget_power: widget=Center+Sub val=1
mplayer-1673  [000]   183.920000: snd_soc_dapm_widget_power: widget=Front val=1
mplayer-1673  [000]   183.920000: snd_soc_dapm_widget_power: widget=VOUT3R val=1
mplayer-1673  [000]   183.920000: snd_soc_dapm_widget_power: widget=VOUT3L val=1
mplayer-1673  [000]   183.920000: snd_soc_dapm_widget_power: widget=VOUT2R val=1
mplayer-1673  [000]   183.920000: snd_soc_dapm_widget_power: widget=VOUT2L val=1
mplayer-1673  [000]   183.920000: snd_soc_dapm_widget_power: widget=VOUT1R val=1
mplayer-1673  [000]   183.920000: snd_soc_dapm_widget_power: widget=VOUT1L val=1
mplayer-1673  [000]   183.920000: snd_soc_dapm_widget_power: widget=DAC3 val=1
mplayer-1673  [000]   183.920000: snd_soc_dapm_widget_power: widget=DAC2 val=1
mplayer-1673  [000]   183.920000: snd_soc_dapm_widget_power: widget=DAC1 val=1
mplayer-1673  [000]   183.920000: snd_soc_bias_level_start: card=SMDK-I2S val=2
mplayer-1673  [000]   183.920000: snd_soc_bias_level_done: card=SMDK-I2S val=2
mplayer-1673  [000]   183.920000: snd_soc_reg_read: codec=wm8580-codec.0-001b.27 reg=32 val=1e
mplayer-1673  [000]   183.920000: snd_soc_reg_write: codec=wm8580-codec.0-001b.27 reg=32 val=2
mplayer-1673  [000]   183.920000: snd_soc_bias_level_start: card=SMDK-I2S val=3
mplayer-1673  [000]   183.920000: snd_soc_bias_level_done: card=SMDK-I2S val=3
mplayer-1673  [000]   183.920000: snd_soc_dapm_done: card=SMDK-I2S
mplayer-1673  [000]   183.920000: snd_soc_reg_read: codec=wm8580-codec.0-001b.27 reg=13 val=10
mplayer-1673  [000]   183.920000: snd_soc_reg_write: codec=wm8580-codec.0-001b.27 reg=13 val=0</pre>
<p>Each line represents a trace event, showing the process that initiated the event, the CPU it ran on and the time it was recorded at together with event-specific details. On this system the time is reported with 10ms accuracy and the CODEC is very simple so the timing information is not terribly informative, but more accurate timers can be really helpful in analysing what&#8217;s going on with more complex CODECs. The set of events available will change over time, the key ones currently present in the kernel are:</p>
<ul>
<li>snd_soc_dapm_start and snd_soc_dapm_done: These events show the start and stop of the DAPM algorithms, showing the time spent on power management decisions.</li>
<li>snd_soc_dapm_widget_power events are generated for each of the widgets which DAPM has determined needs to change state. The &#8216;val=1&#8242; means that all these widgets are being powered up, val=0 would show power down.</li>
<li>snd_soc_reg_write events show values written to registers.</li>
<li>snd_soc_reg_read events show values read from registers &#8211; these reads may be done from the register cache, or may be from the hardware.</li>
<li>snd_soc_dapm_widget_event_start and snd_soc_dapm_widget_event_done show the time spent in per-widget event callbacks.</li>
</ul>
<p>The set of events traced will change as the subsystem develops and as people gain more experience with using the trace API.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sirena.org.uk/log/2011/01/22/tracing-asoc-with-trace-points/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>In-kernel audio mixing</title>
		<link>http://www.sirena.org.uk/log/2009/08/15/in-kernel-audio-mixing/</link>
		<comments>http://www.sirena.org.uk/log/2009/08/15/in-kernel-audio-mixing/#comments</comments>
		<pubDate>Sat, 15 Aug 2009 17:31:16 +0000</pubDate>
		<dc:creator>Mark Brown</dc:creator>
				<category><![CDATA[ASoC]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Planet Debian]]></category>
		<category><![CDATA[alsa]]></category>
		<category><![CDATA[DSP]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[PulseAudio]]></category>

		<guid isPermaLink="false">http://www.sirena.org.uk/log/?p=171</guid>
		<description><![CDATA[Ever since PulseAudio started to be deployed by distributions the most common complaint I&#8217;ve seen about ALSA is that unlike current versions of OSS it doesn&#8217;t provide mixing of audio from multiple applications inside the kernel. Of course what it really comes down to is that people want the system to transparently allow multiple applications [...]]]></description>
			<content:encoded><![CDATA[<p>Ever since <a href="http://www.pulseaudio.org/">PulseAudio</a> started to be deployed by distributions the most common complaint I&#8217;ve seen about ALSA is that unlike current versions of <a href="http://www.opensound.com/">OSS</a> it doesn&#8217;t provide mixing of audio from multiple applications inside the kernel. Of course what it really comes down to is that people want the system to transparently allow multiple applications to play audio simultaneously.</p>
<p>The reason <a href="http://alsa-project.org/">ALSA</a> does things the way it does is that the ALSA APIs that applications interact with are actually implemented by a library. This library provides a plugin based way of defining sound cards, one of the options for which is that the audio can be routed to or from some hardware, but sound can also be routed to other places like networked speakers. This architecture also allows plugins to provide signal processing &#8211; mixing is the example most people notice but things like soft volume controls (not all sound hardware provides volume control) or EQ are also possible.</p>
<p>This could all be implemented in kernel space but there&#8217;s some serious drawbacks in doing so. There are some substantial restrictions on what kernel space code is allowed to do, one of the most relevant being the fact that floating point instructions can&#8217;t be used. It&#8217;s harder to develop kernel code, if for no other reason than the fact that kernel code can crash the system. The main benefit that people expect from pushing things into the kernel is performance but with the facilities available in Linux there&#8217;s no real reason why performance would be better with a kernel mode implementation, kernel and user threads are both scheduled together and shared memory is available.</p>
<p>So why are people running into issues with PulseAudio? Obviously some of them are just bugs in PulseAudio &#8211; the much wider deployment that cones with being used as standard in distributions means much wider testing &#8211; but that&#8217;s not all of it, especially now PulseAudio has been in distributions for a while. The other major source of issues is that due to the need to adapt to the different needs of the applications that it is mixing together PulseAudio is a very demanding user of drivers. This means that switching to PulseAudio can expose bugs in the drivers, often bugs that have existed for years. There&#8217;s a natural tendency to blame PluseAudio when this happens but the fixes that are needed are in the drivers.</p>
<p>None of this is terribly helpful if you&#8217;ve been bitten by one of the bugs of course, but hopefully it goes some way towards explaining why this implementation has been chosen and why there have been problems.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sirena.org.uk/log/2009/08/15/in-kernel-audio-mixing/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>If we build it they will come</title>
		<link>http://www.sirena.org.uk/log/2008/10/16/if-we-build-it-they-will-come/</link>
		<comments>http://www.sirena.org.uk/log/2008/10/16/if-we-build-it-they-will-come/#comments</comments>
		<pubDate>Thu, 16 Oct 2008 09:20:37 +0000</pubDate>
		<dc:creator>Mark Brown</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Planet Debian]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[alsa]]></category>

		<guid isPermaLink="false">http://www.sirena.org.uk/log/?p=136</guid>
		<description><![CDATA[It looks like the jack reporting API for ALSA which just got merged into the mainline kernel for inclusion in 2.6.28 already has its first user &#8211; code from Matthew Ranostay supporting the jack detection in Sigmatel HDA codecs was just queued for merge in the next merge window. Admittedly, the jack reporting API has [...]]]></description>
			<content:encoded><![CDATA[<p>It looks like the <a href="http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=include/sound/jack.h;hb=master">jack reporting API</a> for ALSA which just got merged into the mainline kernel for inclusion in 2.6.28 already has its first user &#8211; code from Matthew Ranostay supporting the jack detection in <a href="http://mailman.alsa-project.org/pipermail/alsa-devel/2008-October/thread.html">Sigmatel HDA codecs</a> was just queued for merge in the next merge window. Admittedly, the jack reporting API has been available in ALSA git since July but it does look like it is just impressively fast adoption after the mainline merge.</p>
<p>Still, a long way to go before user space can start to rely on knowing if things are plugged in or not.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sirena.org.uk/log/2008/10/16/if-we-build-it-they-will-come/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>What&#8217;s the standard Linux audio API?</title>
		<link>http://www.sirena.org.uk/log/2008/09/26/whats-the-standard-linux-audio-api/</link>
		<comments>http://www.sirena.org.uk/log/2008/09/26/whats-the-standard-linux-audio-api/#comments</comments>
		<pubDate>Fri, 26 Sep 2008 11:39:38 +0000</pubDate>
		<dc:creator>Mark Brown</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Planet Debian]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[alsa]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[audio]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[oss]]></category>

		<guid isPermaLink="false">http://www.sirena.org.uk/log/?p=133</guid>
		<description><![CDATA[Lennart Pottering&#8217;s post about the sound APIs available for Linux appears to have caused some consternation from people working with the modern out of tree OSS drivers who feel that the current, out of tree, OSS drivers are being unfairly maligned. This rather misses the point of his post. The fact that there are improved [...]]]></description>
			<content:encoded><![CDATA[<p>Lennart Pottering&#8217;s post about the <a href="http://0pointer.de/blog/projects/guide-to-sound-apis.html">sound APIs available for Linux</a> appears to have caused some <a href="http://blog.rastageeks.org/spip.php?article14">consternation from people working with the modern out of tree OSS drivers</a> who feel that the current, out of tree, OSS drivers are being unfairly maligned. This rather misses the point of his post. The fact that there are improved versions of the OSS code doesn&#8217;t really help developers who are trying to target current Linux distributions which only ship the old OSS drivers. From this point of view the new OSS drivers are probably best looked at as a completely different product.</p>
<p>Joss is right, though &#8211; <a href="http://np237.livejournal.com/19554.html">most applications should be working with a higher level user space API</a> than either ALSA or OSS. One of the most obvious examples of this is in the embedded space where there are often vast numbers of controls that need to be exported in order to support the complex audio routing that devices like phones can have. Most of these should only be touched very occasionally when changing use case and should therefore be hidden from normal applications where they&#8217;re at best irrelevant and at worst confuse end users. They do, however, need to be exposed by the kernel in order to allow user space the flexibility to manage the audio configuration of the system at run time.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sirena.org.uk/log/2008/09/26/whats-the-standard-linux-audio-api/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

