Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 3862

Device Tree • RPI5: Issue with dynamic applying DT for Sound Card

$
0
0
I am facing an issue with dynamically applying a Device Tree Overlay for a sound card. The overlay is being applied successfully via the dtoverlay command, the sound card does not seem to be recognized properly by the system, and I am unable to see the expected configurations in sound devices list.

Code:

aplay -l**** List of PLAYBACK Hardware Devices ****
When I added overlay to config.txt it works fine

Code:

aplay -l**** List of PLAYBACK Hardware Devices ****card 0: sj201 [sj201], device 0: fe203000.i2s-dit-hifi dit-hifi-0 [fe203000.i2s-dit-hifi dit-hifi-0]  Subdevices: 1/1  Subdevice #0: subdevice #0
What I'm trying to achieve:
I want to dynamically apply a Device Tree Overlay for the sound card so that it is recognized by the system without requiring a reboot. This setup works correctly when the overlay is included in the config.txt and the system is rebooted, but not when applying the overlay on-the-fly.

What I've done:
  • Applied the overlay dynamically using: dtoverlay -v name.dtbo.
  • Checked the kernel logs with dmesg, noticing warnings about potential memory leaks but no errors directly indicating a failure to apply the overlay.
  • Attempted to restart the ALSA and PulseAudio services to ensure the system recognizes the new hardware configuration.
  • Verified the overlay application via dtoverlay -l, which shows the overlay as active.
My overlay for RPI 4/5

Code:

dts-v1/;/plugin/;/ {// Specifies compatibility with Broadcom BCM2835compatible = "brcm,bcm2835";// Fragment 0: Enables the I2S clock producerfragment@0 {target = <&i2s_clk_producer>;__overlay__ {status = "okay";};};// Fragment 1: Configures the simple-audio-card for SJ-201fragment@1 {target = <&sound>;__overlay__ {compatible = "simple-audio-card";simple-audio-card,name = "sj201";status = "okay";// Capture link configurationcapture_link: simple-audio-card,dai-link@0 {format = "i2s";r_cpu_dai: cpu {sound-dai = <&i2s_clk_producer>;dai-tdm-slot-num = <2>;dai-tdm-slot-width = <32>;};r_codec_dai: codec {sound-dai = <&codec_in>;};};// Playback link configurationplayback_link: simple-audio-card,dai-link@1 {format = "i2s";p_cpu_dai: cpu {sound-dai = <&i2s_clk_producer>;dai-tdm-slot-num = <2>;dai-tdm-slot-width = <32>;};p_codec_dai: codec {sound-dai = <&codec_out>;};};};};// Fragment 2: Configures vocalfusion soundcard controlfragment@2 {target-path = "/";__overlay__ {// SPDIF transmitter configurationcodec_out: spdif-transmitter {#address-cells = <0>;#size-cells = <0>;#sound-dai-cells = <0>;compatible = "linux,spdif-dit";status = "okay";};// SPDIF receiver configurationcodec_in: spdif-receiver {#address-cells = <0>;#size-cells = <0>;#sound-dai-cells = <0>;compatible = "linux,spdif-dir";status = "okay";};};};};
Step to reproduce:
  • build overlay:

    Code:

    dtc -@ -H epapr -O dtb -o xvf3510.dtbo -Wno-unit_address_vs_reg xvf3510.dts
  • Apply overlay:

    Code:

    sudo dtoverlay -v xvf3510
  • Check sound card devices: arecord -l or aplay -l
Expected result:

Code:

aplay -l**** List of PLAYBACK Hardware Devices ****card 0: sj201 [sj201], device 0: fe203000.i2s-dit-hifi dit-hifi-0 [fe203000.i2s-dit-hifi dit-hifi-0]  Subdevices: 1/1  Subdevice #0: subdevice #0
Actual result:

Code:

aplay -l**** List of PLAYBACK Hardware Devices ****
The same sequence works fine on RPI 3/4

Question:
Is there a known issue or limitation with dynamically applying overlays for sound devices on the Raspberry Pi 5 that could be causing this behavior?

Statistics: Posted by BohdanBuinich — Sun Mar 17, 2024 12:35 am



Viewing all articles
Browse latest Browse all 3862

Trending Articles