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 Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • 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
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • 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 725 subscribers
  • Views 31826 views
  • Users 0 members are here
  • raspberry_pi
  • raspeberry_pi_accessories
Related

New reworked driver for Wolfson/Cirrus Logic audio card

hiassoft
hiassoft over 8 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
  • mskyaxl
    mskyaxl over 8 years ago

    Thanks for updating this! I'll try it today and come back with a feedback. image

     

    [edit]

    I just saw  that this is for kernel 4.9.  rpi-update will just update to 4.4.38. Should I try installing it on this version?

     

    [edit2]

    I'm back with some feedback.

     

    At first I've tried to compile from source but for some reasons the sound card was not shown although the compilation was successful. I did not try the second time as it takes a loooot of time. What I did instead was to use your binaries directly and it worked meaning that I had audio on output.

     

     

    I've notices that in  dmesg I get some errors:

     

     

     

    [    2.450796] systemd[1]: Starting Encrypted Volumes.
    [    2.491344] usb 1-1.4: New USB device found, idVendor=046d, idProduct=c52e
    [    2.491355] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
    [    2.491362] usb 1-1.4: Product: USB Receiver
    [    2.491369] usb 1-1.4: Manufacturer: Logitech
    [    2.513696] input: Logitech USB Receiver as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.0/0003:046D:C52E.0001/input/input0
    [    2.576217] hid-generic 0003:046D:C52E.0001: input,hidraw0: USB HID v1.11 Keyboard [Logitech USB Receiver] on usb-3f980000.usb-1.4/input0
    [    2.583759] input: Logitech USB Receiver as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4/1-1.4:1.1/0003:046D:C52E.0002/input/input1
    [    2.646054] hid-generic 0003:046D:C52E.0002: input,hiddev0,hidraw1: USB HID v1.11 Mouse [Logitech USB Receiver] on usb-3f980000.usb-1.4/input1
    [    3.319367] systemd-udevd[143]: starting version 215
    [    3.702546] gpiomem-bcm2835 3f200000.gpiomem: Initialised: Registers at 0x3f200000
    [    3.854333] arizona spi0.1: Failed to get mclk1: -2
    [    3.854351] arizona spi0.1: Failed to get mclk2: -2
    [    3.854826] LDO1: supplied by RPi-Cirrus 1v8
    [    3.864272] arizona spi0.1: WM5102 revision C
    [    3.890200] Adding alias for supply MICVDD,(null) -> MICVDD,spi0.1
    [    3.890723] Adding alias for supply MICVDD,(null) -> MICVDD,spi0.1
    [    3.890730] Adding alias for supply DBVDD2,(null) -> DBVDD2,spi0.1
    [    3.890736] Adding alias for supply DBVDD3,(null) -> DBVDD3,spi0.1
    [    3.890743] Adding alias for supply CPVDD,(null) -> CPVDD,spi0.1
    [    3.890749] Adding alias for supply SPKVDDL,(null) -> SPKVDDL,spi0.1
    [    3.890755] Adding alias for supply SPKVDDR,(null) -> SPKVDDR,spi0.1
    [    3.908398] MICVDD: supplied by RPi-Cirrus 1v8
    [    3.913997] snd-rpi-cirrus soc:sound: ASoC: CODEC DAI wm5102-aif1 not registered
    [    3.924215] snd-rpi-cirrus soc:sound: ASoC: CODEC DAI wm5102-aif1 not registered
    [    3.929051] wm8804 1-003b: revision E
    [    3.930445] snd-rpi-cirrus soc:sound: ASoC: CODEC DAI wm5102-aif1 not registered
    [    4.090662] snd-rpi-cirrus soc:sound: wm5102-aif1 <-> 3f203000.i2s mapping ok
    [    4.124437] usbcore: registered new interface driver brcmfmac
    [    4.250137] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
    [    4.280279] brcmfmac: brcmf_c_preinit_dcmds: Firmware version = wl0: May 27 2016 00:13:38 version 7.45.41.26 (r640327) FWID 01-df77e4a7
    [    4.321667] brcmfmac: brcmf_cfg80211_reg_notifier: not a ISO3166 code (0x30 0x30)
    [    4.498695] brcmfmac: brcmf_cfg80211_reg_notifier: not a ISO3166 code (0x30 0x30)
    [    4.765902] systemd-journald[141]: Received request to flush runtime journal from PID 1
    [    5.403864] IPv6: ADDRCONF(NETDEV_UP): wlan0: link is not ready
    [    5.403874] brcmfmac: power management disabled
    [    6.048178] uart-pl011 3f201000.serial: no DMA platform data
    [    6.311183] Adding 102396k swap on /var/swap.  Priority:-1 extents:2 across:217084k SSFS
    [    6.636395] smsc95xx 1-1.1:1.0 eth0: hardware isn't capable of remote wakeup
    [    8.120974] smsc95xx 1-1.1:1.0 eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1
    [   10.458792] Bluetooth: Core ver 2.22
    [   10.458918] NET: Registered protocol family 31
    [   10.458924] Bluetooth: HCI device and connection manager initialized
    [   10.460116] Bluetooth: HCI socket layer initialized
    [   10.460140] Bluetooth: L2CAP socket layer initialized
    [   10.460185] Bluetooth: SCO socket layer initialized
    [   10.468484] Bluetooth: HCI UART driver ver 2.3
    [   10.468498] Bluetooth: HCI UART protocol H4 registered
    [   10.468503] Bluetooth: HCI UART protocol Three-wire (H5) registered
    [   10.468707] Bluetooth: HCI UART protocol Broadcom registered
    [   10.666681] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
    [   10.666690] Bluetooth: BNEP filters: protocol multicast
    [   10.666708] Bluetooth: BNEP socket layer initialized
    [   39.934339] random: crng init done
    [ 2744.08356/5] bcm2835-i2s 3f203000.i2s: I2S SYNC error!

    do you know why?

     

    Another thing I would like to "route" from line in to line out is this possible using the "usecase" scripts?

     

    If you want I can try again the compilation if you want to be sure that this works on a different machine. image

     

    Thanks!

     

    [edit3]

    I've just found how to route. image

     

    sudo ./Cirrus_listen.sh line line

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

    Hi Alex, thanks a lot for your feedback!

     

    I just saw that this is for kernel 4.9. rpi-update will just update to 4.4.38. Should I try installing it on this version?

    Yes, this is fine. The reason for running rpi-update is to get a recent gpu firmware version.

    At first I've tried to compile from source but for some reasons the sound card was not shown although the compilation was successful. I did not try the second time as it takes a loooot of time. What I did instead was to use your binaries directly and it worked meaning that I had audio on output.

    It's hard to tell what went wrong but my guess would be missing to install the dtb and dtbo files and/or modules. If you still have the compiled tree you could try reinstalling it, it should work just fine.

    I've notices that in dmesg I get some errors:

    [ 3.913997] snd-rpi-cirrus soc:sound: ASoC: CODEC DAI wm5102-aif1 not registered
    [ 3.924215] snd-rpi-cirrus soc:sound: ASoC: CODEC DAI wm5102-aif1 not registered

    You can ignore these, they come from the kernel deferred probing mechanism. It just means that bcm2835-i2s hadn't been loaded/initialized by the time the kernel tried to load/init the sound card driver.

    sudo ./Cirrus_listen.sh line line

    BTW: you can omit "sudo", running the alsa mixer scripts should work fine as a normal user.

     

    so long,

     

    Hias

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

    Thanks Hias for the reply,

     

    I have another questions as I am quite new to alsa.

    I get sound only when I test it via command line using for example

     

    mplayer -volume 100 file.flac

     

    I've tried some things like running rpi3 with pixel, emulationstation(retropie) and kodi but have some issues as I do not have sound.

    I've disabled the default sound card.

     

    I think it has something to do with the mixer and I think I have to update

    /etc/asound.conf

     

    but I don't know whith what. amixer is returning a lot of entries. image

     

    Do you know how to "fix" this?

     

    Thanks!

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

    Usually you shouldn't have to change /etc/asound.conf or ~/.asoundrc.

     

    Could you post the output of

    aplay -l

     

    BTW: in case of kodi make sure you select the RPi-Cirrus card in audio settings, default usually is to play back via HDMI only. Also make sure you have MMAL video acceleration enabled - OMX can't output to ALSA.

     

    so long,

     

    Hias

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

    aplay -l returns

     

    **** List of PLAYBACK Hardware Devices ****
    card 0: RPiCirrus [RPi-Cirrus], device 0: WM5102 AiFi wm5102-aif1-0 []
      Subdevices: 1/1
      Subdevice #0: subdevice #0

     

     

    BTW: in case of kodi make sure you select the RPi-Cirrus card in audio settings, default usually is to play back via HDMI only. Also make sure you have MMAL video acceleration enabled - OMX can't output to ALSA.

    You are right about kodi, I remember I did this last time with the previous driver and it worked image I do not have it yet installed yet.

     

    I had raspbian lite installed with retropie and I got issues like

     

    VolumeControl::init() - Failed to find mixer elements!

     

    and as far as I understood emulation station assumes that the default alsa mixer is PCM, that's why I was thinking that /etc/asound.conf has to be updated. Somehow I have to point out which is the right mixer.

     

    Having this I said that I should first get the normal raspbian working so I've flashed raspbian lite again and it worked from command line as shown below and afterwards I tried it also on full raspbian with the new pixel desktop and again the volume control is not working and trying to play anything from GUI fails, for example Chronium crashes. I tried to figure out which is the correct mixer but I get a long list.

     

    In general I would like to be able to route from line in to line out as I want have a vinyl player connected to it. I want to use it as my main media player(most probably kodi) and optional I would like to play around with retropie.

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

    Hias,

     

    Thanks for the comment about ALSA not working with OMX! My card was working 2 days ago but I didn't know it while using OMX to test. But now my RPi2 is updated to Jessie and the audio card is working!!!

     

    Also thanks for ALL the work you have done on the updates!

     

    Thanks,

    Kevin

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

    Chromium crashing with kernel 4.9 is a known issue and should be fixed in a future chromium update. Read more about it (and a workaround for the issue) here in the official 4.9 kernel thread:

    https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=167934

     

    I did a quick test on the current Jessie release (with pixel desktop) and VLC played fine, chromium started with --no-sandbox was also able to play a youtube video.

     

    The main control for the lineout volume would be "HPOUT2 Digital". Make sure you don't set it to more than 50% or you'll get clipping (that control can also be used to boost very low volume signals). As an alternative you can change your ~/.asoundrc and use the softvol plugin to create a sofware "PCM" mixer control - but note that this'll affect only the PCM output from the RPi, not any other signals (like linein) that you mixed into the lineout signal:

    pcm.!default {
        type            softvol
        slave.pcm       "plughw:RPiCirrus"
        control.name    "PCM"
        control.card    RPiCirrus
    }

     

    I'm not sure about the issues you've seen with retropie/emulationstation. I'm using emulationstation on LibreELEC (from the gamestarter addon) and it worked fine out of the box (only had to disable onboard sound which was automatically enabled by the addon), didn't see any issues about non-existent mixers.

     

    so long,

     

    Hias

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

    The problem with retropie is that it cannot detect the platform, this is a general retropie issue with kernel 4.9: https://github.com/RetroPie/RetroPie-Setup/issues/1809

     

    As a workaround you could trying to add

    __platform="rpi3"

    (or whatever plaform you are running it on) to /home/pi/RetroPie-Setup/retropie_packages.sh or wait for retropie to resolve the issue.

     

    so long,

     

    Hias

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

    Yes, I know and fixed that some days ago. Thanks for the reply!

     

    I've been reading these days all kinds of wikies and forums about the audio layer of linux(alsa, sdl, omx, etc etc - and it seems that the things are not standardized at all). I think that now my issue lies in the way the application uses the sound card.

     

    Currently:

    -Kodi seems to be working fine

    -Pixel desktop...I don't know yet(maybe it is using OMX?), anyway currently I'm not really interested in using it. image

    -Retropie(emulationstation to be more precise) seems to output sound while "browsing" the settings but it stops when I enter in a "rom" but it seems not to be a problem of this driver but some configuration I have to do image [see later edit]

     

    Thanks for the big contribution and I'll get back if I manage to solve some of these problems!

     

    [later edit]

    I saw afterwards the first post. The error in emulationstation is gone now after doing what you suggested. although I think I will switch to your setup as I think I want more to have kodi as main and to launch emulationstation from kodi than the other way around.

     

    Thanks again!

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

    FYI: Yesterday I released a new LibreELEC build which also uses this new driver:

    https://forum.libreelec.tv/thread-3387.html

     

    As for Linux audio layers, actually it's quite simple:

     

    OMX is RPi specific and IIRC only used by Kodi and the standalone omxplayer application. I interfaces directly with the RPi GPU and can do video decoding and audio output.

     

    All other Linux applications either use ALSA directly or indirectly via some libraries (like SDL) or audio servers (like PulseAudio or Jack).

     

    Personally I'm not a big fan of these audio servers (Pulse has been a real PITA to configure and caused more problems than it solved for me) so unless you really need to use Pulse Audio (eg to connect a bluetooth headset or to be able to quickly switch between HDMI audio and integrated speakers on a laptop) better not install it and stick to pure ALSA. Raspbian ships with ALSA only and fortunately doesn't have Pulse enabled image

     

    so long,

     

    Hias

    • 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 © 2025 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.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube