-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
CAINIAO CNIoT-CORE: use ALSA UCM instead of asound.state #8307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThis change set removes a static ALSA state configuration file for the CAINIAO CNIoT-CORE board and introduces a new ALSA UCM (Use Case Manager) configuration system. It adds two new configuration files: one defining the HiFi audio setup with audio routes, device priorities, and mixer control sequences, and another defining the main board audio configuration with use case and boot sequence settings. The board configuration script is updated to install these new UCM files, create required directories and symbolic links, and provide usage instructions for ALSA UCM. Additionally, a conditional check in the Meson G12B family configuration is consolidated for board-specific U-Boot hooks. Suggested labels
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (5)
💤 Files with no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (4)
✨ Finishing Touches🧪 Generate Unit Tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (5)
packages/bsp/cainiao-cniot-core/cainiao-cniot-core.conf (1)
38-43
: Boot sequence mutes all TDMOUT_A lanes – intentional?
Setting every lane volume to 0 dBFS ≠ 0x00 in Amlogic mixes; value 0 actually mutes them.
If the intent is “unity gain”, use 120 (or whatever the SoC defines as 0 dB) instead of 0.config/sources/families/meson-g12b.conf (1)
24-26
: Nit: use==
for string equality to avoid pattern-matching surprises.-elif [[ $BOARD = khadas-vim3 ]] || [[ $BOARD = cainiao-cniot-core ]]; then +elif [[ $BOARD == khadas-vim3 ]] || [[ $BOARD == cainiao-cniot-core ]]; thenconfig/boards/cainiao-cniot-core.csc (1)
90-107
: Guard against an undefined$destination
and factor out the common UCM path.-function post_family_tweaks_bsp__cainiao-cniot-core() { +function post_family_tweaks_bsp__cainiao-cniot-core() { + : "${destination:?destination rootfs path not set}" + local ucm_dir="${destination}/usr/share/alsa/ucm2/Amlogic/axg-sound-card" install -Dm644 "${SRC}/packages/bsp/cainiao-cniot-core/cainiao-cniot-core-HiFi.conf" \ - "${destination}/usr/share/alsa/ucm2/Amlogic/axg-sound-card/cainiao-cniot-core-HiFi.conf" + "${ucm_dir}/cainiao-cniot-core-HiFi.conf" install -Dm644 "${SRC}/packages/bsp/cainiao-cniot-core/cainiao-cniot-core.conf" \ - "${destination}/usr/share/alsa/ucm2/Amlogic/axg-sound-card/cainiao-cniot-core.conf" + "${ucm_dir}/cainiao-cniot-core.conf" - if [ ! -d "${destination}/usr/share/alsa/ucm2/conf.d/axg-sound-card" ]; then - mkdir -p "${destination}/usr/share/alsa/ucm2/conf.d/axg-sound-card" - fi - ln -sfv /usr/share/alsa/ucm2/Amlogic/axg-sound-card/cainiao-cniot-core.conf \ - "${destination}/usr/share/alsa/ucm2/conf.d/axg-sound-card/cainiao-cniot-core.conf" + install -d "${destination}/usr/share/alsa/ucm2/conf.d/axg-sound-card" + ln -sfv /usr/share/alsa/ucm2/Amlogic/axg-sound-card/cainiao-cniot-core.conf \ + "${destination}/usr/share/alsa/ucm2/conf.d/axg-sound-card/cainiao-cniot-core.conf" }packages/bsp/cainiao-cniot-core/cainiao-cniot-core-HiFi.conf (2)
14-16
: In the verb’sEnableSequence
you explicitly turn HDMI off – could be misleading.Because the HDMI device’s own
EnableSequence
later turns it on again, this double toggle is harmless but adds mixer churn and complicates trace logs. Consider dropping theTOHDMITX Switch off
here and rely solely on the device-level sequences.
24-25
: Maxing outACODEC Playback Volume
(255) risks clipping on the speaker.Typical unity gain on the Amlogic ACODEC is ~192. Unless you have measured headroom, lower this value to preserve dynamic range.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (3)
patch/kernel/archive/meson64-6.12/dt/meson-g12b-a311d-cainiao-cniot-core.dts
is excluded by!patch/**
patch/kernel/archive/meson64-6.15/dt/meson-g12b-a311d-cainiao-cniot-core.dts
is excluded by!patch/**
patch/u-boot/v2025.04/board_cainiao-cniot-core/add-board-cainiao-cniot-core.patch
is excluded by!patch/**
📒 Files selected for processing (5)
config/boards/cainiao-cniot-core.csc
(2 hunks)config/sources/families/meson-g12b.conf
(1 hunks)packages/blobs/asound.state/asound.state.cainiao-cniot-core
(0 hunks)packages/bsp/cainiao-cniot-core/cainiao-cniot-core-HiFi.conf
(1 hunks)packages/bsp/cainiao-cniot-core/cainiao-cniot-core.conf
(1 hunks)
💤 Files with no reviewable changes (1)
- packages/blobs/asound.state/asound.state.cainiao-cniot-core
🔇 Additional comments (1)
packages/bsp/cainiao-cniot-core/cainiao-cniot-core.conf (1)
1-3
: Confirm target userspace ships alsa-lib ≥ 1.2.6 (required by ‘Syntax 4’ UCM files).
UCM v4 files will be ignored by older alsa-lib, falling back to an empty card definition and leaving audio non-functional.#!/usr/bin/env bash # Check that the rootfs pulls in libasound2 >= 1.2.6 fd -e list 'packages' -x grep -H -E 'libasound2.*(1\.2\.[0-5]|1\.1\.)' {} \; || echo "✓ no version pin <1.2.6 detected"
1d9ae00
to
2fafd70
Compare
Description
There is a drawback to configuring audio routing using asound.state. Although you can specify the device of the axg-sound card via commands to output sound to either HDMI or the internal speaker, in a desktop environment, there is only one analog output (defaulting to HDMI). This is because the device actually has only one sound card. By using ALSA UCM to manage sound instances and audio routing, you can freely choose between HDMI or the built-in speaker output in a desktop environment. This is because PipeWire/WirePlumber will parse ALSA UCM and create sinks.
How Has This Been Tested?
build image
boot form usb drive
test sound in CLI and DE
Checklist: