element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum Driver fixes and updates to kernel 3.18.16 and 4.0.5
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 180 replies
  • Subscribers 720 subscribers
  • Views 29083 views
  • Users 0 members are here
  • raspberry_pi
  • raspeberry_pi_accessories
Related

Driver fixes and updates to kernel 3.18.16 and 4.0.5

hiassoft
hiassoft over 11 years ago

Edit: Current kernel versions and install/config instructions are also available from my webpage http://www.horus.com/~hias/cirrus-driver.html

 

During the last few weeks I fixed various issues in the Wolfson/Cirrus driver and rebased it so it works with the current RPi kernel versions (3.18.16 and 4.0.5).

 

You can download the patches from my GitHub repository. The 3.18 kernel with Cirrus drivers is in the cirrus-3.18.y branch, the 4.0 kernel with Cirrus drivers is in the cirrus-4.0.y branch. I'll rebase and update these branches from time to time so that the Cirrus driver and my changes will stay on top of the commit list.

 

If you just want to have an updated 3.18.16 kernel you can download precompiled binaries from here. Just unpack the tarball in the root directory. Before you do that it might be a good idea to update the firmware files (bootcode.bin, start*.elf and fixup*.dat in the boot directory) to the latest version.

 

Here's a list of my changes:

- Added the FLL1 setup back so that switching between 44.1kHz and 48kHz (and other sample rates) works fine.

- Don't register Arizona IRQ if it's set to 0. The Cirrus driver uses polling here and if we register an interrupt handler for irq 0 we get lots of "spurious interrupt" messages spamming dmesg in kernel 3.19 and newer. IRQ 0 is wrong anyway.

- Include DCVDD patches from the Cirrus linux-drivers repository. These patches make sure the WM8804 chip is initialized properly. Without this patch I sometimes had SPDIF audio out only on the right channel.

- Disable spidev0 in Cirrus device tree overlay. That's mainly a safety precaution so that userspace programs trying to access spi0.0 won't interfere with the WM8804 reset line. I'm not 100% sure this is needed at all, so maybe I'll remove it some time later.

 

And some important notes:

I haven't included the mmap patch, this is already supported in the upstream kernels but currently disabled by default. To enable mmap support add the following line to config.txt:

dtoverlay=i2s-mmap

 

If you compile the kernel on your own please note that the devicetree overlays have now been moved to arch/arm/boot/dts/overlays.

 

Kernel 4.0 now uses spi_bcm2835 by default (the older spi_bcm2708 module is available via a devicetree overlay) so you have to extend your /etc/modprobe.d conf file and add a pre-depend for spi_bcm2835 as well. It's safe to have both the old and the new module in here, so just use this configuration:

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

 

so long,

 

Hias

  • Sign in to reply
  • Cancel
  • elb
    elb over 10 years ago in reply to hiassoft

    Hi Mathias !

     

    What kind of file did you try to play? SPDIF on the Cirrus card only supports 32-96kHz stereo files.


    My DAC is a Wadia X32 dating from the 90's. It supports 16 bits 44.1/48 KHz. If the Cirrus card only supports 32-96KHz, then I'm stucked image.


    However that does not comply with the card documentation. Extract p. 17 under SPDIF Output:

    Supported Sample Rates     32, 48, 96, 192, 44.1, 88.2, 176.4, 192 KHz

    Sample depth     Max bit depth of samples     24     bits


    By the way, SPDIF_playback.sh -q gives no output at all.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • hiassoft
    hiassoft over 10 years ago in reply to elb

    Hi Eric!

     

    The Cirrus card should do 16-bit 44.1/48kHz stereo just fine (and, yes, it should go up to 192kHz as mentioned in the datasheet - sorry, my fault).

     

    No output from SPDIF_playback.sh -q is fine, too.

     

    Just tested again here, kernel 4.1.13 on a RPi2, playing a 44.1kHz 16-bit stereo WAV worked fine (I'm using a Behringer SRC2496 as a DAC here). So I'm not sure what's going wrong...

     

    so long,

     

    Hias

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • elb
    elb over 10 years ago in reply to hiassoft

    Hi Mathias!

     

    I've done some tests during the weekend, unfortunately with no success. What happens is the led on the Wadia sparkles when connected to the SPDIF output of the Cirrus Logic card. When I play a file, the Wadia correctly detects the rate (I tried both 44.1 and 48 KHz, 2 rates supported by the X32), but it cannot achieve to lock on the SPDIF signal. The led does not fully light up, and I hear an internal relay switch randomly while the file is playing. Of course there is no sound.

     

    I also tried to power the card and the Pi via the auxiliary power input (with a 1 A power supply). Same result. Maybe I'll try a more powerfull power supply some time.

     

    I'd had the same result with a Hifiberry Digi, which is not very surprising because I think both cards use the same SPDIF module. So it seems there is an incompatibility between the WM8804 and old DACs (I've read a user reporting the same issue using a Hifiberry Digi with another 90s DAC). At least, I can enjoy the analogic output until I find another solution. This is already a major improvement other the Pi default sound :-)

     

    Anyway I'll continue to watch this thread, which is a great value for Cirrus card owners !

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • hiassoft
    hiassoft over 10 years ago in reply to elb

    Hi Eric!

    I've done some tests during the weekend, unfortunately with no success. What happens is the led on the Wadia sparkles when connected to the SPDIF output of the Cirrus Logic card. When I play a file, the Wadia correctly detects the rate (I tried both 44.1 and 48 KHz, 2 rates supported by the X32), but it cannot achieve to lock on the SPDIF signal. The led does not fully light up, and I hear an internal relay switch randomly while the file is playing. Of course there is no sound.

    A quick google search turned up this old article: Wadia Digimaster X-32 digital processor Page 2 | Stereophile.com

    Many people bought X-32s only to discover that they would not lock to their CD players' digital outputs.

    ...

    Wadia has solved this problem by supplying with each X-32 an additional Read-Only Memory (ROM) chip. The socket-mounted ROM that comes in the unit configures the programmable gate-array chips described earlier. If the X-32 will not lock to your CD player, the ROM must be replaced with the extra chip supplied, which fortunately is very simple to do.

    This reads like your DAC is very picky about the input signals and the manufacturer was aware of the fact. If you still have the extra chip for your DAC you could give that a try.

     

    so long,

     

    Hias

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • elb
    elb over 10 years ago in reply to hiassoft

    Hi Mathias!

     

    Thank you for your interest. Unfortunately, I don't have this extra chip, and after some searching on the net, it feels definitely hard to lay hands on one.

     

    This point does not surprise me much. Indeed some Wadia DACs owners I know are making and selling kits for CD players to replace the oscillator and improve the SPDIF signal accuracy and shape. The aim is to seek very low jitter. Too bad the Cirrus card cannot work with the X32, because it is a so brilliant machine. I would love to be able to make it work together with the Pi.

     

    Eric

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • e14 Contributor
    e14 Contributor over 10 years ago

    I would like to say thank you to all the contributions. I followed the instructions contained in the above I was able to download --cirrus-linux-4.1.13 install and it worked first time.

    I am currently testing it with various pieces of SDR software.

     

    Great job - Paul

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • hiassoft
    hiassoft over 10 years ago

    I've uploaded an updated version, based on the freshly released 4.1.16 kernel:

    http://www.horus.com/~hias/tmp/cirrus/cirrus-linux-4.1.16.tgz

     

    As usual the source is on github: https://github.com/HiassofT/rpi-linux/tree/cirrus-4.1.16

     

    I've reworked some of my previous fixes, especially the one which tried to fix switching between 44.1kHz-related and 48kHz-related rates (which resulted in wrong playback rate with the original driver).

     

    The original quick-fix, bringing back the FLL setup into snd_rpi_wsp_config_5102_clks, caused several issues: Whenever one started a recording when playback was running (or vice versa) we got short dropouts/clicks. And, what's even worse, on rare occasions this fix could "confuse" the chip and we ended up with an even more off sample rate.

     

    I've now implemented a (hopefully) proper fix for this and also back-ported some wm5102/arizona related fixes from newer kernel versions.

     

    so long,

     

    Hias

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • e14 Contributor
    e14 Contributor over 10 years ago in reply to hiassoft

    Many thanks for updated kernel source.

     

    I've updated PKGBUILD at GitHub.

    Additionally there are ready to install kernel packages. You can find them at headless.audio.

     

    Ed.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • hiassoft
    hiassoft over 10 years ago

    FYI: I just put a webpage online with installation & configuration instructions and links to the precompiled kernels:

    http://www.horus.com/~hias/cirrus-driver.html

     

    so long,

     

    Hias

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
  • e14 Contributor
    e14 Contributor over 10 years ago in reply to hiassoft

    Thanks for your great work!

    I downloaded the 4.1.16 source code and compile sucefully on rpi1,

    and i sucefully hear the music from mpd.

    but there are some error message from dmesg.

    system:raspbian-jessie-lite 2016-02-06

    pi@Wolfson:~ $ aplay -l

    **** List of PLAYBACK Hardware Devices ****

    card 0: sndrpiwsp [snd_rpi_wsp], device 0: WM5102 AiFi wm5102-aif1-0 []

      Subdevices: 0/1

      Subdevice #0: subdevice #0

    pi@Wolfson:~ $ dmesg | grep snd-rpi

    [    9.980438] snd-rpi-wsp sound: ASoC: CPU DAI (null) not registered

    [    9.980453] snd-rpi-wsp sound: Failed to register card: -517

    [   10.756252] snd-rpi-wsp sound: ASoC: CPU DAI (null) not registered

    [   10.756281] snd-rpi-wsp sound: Failed to register card: -517

    [   12.941450] snd-rpi-wsp sound: ASoC: CPU DAI (null) not registered

    [   12.941491] snd-rpi-wsp sound: Failed to register card: -517

    [   12.959889] snd-rpi-wsp sound: ASoC: CPU DAI (null) not registered

    [   12.959924] snd-rpi-wsp sound: Failed to register card: -517

    [   12.987564] snd-rpi-wsp sound: ASoC: CPU DAI (null) not registered

    [   12.987596] snd-rpi-wsp sound: Failed to register card: -517

    [   12.988953] snd-rpi-wsp sound: ASoC: CPU DAI (null) not registered

    [   12.988987] snd-rpi-wsp sound: Failed to register card: -517

    [   12.991259] snd-rpi-wsp sound: ASoC: CODEC DAI wm5102-aif1 not registered

    [   12.991290] snd-rpi-wsp sound: Failed to register card: -517

    [   12.992325] snd-rpi-wsp sound: ASoC: CODEC DAI wm5102-aif1 not registered

    [   12.992360] snd-rpi-wsp sound: Failed to register card: -517

    [   13.071121] snd-rpi-wsp sound: ASoC: CODEC DAI wm5102-aif1 not registered

    [   13.071153] snd-rpi-wsp sound: Failed to register card: -517

    [   13.290994] snd-rpi-wsp sound: ASoC: CODEC DAI wm5102-aif1 not registered

    [   13.291034] snd-rpi-wsp sound: Failed to register card: -517

    [   13.370104] snd-rpi-wsp sound: ASoC: CODEC DAI wm5102-aif1 not registered

    [   13.370144] snd-rpi-wsp sound: Failed to register card: -517

    [   13.490198] snd-rpi-wsp sound: ASoC: CODEC DAI wm5102-aif1 not registered

    [   13.490242] snd-rpi-wsp sound: Failed to register card: -517

    [   13.504786] snd-rpi-wsp sound: ASoC: CODEC DAI wm5102-aif1 not registered

    [   13.504825] snd-rpi-wsp sound: Failed to register card: -517

    [   16.589497] snd-rpi-wsp sound: wm5102-aif1 <-> 20203000.i2s mapping ok

     

    cat /boot/config.txt

    dtoverlay=rpi-cirrus-wm5102

    dtoverlay=i2s-mmap

    dtdebug=1

     

    pi@Wolfson:~ $ vcdbg

    debug_sym: OpenVideoCoreMemoryFileWithOffset: Unable to open '/dev/vc-mem': Permission denied(13)

     

    pi@Wolfson:~ $ cat /etc/modprobe.d/cirrus.conf

    softdep arizona-spi pre: arizona-ldo1

    softdep spi-bcm2708 pre: fixed

    softdep spi-bcm2835 pre: fixed

    softdep snd-soc-wm8804-i2c pre: snd-soc-rpi-wsp-preinit

    softdep snd-soc-rpi-wsp pre: snd-soc-wm8804-i2c

     

    Unable to open videocore memory access: -13

     

    share my mpd settings.

    /etc/mpd.conf

    audio_output {

            type            "alsa"

            name            "My ALSA Device"

            device          "hw:0,0"        # optional

            mixer_device    "hw:0"  # optional

            mixer_control   "HPOUT1 Digital"                # optional

            mixer_index     "0"             # optional

    }

     

    It alwanys prompt  Failed to register card: -517,but the wolfson audio card did work.why there are so many error prompt?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
<>
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2026 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube