Audio
1. Overview
The audio part of the Omni3576 development board uses the ES8388 driver chip, which is a high-performance, low-power and low-cost audio codec. It includes a 2-channel ADC, a 2-channel DAC, a microphone amplifier, a headphone amplifier, digital sound effects, and analog mixing and gain functions.
2. Sound configuration
-
Check the sound card device
luckfox@luckfox:~$ arecord -l**** List of CAPTURE Hardware Devices ****card 0: rockchipes8388 [rockchip-es8388], device 0: dailink-multicodecs ES8323 HiFi-0 [dailink-multicodecs ES8323 HiFi-0]Subdevices: 1/1Subdevice #0: subdevice #0luckfox@luckfox:~$ aplay -l**** List of PLAYBACK Hardware Devices ****card 0: rockchipes8388 [rockchip-es8388], device 0: dailink-multicodecs ES8323 HiFi-0 [dailink-multicodecs ES8323 HiFi-0]Subdevices: 1/1Subdevice #0: subdevice #0card 1: rockchipdp0 [rockchip-dp0], device 0: rockchip-dp0 spdif-hifi-0 [rockchip-dp0 spdif-hifi-0]Subdevices: 1/1Subdevice #0: subdevice #0 -
Sound card driver directory
luckfox@luckfox:~$ ls /dev/snd/by-path controlC0 controlC1 pcmC0D0c pcmC0D0p pcmC1D0p seq timercontrolC0andcontrolC1: used for sound card control, C0 means sound card 0, C1 means sound card 1, corresponding to the sound output of SOC abovepcmC0D0c: pcm device for recording, the last "c" is the abbreviation of capture, indicating the recording devicepcmC0D0pandpcmC1D0p: pcm device for playback, the last "p" is the abbreviation of playback, indicating the playback device
luckfox@luckfox:~$ ls -l /dev/snd/by-path/total 0lrwxrwxrwx 1 root root 12 Oct 18 10:03 platform-dp0-sound -> ../controlC1lrwxrwxrwx 1 root root 12 Oct 18 10:03 platform-es8388-sound -> ../controlC0
3. Test
-
Recording Test
arecord -Dhw:0,0 -f cd -r 44100 -c 2 -t wav test.wav -
Headphone test (plugging in headphones will automatically switch input and output channels)
设置录音增益:tinymix -D 0 set "Left Channel Capture Volume" 8tinymix -D 0 set "Right Channel Capture Volume" 8设置播放音量:tinymix -D 0 set "Output 1 Playback Volume" 33 33tinymix -D 0 set "Output 2 Playback Volume" 33 33播放:aplay -Dhw:0,0 -t wav /userdata/test.wav录音:arecord -Dhw:0,0 -f cd -r 44100 -c 2 -t wav /userdata/test.wav -
Playback test
aplay -Dhw:0,0 -t wav /userdata/test.wav
4. Device tree Overview
-
The Audio DTS source file has been defined in
kernel-6.10/arch/arm64/boot/dts/rockchip/luckfox-omni3576-codec.dtsi, and we can call it directly./ {es8388_sound: es8388-sound {status = "okay";compatible = "rockchip,multicodecs-card";rockchip,card-name = "rockchip-es8388";rockchip,format = "i2s";rockchip,mclk-fs = <256>;rockchip,cpu = <&sai1>;rockchip,codec = <&es8388>;rockchip,audio-routing ="Headphone", "LOUT1","Headphone", "ROUT1","Speaker", "LOUT1","Speaker", "ROUT1","LINPUT2", "Main Mic","RINPUT2", "Main Mic","LINPUT2", "Headset Mic","RINPUT2", "Headset Mic";};};&i2c2 {status = "okay";es8388: es8388@10 {status = "okay";#sound-dai-cells = <0>;compatible = "everest,es8388", "everest,es8323";reg = <0x10>;clocks = <&mclkout_sai1>;clock-names = "mclk";assigned-clocks = <&mclkout_sai1>;assigned-clock-rates = <12288000>;pinctrl-names = "default";pinctrl-0 = <&sai1m0_mclk>;};};&sai1 {status = "okay";pinctrl-names = "default";pinctrl-0 = <&sai1m0_lrck&sai1m0_sclk&sai1m0_sdi0&sai1m0_sdo0>;};