raspberrypi / linux

Kernel source tree for Raspberry Pi-provided kernel builds. Issues unrelated to the linux kernel should be posted on the community forum at https://forums.raspberrypi.com/
Other
11.13k stars 4.98k forks source link

Audio Overlay Documentation Confusion #1078

Closed mvastola closed 9 years ago

mvastola commented 9 years ago

In arch/arm/boot/dts/overlays/README on the rpi-4.0.y branch, the following is stated (currently on lines 81-82):

audio               Set to "on" to disable the onboard ALSA audio interface (default "off")

I would imagine this is a simple typo, in which case the documentation needs to be updated, but in the case the documentation is actually correct, please consider this submission to be a feature request to make this configuration setting and the accompanying documentation more intuitive.

Thanks, Mike

pelwell commented 9 years ago

No, it is a simple typo that I will correct - thanks - but the behaviour of the system as a whole is more complicated.

In order for the ALSA PCM sound output to be available, two things are required - the creation of a platform device and the loading of a driver module. Currently the platform device is always created - if Device Tree doesn't do it (e.g. using dtparam=audio=on), then the board support code will. Enabing audio from Device Tree will cause the module to be loaded automatically, otherwise it will have to be loaded manually, usually from /etc/modules. This approach allows a staged transition from always-on (because it is in /etc/modules) to on-if-enabled-in-DT. Once the config.txt setting has been added to new installs and there is a suitable upgrade script (one which spots snd-bcm2835 in /etc/modules entry, removes it and adds dtparam=audio=on to config.txt), then the hack in the board support code can be removed.

See this thread and this commit for more details.

pelwell commented 9 years ago

There is a patch for the typo in the source tree, and it will appear in the next release. With this patch and the above explanation, can we close this issue?

mvastola commented 9 years ago

Certainly. Thanks a ton!

Sent from my T-Mobile 4G LTE Device

-------- Original message -------- From: Phil Elwell notifications@github.com Date:07/21/2015 6:29 AM (GMT-05:00) To: raspberrypi/linux linux@noreply.github.com Cc: Michael Vastola mike@vasto.la Subject: Re: [linux] Audio Overlay Documentation Confusion (#1078)

There is a patch for the typo in the source tree, and it will appear in the next release. With this patch and the above explanation, can we close this issue?

— Reply to this email directly or view it on GitHub.

NicoHood commented 8 years ago

I read in the arch wiki that this option in config.txt is now essential. I installed all related alsa packages, pulseaudio etc and also set the config.txt option. But on arch linux I will get no sound output. The installed kodi package can output audio though. I also forced the output to the audio jack, rather than hdmi. I checked pavucontrol and alsamixer. Any ideas why it still does not work?

popcornmix commented 8 years ago

What is in config.txt? What does aplay -l report?

NicoHood commented 8 years ago
[alarm@alarmpi ~]$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
  Subdevices: 7/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 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

# See /boot/overlays/README for all available options

[pi0]
# USB OTG driver
dtoverlay=dwc2

[pi1]
# Overclocking Turbo
arm_freq=1000
core_freq=500
sdram_freq=500
over_voltage=6
temp_limit=70

[pi2]

[pi3]

[all]
gpu_mem=128
disable_overscan=1
hdmi_force_hotplug=1
disable_splash=1
dtparam=audio=on
framebuffer_depth=32
framebuffer_ignore_alpha=1

# Get the monitor setting via
# tvservice -n
# /opt/vc/bin/tvservice -n
[EDID=ACR-M230HDL]
# DVI Monitor Mode
hdmi_drive=1
popcornmix commented 8 years ago

Okay, the dtparam=audio=on is working. I suspect this is a configuration issue. I'd suggest removing puleaudio and any custom audio config and checking if aplay can play a wav file.

NicoHood commented 8 years ago

I always use this command to test audio: aplay /usr/share/sounds/alsa/Front_Center.wav

It did not work, even when i had no pulseaudio etc installed. I started from little packages and tried with installing more, but nothing helped.

popcornmix commented 8 years ago

Afraid we can't offer much support for Arch. If you can try a raspbian install I suspect it would just work, but if it doesn't then we can try to help. Open a new issue though, as yours doesn't seem related to this one.

NicoHood commented 8 years ago

On raspi1 (with arch linux for pi1) aplay -l does not even recognize a soundcard. alsamixer has at least a sound bar that i can move up and down. config.txt is set correct. kodi works here too (even with no additional alsa packages installed, but maybe they were pulled in via dependency). I know that you don't do arch for rpi, but isnt that strange? rpi1 has the latest 4.4-13 kernel.

Edit: after i installed xfce and launched the desktop the card IS recognized. So i think xorg (all) or xfce4 (all) pulled in some missing dependencies. I guess there are more missing. Do you have any ideas what was missing so far? (aplay a wav still does not work)

Edit: Those packages were pulled in by xfce4 and xorg and xf86-video-fbturbo-git:

Packages (173) adwaita-icon-theme-3.20-2  at-spi2-atk-2.20.1-2  at-spi2-core-2.20.2-1  atk-2.20.0-1  cairo-1.14.6-1  cantarell-fonts-1:0.0.24-1  cdparanoia-10.2-5  colord-1.3.2-2  dbus-glib-0.106-1
               dconf-0.26.0-1  dri2proto-2.8-2  dri3proto-1.0-1  fontsproto-2.1.3-1  gdk-pixbuf2-2.34.0-2  glib-networking-2.48.2-1  glproto-1.4.17-1  gnome-icon-theme-3.12.0-3
               gnome-icon-theme-symbolic-3.12.0-4  gnome-themes-standard-3.20.2-1  gsettings-desktop-schemas-3.21.2-1  gstreamer0.10-0.10.36-4  gstreamer0.10-base-0.10.36-3
               gstreamer0.10-base-plugins-0.10.36-3  gtk-update-icon-cache-3.20.6-1  gtk2-2.24.30-2  gtk3-3.20.6-1  iso-codes-3.68-1  json-glib-1.2.0-1  lcms2-2.7-1  libcroco-0.6.11-1
               libdatrie-0.2.10-1  libepoxy-1.3.1-1  libevdev-1.5.1-1  libexif-0.6.21-2  libfontenc-1.1.3-1  libgudev-230-1  libgusb-0.2.9-1  libimobiledevice-1.2.0-3  libinput-1.3.0-2
               libkeybinder2-0.3.0-2  libnotify-0.7.6-2  libproxy-0.4.12-2  librsvg-2:2.40.16-1  libsoup-2.54.1-1  libthai-0.1.24-1  libtheora-1.1.1-3  libunique-1.1.6-6  libunwind-1.1-3
               libusbmuxd-1.0.10-1  libvisual-0.4.0-6  libwacom-0.18-1  libwnck-2.31.0-1  libxaw-1.0.13-1  libxcursor-1.1.14-2  libxfce4ui-4.12.1-2  libxfce4util-4.12.1-1  libxfont-1.5.1-1
               libxft-2.3.2-1  libxkbcommon-0.6.1-1  libxkbfile-1.0.9-1  libxklavier-5.4-1  libxmu-1.1.2-1  libxpm-3.5.11-1  libxres-1.0.7-1  libxt-1.1.5-1  libxv-1.0.10-1  mtdev-1.1.5-1
               pango-1.40.1-1  perl-uri-1.71-1  pixman-0.34.0-1  polkit-gnome-0.105-3  presentproto-1.0-1  resourceproto-1.2.0-3  rest-0.8.0-1  scrnsaverproto-1.2.2-2  shared-mime-info-1.6-2
               startup-notification-0.12-4  ttf-dejavu-2.35-1  upower-0.99.4-2  videoproto-2.3.3-1  vte-0.28.2-7  vte-common-0.44.2-1  wayland-protocols-1.4-1  xcb-util-0.4.0-1
               xcb-util-image-0.4.0-1  xcb-util-keysyms-0.4.0-1  xcb-util-renderutil-0.3.9-1  xcb-util-wm-0.4.1-1  xf86driproto-2.1.1-3  xkeyboard-config-2.17-2  xorg-font-utils-7.6-4
               xorg-fonts-alias-1.0.3-1  xorg-fonts-misc-1.0.3-4  xorg-util-macros-1.19.0-1  xorg-xinit-1.3.4-4  exo-0.10.7-2  garcon-0.4.0-1  gtk-xfce-engine-2.10.1-1  thunar-1.6.10-3
               thunar-volman-0.8.1-2  tumbler-0.1.31-1  xf86-input-evdev-2.10.3-1  xf86-input-joystick-1.6.2-6  xf86-input-keyboard-1.8.1-2  xf86-input-libinput-0.19.0-1  xf86-input-mouse-1.9.1-2
               xf86-input-synaptics-1.8.3-2  xf86-input-void-1.4.1-2  xf86-video-dummy-0.3.7-5  xf86-video-fbdev-0.4.4-5  xf86-video-fbturbo-git-199.f9a6ed7-1  xf86-video-vesa-2.3.4-2
               xfce4-appfinder-4.12.0-4  xfce4-mixer-4.11.0-3  xfce4-panel-4.12.0-2  xfce4-power-manager-1.4.4-2  xfce4-session-4.12.1-4  xfce4-settings-4.12.0-4  xfce4-terminal-0.6.3-3
               xfconf-4.12.0-3  xfdesktop-4.12.3-2  xfwm4-4.12.3-2  xfwm4-themes-4.10.0-2  xorg-bdftopcf-1.0.5-1  xorg-docs-1.7.1-1  xorg-font-util-1.3.1-1  xorg-fonts-100dpi-1.0.3-2
               xorg-fonts-75dpi-1.0.3-2  xorg-fonts-encodings-1.0.4-4  xorg-iceauth-1.0.7-1  xorg-luit-1.1.1-2  xorg-mkfontdir-1.0.7-2  xorg-mkfontscale-1.1.2-1  xorg-server-1.18.3-2
               xorg-server-common-1.18.3-2  xorg-server-devel-1.18.3-2  xorg-server-xdmx-1.18.3-2  xorg-server-xephyr-1.18.3-2  xorg-server-xnest-1.18.3-2  xorg-server-xvfb-1.18.3-2
               xorg-server-xwayland-1.18.3-2  xorg-sessreg-1.1.0-1  xorg-setxkbmap-1.3.1-1  xorg-smproxy-1.0.6-1  xorg-x11perf-1.6.0-1  xorg-xauth-1.0.9-1  xorg-xbacklight-1.2.1-1
               xorg-xcmsdb-1.0.5-1  xorg-xcursorgen-1.0.6-1  xorg-xdpyinfo-1.3.2-1  xorg-xdriinfo-1.0.5-1  xorg-xev-1.2.2-1  xorg-xgamma-1.0.6-1  xorg-xhost-1.0.7-1  xorg-xinput-1.6.2-1
               xorg-xkbcomp-1.3.1-1  xorg-xkbevd-1.1.4-1  xorg-xkbutils-1.0.4-2  xorg-xkill-1.0.4-1  xorg-xlsatoms-1.1.2-1  xorg-xlsclients-1.1.3-1  xorg-xmodmap-1.0.9-1  xorg-xpr-1.0.4-2
               xorg-xprop-1.2.2-1  xorg-xrandr-1.5.0-1  xorg-xrdb-1.1.0-2  xorg-xrefresh-1.0.5-1  xorg-xset-1.2.3-1  xorg-xsetroot-1.1.1-2  xorg-xvinfo-1.1.3-1  xorg-xwd-1.0.6-1
               xorg-xwininfo-1.1.3-1  xorg-xwud-1.0.4-2
popcornmix commented 8 years ago

kodi doesn't use ALSA (it uses OpenMAX for audio), so its behaviour isn't relevant. You would would be better off asking Arch packaging questions in an Arch forum - I have no knowledge of that.

NicoHood commented 8 years ago

Thanks for the help popcornmix, I will try to solve the issue. I'd like to add some information here, as people might find this on google. I'll edit this post, if i find out more about it. You may comment if you have further ideas. If not, thats all fine :)

So I plugged in my external usb sound card and tried to play sound with it. And it works.

aplay -D plughw:1,0 /usr/share/sounds/alsa/Front_Center.wav

So there must be something wrong with the analog output. I might try hdmi output as well. And as the command itself (for analog) gives no error, I assume that there must be something wrong with the sound volume or the sound setting in config.txt (maybe i could try to force the audio jack).

With pulseaudio running I only get some "click" sounds with kodi (corrupted sound). I already noticed this with raspbian. So for kodi you rather disable pulseaudio or use its pulseaudio server. Using the pulseaudio server works fine for the usb sound card.

pelwell commented 8 years ago

Have you used raspi-config to force the audio to use the analogue outputs? By default it will use HDMI in preference.

NicoHood commented 8 years ago

Sure i did, via the command line. On arch there is no raspi-config