[PATCH v2 6/6] arm64: dts: ad402: enable audio
From: Jan Dakinevich <hidden>
Date: 2025-03-09 18:21:36
Also in:
linux-amlogic, linux-arm-kernel, linux-sound, lkml
Subsystem:
arm/amlogic meson soc support, the rest · Maintainers:
Neil Armstrong, Kevin Hilman, Linus Torvalds
* playback to speaker
- setup:
$ amixer set "FRDDR_A SINK 1 SEL" "OUT 0"
$ amixer set "FRDDR_A SRC 1 EN" "on"
$ amixer set "TDMOUT_A SRC SEL" "IN 0"
$ amixer set "TOACODEC Source" "I2S A"
$ amixer set "TOACODEC Lane Select" "0"
$ amixer set "TOACODEC EN" "on"
$ amixer set "ACODEC" "70%"
$ amixer set "ACODEC Playback Channel Mode" "Mono"
- usage:
$ aplay -D hw:0,0 -f S16_LE -r 48000 /path/to/sample.wav
* capture from digital mics
- setup:
$ amixer set "TODDR_B SRC SEL" "IN 4"
- usage:
$ arecord -D hw:0,1 -f S32_LE -r 48000 -c 2 -t wav /path/to/sample.wav
* capture from analog mics
- setup:
$ amixer set "TDMIN_A SRC SEL" "IN 3"
$ amixer set "TODDR_A SRC SEL" "IN 0"
$ amixer set "TOACODEC Source" "I2S A"
$ amixer set "TOACODEC Lane Select" "0"
$ amixer set "TOACODEC EN" "on"
$ amixer set "ACODEC ADC" "70%"
$ amixer set "ACODEC ADC Filter" "on"
$ amixer set "ACODEC ADC Filter Mode" "HiFi"
$ amixer set "ACODEC ADC PGA" "50%"
- usage:
$ arecord -D hw:0,2 -f S16_LE -r 48000 -c 2 -t wav /path/to/sample.wav
* capture from TDM loopback
- setup:
$ amixer set "TDMIN_LB SRC SEL" "IN 0"
$ amixer set "TODDR_B SRC SEL" "IN 6"
- usage:
$ arecord -D hw:0,1 -f S16_LE -r 48000 -c 2 -t wav /path/to/sample.wav
or
- setup:
$ amixer set "TDMIN_LB SRC SEL" "IN 0"
$ amixer set "TODDR_A SRC SEL" "IN 6"
- usage:
$ arecord -D hw:0,2 -f S16_LE -r 48000 -c 2 -t wav /path/to/sample.wav
Signed-off-by: Jan Dakinevich <redacted>
Signed-off-by: Dmitry Rokosov <redacted>
---
.../arm64/boot/dts/amlogic/meson-a1-ad402.dts | 110 ++++++++++++++++++
1 file changed, 110 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-a1-ad402.dts b/arch/arm64/boot/dts/amlogic/meson-a1-ad402.dts
index 0d92f5253b64..09a5732f0981 100644
--- a/arch/arm64/boot/dts/amlogic/meson-a1-ad402.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-a1-ad402.dts@@ -9,6 +9,8 @@ #include "meson-a1.dtsi" #include <dt-bindings/thermal/thermal.h> +#include <dt-bindings/gpio/gpio.h> + / { compatible = "amlogic,ad402", "amlogic,a1"; model = "Amlogic Meson A1 AD402 Development Board";
@@ -128,6 +130,98 @@ map1 { }; }; }; + + amplifier: amplifier { + compatible = "simple-audio-amplifier"; + sound-name-prefix = "AMPLIFIER"; + enable-gpios = <&gpio GPIOF_4 GPIO_ACTIVE_HIGH>; + VCC-supply = <&battery_4v2>; + }; + + dmics: dmics { + compatible = "dmic-codec"; + #sound-dai-cells = <0>; + sound-name-prefix = "MIC"; + num-channels = <4>; + wakeup-delay-ms = <50>; + }; + + sound { + compatible = "amlogic,axg-sound-card"; + model = "AD402"; + audio-aux-devs = <&tdmout_a>, + <&lifier>, + <&tdmin_lb>, + <&tdmin_a>; + audio-routing = "TDMOUT_A IN 0", "FRDDR_A OUT 0", + "TDM_A Playback", "TDMOUT_A OUT", + "AMPLIFIER INL", "ACODEC LOLP", + "AMPLIFIER INR", "ACODEC LORP", + + "TODDR_B IN 4", "PDM Capture", + + "TDMIN_LB IN 0", "TDM_A Loopback", + "TODDR_A IN 6", "TDMIN_LB OUT", + "TODDR_B IN 6", "TDMIN_LB OUT", + + "TDMIN_A IN 3", "TDM_A Capture", + "TODDR_A IN 0", "TDMIN_A OUT"; + assigned-clocks = <&clkc_pll CLKID_HIFI_PLL>; + assigned-clock-parents = <0>; + assigned-clock-rates = <1536000000>; + + dai-link-0 { + sound-dai = <&frddr_a>; + }; + + dai-link-1 { + sound-dai = <&toddr_b>; + }; + + dai-link-2 { + sound-dai = <&toddr_a>; + }; + + dai-link-3 { + sound-dai = <&tdmif_a>; + dai-format = "i2s"; + dai-tdm-slot-tx-mask-0 = <1 1>; + dai-tdm-slot-rx-mask-0 = <1 1>; + mclk-fs = <256>; + + codec-0 { + sound-dai = <&toacodec TOACODEC_IN_A>; + }; + + codec-1 { + sound-dai = <&toacodec TOACODEC_CAPTURE_OUT_A>; + }; + }; + + dai-link-4 { + sound-dai = <&toacodec TOACODEC_OUT>; + + codec { + sound-dai = <&acodec>; + }; + }; + + dai-link-5 { + sound-dai = <&toacodec TOACODEC_CAPTURE_IN>; + + codec { + sound-dai = <&acodec>; + }; + }; + + dai-link-6 { + sound-dai = <&pdm>; + + codec { + sound-dai = <&dmics>; + }; + }; + }; }; /* Bluetooth HCI H4 */
@@ -190,3 +284,19 @@ &sd_emmc { vmmc-supply = <&vddao_3v3>; vqmmc-supply = <&vddio_1v8>; }; + +&acodec { + AVDD-supply = <&vddio_1v8>; + lineout-left = "right-inverted"; + lineout-right = "right"; + linein-left = "differential"; + linein-right = "differential"; + micbias = "2.5V"; +}; + +&pdm { + pinctrl-0 = <&pdm_din0_a_pins>, + <&pdm_din1_a_pins>, + <&pdm_dclk_a_pins>; + pinctrl-names = "default"; +};
--
2.34.1