Older blog entries for broonie (starting at number 102)

I know that place

One slightly unexpected effect of all the travel I’ve been doing recently is that I get a real, visceral sense of place from some slightly surprising places when I see them on the big screen. Having an idea of how the place really is, how people behave, how the air feels, how the food tastes, how it smells, a sense of what’s around the corner and beyond the camera. A sense of memory, not of imagination or of an idea of what a place should be.

San Francisco is one place this happens for and is perhaps not so surprising – it is a pretty distinctive place after all and the imagery was already familiar from countless movies and TV shows before I ever went there. What was a bit more surprising was a random suburban area in South Korea; Korea has had a real building boom amid all the growth it’s had which has resulted in a certain look and feel to the architecture and the cities being very common though not distinctive of any once place. That’s the space where a lot of the more “real world” Korean films are set, and it’s the one I recognise. Don’t think I’ve ever seen a film that ventured into Itaewon (이태원동), mind you.

It’s a much stronger feeling of recognition than I get with anywhere in the UK, I think purely due to the surprise factor. Having a good picture of Edinburgh isn’t a great surprise, finding how quickly I’ve built one up of places on other continents much more so.

Syndicated 2011-06-25 23:36:55 from Technicalities

ASoC updates in 2.6.39

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 be removed at some point in the future.
  • Support for ordering widget power changes within widget types, helping with large CODECs and multi-stage amplifiers.
  • 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.
  • CPU support for Intel Medfield and nVidia Tegra2.
  • CODEC support for Cirrus CS4271, Freescale SGTL5000, Maxim MAX8950, National Semiconductors LM4857, TI SN95031 and Wolfson WM8991
  • Machine support for Intel Medfield MID reference platforms, nVidia Harmony, and Visstrim M10.

Syndicated 2011-05-19 21:26:18 from Technicalities

ASoC conference 2011 – Edinburgh, 4-5th May

There will be an ASoC conference in Edinburgh 4th-5th May this year, held in the Scotch Malt Whisky Society in Edinburgh. Full details are in the announcement – if you’ve got an interest in embedded audio on Linux I recommend you attend, there’s a lot of development going on in this area right now and it promises to be a great opportunity to coordinate development plans and make sure things work well for everyone. Having met quite a few of the attendees who’ve signed up already I can also say that it should be an opportunity to meet some really excellent people.

Syndicated 2011-03-26 00:20:06 from Technicalities

ASoC updates in 2.6.38

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 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.
  • 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 ASoC trace points in more detail at the time.
  • Restructuring of the Samsung CPU support from Jassi Brar, 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.
  • New CODEC drivers for ALC5621/2/3, WM8737, WM8770 and WM8958.
  • Machine support for HP iPAQ H1940, HP t5325 thin clients and OpenRC Ultimate.

Syndicated 2011-03-15 12:58:48 from Technicalities

Changing core code

One of the biggest differences between working on most other OSs and working upstream on drivers for the Linux kernel is that elsewhere the core is usually a fixed thing that has been released and can’t really be changed, even if source is available (which may not even be the case). If whatever subsystem you’re working in can’t cope with the thing you’re trying to express then one of the things it’s really useful to be good at is working out ways to implement the behaviour that’s required behind the back of the subsystem. It’s very common to see such code in drivers submitted by hardware vendors, particularly those that are new to Linux, as this is such a big mindset shift.

With kernel development the approach is much more to make sure that the core can cope with whatever needs expressing. It’s not always done in the core – for example, sometimes the issue is due to unusually limited hardware and very likely to never come up again – but it’s very unusual to see code merged that doesn’t at least fit in with the design of the subsystem.

This post is inspired by a brief exchange with Thomas Gleixner on linux-kernel who articulated the advantages of doing things this way very well:

 - It's usually simpler and faster as the core code has all the
   necessary information. So that's even an argument which managers
   might understand.

 - Such workarounds, when not caught, tend to spread themself
   magically because driver writers checkout the existing code of
   similar devices and copy/paste/modify^Wuglify them over and over.

 - In the worst case such workarounds make the core maintainence
   harder and in some cases impossible, because they silently imply
   semantics on the core w/o the core maintainer knowing about them.

The last point is the most important one to me as a subsystem maintainer – I really don’t want to be merging code that is going to create issues with ongoing development of the subsystem. This is all another facet of the policy on stable APIs: APIs are only worth working around if they’re fixed, and the assumptions that end up embedded in a workaroud are as much part of the API as the explicit interfaces.

It’s things like this that make Linux such a pleasure to work on.

Syndicated 2011-03-13 21:12:10 from Technicalities

Updating the kernel on the Nexus S

Building the kernel for the Nexus S is straightforward – the kernel is public as one would expect so it’s simply a matter of building it using the standard Linux build system (the machine is called herring in the code). There is one gotcha, though – the driver for the BCM4329 WiFi controller is a loadable kernel module rather than being built into the image. This means you need to copy it onto the device filesystem separately to flashing the kernel itself if you’re only updating the kernel. The procedure I use for this is below – it’s straightforward but I’m posting it here to make it a bit more discoverable.

First we make the system partition writable:

adb root
adb remount

Then copy the BCM4329 driver over (the path to the driver here is running from the root of the kernel tree:

adb push drivers/net/wireless/bcm4329/bcm4329.ko /system/modules

Finally, reboot into the bootloader and flash the actual kernel:

adb reboot bootloader
fastboot flash zimage arch/arm/boot/zImage
fastboot reboot

Note that some of these commands may return before the operation they’ve started has completed so you may need to wait for the phone at various points.

As with updating the main system firmware the above requires an unlocked device which voids your warranty.

Syndicated 2011-02-14 13:12:15 from Technicalities

Tracing ASoC with trace events

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 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’s reasonable to leave them enabled all the time, making life much easier especially when debugging intermittent problems.

There’s a bunch of existing documentation out there for the trace subsystem, including some in the kernel under Documentation/trace, which I won’t repeat here. The ASoC events are grouped together under ‘asoc’. The raw log can be viewed by looking at the file tracing/trace in debugfs. Here’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:

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

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’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:

  • 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.
  • snd_soc_dapm_widget_power events are generated for each of the widgets which DAPM has determined needs to change state. The ‘val=1′ means that all these widgets are being powered up, val=0 would show power down.
  • snd_soc_reg_write events show values written to registers.
  • snd_soc_reg_read events show values read from registers – these reads may be done from the register cache, or may be from the hardware.
  • snd_soc_dapm_event_start and snd_soc_dapm_event_done show the time spent in per-widget event callbacks.

The set of events traced will change as the subsystem develops and as people gain more experience with using the trace API.

Syndicated 2011-01-22 16:21:50 from Technicalities

ASoC changes in 2.6.37

2.6.37, which was released today, has been a very big release for ASoC – about 40,000 lines of changes covering every single file within the subsystem plus a bunch of new drivers. The highlights are:

  • Overhaul of the core APIs for registration of all kinds of devices from my co-maintainer Liam Girdwood, reducing the level of direct coupling between machine drivers and their CODEC and CPU drivers allowing ASoC machines to have multiple CODEC devices and multiple instances of the same CODEC device within a system.
  • New CODEC drivers for  88PM860x CODEC, MAX98088/9, WL1273, WM8962, WM8804, and WM8985.
  • New CPU drivers for EP93xx AC’97 controllers, MPC85xx SSI ports, and SH HDMI controllers.
  • Machine support for Freescale P1022 DS, Marvell Tavor and Saarb and Simplemachines Sim.One

Syndicated 2011-01-05 11:34:45 from Technicalities

Building firmware images for Nexus S

Since I couldn’t seem to readily find any useful instructions for building firmware images for the Nexus S I thought I’d publish some. In a clean directory this sequence of commands should result in a working set of application layer images. They assume you’ve already got all the Android build dependencies installed:

repo init -u git://android.git.kernel.org/platform/manifest.git -b gingerbread
repo sync
export MYDROID
. ./build/envsetup.sh
make PRODUCT-full_crespo-user

The resulting images will be in the directory out/target/product/crespo. You can get this running on your device by flashing the boot, recovery and system images:

out/host/linux-x86/bin/fastboot flash boot out/target/product/crespo/boot.img
out/host/linux-x86/bin/fastboot flash recovery out/target/product/crespo/recovery.img
out/host/linux-x86/bin/fastboot flash system out/target/product/crespo/system.img

Note that using these firmware images will void any warranty you have on the phone – you’ll need to unlock the phone using fastboot oem unlock, but note that this is irreversible.

Similar instructions should work for Nexus One too, using passion instead of crespo in the make command above.

Syndicated 2011-01-04 16:03:54 from Technicalities

ASoC changes in 2.6.36

Linux 2.6.36 was released today. This has been a very quiet release for the ASoC core code but one of the busiest releases for a while for new CPU support, with four new architectures added:

  • CODEC support for  JZ4740, WM8741, and WM8987
  • CPU drivers for EP93xx, JZ4740, Marvell Kirkwood/Orion I2S, NUC900, and SH S/PDIF
  • Machine support for Eureka, OpenRD, qi_lb60, SmartQ, and Snapper CL15

Syndicated 2010-10-21 00:42:43 from Technicalities

93 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!