User Tools

Site Tools


doc:appunti:hardware:mini_pc_ryzen_7_5825u

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
doc:appunti:hardware:mini_pc_ryzen_7_5825u [2025/06/07 08:30] – [Problem with audio over HDMI using Pulseaudio and ALSA] niccolodoc:appunti:hardware:mini_pc_ryzen_7_5825u [2025/10/17 16:36] (current) – [The problem of mute HDMI audio] niccolo
Line 7: Line 7:
 ===== Linux kernel support of WiFi adapter ===== ===== Linux kernel support of WiFi adapter =====
  
-GNU/Linux **kernel 6.1.0** shipped with **Debian 12 Bookworm** does not support the WiFi adapter FIXME.+GNU/Linux **kernel 6.1.0** shipped with **Debian 12 Bookworm** does not support the **RTL8852BE** WiFi adapter. You can download kernel 6.12.22 from bookworm backports and install it manually using **%%dpkg -i%%**. Download also the backported firmwares: 
 + 
 +  * **[[https://packages.debian.org/bookworm-backports/linux-image-6.12.22+bpo-amd64|linux-image-6.12.22+bpo-amd64_6.12.22-1~bpo12+1_amd64.deb]]** 
 +  * **[[https://packages.debian.org/bookworm-backports/firmware-amd-graphics|firmware-amd-graphics_20241210-1~bpo12+1_all.deb]]** 
 +  * **[[https://packages.debian.org/bookworm-backports/firmware-realtek|firmware-realtek_20241210-1~bpo12+1_all.deb]]** 
 ===== Problem with audio over HDMI using Pulseaudio and ALSA ===== ===== Problem with audio over HDMI using Pulseaudio and ALSA =====
  
 I had a problem getting audio to work on the **HDMI port**: at bootstrap the PC was totally mute; **no audio** was routed to the HDMI display. I had a problem getting audio to work on the **HDMI port**: at bootstrap the PC was totally mute; **no audio** was routed to the HDMI display.
  
-First of all I manually checked all the following:+First of all I manually checked all the following to ensure that audio can work:
  
-  * Using **alsamixer** unmute the **S/PDIF output** of the **default:1  HD-Audio Generic** sound card.+  * From **alsamixer**unmute the **S/PDIF output** of the first **HD-Audio Generic** sound card
 +  * From the **PulseAdio Plugin** on the XFCE panel: check that the master volume control si associated to the **Renoir Radeon High Definition Audio Controller HDMI / DisplayPort 1 Output**, enable the output and set a sensible volume level.
   * Open the XFCE mixer app **pavucontrol**:   * Open the XFCE mixer app **pavucontrol**:
-    * Into the **Output Devices** tab: check that the **HDMI / DisplayPort 1 Output** is marked as //plugged in//, //unmuted// and click the //Set as fallback// button. +    * Into the **Output Devices** tab: check that the **HDMI / DisplayPort 1 Output** is marked as //plugged in//, verify it is //unmuted// and click the //Set as fallback// button. 
-    * From the **PulseAdio Plugin** on the XFCE panel: check that the master volume control si associated to the **Renoir Radeon High Definition Audio Controller HDMI / DisplayPort 1 Output**. +    * Start an audio player (e.g. the **audacious** program to play some mp3 files); into the **Playback** tab of **pavucontrol** check that the app is using the **Renoir Radeon High Definition Audio Controller HDMI / DisplayPort 1 Output** port to route the sound
-    Start an audio player (e.g. the **audacious** program to play some mp3 files); into the **Playback** tab of pavucontrol check that the app is using the **HDMI #1** port to route the sound.+ 
 +==== The problem of mute HDMI audio ==== 
 + 
 +There are actually two problems with this PC and the HDMI audio: 
 + 
 +  - On each reboot the order of the sound cards may vary. The mini PC has two sound cards that can play audio: a **C-Media Electronics Inc. USB Audio Device** is connected to the 3.5 mm jack,  and an **HDA-Intel** is responsible to send audio to the HDMI port. On each boot the kernel may discover the hardware with different timing, so the **card #0** is not guaranteed to be always the same. 
 +  - A **pulseaudio.service** is started in user-space. If you run a graphical environment, you will find the process running e.g. under the ''lightdm'' user name, otherwise the process will run under the logged in user name (the user must be in the //audio// group to have this). It seems that this service resets the HDMI audio port to the muted state on each start. 
 + 
 +There is the system-wide service named **alsa-restore.service**, this service is intended to save the current ALSA mixer settings on shutdown and restore them on bootstrap. The service actually works and you can find the saved state in the **/var/lib/alsa/asound.state** file. So the ALSA mixer is correctly set during bootstrap, but as soon as the pulseaudio.service starts, the HDMI audio port is muted again. 
 + 
 +To solve the first problem, set - as the intended user - **the default PulseAudio sink** (where audio goes): 
 + 
 +<code bash> 
 +pactl set-default-sink 'alsa_output.pci-0000_04_00.1.HiFi__hw_Generic_1_3__sink' 
 +</code> 
 + 
 +You can discover the available audio sink using the command (search for the lines starting with ''name:''): 
 + 
 +<code bash> 
 +pacmd list-sinks 
 +</code> 
 + 
 +You can confirm that the default sink is correctly set with: 
 + 
 +<code bash> 
 +pactl get-default-sink 
 +</code> 
 + 
 +The settings are saved into the user directory **$HOME/.config/pulse/**. If you want to give this same default for all the new users, create a file **/etc/pulse/client.conf.d/99-local.conf** with: 
 + 
 +<file> 
 +Renoir Radeon High Definition Audio Controller HDMI / DisplayPort Output 
 +default-sink = alsa_output.pci-0000_04_00.1.HiFi__hw_Generic_1_3__sink 
 +</file> 
 + 
 +Solving the second problem (pulseaudio.service which sets the mute state to the HDMI port) is a bit more complicated. I resorted on creating **an user systemd service** to be run just after the pulseaudio.service. 
 + 
 +First of all unmute the HDMI S/PDIF port using **alsamixer**; then save the ALSA mixer settings in an user file using **alsactl**: 
 + 
 +<code bash> 
 +mkdir -p ~/.config/alsa/ 
 +/usr/sbin/alsactl --file ~/.config/alsa/asound.state store 
 +</code> 
 + 
 +Create a systemd service named **alsa-restore.service** (the name is the same as the system-wide service, but this is executed on user logon): 
 + 
 +<code bash> 
 +mkdir -p ~/.config/systemd/user/ 
 +vi ~/.config/systemd/user/alsa-restore.service 
 +</code> 
 + 
 +The file is like this: 
 + 
 +<file> 
 +[Unit] 
 +Description=Restore ALSA mixer levels 
 +After=pulseaudio.service 
 + 
 +[Service] 
 +Type=oneshot 
 +RemainAfterExit=true 
 +ExecStart=/usr/sbin/alsactl --file %h/.config/alsa/asound.state restore Generic_1 
 + 
 +[Install] 
 +WantedBy=default.target 
 +</file> 
 + 
 +Finally enable this user's systemd service: 
 + 
 +<code bash> 
 +systemctl --user enable alsa-restore.service 
 +</code> 
 + 
 +**NOTICE**: The ''alsactl restore'' command is executed passing the ID of the sound card //Generic_1// (passing the card number is not feasible because that number can vary across reboots)Passing the card ID is required because restoring the ALSA mixer status for all the available cards leads to this error message: 
 + 
 +<code> 
 +/usr/sbin/alsactl --file ~/.config/alsa/asound.state restore 
 +alsa-lib parser.c:2080:(parse_verb_file) error: no use case device defined 
 +alsa-lib main.c:1541:(snd_use_case_mgr_open) error: failed to import hw:1 use case configuration -22 
 +</code> 
 + 
 +To view the **card ID** associated to the **card number**, inspect the ''/proc/asound/cards'' pseudo file:
  
-Now you should ear the sound coming from the HDMI display (obviously your device must have the speakers!).+<code> 
 +cat /proc/asound/cards 
 + 0 [Generic_1      ]: HDA-Intel - HD-Audio Generic 
 +                      HD-Audio Generic at 0xfc9c8000 irq 69 
 + 1 [Generic        ]: HDA-Intel - HD-Audio Generic 
 +                      HD-Audio Generic at 0xfc9c0000 irq 70 
 + 2 [Device         ]: USB-Audio - USB Audio Device 
 +                      C-Media Electronics IncUSB Audio Device at usb-0000:04:00.4-3, full speed 
 + 3 [acp            ]: acp - acp 
 +                      HCTechnology.Ltd.-HCAR5000_MI-Defaultstring 
 +</code>
  
doc/appunti/hardware/mini_pc_ryzen_7_5825u.1749277810.txt.gz · Last modified: by niccolo