How to use codec "alc5640" on orin devkit

Hi, nvidia teams:
I want to add “alc5640” codec’s support on devkit, I add the following code in device tree:

+#include <audio/tegra-platforms-audio-dai-links.dtsi>
+#include <audio/tegra186-audio-dai-links.dtsi>
+#include <dt-bindings/sound/rt5640.h>

  • / {*
  •    i2c@31e0000 {*
    

+ rt5640: rt5640.8-001c@1c {
+ compatible = “realtek,rt5640”;
+ reg = <0x1c>;
+ clocks = <&bpmp TEGRA234_CLK_AUD_MCLK>;
+ clock-names = “mclk”;
+ realtek,dmic1-data-pin = <RT5640_DMIC1_DATA_PIN_NONE>;
+ realtek,dmic2-data-pin = <RT5640_DMIC2_DATA_PIN_NONE>;
+ realtek,jack-detect-source = <RT5640_JD_SRC_JD2_IN4N>;
+ interrupt-parent = <&tegra_main_gpio>;
+ interrupts = <TEGRA234_MAIN_GPIO(J, 2) GPIO_ACTIVE_HIGH>;
+
+ #sound-dai-cells = <1>;
+ sound-name-prefix = “CVB-RT”;
+
+ status = “okay”;
+ };
+
+ };
+ tegra_sound: sound {
+ compatible = “nvidia,tegra186-ape”;
+ clocks = <&bpmp_clks TEGRA234_CLK_PLLA>,
+ <&bpmp_clks TEGRA234_CLK_PLLA_OUT0>,
+ <&bpmp_clks TEGRA234_CLK_AUD_MCLK>;
+ clock-names = “pll_a”, “pll_a_out0”, “extern1”;
+ assigned-clocks = <&bpmp_clks TEGRA234_CLK_PLLA_OUT0>,
+ <&bpmp_clks TEGRA234_CLK_AUD_MCLK>;
+ assigned-clock-parents = <&bpmp_clks TEGRA234_CLK_PLLA>,
+ <&bpmp_clks TEGRA234_CLK_PLLA_OUT0>;
+
+ nvidia-audio-card,widgets =
+ “Headphone”, “CVB-RT Headphone Jack”,
+ “Microphone”, “CVB-RT Mic Jack”,
+ “Speaker”, “CVB-RT Int Spk”,
+ “Microphone”, “CVB-RT Int Mic”;
+
+ nvidia-audio-card,routing =
+ “CVB-RT Headphone Jack”, “CVB-RT HPOL”,
+ “CVB-RT Headphone Jack”, “CVB-RT HPOR”,
+ “CVB-RT IN1P”, “CVB-RT Mic Jack”,
+ “CVB-RT IN2P”, “CVB-RT Mic Jack”,
+ “CVB-RT Int Spk”, “CVB-RT SPOLP”,
+ “CVB-RT Int Spk”, “CVB-RT SPORP”,
+ “CVB-RT DMIC1”, “CVB-RT Int Mic”,
+ “CVB-RT DMIC2”, “CVB-RT Int Mic”;
+
+ nvidia-audio-card,mclk-fs = <256>;
+ };
+
+};
+&i2s1_to_codec {
+ link-name = “rt5640-playback”;
+ codec {
+ sound-dai = <&rt5640 0>;
+ prefix = “CVB-RT”;

  •    };*
    
  • };*

but when I use “aplay” command to play .wav file, it only play noise. and print an error log:

"[ 86.188104] rt5640 8-001c: ASoC: error at snd_soc_dai_hw_params on rt5640-aif1: -22
[ 86.196146] tegra-asoc: sound: ASoC: PRE_PMU: rt5640-playback-playback event failed: -22"

so does my code has some fault? how to modify it? please give me some suggestion.

Please follow steps captured in Jetson AGX Orin Dev kit analog sound not coming and see if your errors go away.

If above does not work share logs as per Audio Setup and Development — Jetson Linux<br/>Developer Guide 34.1 documentation

Hi, spujar:
Thanks for your support, it can work well now;

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.