s_frit

  • Content Count

    24
  • Joined

  • Last visited

Reputation Activity

  1. Like
    s_frit got a reaction from aaditya in No sound on nanopc t4   
    In case anyone else wants to look at T4 audio I thought I'd leave a few of my notes here, as I need to move on to other things for a while.
    The device tree audio widgets mention "MICBIAS1" but the rt5651 driver actually uses the lower case string "micbias1". This seems to be a bug in FriendlyElec's .dts (probably copied from some other realktek codec drivers which do use the uppercase spelling). Fixing this fixes an error message in the dmesg startup log. You can confirm this by looking for micbias in the rt5651 driver source code in the kernel tree. Armbian has a mechanism for shipping asound.state with the build. We should work out a canonical asound.state for the T4 and M4 boards and add it to Armbian build. However, I don't know if or how this interacts with pulseaudio. Maybe extra work is needed to get everything to play nice with pulse -- none the less, a working ALSA config would be a good start. I have yet to check this with an analog audio expert, but my reading of the T4 schematic is that the onboard Mic is connected to the codec in differential mode. However, by default the driver configures the codec in single-ended mode. The version of the driver in FriendlyElec's branch doesn't have the device tree binding to allow enabling differential mode for the Mic2 input (later versions of the driver for that codec do). TO TRY: add device tree binding to driver, add appropriate entry to device tree, see whether it improves onboard Mic audio quality. (should reduce noise/increase gain). NOTE: the DT binding docs for that codec which do have the binding for the differential mic input have an error in the docs. they misname the param and say something like diff-param=true; when it should just be differential-param; (not the real names). I'm still very new to Armbian and have no idea whether there are any common practices with regard to setting up audio on new boards. Guidance and feedback would be appreciated.
  2. Like
    s_frit got a reaction from PRIHLOP in No sound on nanopc t4   
    Here is a way to get the onboard audio working on NanoPC T4 (and probably M4 too). It kind-of works with pulseaudio, but I think more work is needed for a good solution for pulseaudio (need to develop a UCM profile). The attached asound.state file will configure the rt5651 codec mixer with sane settings. To use it:
    Download the attached asound.state.draft.201902018 Run the following command from a terminal (in whatever directory you downloaded the file): alsactl --file ./asound.state.draft.201902018 restore  
    After that you should have working headphone audio and microphone capture.
     
    WARNING: this command may make a loud audible thump. Do not wear the headphones when running it.
     
    Note that in the absence of a ucm profile, pulseaudio might make its own changes to the codec mixer settings at login, so you should run the above alsactl restore command *after* logging into the desktop. You can try using alsactl globally to save the settings for use after reboot, but personally I have not yet found a good solution -- please let me know if you have any thoughts on permanent save/restore and pulseaudio interop. There is some general discussion about asound.state management here.
     
    If you run alsamixer from the command line you can adjust output level using "DAC1" and "HP". Hit F4 for capture, then the gain settings that appear to work for the internal microphone are "ADC", "ADC Boost Gain" and "IN2 Boost".
     
    ...
     
    So far I developed this configuration with the help of the following resources:
     
    plbossart's configuration for baytrail boards using the same ALC5651 codec:
    https://github.com/plbossart/UCM
     
    ALC5651 codec data sheet v0.92
    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/6/ALC5651-DataSheet_5F00_V0.92.pdf
    (Audio routing diagrams are on pages 4 and 5. Page 4 is the analog routing, page 6 is the digital routing.)
     
    NanoPC-T4 Schematic
    http://wiki.friendlyarm.com/wiki/images/f/f4/NanoPC-T4-1802-Schematic.pdf
     
    NOTE: Beyond the codec mixer settings I think there are some things that can be tweaked with the device tree and drivers that may improve the microphone noise floor, but I haven't gone too far into that yet.
     
    If anyone is interested I'm happy to share my notes or discuss details of the routings I chose.
    asound.state.draft.201902018