MichaIng / DietPi

Lightweight justice for your single-board computer!
https://dietpi.com/
GNU General Public License v2.0
4.91k stars 499 forks source link

PINE A64 | No sound with mainline kernel #4805

Open Sciamano72 opened 3 years ago

Sciamano72 commented 3 years ago

Creating a bug report/issue

Required Information

Additional Information (if applicable)

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

MichaIng commented 3 years ago

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

aplay -l
Sciamano72 commented 3 years ago

Nope:

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

MichaIng commented 3 years ago

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'
Sciamano72 commented 3 years ago

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
MichaIng commented 3 years ago

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

Sciamano72 commented 3 years ago

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

MichaIng commented 3 years ago

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.

Sciamano72 commented 3 years ago

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 commented 3 years ago

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 :(

MichaIng commented 3 years ago

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.

Sciamano72 commented 3 years ago

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

MichaIng commented 3 years ago

Can you show the available controls with values:

amixer -c 0 scontents
Sciamano72 commented 3 years ago

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' ```
MichaIng commented 3 years ago

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]
Sciamano72 commented 3 years ago

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

MichaIng commented 3 years ago

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

Sciamano72 commented 3 years ago

Should I try to update my installation to Bullseye?

MichaIng commented 3 years ago

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

Sciamano72 commented 3 years ago

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

MichaIng commented 3 years ago

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

Sciamano72 commented 3 years ago

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

MichaIng commented 3 years ago

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

Sciamano72 commented 3 years ago

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...

MichaIng commented 3 years ago

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/

Sciamano72 commented 3 years ago

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

MichaIng commented 3 years ago

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.

Sciamano72 commented 3 years ago

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.

MichaIng commented 3 years ago

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
Sciamano72 commented 3 years ago

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...

MichaIng commented 3 years ago

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.

Sciamano72 commented 3 years ago

No output with speaker-test either :(

Here is what I see:

root@pine64:~# speaker-test

speaker-test 1.2.4

Playback device is default
Stream parameters are 48000Hz, S16_LE, 1 channels
Using 16 octaves of pink noise
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 256 to 262144
Period size range from 128 to 32768
Using max buffer size 262144
Periods = 4
was set period_size = 32768
was set buffer_size = 262144
 0 - Front Left
Time per period = 5.469834
 0 - Front Left
Time per period = 5.472633

But I hear nothing. Hardware problem?

I have also tried the following:

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

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

root@pine64:~# dmesg -l emerg,alert,crit,err
[    2.150891] sun8i-dw-hdmi 1ee0000.hdmi: Couldn't get regulator
[    2.151310] sun4i-drm display-engine: Couldn't bind all pipelines components
[    2.174817] phy id_det change to host
[    2.381376] phy id_det change to host

root@pine64:~# dmesg | grep -E 'audio|sound|snd'
[    2.602167]   No soundcards found.
[    6.437318] input: sun50i-a64-audio Headset Jack as /devices/platform/sound/sound/card0/input1
MichaIng commented 3 years ago

That looks pretty similar like what you got with our Buster image indeed. Probably it is indeed a hardware issue then and whether the sound card is finally found or not, or only the capture device but not the playback device, is based on some randomness.

One other test, enabling the ALSA auto-conversion plugin:

cat << '_EOF_' > /etc/asound.conf
pcm.!default {
    type plug
    slave.pcm {
        type hw
        card 0
        device 0
    }
}
ctl.!default {
    type hw
    card 0
}
_EOF_
speaker-test

And then the legacy kernel could still be tested.

Sciamano72 commented 3 years ago

Guess what? I pulled the cable very slowly out from the headphone socket and I started hearing the speaker-test. Tried with music and I can hear it although its quality is AWFUL. So I guess the problem lies in the headphones socket.

All this mess for a hardware problem!! I'm so pi**ed-off! Sorry for wasting your time, I had tried with multiple headphones and cable and the result was always silence, so I thought it were a software-related problem :(

But there is something that I don't understand: I've also tried with a USB DAC and I couldn't get output either!

MichaIng commented 3 years ago

Probably the socket needs to be cleaned. But that alone does not explain why no sound card/device is found at all in some cases. At least I don't think that it is only loaded once a connected speaker/headphone as been found 🤔. Probably it is some loose solder joint that gets connected/disconnected as well when moving the headphone plug (and this being at a place where the whole sound card cannot be found by the kernel)?

With the DAC reasons can be different, e.g. when no driver for the particular one is available. Or probably the card indexes change when the onboard audio card is sometimes appearing sometimes disappearing so that the asound.conf points to an invalid card index. And of course, the auto-conversion plugin and alsamixer are always good to play around with.

MichaIng commented 3 years ago

I also checked the Armbian image, and at least there are no additional modules loaded or related module configurations applied. They have a generic sound config script, but it does not "create" a sound card, but only configures the found ones in all possible ways to assure that everything is unmuted and volumes sufficiently high, I guess. At least for the DAC case this could be tried, or then the onboard audio card is listed by aplay -l:

armbian-audio-config ```sh #!/bin/sh mixer() { parm=${4:-on} amixer -c "$1" sset "$2" "$3" $parm >/dev/null 2>&1 amixer -c "$1" sset "$2" $parm >/dev/null 2>&1 } if [ -f $HOME/.config/sound.conf ]; then alsactl restore -f $HOME/.config/sound.conf else # get card num #card=`echo $1 | sed 's/[^0-9]*//g'` card1=`aplay -l | grep "device 0" | awk '{print $3}'` #echo $card for card in $card1 do #echo $card # set common mixer params mixer $card Master 0db mixer $card Front 100% mixer $card PCM 0db mixer $card Synth 100% # mute CD, since using digital audio instead mixer $card CD 0% mute # Only unmute Line and Aux if they are possibly used. # mixer $card Line 100% # mixer $card Aux 100% # mute mic mixer $card Mic 0% mute # ESS 1969 chipset has 2 PCM channels mixer $card PCM,1 100% # Trident/YMFPCI/emu10k1 mixer $card Wave 100% mixer $card Music 100% mixer $card AC97 100% mixer $card Surround 90% mixer $card 'Surround Digital' 90% mixer $card 'Wave Surround' 90% mixer $card 'Duplicate Front' 90% mixer $card 'Sigmatel 4-Speaker Stereo' 90% # CS4237B chipset: mixer $card 'Master Digital' 100% # DRC mixer $card 'Dynamic Range Compression' 90% # Envy24 chips with analog outs mixer $card DAC 100% mixer $card DAC,0 100% mixer $card DAC,1 100% # some notebooks use headphone instead of master mixer $card Headphone 100% mixer $card Speaker 100% mixer $card 'Internal Speaker' 0% mute mixer $card Playback 100% mixer $card Headphone 100% mixer $card Speaker 100% mixer $card Center 100% mixer $card LFE 100% mixer $card Center/LFE 100% # Intel P4P800-MX (Ubuntu bug #5813) mixer $card 'Master Playback Switch' on # set digital output mixer params mixer $card 'IEC958' 100% on mixer $card 'IEC958 Output' 100% mixer $card 'IEC958 Coaxial' 100% mixer $card 'IEC958 LiveDrive' 100% mixer $card 'IEC958 Optical Raw' 100% mixer $card 'SPDIF Out' 100% mixer $card 'SPDIF Front' 100% mixer $card 'SPDIF Rear' 100% mixer $card 'SPDIF Center/LFE' 100% mixer $card 'Master Digital' 100% mixer $card 'Analog Front' 100% mixer $card 'Analog Rear' 100% mixer $card 'Analog Center/LFE' 100% # ASRock ION 330 (and perhaps others) has 2 IEC958 channels mixer $card IEC958,0 on mixer $card IEC958,1 on # some ION2 has much more IEC958 channels ... mixer $card IEC958,2 on mixer $card IEC958,3 on # ASRock ION 330 has Master Front set to 0 mixer $card 'Master Front' 100% # Shuttle XS35GT needs this too mixer $card 'Master',0 100% on # and this for various Fusion devices like Zotac ZBOX mixer $card 'Front',0 100% on # NVidia CK804 sound devices mixer $card 'IEC958 Playback AC97-SPSA' 100% # Allwinner H3 Analog mixer $card 'Line Out' 0db on # Allwinner A20 Analog mixer $card 'Power Amplifier' 0db mixer $card 'Power Amplifier DAC' on mixer $card 'Power Amplifier Mute' on # Allwinner A64 Analog mixer $card Headphone 0db on mixer $card 'AIF1 Slot 0 Digital DAC' on # Amlogic G12 HDMI to PCM0 mixer $card 'FRDDR_A SINK 1 SEL' 'OUT 1' mixer $card 'FRDDR_A SRC 1 EN' on mixer $card 'TDMOUT_B SRC SEL' 'IN 0' mixer $card 'TOHDMITX I2S SRC' 'I2S B' mixer $card 'TOHDMITX' on # Amlogic G12 S/PDIF to PCM1 mixer $card 'FRDDR_B SINK 1 SEL' 'OUT 3' mixer $card 'FRDDR_B SRC 1 EN' on mixer $card 'SPDIFOUT SRC SEL' 'IN 1' mixer $card 'SPDIFOUT Playback' on # Amlogic GX HDMI and S/PDIF mixer $card 'AIU HDMI CTRL SRC' 'I2S' mixer $card 'AIU SPDIF SRC SEL' 'SPDIF' # RockPI 4B Analog mixer $card 'Right Headphone Mixer Right DAC' on mixer $card 'Left Headphone Mixer Left DAC' on # NanoPC T4 Analog mixer $card 'HPO L' on mixer $card 'HPO R' on mixer $card 'HPOVOL L' on mixer $card 'HPOVOL R' on mixer $card 'HPO MIX HPVOL' on mixer $card 'OUT MIXL DAC L1' on mixer $card 'OUT MIXR DAC R1' on mixer $card 'Stereo DAC MIXL DAC L1' on mixer $card 'Stereo DAC MIXR DAC R1' on done fi ```
Sciamano72 commented 3 years ago

Thanks for the suggestions. I'll go through them and try to find out where the problem is. The board has been sitting in a drawer for a long time, so I guess dirt could be one issue, but as you said, this doesn't explain why the sound card is not being recognized.

I will also try to get my hands on one of those cheap and basic USB soundcard dongles and see if I can get sound from those. Even though it used to work perfectly on a Raspberry Pi 1revB, I suspect my USB DAC is not being recognized, so maybe starting with something basic that surely works in Linux would be a start.

I will keep you posted with my findings soon. Thank you for your help and patience so far.

MichaIng commented 3 years ago

EDIT: Sorry, wrong board 😅

MichaIng commented 2 years ago

Marking as closed due to outstanding reply. But feel free to reopen when you found time to further investigate.

PineA64explore commented 2 years ago

Hi,

I am trying to build a webradio with my Pine A64+ board and was unable to output any sound from the jack headphone connector during months (HDMI was working though). I tried just about every tip and trick (with alsa, amixer, alsamixer, pulseaudio, fiddling with asound.state files and so on) I could find, with no success and was up to the point of asking for RMA when I ran through this GitHub issue, and finally tried your suggestion: apt install linux-image-legacy-sunxi64 linux-dtb-legacy-sunxi64 linux-u-boot-pine64-legacy And it worked ! Thanks.Thank. Thanks

I would like to help tracking the issue and make sure that it disappears from future DietPi and Armbian builds.

Before installing the legacy images you proposed, I was running the last DietPi Bullseye image (before that I tried Armbian Bullseye). The playback devices seemed ok:

_root@DietPi:~# 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: sun9ihdmi [sun9i-hdmi], device 0: SUN9I-HDMI PCM i2s-hifi-0 [SUN9I-HDMI PCM i2s-hifi-0] Subdevices: 1/1 Subdevice #0: subdevice #0_

But I couldn't get any sound from jack.

One day, looking at dmesg during headphone plug-in and plug-out, what I found was intriging : This is what I get when plugging IN : [ 3517.655643] jack: irq plug-out [ 3517.663413] jack: irq plug-in [ 3517.696086] jack: irq plug-out [ 3517.762223] jack: plug-out reported => so the headphone is reported being plugged out, when I plug it in.

This is what I get when plugging OUT : [ 3532.479203] jack: irq plug-in [ 3532.487846] jack: irq plug-out [ 3532.496029] jack: irq plug-in => the headphone is reported being plugged in when I plug it out.

After installing the legacy images, these messages disappeared totally (no message at all about jack). Maybe nothing to do with the sound problem, but still...

How can I help ? I have two of these boards, and can try any suggestion or build in order to track down the bug in the recent builds.. Thanks

MichaIng commented 2 years ago

If you find time, you could try edge kernel, hence newer one instead of older:

G_AGP linux-{image,dtb}-{current,legacy}-sunxi64 linux-u-boot-pine64-{current,legacy}
G_AGI linux-{image,dtb}-edge-sunxi64 linux-u-boot-pine64-edge
PineA64explore commented 2 years ago

Tried and compared legacy, current and edge:

1) Current : no sound through jack connector

root@DietPi:~# lsmod 
Module                  Size  Used by
snd_soc_hdmi_codec     24576  1
axp20x_adc             20480  0
joydev                 28672  0
axp20x_battery         16384  0
sun9i_hdmi_audio       16384  0
axp20x_ac_power        16384  0
snd_soc_simple_card    24576  0
snd_soc_simple_card_utils    24576  1 snd_soc_simple_card
dw_hdmi_cec            16384  0
sunxi_cedrus           49152  0
videobuf2_dma_contig    24576  1 sunxi_cedrus
dw_hdmi_i2s_audio      16384  0
v4l2_mem2mem           36864  1 sunxi_cedrus
videobuf2_memops       20480  1 videobuf2_dma_contig
sun4i_gpadc_iio        24576  0
lima                   57344  0
videobuf2_v4l2         24576  2 sunxi_cedrus,v4l2_mem2mem
gpu_sched              32768  1 lima
sun8i_mbus             20480  0
videobuf2_common       49152  5 sunxi_cedrus,videobuf2_dma_contig,videobuf2_v4l2,v4l2_mem2mem,videobuf2_memops
industrialio           73728  4 axp20x_battery,sun4i_gpadc_iio,axp20x_ac_power,axp20x_adc
sun4i_i2s              24576  4
videodev              204800  4 sunxi_cedrus,videobuf2_v4l2,videobuf2_common,v4l2_mem2mem
mc                     49152  5 sunxi_cedrus,videodev,videobuf2_v4l2,videobuf2_common,v4l2_mem2mem
display_connector      20480  0
cpufreq_dt             20480  0
fuse                  126976  1
pinctrl_axp209         16384  0
realtek                32768  1
dwmac_sun8i            28672  0
mdio_mux               16384  1 dwmac_sun8i
i2c_mv64xxx            24576  0

2) Legacy : jack works perfectly

root@DietPi:~# lsmod 
Module                  Size  Used by
snd_soc_hdmi_codec     20480  1
dw_hdmi_i2s_audio      16384  0
dw_hdmi_cec            16384  0
snd_soc_spdif_tx       16384  0
axp20x_adc             20480  0
axp20x_battery         16384  0
axp20x_ac_power        16384  0
sun50i_codec_analog    28672  1
snd_soc_simple_card    24576  0
snd_soc_simple_card_utils    20480  1 snd_soc_simple_card
sun8i_adda_pr_regmap    16384  1 sun50i_codec_analog
sun8i_codec            28672  1
sun4i_i2s              24576  4
snd_soc_core          176128  7 sun4i_i2s,snd_soc_spdif_tx,snd_soc_hdmi_codec,sun50i_codec_analog,sun8i_codec,snd_soc_simple_card_utils,snd_soc_simple_card
ac97_bus               16384  1 snd_soc_core
sun8i_drm_hdmi         24576  0
lima                   45056  0
dw_hdmi                40960  2 sun8i_drm_hdmi,dw_hdmi_i2s_audio
snd_pcm_dmaengine      16384  1 snd_soc_core
joydev                 32768  0
cec                    69632  2 dw_hdmi_cec,dw_hdmi
snd_pcm               110592  5 sun4i_i2s,snd_soc_hdmi_codec,sun8i_codec,snd_soc_core,snd_pcm_dmaengine
gpu_sched              28672  1 lima
snd_timer              40960  1 snd_pcm
snd                    86016  4 snd_soc_hdmi_codec,snd_timer,snd_soc_core,snd_pcm
sun4i_gpadc_iio        24576  0
soundcore              16384  1 snd
cpufreq_dt             20480  0
ip_tables              32768  0
x_tables               36864  1 ip_tables
autofs4                49152  2
realtek                24576  1
axp20x_regulator       45056  7
pinctrl_axp209         16384  0
axp20x_usb_power       16384  0
dwmac_sun8i            28672  0
mdio_mux               16384  1 dwmac_sun8i
i2c_mv64xxx            20480  0
sun8i_mixer            40960  0
sun4i_drm              20480  0
sun4i_frontend         20480  1 sun4i_drm
sun4i_tcon             32768  1 sun4i_drm
sun8i_tcon_top         16384  3 sun8i_drm_hdmi,sun4i_tcon,sun4i_drm

3) Edge : no sound through jack connector Edge

root@DietPi:~# lsmod 
Module                  Size  Used by
snd_soc_hdmi_codec     24576  1
joydev                 32768  0
axp20x_adc             20480  0
snd_soc_simple_card    24576  0
axp20x_ac_power        16384  0
sun9i_hdmi_audio       16384  0
snd_soc_simple_card_utils    24576  1 snd_soc_simple_card
axp20x_battery         16384  0
sunxi_cedrus           49152  0
videobuf2_dma_contig    24576  1 sunxi_cedrus
v4l2_mem2mem           36864  1 sunxi_cedrus
lima                   57344  0
videobuf2_memops       20480  1 videobuf2_dma_contig
sun4i_gpadc_iio        24576  0
videobuf2_v4l2         24576  2 sunxi_cedrus,v4l2_mem2mem
gpu_sched              32768  1 lima
dw_hdmi_i2s_audio      16384  0
dw_hdmi_cec            16384  0
videobuf2_common       49152  5 sunxi_cedrus,videobuf2_dma_contig,videobuf2_v4l2,v4l2_mem2mem,videobuf2_memops
sun4i_i2s              24576  4
sun8i_a33_mbus         20480  0
drm_shmem_helper       20480  1 lima
industrialio           73728  4 axp20x_battery,sun4i_gpadc_iio,axp20x_ac_power,axp20x_adc
videodev              204800  4 sunxi_cedrus,videobuf2_v4l2,videobuf2_common,v4l2_mem2mem
mc                     49152  5 sunxi_cedrus,videodev,videobuf2_v4l2,videobuf2_common,v4l2_mem2mem
display_connector      20480  0
cpufreq_dt             20480  0
fuse                  126976  1
realtek                32768  1
pinctrl_axp209         16384  0
dwmac_sun8i            28672  0
mdio_mux               16384  1 dwmac_sun8i

Legacy seems to have many more modules activated. and they differ a lot from current and edge.

MichaIng commented 2 years ago

I guess sun50i_codec_analog is the relevant module, and snd_soc_simple_card the non-functional fallback. Yeah, legacy most likely is the outdated but original PINE64 vendor kernel, while current and edge are patched mainline kernel builds.

I guess it will be the same issue on Pinebook.

Legacy is Linux 5.4, right?

uname -a
PineA64explore commented 2 years ago
root@DietPi:~# uname -a
Linux DietPi 5.4.88-sunxi64 #21.02.3 SMP Mon Mar 8 08:07:33 UTC 2021 aarch64 GNU/Linux
PineA64explore commented 2 years ago

Can I help with more tests ? Or do I need to open a new issue or is this one reopened ? Sorry, I am not that familiar with the process...

MichaIng commented 2 years ago

I'll do some research tomorrow. If there is no solution in sight, I'll generate legacy kernel images.

MichaIng commented 1 year ago

Based on case with ROCK Pi 4, as long as aplay -l does show the analogue jack audio device, tweaking amixer/alsamixer controls might fix it. If someone lands here or has time to test with our current image (and current kernel branch), please paste the output of the following command:

amixer -c 0 scontents
PineA64explore commented 1 year ago

Just tried current again, still no sound. Here's what I get with aplay an a amixer:

root@DietPi:~# 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: sun9ihdmi [sun9i-hdmi], device 0: SUN9I-HDMI PCM i2s-hifi-0 [SUN9I-HDMI PCM i2s-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

After unmuting all devices devices with alsamixer, this is what amixer gives:

root@DietPi:~# 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 56 [89%] [-7.00dB] [on]
  Front Right: Playback 56 [89%] [-7.00dB] [on]
Simple mixer control 'Headphone Source',0
  Capabilities: penum
  Items: 'DAC' 'Mixer'
  Item0: 'DAC'
  Item1: 'DAC'
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 5 [71%] [3.00dB] [on] Capture [off]
  Front Right: Playback 5 [71%] [3.00dB] [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 27 [87%] [-6.00dB] [on]
  Front Right: Playback 27 [87%] [-6.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 5 [71%] [3.00dB] [on] Capture [off]
  Front Right: Playback 5 [71%] [3.00dB] [on] Capture [off]
Simple mixer control 'Mic1 Boost',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 7
  Mono: 4 [57%] [33.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 5 [71%] [3.00dB] [on] Capture [off]
  Front Right: Playback 5 [71%] [3.00dB] [on] Capture [off]
Simple mixer control 'Mic2 Boost',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: 0 - 7
  Mono: 5 [71%] [36.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 [on]
  Front Right: Playback [on]
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 [on]
  Front Right: Playback [on]
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 182 [95%] [16.50dB]
  Front Right: Playback 182 [95%] [16.50dB]
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 [on]
  Front Right: Playback [on]
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 178 [93%] [13.50dB] [on]
  Front Right: Playback 178 [93%] [13.50dB] [on]
Simple mixer control 'DAC Reversed',0
  Capabilities: pswitch
  Playback channels: Front Left - Front Right
  Mono:
  Front Left: Playback [on]
  Front Right: Playback [on]
Simple mixer control 'Earpiece',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback 0 - 31
  Mono: Playback 24 [77%] [-10.50dB] [on]
Simple mixer control 'Earpiece Source',0
  Capabilities: penum
  Items: 'DACR' 'DACL' 'Right Mixer' 'Left Mixer'
  Item0: 'DACR'
uname -a : Linux DietPi 5.15.80-sunxi64 #22.11.1 SMP Wed Nov 30 11:23:00 UTC 2022 aarch64 GNU/Linux
qtpies commented 1 year ago

I'm having exactly the same issue on Armbian. Looking forward to any kind of resolution.

MichaIng commented 1 year ago

Does this help?

amixer -c 0 set 'AIF1 DA0' '100%'
qtpies commented 1 year ago

Does this help?

amixer -c 0 set 'AIF1 DA0' '100%'

Unfortunately not. I also get the plug-in/out reversed in dmesg.

One day, looking at dmesg during headphone plug-in and plug-out, what I found was intriging : This is what I get when plugging IN : [ 3517.655643] jack: irq plug-out [ 3517.663413] jack: irq plug-in [ 3517.696086] jack: irq plug-out [ 3517.762223] jack: plug-out reported => so the headphone is reported being plugged out, when I plug it in.

This is what I get when plugging OUT : [ 3532.479203] jack: irq plug-in [ 3532.487846] jack: irq plug-out [ 3532.496029] jack: irq plug-in => the headphone is reported being plugged in when I plug it out.