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
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
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.
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 |
|
previous version: |
4.4.6
2016-04-12 |
cirrus-linux-4.4.6.tgz
Source code |
Important notes if you update from kernel 4.1.y:
|
old versions: | ||
Download from archive | Read Changelog.txt for details |
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
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
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
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
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.
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.
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
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:
Add the following line to /boot/config.txt
to
enable devicetree debugging, then reboot your RPi.
dtdebug=1
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