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 New reworked driver for Wolfson/Cirrus Logic audio card
  • 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 390 replies
  • Subscribers 767 subscribers
  • Views 50263 views
  • Users 0 members are here
  • raspberry_pi
  • raspeberry_pi_accessories
Related

New reworked driver for Wolfson/Cirrus Logic audio card

hiassoft
hiassoft over 9 years ago

I've been working on a driver rework, mainly to get rid of the requirement to carry around a bunch of patches to upstream driver code, and also to fix some outstanding issues and introduce some new features.

 

Most issues have been ironed out so here's the first public release.

 

Edit: the driver has been included in official RPi kernels. Just run sudo rpi-update to install it.

You still have to install the mixer scripts and add the /etc/modprobe.d file. See my website for details

RPi Linux driver for Wolfson / Cirrus Logic Audio Card

 

Source: https://github.com/HiassofT/rpi-linux/tree/cirrus-ng-4.9.0

Precompiled kernel: http://www.horus.com/~hias/tmp/cirrus/cirrus-ng-linux-4.9.0.tgz

New mixer scripts: http://www.horus.com/~hias/tmp/cirrus/cirrus-ng-scripts.tgz

 

Important notes:

  • The new driver bases on the rather fresh kernel 4.9.0 which means there's some risk of (yet unknown) issues. Use it at your own risk and please run "rpi-update" to get the latest firmware before installing the new driver.
  • The soundcard name has been changed from "snd_rpi_wsp" to "RPi-Cirrus", also several ALSA controls have been removed and new ones were added. This means the old usecase scripts and any custom-made scripts will no longer work. Use the new mixer scripts instead of the old usecase/listen scripts.
  • The new driver supports setting (and receiving) of the S/PDIF channel status bits (aka AES bits). If you add an ALSA card configuration file this means applications like Kodi can do proper AC3/DTS passthrough. A sample card configuration file (plus the mixer scripts) can be found here: https://github.com/HiassofT/rpi-cirrus-config
  • I haven't fully updated the documentation on my website RPi Linux driver for Wolfson / Cirrus Logic Audio Card  yet, will do that during the next weeks/months. But except for the things noted above most stuff should still work as in previous driver versions.

 

Please report back if you tested the driver (either successfully or unsuccessfully), any feedback will help me!

 

so long,

 

Hias

  • Sign in to reply
  • Cancel
Parents
  • kjciszewski
    kjciszewski over 9 years ago

    Thanks for that--I added Reset_paths.sh to my Lbio8.sh script, and the sample rate issue went away.

     

    There still seems to be a lot of white noise (hiss) in the audio that I don't remember from the earlier RPIs, audio cards and drivers, so I'll have to look into that.

     

    The default hw:0 thing was the original ALSA default, as I understand it, going way back. Ragnar Jensen's driver changed that to hw:1, as I recall (that as 3.12.33+, I think).

     

    It's interesting how different driver versions do things like add a minimum sample rate control, but I don't remember seeing that documented anywhere.

     

    I appreciate all of your hard work on this driver rework, without it we'd probably have nothing for RPI 3--the original powers that be didn't keep up very well the the Wolfson and CIrrus audio cards drivers relative to the changing RPI models.

     

    That said, one of the issues with all of this is some kind of documentation of changes and special features--unless I missed that somewhere.

     

    Thanks again.

     

    Have you heard if the Cirrus audio card will continue to be produced?  I saw one suppliers site that said it is no longer manufactured, while another said it would ship once supplies were restocked.

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

    Hi Kenneth!

     

    I haven't noticed any noise/hiss issues so far. Try to check the cabling first, if it doesn't help please test with the old 4.4 kernel and see if it makes a difference.

     

    I've added the minimum/maximum samplerate controls to make it easier to interface with S/PDIF DACs and ADCs. And I also added controls to get/set the S/PDIF channel status bits (conforming to the ALSA IEC958 standard) both for transmission and reception, plus a few other read-only controls (all having "IEC958" at the beginning of the name) to check the internal S/PDIF receiver status registers - so users/application can detect if S/PDIF reception is OK.

     

    My plan is to document these new features later on my website, but number one priority for me was to get the new driver out to the public and get some feedback. If something's unclear or you need more info, just ask here!

     

    so long,

     

    Hias

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

    I have a Raspberry PI 2, so I ran version 3.18.9-v7+ using my Lbio8.sh script, and compared that to running version v.9.0-v7+ (your new driver) on the RP 2.  The there is virtually no "hiss" noise out of 3.18.9-v7+, while there is considerable noise coming out of V.9.0-v7+.

     

    It may be that there was some audio compensation/.filtering in the earlier version that cut back on the "hiss" noise--the WM5102 has a lot capabilities like filtering that might have been involved.  I'm not sure.  However, the difference is noticeable as soon as the Lbio8.sh script is loaded and the screen tells us that both the record and play functions are running.  With V.9.0-v7+, when the Lbio8.sh script is started, the noise occurs immediately, and when the Lbio8.sh script is killed,  the noise goes away.  Running version 3.18.9-v7+ does not produce the same level of noise.  This noise is loud enough to be audible even with a signal being input and looped through (I use a pocket music player that plays music files from a memory card)--I start the script, wait and listen to the output noise level, then start playing a music file.

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

    I have a Raspberry PI 2, so I ran version 3.18.9-v7+ using my Lbio8.sh script, and compared that to running version v.9.0-v7+ (your new driver) on the RP 2. The there is virtually no "hiss" noise out of 3.18.9-v7+, while there is considerable noise coming out of V.9.0-v7+.

     

    It may be that there was some audio compensation/.filtering in the earlier version that cut back on the "hiss" noise--the WM5102 has a lot capabilities like filtering that might have been involved. I'm not sure. However, the difference is noticeable as soon as the Lbio8.sh script is loaded and the screen tells us that both the record and play functions are running. With V.9.0-v7+, when the Lbio8.sh script is started, the noise occurs immediately, and when the Lbio8.sh script is killed, the noise goes away. Running version 3.18.9-v7+ does not produce the same level of noise. This noise is loud enough to be audible even with a signal being input and looped through (I use a pocket music player that plays music files from a memory card)--I start the script, wait and listen to the output noise level, then start playing a music file.

    Could you please post the Lbio8.sh script? Also post how you configure the card, i.e. which Playback/Listen scripts you are running. BTW: when setting up the card it's a good idea to run Reset_paths first.

     

    Which inputs and outputs are you using?

     

    so long,

     

    Hias

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

    I'm using the line in (pink) and line out (green) jacks on the CIrrus Logic audio card.

     

    ----> Lbio8.sh for v.4.9.0-v7+ is

     

    ./Reset_paths.sh

     

    ./Playback_to_Lineout.sh

     

    ./Record_from_Linein.sh

     

    arecord -Dhw:1 -r 8000 -c 2 -f S32_LE | aplay -Dhw:1 -r 8000 -c 2 -f S32_LE

     

    ----> Lbio8.sh for version 3.18.9-v7+ is

     

    ./Playback_to_Lineout.sh

     

    ./Record_from_Linein.sh

     

    arecord -Dhw:1 -r 8000 -c 2 -f S32_LE | aplay -Dhw:1 -r 8000 -c 2 -f S32_LE

     

    No one said it was necessary to reset paths with the earlier driver.  I have done that in the past manually at times, but never noticed any difference.

     

    The playback/listen scripts for v.4.9.0-v7+ are the new ones you provided.

     

    The playback/listen scripts for version 3.18.9-v7+  are

     

    ----->  Record_from_Linein.sh

     

    #!/bin/bash

     

    # $1 added to support 1st line argument. i.e. "./Record_from_linein.sh -q" will stop all the control information being displayed on screen

     

    #Record from onboard Line Input to AP

    # +8dB input PGA gain

    amixer $1 -Dhw:sndrpiwsp cset name='IN3L Volume' 8

    amixer $1 -Dhw:sndrpiwsp cset name='IN3R Volume' 8

     

    # better THD in normal mode vs lower noise floor in high performance

    amixer $1 -Dhw:sndrpiwsp cset name='IN3 High Performance Switch' on

    # Configure the input path for 0dB Gain,  HPF with a low cut off for DC removal

    amixer $1 -Dhw:sndrpiwsp cset name='IN3L Digital Volume' 128

    amixer $1 -Dhw:sndrpiwsp cset name='IN3R Digital Volume' 128

    amixer $1 -Dhw:sndrpiwsp cset name='LHPF1 Input 1' IN3L

    amixer $1 -Dhw:sndrpiwsp cset name='LHPF2 Input 1' IN3R

    amixer $1 -Dhw:sndrpiwsp cset name='LHPF1 Mode' High-pass

    amixer $1 -Dhw:sndrpiwsp cset name='LHPF2 Mode' High-pass

    amixer $1 -Dhw:sndrpiwsp cset name='LHPF1 Coefficients' 240,3

    amixer $1 -Dhw:sndrpiwsp cset name='LHPF2 Coefficients' 240,3

    # Configure the Audio Interface and volume 0dB

    amixer $1 -Dhw:sndrpiwsp cset name='AIF1TX1 Input 1' LHPF1

    amixer $1 -Dhw:sndrpiwsp cset name='AIF1TX1 Input 1 Volume' 32

    amixer $1 -Dhw:sndrpiwsp cset name='AIF1TX2 Input 1' LHPF2

    amixer $1 -Dhw:sndrpiwsp cset name='AIF1TX2 Input 1 Volume' 32

     

     

    # The following command should be used to test

    # arecord -Dhw:sndrpiwsp -r 44100 -c 2 -f S32_LE <file>

     

    ----->  Playback_to_Lineout.sh

     

    #!/bin/bash

     

    # $1 added to support 1st line argument. i.e. "./Playback_to_Lineout.sh -q" will stop all the control information being displayed on screen

     

    #Playback from AP to Line Output, default gain 0dB

     

    # Clear the HPOUT2 Input 1 and 2  mixers. This will ensure no previous paths are connected to the HPOUT2.

    # This doesn't include Inputs 3 and 4.

    amixer $1 -Dhw:sndrpiwsp cset name='HPOUT2L Input 1' None

    amixer $1 -Dhw:sndrpiwsp cset name='HPOUT2R Input 1' None

    amixer $1 -Dhw:sndrpiwsp cset name='HPOUT2L Input 2' None

    amixer $1 -Dhw:sndrpiwsp cset name='HPOUT2R Input 2' None

    # Setup HPOUT2 input path and volume

    amixer $1 -Dhw:sndrpiwsp cset name='HPOUT2L Input 1' AIF1RX1

    amixer $1 -Dhw:sndrpiwsp cset name='HPOUT2L Input 1 Volume' 32

    amixer $1 -Dhw:sndrpiwsp cset name='HPOUT2R Input 1' AIF1RX2

    amixer $1 -Dhw:sndrpiwsp cset name='HPOUT2R Input 1 Volume' 32

    # Unmute HPOUT2 Output

    amixer $1 -Dhw:sndrpiwsp cset name='HPOUT2 Digital Switch' on

     

     

    # The following command can be used to test

    # aplay -Dhw:sndrpiwsp -r 44100 -c 2 -f S32_LE <file>

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

    Hi Kenneth,

     

    thanks a lot for the info! I could reproduce the issue, it looks like it comes from the micbias disable fix (the original driver was buggy in this respect and had micbias always enabled on line-in). I think I might have a solution but need to run some more tests first.

     

    As a workaround could you try using "Record_from_Linein_Micbias.sh" instead of "Record_from_Linein.sh" and see if the noise disappears? That'll setup the card as with the original drivers/mixer scripts.

     

    BTW: When you want to monitor a signal from an input it'd be better to use a samplerate of 44100 instead of 8000, that improves quality a lot. You could also use the listen script "Cirrus_listen.sh line line", that'll route line-in to line-out inside of the chip (no need for arecord | aplay) - in that case the driver will use whatever samplerate has last been used (default after powerup is 44100 Hz).

     

    Ah, and always using Reset_paths.sh is not strictly necessary, but it's a good thing to do before testing so the card is in a known state and I have a chance to reproduce issues - there are tons of stuff that could be set wrong and cause all kinds of problems.

     

    so long,

     

    Hias

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

    Thanks for taking the time to work on this.

     

    I use 8000 Hz because of an interest voice intercom over IP, something I'm still working on. It's kind of a common sample rate used for digital voice communication. Finding a suitable ethernet interface to use is still a challenge.

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

    Hi Kenneth,

     

    could you please test with this kernel http://www.horus.com/~hias/tmp/cirrus/cirrus-ng-linux-4.9.3.tgz

     

    I did some tests here and it looks like I found a fix for the hiss issue when micbias on linein is turned off.

     

    so long,

     

    Hias

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

    So I installed this 4.9.3 on top of 2016-11-25-raspbian-jessie on a new SD card like I did before, made the other changes in your app note, fired it up using Lbio8.sh. and I get a lot of really loud white noise and a series of overruns (at least 122.xxx long).

     

    Should I have installed 4.9.3 over 4.9.0 instead?

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

    All this on an RPI 3

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • kjciszewski
    kjciszewski over 9 years ago in reply to hiassoft

    All this on an RPI 3

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Children
No Data
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