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
  • 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 737 subscribers
  • Views 40889 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
  • phxang
    phxang over 8 years ago

    Can I boost DMIC sensitivity?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • phxang
    phxang over 8 years ago

    Can I boost DMIC sensitivity?

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

    Hi Andrey!

    Can I boost DMIC sensitivity?

    Yes. You can change "IN2L Digital Volume" and "IN2R Digital Volume". By default these are set to 116 which is -6dB. Setting these to 128 would be 0dB (each step is 0.5dB). You can also set them to more than 128 - just try different values and see what works best.

     

    BTW: The purpose of the "usecase" mixer scripts is to give you a quick start, usually you'll have to tweak the settings (boost/attenuate signals, add/remove filters, use different routing etc). Remembering which input/output corresponds to which mixer can be hard, therefore I created a bunch of helper functions and definitions in rpi-cirrus-functions.sh to simplify that. Feel free to change that to your needs, modify it or use it in your own scripts.

     

    For example, the "Record_from_DMIC.sh" script calls the "record_from_dmic" function in rpi-cirrus-functions.sh. It looks like that:

    # args: [ VOLUME [ DIGITAL_VOLUME ] ]
    record_from_dmic() {
            reset_dmic_in
            reset_filter
            reset_rpi_in
    
            # default input gain 0dB and digital gain -6dB
            setup_dmic_in "${1:-0}" "${2:-116}"
    
            # route input through high pass filter to remove DC
            setup_high_pass_filter $dmic_in_signals
            set_mixer $rpi_in_signals $filter_signals
    }

     

    You can pass 2 additional arguments to that function, volume (which should be 0 when using DMIC) and the digital volume (eg 128). If these are not set, the default values 0 and 116 will be used when calling setup_dmic_in.

     

    If you want you can also remove the high-pass filter, drop the "set_high_pass_filter" line and change the set_mixer call below to "set_mixer $rpi_in_signals $dmic_in_signals" - then DMIC won't be routed through the high-pass filter but sent directly to the RPi audio input.

     

    If you want to mix multiple (analog) inputs into your output signal have a look at what "Cirrus_listen.sh" does, eg in the case of listening to DMIC on line-out:

     

    First it configures the DMIC input, like the record function:

    setup_dmic_in 0 116

    Then it sets the lineout volume to the default (128 means 0dB)

    mixer "${line_out} Digital Volume" 128

    and routes the input signal (in this case "$dmic_in_signals) to the specified input of the line-out mixer (default is 2):

    set_mixer $line_out_signals $dmic_in_signals 32 2

     

    Each mixer block inside the WM5102 has 4 inputs, the "Playback" scripts/functions use the first one, the listen scripts by default the second one, so if you like you can add 2 more signals (eg line-in and headset-in) to the remaining 2 mixer inputs.

     

    The "32" in the set_mixer call specifies the volume of the input. 32 is 0dB. Change it to your needs, for example to boost dmic-in or attenuate line-in.

     

    so long,

     

    Hias

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

    Hi , i am looking  for a way to combine Linein and DMIC. This worked for me in the old use-case script files but I do not see a way to do this with the new use-case-ng scripts. Could you shine your light on this?

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

    Hi , i am looking for a way to combine Linein and DMIC. This worked for me in the old use-case script files but I do not see a way to do this with the new use-case-ng scripts. Could you shine your light on this?

    You can either to this with the helper functions in rpi-cirrus-functions.sh or manually via amixer commands (like before, just change the soundcard name).

     

    If you like to test with the helper functions you can simply source the helper file in your current shell and then also use the helper functions on the command line. For example

    pi@rpi3:~ $ . bin/rpi-cirrus-functions.sh
    pi@rpi3:~ $ record_from_linein
    pi@rpi3:~ $ setup_dmic_in 0 116
    pi@rpi3:~ $ set_mixer $filter_signals $dmic_in_signals 32 2

     

    This'll first configure for normal linein recording where the line input is sent through a high-pass filter.

     

    Then setup the dmic input: 0 is the analog gain (keep this at 0 for dmic), 116 is the digital gain, -6dB.

     

    In the third line the DMIC input is mixed together with the line input in the highpass filter. LineIn uses the default first input of the filter, dmic the second input - this is the 2 at the end. The 32 before that is the input gain at the filter which means 0dB.

     

    Another possibility would be to drop the filter and mix both signals together in the digital output mixer to the RPi:

    pi@rpi3:~ $ record_from_linein
    pi@rpi3:~ $ setup_dmic_in 0 116
    pi@rpi3:~ $ set_mixer $rpi_in_signals $line_in_signals 32 1
    pi@rpi3:~ $ set_mixer $rpi_in_signals $dmic_in_signals 32 2

     

    BTW: if you enter "set -x" you can see the actual mixer commands and helper functions being called.

     

    so long,

     

    Hias

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

    Hello Matthias,

    thx for your response, I am using the helper function file as you stated in your response with good results!

    i was also looking for the DMIC on/off switch but soon realized I could as well set DMIC to 0,0 when not using the microphone!

     

    thanks for your answer!

    • 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