Jump to content

No audio on S905X TV box because device tree doesn't include it


dreamlayers

Recommended Posts

I have an OTT TV Box, model ABOX-A1 ( 1G + 8G, S905X ). Inside it looks very similar to NEXBOX A95X discussed at https://www.savagemessiahzine.com/forum/index.php?showtopic=770346 . It has an analog AV port, with a 3PEAK TPF632A audio line driver on the output. So, all the digital audio stuff is inside the S905X SOC, and maybe some GPIO switches mute of that analog output chip.

 

I first booted Devmfc_Debian-Bookworm_6.1.57-meson64_Minimal-23.10.12.img.xz from https://github.com/devmfc/debian-on-amlogic and had sound on the analog output. (The later Devmfc_Debian-Bookworm_6.6.1-meson64_Minimal-23.11.09.img.xz did not work.) I used its aml-multiboot-setup.sh script to set up automatic boot from USB or SD if they're present, without needing to hold the button in the bottom of the AV port.

 

Then I decided I'd rather run Armbian, and I got Armbian_23.11.1_Aml-s9xx-box_bookworm_current_6.1.63_minimal.img.xz running from a USB drive. (I couldn't run Armbian_23.11.1_Aml-s9xx-box_bookworm_current_6.1.63.img.xz and some others, but I'm not 100% sure that I didn't do something wrong that prevented them from running.) This works fine, except there are absolutely no audio devices, either for HDMI or analog audio. I saw that the kernel modules that seem needed were present, but they weren't loaded and loading them didn't help. I guess they only work if the device tree informs Linux about that hardware being present.  Using grep gx-sound-card /boot/dtb/amlogic/*s905x* I see only meson-gxl-s905x-khadas-vim.dtb, meson-gxl-s905x-libretech-cc.dtb, and meson-gxl-s905x-libretech-cc-v2.dtb contain that. I had had tried meson-gxl-s905x-p212.dtb and meson-gxl-s905x-nexbox-a95x.dtb so far, and neither have sound.

 

Then I found https://github.com/torvalds/linux/commit/7e01e14e9f75385910d1e42f97a5e98f36244967 "arm64: dts: meson: add audio playback to S905X-P212 dts". After applying that patch, rebuilding the .dtb, and rebooting, I got a sound device. I could play audio files, and that took the appropriate amount of time, as if audio was going somewhere, but there was no analog audio output. Then, changing some things via amixer got it to work. These changes must have persisted, because I shut down, removed power, and booted again, and analog audio worked without having to do anything.

 

I am attaching the altered .dtb file, the .dts file with the patch applied, and amixer output showing the current configuration with working analog audio. If you don't get audio, you can diff your amixer output against that output and see what might need to be changed.

 

If you want to build the .dtb file yourself, note that the dtc program cannot handle the C preprocessor include directives found in these files. So, you first need to run them through the C preprocessor, and then you need to run dtc on the preprocessed output. Use something like

cpp -nostdinc -I include -I arch  -undef -x assembler-with-cpp  arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dts ~/p212.dtsp

To obtain the source code, I simply used https://github.com/armbian/build to start a build of a minimal Armbian system, telling it I want to custom configure the kernel. Then when the kernel configuration menu came up, I killed that, knowing all the files I needed were present.

s905x-p212_audio_fix.tar.xz

Link to comment
Share on other sites

Contribute to Armbian FOSS project and win a powerful workstation from Khadas!

Have you tried an armbian build with a kernel newer than 6.1.x?  The upstream patch you mention was incorporated after 6.1 and not back ported to 6.1.  So the fix should be included in mainline (and thus armbian) in any kernel later than the 6.1 lts series.

Link to comment
Share on other sites

I wanted a stable version because I thought that would involve less problems. Replacing the device tree only means replacing a single file and it is an easy fix that should easily persist across updates.

 

I see that the weekly development builds at https://github.com/armbian/community/releases/tag/24.2.0-trunk.103 involving "Aml_s9xx_box" all use 6.1.66 kernel, and the patch is clearly not there: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dts?h=v6.1.66 . It clearly is in 6.6.1 and later: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/arch/arm64/boot/dts/amlogic/meson-gxl-s905x-p212.dts?h=v6.6.1

 

To fix this problem, builds need to either transition to the 6.6 kernel, or add the patch before building the 6.1 kernel.

Link to comment
Share on other sites

If you build from source the 'edge' kernel, you will get 6.6. 

 

36 minutes ago, dreamlayers said:

Replacing the device tree only means replacing a single file and it is an easy fix that should easily persist across updates.

FYI. Device dtb files do not persist across kernel updates,  You will need to reapply for any kernel updates you receive.

Link to comment
Share on other sites

I used a different file name for the fixed dtb: meson-gxl-s905x-p212-sound.dtb. Because of that I don't think it should be overwritten when the kernel is updated.  I don't expect updates to remove the entire directory, but even then, surely there is some space on the boot partition where I can put my custom dtb so it doesn't get deleted.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines