WM8960-Audio-HAT icon indicating copy to clipboard operation
WM8960-Audio-HAT copied to clipboard

Build error on kernel: 5.15.30-v7+ (armv7l)

Open theNorNi opened this issue 3 years ago • 42 comments

New kernel version for Raspberry OS Bullseye raspberrypi-kernel (1:1.20220328-1). raspberrypi-kernel-headers (1:1.20220328-1).

Build fails with error message: "Error! Bad return status for module build on kernel: 5.15.30-v7+ (armv7l)" make.log

theNorNi avatar Apr 01 '22 21:04 theNorNi

Same here at waveshares 13.1 Magic Mirror with Raspberry OS Bullseye.

bnwlf avatar Apr 02 '22 21:04 bnwlf

I've started to fix the problem: (see also https://github.com/torvalds/linux/blob/master/sound/soc/generic/simple-card.c)

Compilation is now working in my fork: diff: https://github.com/dr-ni/WM8960-Audio-HAT/commit/ae4522f44125754783ce12043bc0f3ffab075441

However, still some remainining problems:

pi@pizero2:~/WM8960-Audio-HAT $ sudo  ./install.sh 
OK:1 http://raspbian.raspberrypi.org/raspbian bullseye InRelease
OK:2 http://archive.raspberrypi.org/debian bullseye InRelease
Paketlisten werden gelesen… Fertig
Abhängigkeitsbaum wird aufgebaut… Fertig
Statusinformationen werden eingelesen… Fertig
Alle Pakete sind aktuell.
Paketlisten werden gelesen… Fertig
Abhängigkeitsbaum wird aufgebaut… Fertig
Statusinformationen werden eingelesen… Fertig
raspberrypi-kernel ist schon die neueste Version (1:1.20220331-1).
raspberrypi-kernel-headers ist schon die neueste Version (1:1.20220331-1).
0 aktualisiert, 0 neu installiert, 0 zu entfernen und 0 nicht aktualisiert.
Paketlisten werden gelesen… Fertig
Abhängigkeitsbaum wird aufgebaut… Fertig
Statusinformationen werden eingelesen… Fertig
dkms ist schon die neueste Version (2.8.4-3).
git ist schon die neueste Version (1:2.30.2-1).
i2c-tools ist schon die neueste Version (4.2-1+b1).
libasound2-plugins ist schon die neueste Version (1.2.2-2).
0 aktualisiert, 0 neu installiert, 0 zu entfernen und 0 nicht aktualisiert.
Error! The module/version combo: wm8960-soundcard-1.0
is not located in the DKMS tree.

Creating symlink /var/lib/dkms/wm8960-soundcard/1.0/source ->
                 /usr/src/wm8960-soundcard-1.0

DKMS: add completed.

Kernel preparation unnecessary for this kernel.  Skipping...

Building module:
cleaning build area...
make -j2 KERNELRELEASE=5.15.32-v7+ -C /lib/modules/5.15.32-v7+/build M=/var/lib/dkms/wm8960-soundcard/1.0/build......
cleaning build area...

DKMS: build completed.

snd-soc-wm8960.ko:
Running module version sanity check.
 - Original module
   - Found /lib/modules/5.15.32-v7+/kernel/sound/soc/codecs/snd-soc-wm8960.ko
   - Storing in /var/lib/dkms/wm8960-soundcard/original_module/5.15.32-v7+/armv7l/
   - Archiving for uninstallation purposes
 - Installation
   - Installing to /lib/modules/5.15.32-v7+/kernel/sound/soc/codecs/

snd-soc-wm8960-soundcard.ko:
Running module version sanity check.
 - Original module
   - Found /lib/modules/5.15.32-v7+/kernel/sound/soc/bcm/snd-soc-wm8960-soundcard.ko
   - Storing in /var/lib/dkms/wm8960-soundcard/original_module/5.15.32-v7+/armv7l/
   - Archiving for uninstallation purposes
 - Installation
   - Installing to /lib/modules/5.15.32-v7+/kernel/sound/soc/bcm/

depmod......

DKMS: install completed.
mkdir: das Verzeichnis „/etc/wm8960-soundcard“ kann nicht angelegt werden: Die Datei existiert bereits
Job for wm8960-soundcard.service failed because the control process exited with error code.
See "systemctl status wm8960-soundcard.service" and "journalctl -xe" for details.
------------------------------------------------------
Please reboot your raspberry pi to apply all settings
Enjoy!
------------------------------------------------------


pi@pizero2:~/WM8960-Audio-HAT $ systemctl status wm8960-soundcard.service
 wm8960-soundcard.service - WM8960 soundcard service
     Loaded: loaded (/lib/systemd/system/wm8960-soundcard.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Wed 2022-04-06 16:30:29 BST; 7min ago
    Process: 4430 ExecStart=/usr/bin/wm8960-soundcard (code=exited, status=1/FAILURE)
   Main PID: 4430 (code=exited, status=1/FAILURE)
        CPU: 370ms

Apr 06 16:30:27 pilot systemd[1]: Starting WM8960 soundcard service...
Apr 06 16:30:27 pilot wm8960-soundcard[4430]: + exec
Apr 06 16:30:27 pilot wm8960-soundcard[4431]: ++ basename /usr/bin/wm8960-soundcard
Apr 06 16:30:29 pilot systemd[1]: wm8960-soundcard.service: Main process exited, code=exited, status=1/FAILURE
Apr 06 16:30:29 pilot systemd[1]: wm8960-soundcard.service: Failed with result 'exit-code'.
Apr 06 16:30:29 pilot systemd[1]: Failed to start WM8960 soundcard service.

pi@pizero2:~/WM8960-Audio-HAT $ sudo dmesg
[   14.806454] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /soc/i2c@7e804000/status
[   15.580666] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /soc/i2s@7e203000/status
[   15.581812] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /soc/i2c@7e804000/status
[   15.581973] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /soc/sound/compatible
[   15.581994] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /soc/sound/simple-audio-card,format
[   15.582014] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /soc/sound/simple-audio-card,name
[   15.582047] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /soc/sound/status
[   15.582066] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /soc/sound/simple-audio-card,widgets
[   15.582086] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /soc/sound/simple-audio-card,routing
[   15.631265] Error: Driver 'asoc-simple-card' is already registered, aborting...
[   15.987844] OF: overlay: WARNING: memory leak will occur if overlay removed, property: /soc/i2s@7e203000/status
[   16.064596] wm8960 1-001a: failed to configure clock
[   16.064622] wm8960 1-001a: ASoC: error at snd_soc_component_set_bias_level on wm8960.1-001a: -22
[   16.064637] wm8960 1-001a: ASoC: Failed to prepare bias: -22
[   16.065631] wm8960 1-001a: failed to configure clock
[   16.065642] wm8960 1-001a: ASoC: error at snd_soc_dai_hw_params on wm8960-hifi: -22
[   16.065656] asoc-simple-card soc:sound: ASoC: PRE_PMU: wm8960-hifi-wm8960-hifi-playback event failed: -22
[   16.065996] wm8960 1-001a: failed to configure clock
[   16.066006] wm8960 1-001a: ASoC: error at snd_soc_dai_hw_params on wm8960-hifi: -22
[   16.066018] asoc-simple-card soc:sound: ASoC: PRE_PMU: wm8960-hifi-wm8960-hifi-capture event failed: -22
[   16.068719] wm8960 1-001a: failed to configure clock
[   16.068730] wm8960 1-001a: ASoC: error at snd_soc_component_set_bias_level on wm8960.1-001a: -22

dr-ni avatar Apr 06 '22 15:04 dr-ni

update:

forgot to update wm8960.c and wm8960.h diff: https://github.com/dr-ni/WM8960-Audio-HAT/commit/5f3edc13a3ab591ed2af40a6c0b3b286e312cb8e so now dmesg is looking better but still some problems:

pi@pizero2:~/WM8960-Audio-HAT $ arecord test.wav 
ALSA lib pcm_dsnoop.c:638:(snd_pcm_dsnoop_open) unable to open slave
arecord: main:830: Fehler beim Öffnen des Gerätes: Datei oder Verzeichnis nicht gefunden
pi@pizero2:~/WM8960-Audio-HAT $ speaker-test -t wav 

speaker-test 1.2.4

Wiedergabe-Gerät ist default
Stream-Parameter sind 48000 Hz, S16_LE, 1 Kanäle
WAV-Datei(en)
ALSA lib pcm_dmix.c:1075:(snd_pcm_dmix_open) unable to open slave
Fehler beim Öffnen des Gerätes: -2, Datei oder Verzeichnis nicht gefunden

dr-ni avatar Apr 06 '22 19:04 dr-ni

update: https://github.com/dr-ni/WM8960-Audio-HAT/commit/4ec150d5a0042727143e3b910b99dd56a3a8011b

I have now some noisy sound on raspberrypi zero 2. Can anybody test this also on other models and report?

https://github.com/dr-ni/WM8960-Audio-HAT

dr-ni avatar Apr 07 '22 12:04 dr-ni

Yes thank you - tested on Pi4B waveshare Pi WM8960 Hat- git pull from your own fork - scratchy sound with VLC - but it is getting there!

TobiasVanDyk avatar Apr 07 '22 14:04 TobiasVanDyk

and recording? is it working?

dr-ni avatar Apr 07 '22 14:04 dr-ni

yes tested with arecord -v test.wav is working

TobiasVanDyk avatar Apr 07 '22 14:04 TobiasVanDyk

speaker-test -t wav

gives me a clear "Front-Left" with no scratchy noises

TobiasVanDyk avatar Apr 07 '22 14:04 TobiasVanDyk

and speaker-test -t wav -c 2

is the recording stereo and scratching?

dr-ni avatar Apr 07 '22 14:04 dr-ni

speaker-test -t wav -c 2 Front-Right no scrathes very clear hifi

recording mike is inside a box on the hat but is sounds clear no scratches

TobiasVanDyk avatar Apr 07 '22 14:04 TobiasVanDyk

speaker-test -t wav -c 2 Front-Right no scratches very clear hifi

recording mike is inside a box on the hat but is sounds clear no scratches

TobiasVanDyk avatar Apr 07 '22 14:04 TobiasVanDyk

is it stereo?

dr-ni avatar Apr 07 '22 14:04 dr-ni

speaker test -t wav -c 2 reports it as 2 channels arecord is mono

TobiasVanDyk avatar Apr 07 '22 14:04 TobiasVanDyk

and arecord -f S32_LE -r 48000 -c 2 test.wav

dr-ni avatar Apr 07 '22 14:04 dr-ni

Stereo

TobiasVanDyk avatar Apr 07 '22 14:04 TobiasVanDyk

can you please test again:

git pull git checkout master sudo ./install.sh sudo reboot

dr-ni avatar Apr 07 '22 15:04 dr-ni

Hi still crackling playback with vlc mp3 Goimg to do clean uninstall - install

TobiasVanDyk avatar Apr 07 '22 15:04 TobiasVanDyk

Plays nicely with the wav files in /usr/share/sounds - no scratches

But 16bit 44.1kHz wav file still scratchy sounds

TobiasVanDyk avatar Apr 07 '22 16:04 TobiasVanDyk

what does aplay -l and aplay -L show?

dr-ni avatar Apr 07 '22 19:04 dr-ni

pi@raspberrypi:~ $ aplay -l **** List of PLAYBACK Hardware Devices **** card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones] Subdevices: 8/8 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2 Subdevice #3: subdevice #3 Subdevice #4: subdevice #4 Subdevice #5: subdevice #5 Subdevice #6: subdevice #6 Subdevice #7: subdevice #7 card 1: wm8960soundcard [wm8960-soundcard], device 0: bcm2835-i2s-wm8960-hifi wm8960-hifi-0 [bcm2835-i2s-wm8960-hifi wm8960-hifi-0] Subdevices: 1/1 Subdevice #0: subdevice #0 card 2: vc4hdmi0 [vc4-hdmi-0], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0] Subdevices: 1/1 Subdevice #0: subdevice #0 card 3: vc4hdmi1 [vc4-hdmi-1], device 0: MAI PCM i2s-hifi-0 [MAI PCM i2s-hifi-0] Subdevices: 1/1 Subdevice #0: subdevice #0 pi@raspberrypi:~ $ aplay -L null Discard all samples (playback) or generate zero samples (capture) lavrate Rate Converter Plugin Using Libav/FFmpeg Library samplerate Rate Converter Plugin Using Samplerate Library speexrate Rate Converter Plugin Using Speex Resampler jack JACK Audio Connection Kit oss Open Sound System pulse PulseAudio Sound Server upmix Plugin for channel upmix (4,6,8) vdownmix Plugin for channel downmix (stereo) with a simple spacialization default Playback/recording through the PulseAudio sound server playback capture dmixed array hw:CARD=Headphones,DEV=0 bcm2835 Headphones, bcm2835 Headphones Direct hardware device without any conversions plughw:CARD=Headphones,DEV=0 bcm2835 Headphones, bcm2835 Headphones Hardware device with all software conversions sysdefault:CARD=Headphones bcm2835 Headphones, bcm2835 Headphones Default Audio Device dmix:CARD=Headphones,DEV=0 bcm2835 Headphones, bcm2835 Headphones Direct sample mixing device usbstream:CARD=Headphones bcm2835 Headphones USB Stream Output hw:CARD=wm8960soundcard,DEV=0 wm8960-soundcard, bcm2835-i2s-wm8960-hifi wm8960-hifi-0 Direct hardware device without any conversions plughw:CARD=wm8960soundcard,DEV=0 wm8960-soundcard, bcm2835-i2s-wm8960-hifi wm8960-hifi-0 Hardware device with all software conversions sysdefault:CARD=wm8960soundcard wm8960-soundcard, bcm2835-i2s-wm8960-hifi wm8960-hifi-0 Default Audio Device dmix:CARD=wm8960soundcard,DEV=0 wm8960-soundcard, bcm2835-i2s-wm8960-hifi wm8960-hifi-0 Direct sample mixing device usbstream:CARD=wm8960soundcard wm8960-soundcard USB Stream Output hw:CARD=vc4hdmi0,DEV=0 vc4-hdmi-0, MAI PCM i2s-hifi-0 Direct hardware device without any conversions plughw:CARD=vc4hdmi0,DEV=0 vc4-hdmi-0, MAI PCM i2s-hifi-0 Hardware device with all software conversions sysdefault:CARD=vc4hdmi0 vc4-hdmi-0, MAI PCM i2s-hifi-0 Default Audio Device hdmi:CARD=vc4hdmi0,DEV=0 vc4-hdmi-0, MAI PCM i2s-hifi-0 HDMI Audio Output dmix:CARD=vc4hdmi0,DEV=0 vc4-hdmi-0, MAI PCM i2s-hifi-0 Direct sample mixing device usbstream:CARD=vc4hdmi0 vc4-hdmi-0 USB Stream Output hw:CARD=vc4hdmi1,DEV=0 vc4-hdmi-1, MAI PCM i2s-hifi-0 Direct hardware device without any conversions plughw:CARD=vc4hdmi1,DEV=0 vc4-hdmi-1, MAI PCM i2s-hifi-0 Hardware device with all software conversions sysdefault:CARD=vc4hdmi1 vc4-hdmi-1, MAI PCM i2s-hifi-0 Default Audio Device hdmi:CARD=vc4hdmi1,DEV=0 vc4-hdmi-1, MAI PCM i2s-hifi-0 HDMI Audio Output dmix:CARD=vc4hdmi1,DEV=0 vc4-hdmi-1, MAI PCM i2s-hifi-0 Direct sample mixing device usbstream:CARD=vc4hdmi1 vc4-hdmi-1 USB Stream Output pi@raspberrypi:~ $

TobiasVanDyk avatar Apr 07 '22 19:04 TobiasVanDyk

when using audacious getting much better quality sound - have to adjust the two volume (audacious and main) controls - still some background crackle but much less

Getting no crackle sound in Audacious when using Alsa with direct HW WM8960 setting - solved?

Yes using the same setting with VLC (ALSA and Direct HW WM8960) gives good sound - SOLVED by your code!!

TobiasVanDyk avatar Apr 07 '22 20:04 TobiasVanDyk

Hi folks, I hadn't the time to check the new fixes. Since my post i found this repo: https://github.com/HinTak/seeed-voicecard. It works at least somehow. (But I will try it in the next days. Thanks for that!)

The wm8960-soundcard.service is there also failing (status 99). Do you know the sense of this service since the driver?

bnwlf avatar Apr 07 '22 20:04 bnwlf

@TobiasVanDyk is aplay -D dmixed pcm16LE44100.wav playing clean?

dr-ni avatar Apr 07 '22 21:04 dr-ni

@bnwlf sorry I'm not familar with this

dr-ni avatar Apr 07 '22 21:04 dr-ni

@dr-ni

Yes it plays clean no noise - I used another 16bit/44.1kHz file: (no dmix plugin so it plays little bit too fast 48/44.1 x normal rate)

pi@raspberrypi:~ $ aplay -D dmixed pcm16LE44100.wav pcm16LE44100.wav: No such file or directory pi@raspberrypi:~ $ aplay -D dmixed 1.wav Playing WAVE '1.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo Warning: rate is not accurate (requested = 44100Hz, got = 48000Hz) please, try the plug plugin (-Dplug:dmixed)

VLC now plays cleanly using ALSA + wm8960-soundcard-direct-mixer setting in VLC preferences->Audio-settings Using pulseaudio still has the noisy distortion

To install first uninstall the old waveshare driver and reboot then delete the old WM8960-Audio-HAT folder Then: git clone https://github.com/dr-ni/WM8960-Audio-HAT cd WM8960-Audio-HAT sudo ./install.sh sudo reboot

Ignore the message "failed to load i2s-mmap" - it does load from config.txt and it is required Change VLC audio preferences to use ALSA and the mixer to wm8960 direct mixer

TobiasVanDyk avatar Apr 08 '22 06:04 TobiasVanDyk

I have actually no clue about that noise is it only with pulseaudio?

you have to play like this: aplay -D plug:dmixed audio.wav

dr-ni avatar Apr 08 '22 11:04 dr-ni

I assumed it is the same noise you experienced here?

dr-ni commented 23 hours ago update: https://github.com/dr-ni/WM8960-Audio-HAT/commit/4ec150d5a0042727143e3b910b99dd56a3a8011b I have now some noisy sound on raspberrypi zero 2. Can anybody test this also on other models and report? https://github.com/dr-ni/WM8960-Audio-HAT

TobiasVanDyk avatar Apr 08 '22 11:04 TobiasVanDyk

I have now no noise with dmixed so maybe only a resampling problem. I don't have pulseaudio and no X

dr-ni avatar Apr 08 '22 11:04 dr-ni

Yes I am happy - it now plays nicely I am hoping for others to comment on their experience?

The noise seems to be a distorted audio sub-level with clear audio super-imposed on the noise

TobiasVanDyk avatar Apr 08 '22 12:04 TobiasVanDyk

yes, would be interesting how it is working on other systems

https://github.com/dr-ni/WM8960-Audio-HAT

dr-ni avatar Apr 08 '22 15:04 dr-ni