Old kernel 4.4 version of RPi Wolfson / Cirrus drivers

Warning
This page is about the previous version of the driver.
Latest instructions can be found here

I've ported the original Wolfson/Cirrus driver from Raspberry Pi kernel 3.18 over to newer kernel versions and fixed various bugs:

For a detailled history of my changes please have a look at the Changelog.txt

Source code downloads

Original driver code from Cirrus Logic: https://github.com/CirrusLogic/rpi-linux

Repository with my changes: https://github.com/HiassofT/rpi-linux
Currently maintained tree: cirrus-4.4.y

Compiling from source

Just clone one of my trees and follow the official RPi kernel compilation instructions. When you do a make bcmrpi_defconfig or a make bcm2709_defconfig the Cirrus driver will be enabled automatically.

Precompiled kernels

If you don't want to or can't compile from source yourself download one of the precompiled kernels below. To install them use the following command (replace 4.4.14 with the actual version you've downloaded):

sudo tar zxf cirrus-linux-4.4.14.tgz -C /

Note: the tarball contains kernels and modules for both the RPi / Wolfson Audio Card and RPi2 / Cirrus Logic Audio Card.

latest version:
4.4.14
2016-07-04
cirrus-linux-4.4.14.tgz
Source code
  • Drop local I2S/DMA fixes, these issues have been fixed in the RPi kernel
previous version:
4.4.6
2016-04-12
cirrus-linux-4.4.6.tgz
Source code
  • Switch to kernel 4.4 series, version 4.4.6
  • Remove now obsolete non-devicetree code from driver

Important notes if you update from kernel 4.1.y:

  1. Update the GPU firmware using sudo SKIP_KERNEL=1 rpi-update before installing the 4.4 kernel. Failing to do this may result in various errors or a non-booting system!
  2. Check that you have dtoverlay=rpi-cirrus-wm5102 in your config.txt, the old variant dtoverlay=rpi-cirrus-wm5102-overlay is no longer supported.
old versions:
  Download from archive Read Changelog.txt for details

Configuration

Enable the driver

Add the following line to /boot/config.txt to enable the Cirrus Logic card driver

dtoverlay=rpi-cirrus-wm5102

If you want MMAP support (eg for Alsa plugins) add this line as well:

dtoverlay=i2s-mmap

Setup module dependencies

The cirrus driver requires some manually defined module dependencies, if you fail to add them the driver won't load properly.

Create a file /etc/modprobe.d/cirrus.conf with the following content:

softdep arizona-spi pre: arizona-ldo1
softdep spi-bcm2708 pre: fixed
softdep spi-bcm2835 pre: fixed

Download and install "usecase" scripts

Instead of doing the "git clone" as described in the Cirrus wiki you can just download this tarball and extract it for example in /home/pi/bin.

wget http://www.horus.com/~hias/tmp/cirrus/usecase-scripts.tgz
mkdir bin
cd bin
tar zxf ../usecase-scripts.tgz

Note: You have to start the appropriate scripts before you can use the card. For example:

./Reset_paths.sh -q
./Playback_to_Lineout.sh -q
./SPDIF_playback.sh -q
./Record_from_lineIn.sh -q

Disable RPi on-board audio device snd-bcm2835

On Raspbian the RPi on-board audio device snd-bcm2835 is enabled by default. When you run aplay -l you'll see two cards, the Cirrus card sndrpiwsp and the on-board card bcm2835.

If you don't need on-board audio you can disable it by removing (or commenting out) the dtparam=audio=on line from /boot/config.txt.

#dtparam=audio=on

Optionally: use fixed card number

If you don't want to disable snd-bcm2835 or if you also have an USB audio device connected you might notice that the card numbers under which the drivers register will change. Sometimes the Cirrus card will card 0, sometimes on-board audio. The card number depends on which driver is registered first, which is purely random.

You can manually assign fixed card (slot/index) numbers using the slot option of the snd module. For example, if you want the Cirrus card always to be the first and on-board audio the second one, add the following line to your /etc/modprobe.d/cirrus.conf file:

options snd slots=snd-soc-rpi-wsp,snd-bcm2835

Note: you need to use kernel 4.1.19 or newer, slot numbering doesn't work in earlier versions.

Optionally: disable Raspbian kernel updates

From time to time Raspbian will update the kernel+GPU firmeware package. If you do an apt-get upgrade the Cirrus kernel will be replaced with the official Raspbian kernel and the sound card no longer works.

You can prevent Raspbian kernel updates by putting the raspberrypi-bootloader and raspberrypi-kernel packages on hold:

sudo apt-mark hold raspberrypi-bootloader raspberrypi-kernel

Note: this will also disable GPU firmware updates.

Updating the GPU firmware

Sometimes new kernel versions require an updated GPU firmware to work properly (or even boot at all).

To update the GPU firmware but not the kernel install the rpi-update package and then update the GPU firmware with this command:

sudo SKIP_KERNEL=1 rpi-update

Troubleshooting

If something doesn't work as expected please post your questions in this thread on the element14 site.

In order to track down problems follow the steps below and include the URLs to the paste files in your post:

  1. Add the following line to /boot/config.txt to enable devicetree debugging, then reboot your RPi.

    dtdebug=1
  2. Upload your /boot/config.txt file, the GPU firmware version, GPU firmware and linux kernel logs and the outputs of lsmod and aplay -l. The easiest way to do this is by using the paste command which is included in Raspbian. Enter the following commands and include the URLs that are output on the terminal in your post:

    paste /boot/config.txt
    vcgencmd version | paste
    sudo vcdbg log msg 2>&1 | paste
    dmesg | paste
    lsmod | paste
    aplay -l | paste

Home