DietPi icon indicating copy to clipboard operation
DietPi copied to clipboard

PINE A64 | No sound with mainline kernel

Open Sciamano72 opened this issue 4 years ago • 69 comments

Creating a bug report/issue

Required Information

  • DietPi version | G_DIETPI_VERSION_CORE=7 G_DIETPI_VERSION_SUB=6 G_DIETPI_VERSION_RC=2 G_GITBRANCH='master' G_GITOWNER='MichaIng' G_LIVE_PATCH_STATUS[0]='not applicable' G_LIVE_PATCH_STATUS[1]='applied' G_LIVE_PATCH_STATUS[2]='applied' G_LIVE_PATCH_STATUS[3]='applied' G_LIVE_PATCH_STATUS[4]='not applicable'

  • Distro version | buster

  • Kernel version | Linux DietPineA64 5.10.60-sunxi64 #21.08.1 SMP Wed Aug 25 18:29:57 UTC 2021 aarch64 GNU/Linux

  • SBC model | PINE A64 (aarch64)

  • Power supply used | 5V 2A UGreen

  • SDcard used | SanDisk ultra 32Gb

Additional Information (if applicable)

  • Software title | squeezelite
  • Freshly installed
  • Can this issue be replicated on a fresh installation of DietPi? Yes
  • Bug report ID | echo $G_HW_UUID

Steps to reproduce

  1. Enable Audio Card (no matter which one) in dietpi-config
  2. Install squeezeboxserver + squeezelite
  3. command 'squeezelite -l' which shows available cards will respond "null - Discard all samples (playback) or generate zero samples (capture)"
  4. playing any audio file from squeezeboxserver (or locally, does not matter) does not result in any hearable output

Expected behaviour

  • command 'squeezelite -l' should list available sound cards
  • audio should be heard from the output

Sciamano72 avatar Oct 06 '21 15:10 Sciamano72

Many thanks for your report. Is the sound card listed by ALSA?

aplay -l

MichaIng avatar Oct 06 '21 15:10 MichaIng

Nope:

aplay: device_list:272: no soundcards found...

Sciamano72 avatar Oct 06 '21 16:10 Sciamano72

So there is simply no sound device found. I checked the current A64 kernel and device tree overlays and there is at least no overlay to enable onboard sound, means that it "should" be enabled by default.

I checked the Armbian forum but couldn't find something related so far: https://forum.armbian.com/forum/27-allwinner-a64-h5-h6-and-h616/

Does the kernel report any errors that may be related?

dmesg -l emerg,alert,crit,err
dmesg | grep -E 'audio|sound|snd'

MichaIng avatar Oct 07 '21 12:10 MichaIng

These are the errors I found (there are many others but they are CIFS-related):

root@DietPineA64:~# dmesg -l emerg,alert,crit,err
[    2.083430] sun8i-dw-hdmi 1ee0000.hdmi: Couldn't get regulator
[    2.083874] sun4i-drm display-engine: Couldn't bind all pipelines components
[    2.120296] phy id_det change to host
[    2.329316] phy id_det change to host

and

root@DietPineA64:~# dmesg | grep -E 'audio|sound|snd'
[    2.549955]   No soundcards found.
[    5.693445] input: sun50i-a64-audio Headset Jack as /devices/platform/sound/sound/card0/input1
[21091.840486] usbcore: registered new interface driver snd-usb-audio

Sciamano72 avatar Oct 07 '21 16:10 Sciamano72

Was this on a fresh DietPi system or did it work before?

MichaIng avatar Oct 08 '21 14:10 MichaIng

Sorry, did not receive the notification for your reply. It's a fresh DietPi system.

Sciamano72 avatar Oct 12 '21 12:10 Sciamano72

You tried a reboot, didn't you?

To me it looks like a related kernel module isn't loaded. Does this one load?

modprobe sunxi_codec

or this one:

modprobe snd-soc-simple-card

Interesting is that input: sun50i-a64-audio Headset Jack was detected, but only the input device, no output device.

MichaIng avatar Oct 12 '21 13:10 MichaIng

Yes, I've rebooted many times already.

root@DietPineA64:~# modprobe sunxi_codec
modprobe: FATAL: Module sunxi_codec not found in directory /lib/modules/5.10.60-sunxi64

root@DietPineA64: # modprobe snd-soc-simple-card
root@DietPineA64:~#

(No output on the last one)

Sciamano72 avatar Oct 12 '21 13:10 Sciamano72

Ok, I don't know what I did, but now the soundcards show up (but still no sound):

root@DietPineA64:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: sun50ia64audio [sun50i-a64-audio], device 0: 1c22c00.dai-sun8i-codec-aif1 sun8i-codec-aif1-0 [1c22c00.dai-sun8i-codec-aif1 sun8i-codec-aif1-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: sun50ia64hdmi [sun50i-a64-hdmi], device 0: 1c22800.i2s-i2s-hifi i2s-hifi-0 [1c22800.i2s-i2s-hifi i2s-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

root@DietPineA64:~# squeezelite -l
Output devices:
  null                           - Discard all samples (playback) or generate zero samples (capture)
  sysdefault:CARD=sun50ia64audio - sun50i-a64-audio, 1c22c00.dai-sun8i-codec-aif1 sun8i-codec-aif1-0 - Default Audio Device
  dmix:CARD=sun50ia64audio,DEV=0 - sun50i-a64-audio, 1c22c00.dai-sun8i-codec-aif1 sun8i-codec-aif1-0 - Direct sample mixing device
  dsnoop:CARD=sun50ia64audio,DEV=0 - sun50i-a64-audio, 1c22c00.dai-sun8i-codec-aif1 sun8i-codec-aif1-0 - Direct sample snooping device
  hw:CARD=sun50ia64audio,DEV=0   - sun50i-a64-audio, 1c22c00.dai-sun8i-codec-aif1 sun8i-codec-aif1-0 - Direct hardware device without any conversions
  plughw:CARD=sun50ia64audio,DEV=0 - sun50i-a64-audio, 1c22c00.dai-sun8i-codec-aif1 sun8i-codec-aif1-0 - Hardware device with all software conversions
  sysdefault:CARD=sun50ia64hdmi  - sun50i-a64-hdmi, 1c22800.i2s-i2s-hifi i2s-hifi-0 - Default Audio Device
  dmix:CARD=sun50ia64hdmi,DEV=0  - sun50i-a64-hdmi, 1c22800.i2s-i2s-hifi i2s-hifi-0 - Direct sample mixing device
  dsnoop:CARD=sun50ia64hdmi,DEV=0 - sun50i-a64-hdmi, 1c22800.i2s-i2s-hifi i2s-hifi-0 - Direct sample snooping device
  hw:CARD=sun50ia64hdmi,DEV=0    - sun50i-a64-hdmi, 1c22800.i2s-i2s-hifi i2s-hifi-0 - Direct hardware device without any conversions
  plughw:CARD=sun50ia64hdmi,DEV=0 - sun50i-a64-hdmi, 1c22800.i2s-i2s-hifi i2s-hifi-0 - Hardware device with all software conversions

I have also tried editing the squeezelite service to specify the output card ("-o hw:CARD=sun50ia64audio,DEV=0") but still can't hear any sounds :(

Sciamano72 avatar Oct 12 '21 14:10 Sciamano72

Good so far. Can you please try to re-select the right card via dietpi-config now? I guess sun50i-a64-audio is the 3.5mm jack while sun50i-a64-hdmi is HDMI audio. If there is still no sound, check if you find some muted volume toggles in alsamixer.

MichaIng avatar Oct 13 '21 10:10 MichaIng

I've re-selected sun50i-a64-audio in dietpi-config and checked in alsamixer that nothing is muted. Still no sound from the 3.5mm jack. I've also tried selecting the HDMI option, but then I couldn't find any way to verify whether sound worked or not as I can't plug the A64 to any HDMI-equipped device :-D

Sciamano72 avatar Oct 13 '21 16:10 Sciamano72

Can you show the available controls with values:

amixer -c 0 scontents

MichaIng avatar Oct 13 '21 16:10 MichaIng

Sure:

Logfile attached. Click to expand!
root@DietPineA64:~# amixer -c 0 scontents
Simple mixer control 'Headphone',0
  Capabilities: pvolume pvolume-joined pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 63
  Mono:
  Front Left: Playback 43 [68%] [-20.00dB] [on]
  Front Right: Playback 43 [68%] [-20.00dB] [on]
Simple mixer control 'Headphone Source',0
  Capabilities: penum
  Items: 'DAC' 'Mixer'
  Item0: 'Mixer'
  Item1: 'Mixer'
Simple mixer control 'Line In',0
  Capabilities: pvolume pvolume-joined pswitch cswitch
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: Playback 0 - 7
  Front Left: Playback 4 [57%] [1.50dB] [on] Capture [off]
  Front Right: Playback 4 [57%] [1.50dB] [on] Capture [off]
Simple mixer control 'Line Out',0
  Capabilities: pvolume pvolume-joined pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Mono:
  Front Left: Playback 17 [55%] [-21.00dB] [on]
  Front Right: Playback 17 [55%] [-21.00dB] [on]
Simple mixer control 'Line Out Source',0
  Capabilities: penum
  Items: 'Stereo' 'Mono Differential'
  Item0: 'Stereo'
  Item1: 'Stereo'
Simple mixer control 'Mic1',0
  Capabilities: pvolume pvolume-joined pswitch cswitch
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: Playback 0 - 7
  Front Left: Playback 4 [57%] [1.50dB] [on] Capture [off]
  Front Right: Playback 4 [57%] [1.50dB] [on] Capture [off]
Simple mixer control 'Mic1 Boost',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 7
  Mono: 3 [43%] [30.00dB]
Simple mixer control 'Mic2',0
  Capabilities: pvolume pvolume-joined pswitch cswitch
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: Playback 0 - 7
  Front Left: Playback 3 [43%] [0.00dB] [on] Capture [off]
  Front Right: Playback 3 [43%] [0.00dB] [on] Capture [off]
Simple mixer control 'Mic2 Boost',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 7
  Mono: 4 [57%] [33.00dB]
Simple mixer control 'Mixer',0
  Capabilities: cswitch
  Capture channels: Front Left - Front Right
  Front Left: Capture [off]
  Front Right: Capture [off]
Simple mixer control 'Mixer Reversed',0
  Capabilities: cswitch
  Capture channels: Front Left - Front Right
  Front Left: Capture [off]
  Front Right: Capture [off]
Simple mixer control 'ADC',0
  Capabilities: cvolume
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 192
  Front Left: Capture 0 [0%] [-99999.99dB]
  Front Right: Capture 0 [0%] [-99999.99dB]
Simple mixer control 'ADC Digital DAC',0
  Capabilities: pswitch
  Playback channels: Front Left - Front Right
  Mono:
  Front Left: Playback [off]
  Front Right: Playback [off]
Simple mixer control 'ADC Gain',0
  Capabilities: cvolume cvolume-joined
  Capture channels: Mono
  Limits: Capture 0 - 7
  Mono: Capture 3 [43%] [0.00dB]
Simple mixer control 'AIF1 AD0',0
  Capabilities: cvolume
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 192
  Front Left: Capture 0 [0%] [-99999.99dB]
  Front Right: Capture 0 [0%] [-99999.99dB]
Simple mixer control 'AIF1 AD0 Stereo',0
  Capabilities: cenum
  Items: 'Stereo' 'Reverse Stereo' 'Sum Mono' 'Mix Mono'
  Item0: 'Stereo'
  Item1: 'Stereo'
Simple mixer control 'AIF1 DA0',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 192
  Mono:
  Front Left: Playback 0 [0%] [-99999.99dB]
  Front Right: Playback 0 [0%] [-99999.99dB]
Simple mixer control 'AIF1 DA0 Stereo',0
  Capabilities: penum
  Items: 'Stereo' 'Reverse Stereo' 'Sum Mono' 'Mix Mono'
  Item0: 'Stereo'
  Item1: 'Stereo'
Simple mixer control 'AIF1 Data Digital ADC',0
  Capabilities: cswitch
  Capture channels: Front Left - Front Right
  Front Left: Capture [off]
  Front Right: Capture [off]
Simple mixer control 'AIF1 Slot 0 Digital ADC',0
  Capabilities: cswitch
  Capture channels: Front Left - Front Right
  Front Left: Capture [off]
  Front Right: Capture [off]
Simple mixer control 'AIF1 Slot 0 Digital DAC',0
  Capabilities: pswitch
  Playback channels: Front Left - Front Right
  Mono:
  Front Left: Playback [off]
  Front Right: Playback [off]
Simple mixer control 'AIF2 ADC',0
  Capabilities: cvolume
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 192
  Front Left: Capture 0 [0%] [-99999.99dB]
  Front Right: Capture 0 [0%] [-99999.99dB]
Simple mixer control 'AIF2 ADC Mixer ADC',0
  Capabilities: cswitch
  Capture channels: Front Left - Front Right
  Front Left: Capture [off]
  Front Right: Capture [off]
Simple mixer control 'AIF2 ADC Mixer AIF1 DA0',0
  Capabilities: cswitch
  Capture channels: Front Left - Front Right
  Front Left: Capture [off]
  Front Right: Capture [off]
Simple mixer control 'AIF2 ADC Mixer AIF2 DAC Rev',0
  Capabilities: cswitch
  Capture channels: Front Left - Front Right
  Front Left: Capture [off]
  Front Right: Capture [off]
Simple mixer control 'AIF2 ADC Stereo',0
  Capabilities: cenum
  Items: 'Stereo' 'Reverse Stereo' 'Sum Mono' 'Mix Mono'
  Item0: 'Stereo'
  Item1: 'Stereo'
Simple mixer control 'AIF2 DAC',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 192
  Mono:
  Front Left: Playback 0 [0%] [-99999.99dB]
  Front Right: Playback 0 [0%] [-99999.99dB]
Simple mixer control 'AIF2 DAC Source',0
  Capabilities: penum
  Items: 'AIF2' 'AIF3+2' 'AIF2+3'
  Item0: 'AIF2'
Simple mixer control 'AIF2 DAC Stereo',0
  Capabilities: penum
  Items: 'Stereo' 'Reverse Stereo' 'Sum Mono' 'Mix Mono'
  Item0: 'Stereo'
  Item1: 'Stereo'
Simple mixer control 'AIF2 Digital ADC',0
  Capabilities: cswitch
  Capture channels: Front Left - Front Right
  Front Left: Capture [off]
  Front Right: Capture [off]
Simple mixer control 'AIF2 Digital DAC',0
  Capabilities: pswitch
  Playback channels: Front Left - Front Right
  Mono:
  Front Left: Playback [off]
  Front Right: Playback [off]
Simple mixer control 'AIF2 Inv Digital ADC',0
  Capabilities: cswitch
  Capture channels: Front Left - Front Right
  Front Left: Capture [off]
  Front Right: Capture [off]
Simple mixer control 'AIF3 ADC Source',0
  Capabilities: cenum
  Items: 'None' 'AIF2 ADCL' 'AIF2 ADCR'
  Item0: 'None'
Simple mixer control 'DAC',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 192
  Mono:
  Front Left: Playback 133 [69%] [-20.25dB] [on]
  Front Right: Playback 133 [69%] [-20.25dB] [on]
Simple mixer control 'DAC Reversed',0
  Capabilities: pswitch
  Playback channels: Front Left - Front Right
  Mono:
  Front Left: Playback [off]
  Front Right: Playback [off]
Simple mixer control 'Earpiece',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback 0 - 31
  Mono: Playback 0 [0%] [-99999.99dB] [off]
Simple mixer control 'Earpiece Source',0
  Capabilities: penum
  Items: 'DACR' 'DACL' 'Right Mixer' 'Left Mixer'
  Item0: 'DACR'

Sciamano72 avatar Oct 13 '21 17:10 Sciamano72

Okay, I also cannot see something that is missing or muted. Try to move all sliders to max in alsamixer.

Some controls are muted, especially try to raise those, although it doesn't look like it were related to regular 3.5mm output, mostly ADC/DAC devices:

Simple mixer control 'ADC Digital DAC',0
  Capabilities: pswitch
  Playback channels: Front Left - Front Right
  Mono:
  Front Left: Playback [off]
  Front Right: Playback [off]
...
Simple mixer control 'Earpiece',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback 0 - 31
  Mono: Playback 0 [0%] [-99999.99dB] [off]

MichaIng avatar Oct 16 '21 18:10 MichaIng

I've followed your advice and unmuted everything, then raised everything to 100%. Rebooted. Still no sounds. :(

Sciamano72 avatar Oct 19 '21 13:10 Sciamano72

Let me create a Bullseye image, probably the userland updates solve it, so we don't waste time in debugging an old Debian version.

MichaIng avatar Oct 19 '21 13:10 MichaIng

Should I try to update my installation to Bullseye?

Sciamano72 avatar Oct 19 '21 13:10 Sciamano72

Good idea, as my server is in the middle of builds already: https://dietpi.com/blog/?p=811#2.2-manual-upgrade

MichaIng avatar Oct 19 '21 13:10 MichaIng

Ok, I don't have the time to do that now either but will try ASAP. Thank you

Sciamano72 avatar Oct 19 '21 13:10 Sciamano72

Okay, a new image will be ready then as well, so you have the choice.

MichaIng avatar Oct 19 '21 13:10 MichaIng

Perfect, I can even try both solutions, so we can see what works and what does not.

Sciamano72 avatar Oct 19 '21 13:10 Sciamano72

Image ready: https://dietpi.com/downloads/images/

MichaIng avatar Oct 19 '21 21:10 MichaIng

Trying the new image:

root@DietPi:~# aplay - l
^CAborted by signal Interrupt...
aplay: read_header:2839: read error

this command hangs.

And after installing LMS+Squeezelite, still no audio output :-(

But if I launch a song on Squeezelite, this happens:

root@DietPi:~# aplay - l
aplay: main:830: audio open error: Device or resource busy

I'm starting to suspect my line-out output is defective...

Sciamano72 avatar Oct 21 '21 13:10 Sciamano72

As long as ALSA (aplay) does not find any device, audio software cannot work with it either. So no need to try this as long as aplay -l does not list any device.

Can you check again:

dmesg | grep -E 'audio|sound|snd'

Probably the legacy kernel is then required. If you find time, could you try to replicate the same issue with Armbian's Bullseye image: https://www.armbian.com/pine64/

MichaIng avatar Oct 21 '21 13:10 MichaIng

My latest post was related to the Bullseye image. Sorry for not being clear about that.

Sciamano72 avatar Oct 21 '21 13:10 Sciamano72

Yes but it was the DietPi Bullseye image. Before we report this to Armbian, it should be assured that it is not something missing our end. Bootloader, boot configuration, device tree and kernel are the same, but we should rule out that there is not a userland part missing.

Basically booting the Armbian image, then:

apt install alsa-utils
aplay -l
# and to be sure
reboot
aplay -l

If this suffers from the same issue, then it is a bug in the Armbian kernel and since they still officially support the PINE A64, we should have good chances that someone is looking into it.

MichaIng avatar Oct 21 '21 13:10 MichaIng

Oh! OK, sorry I did not understand you meant to try the armbian image. I'll try to do that ASAP, but I have not enough time now, I might need a few days.

Sciamano72 avatar Oct 21 '21 14:10 Sciamano72

And just to collect possible workarounds here, the legacy kernel (Linux 5.4) could be tested:

apt purge linux-image-current-sunxi64 linux-dtb-current-sinxi64 linux-u-boot-pine64-current
apt install linux-image-legacy-sunxi64 linux-dtb-legacy-sinxi64 linux-u-boot-pine64-legacy
reboot
# and then checking again
aplay -l

MichaIng avatar Oct 21 '21 14:10 MichaIng

OK, thought it would be longer. Here it is, in Armbian Bullseye:

root@pine64:~# apt install alsa-utils
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
alsa-utils is already the newest version (1.2.4-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@pine64:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: sun50ia64audio [sun50i-a64-audio], device 0: 1c22c00.dai-sun8i-codec-aif1 sun8i-codec-aif1-0 [1c22c00.dai-sun8i-codec-aif1 sun8i-codec-aif1-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: sun50ia64hdmi [sun50i-a64-hdmi], device 0: 1c22800.i2s-i2s-hifi i2s-hifi-0 [1c22800.i2s-i2s-hifi i2s-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

After reboot, same output as above.

Do I still need to try the legacy kernel? I guess not...

Sciamano72 avatar Oct 21 '21 14:10 Sciamano72

If this is working on Armbian, then the kernel is not the issue. Does playing sound work as well (as you had the same output on the Buster image but no audio), e.g. via:

speaker-test

I'll have a look through the image, e.g. manually loaded kernel modules and such.

MichaIng avatar Oct 21 '21 14:10 MichaIng