imx95 19x19 board using codec as master example

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

imx95 19x19 board using codec as master example

89 Views
andyhuang_msi
Contributor I

Hi everyone:

Our project using TI's codec 6PAIC3104IRHBRQ1.

BCLK, WCLK, DIN and DOUT are connected to SAI3 module of soc.

But the MCLK is connected to external Oscillator, OSC-24MHZ30_S-HF instead of SAI3 module of soc.

In this condition, the master CLK is provided by codec not by SAI3 module of soc.

I would like to ask if anyone could provide dts example of master CLK provided by codec. 

If necessary, I could provide my patch for review.

 

 

0 Kudos
Reply
3 Replies

63 Views
JorgeCas
NXP TechSupport
NXP TechSupport

Hello,

Unfortunately this CODEC is not supported by default on our BSP and there is no a guide to port it. The references we have are the i.MX porting guide.

My recommendation is declare the fixed clock configuration in CODEC side as follows:

codec_mclk: codec_mclk {
        compatible = "fixed-clock";
        #clock-cells = <0>;
        clock-frequency = <24000000>;
};

And use this properties to configure you CODEC as master, for example:

simple-audio-card,bitclock-master = <&dailink_codec>;
simple-audio-card,frame-master = <&dailink_codec>;

Best regards.

0 Kudos
Reply

45 Views
andyhuang_msi
Contributor I

@JorgeCas 

Thanks for your reply.

I found the codec driver of TI audio codec on imx95  bsp: 

vendor/nxp-opensource/kernel_imx/sound/soc/codecs/tlv320aic3x.c

vendor/nxp-opensource/kernel_imx/sound/soc/codecs/tlv320aic3x-i2c.c

 

I modify defconfig file(arch/arm64/configs/imx95_gki.fragment) to add two drivers into compile:

+CONFIG_SND_SOC_TLV320AIC3X=m
+CONFIG_SND_SOC_TLV320AIC3X_I2C=m      

device/nxp/imx9/evk_95/SharedBoardConfig.mk

BOARD_VENDOR_KERNEL_MODULES += \

+ $(KERNEL_OUT)/sound/soc/codecs/snd-soc-tlv320aic3x.ko \
+ $(KERNEL_OUT)/sound/soc/codecs/snd-soc-tlv320aic3x-i2c.ko \

 

I also take your suggestion and modify dts.

The attached files containing modified dts, imx95-19x19-evk.dts and patch, imx95_evk_dts.patch.

The following section details the changes and their purposes.

(1)&sai3, pinctrl_sai3, pinctrl_sai3_sleep:

      BCLK, WCLK, DIN and DOUT gpio of audio codec connect to SAI3 module of soc.

      MCLK gpio not connected to soc and comment.

(2)codec_mclk: codec-mclk

 add a fixed clock as suggestion

(3)tlv320aic3x: tlv320aic3x@18

audio codec driver node

clocks = <&codec_mclk>;   reference to fixed clock codec_mclk

(4)sound-tlv320aic3x

dai connection of sai3 module of soc and TI audio codec

 simple-audio-card,bitclock-master and simple-audio-card,frame-master reference dailink_master_codec as master.

The dailink_master_codec set clocks to fixed clock codec_mclk。

 

I prepare three audio wav files and use tinyplay to test speaker of audio codec.

Although no error messages happened during test prieod of the three wav files, I cannot hear the audio.

ex:

tinyplay /sdcard/rhj08-s3gh1_2.wav -D 2

Playing sample: 2ch, 48000 hz, 16bit 1414376 bytes
Draining... Wait 85333 us

 

I also use some commands, i2cdetect, lsmod, cat /proc/asound/cards , tinypcminfo -D 2, cat /sys/kernel/debug/clk/clk_summary | grep "codec-mclk" and tinyplay command to test the audio codec.

The results are listed in the attached file, audio_test_commands_results.txt.

 

I would like to ask if  any suggestion about current dts or linux command to check status of audio codec?

 

 

 

 

0 Kudos
Reply

21 Views
JorgeCas
NXP TechSupport
NXP TechSupport

Hello,

Thank you for the update.

Please try to change the clock configuration as is in commented SAI3 node:

assigned-clock-rates = <3932160000>,
    <3612672000>, <393216000>,
    <361267200>, <12288000>;

If possible please confirm if there are activity in SAI signals when sound should be playing.

Also, I suggest you confirm if the audio routing is according to the outputs you are using.

Could you please share your dmesg?

Best regards.

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2376807%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3Eimx95%2019x19%20board%20using%20codec%20as%20master%20example%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2376807%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20everyone%3A%3C%2FP%3E%3CP%3EOur%20project%20using%20TI's%20codec%26nbsp%3B6PAIC3104IRHBRQ1.%3C%2FP%3E%3CP%3EBCLK%2C%26nbsp%3BWCLK%2C%26nbsp%3BDIN%20and%26nbsp%3BDOUT%20are%20connected%20to%20SAI3%20module%20of%20soc.%3C%2FP%3E%3CP%3EBut%20the%26nbsp%3BMCLK%20is%20connected%20to%20external%26nbsp%3BOscillator%2C%20OSC-24MHZ30_S-HF%20instead%20of%20SAI3%20module%20of%20soc.%3C%2FP%3E%3CP%3EIn%20this%20condition%2C%20the%20master%20CLK%20is%20provided%20by%20codec%20not%20by%20SAI3%20module%20of%20soc.%3C%2FP%3E%3CP%3EI%20would%20like%20to%20ask%20if%20anyone%20could%20provide%20dts%20example%20of%20master%20CLK%20provided%20by%20codec.%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20necessary%2C%20I%20could%20provide%20my%20patch%20for%20review.%3C%2FP%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2377666%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20imx95%2019x19%20board%20using%20codec%20as%20master%20example%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2377666%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%2C%3C%2FP%3E%0A%3CP%3EThank%20you%20for%20the%20update.%3C%2FP%3E%0A%3CP%3EPlease%20try%20to%20change%20the%20clock%20configuration%20as%20is%20in%20commented%20SAI3%20node%3A%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-c%22%3E%3CCODE%3Eassigned-clock-rates%20%3D%20%26lt%3B3932160000%26gt%3B%2C%0A%20%20%20%20%26lt%3B3612672000%26gt%3B%2C%20%26lt%3B393216000%26gt%3B%2C%0A%20%20%20%20%26lt%3B361267200%26gt%3B%2C%20%26lt%3B12288000%26gt%3B%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EIf%20possible%20please%20confirm%20if%20there%20are%20activity%20in%20SAI%20signals%20when%20sound%20should%20be%20playing.%3C%2FP%3E%0A%3CP%3EAlso%2C%20I%20suggest%20you%20confirm%20if%20the%20audio%20routing%20is%20according%20to%20the%20outputs%20you%20are%20using.%3C%2FP%3E%0A%3CP%3ECould%20you%20please%20share%20your%20dmesg%3F%3C%2FP%3E%0A%3CP%3EBest%20regards.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2377206%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20imx95%2019x19%20board%20using%20codec%20as%20master%20example%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2377206%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F203308%22%20target%3D%22_blank%22%3E%40JorgeCas%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20for%20your%20reply.%3C%2FP%3E%3CP%3EI%20found%20the%20codec%20driver%20of%20TI%20audio%20codec%20on%20imx95%26nbsp%3B%20bsp%3A%26nbsp%3B%3C%2FP%3E%3CP%3Evendor%2Fnxp-opensource%2Fkernel_imx%2Fsound%2Fsoc%2Fcodecs%2Ftlv320aic3x.c%3C%2FP%3E%3CP%3Evendor%2Fnxp-opensource%2Fkernel_imx%2Fsound%2Fsoc%2Fcodecs%2Ftlv320aic3x-i2c.c%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EI%20modify%20defconfig%20file(arch%2Farm64%2Fconfigs%2Fimx95_gki.fragment)%20to%20add%20two%20drivers%20into%20compile%3A%3C%2FP%3E%3CP%3E%2BCONFIG_SND_SOC_TLV320AIC3X%3Dm%3CBR%20%2F%3E%2BCONFIG_SND_SOC_TLV320AIC3X_I2C%3Dm%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%3C%2FP%3E%3CP%3Edevice%2Fnxp%2Fimx9%2Fevk_95%2FSharedBoardConfig.mk%3C%2FP%3E%3CP%3EBOARD_VENDOR_KERNEL_MODULES%20%2B%3D%20%5C%3C%2FP%3E%3CP%3E%2B%20%24(KERNEL_OUT)%2Fsound%2Fsoc%2Fcodecs%2Fsnd-soc-tlv320aic3x.ko%20%5C%3CBR%20%2F%3E%2B%20%24(KERNEL_OUT)%2Fsound%2Fsoc%2Fcodecs%2Fsnd-soc-tlv320aic3x-i2c.ko%20%5C%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EI%20also%20take%20your%20suggestion%20and%20modify%20dts.%3C%2FP%3E%3CP%3EThe%20attached%20files%20containing%20modified%20dts%2C%26nbsp%3Bimx95-19x19-evk.dts%20and%20patch%2C%26nbsp%3Bimx95_evk_dts.patch.%3C%2FP%3E%3CP%3EThe%20following%20section%20details%20the%20changes%20and%20their%20purposes.%3C%2FP%3E%3CP%3E(1)%26amp%3Bsai3%2C%20pinctrl_sai3%2C%20pinctrl_sai3_sleep%3A%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20BCLK%2C%20WCLK%2C%20DIN%20and%20DOUT%20gpio%20of%20audio%20codec%20connect%20to%20SAI3%20module%20of%20soc.%3C%2FP%3E%3CP%3E%26nbsp%3B%20%26nbsp%3B%20%26nbsp%3B%20MCLK%20gpio%20not%20connected%20to%20soc%20and%20comment.%3C%2FP%3E%3CP%3E(2)codec_mclk%3A%20codec-mclk%3C%2FP%3E%3CP%3E%26nbsp%3Badd%20a%20fixed%20clock%20as%20suggestion%3C%2FP%3E%3CP%3E(3)tlv320aic3x%3A%20tlv320aic3x%4018%3C%2FP%3E%3CP%3Eaudio%20codec%20driver%20node%3C%2FP%3E%3CP%3Eclocks%20%3D%20%26lt%3B%26amp%3Bcodec_mclk%26gt%3B%3B%26nbsp%3B%20%26nbsp%3Breference%20to%26nbsp%3Bfixed%20clock%26nbsp%3Bcodec_mclk%3C%2FP%3E%3CP%3E(4)sound-tlv320aic3x%3C%2FP%3E%3CP%3Edai%20connection%20of%20sai3%20module%20of%20soc%20and%20TI%20audio%20codec%3C%2FP%3E%3CP%3E%26nbsp%3Bsimple-audio-card%2Cbitclock-master%20and%26nbsp%3Bsimple-audio-card%2Cframe-master%20reference%26nbsp%3Bdailink_master_codec%20as%20master.%3C%2FP%3E%3CP%3EThe%26nbsp%3Bdailink_master_codec%20set%20clocks%20to%20fixed%20clock%26nbsp%3Bcodec_mclk%E3%80%82%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EI%20prepare%20three%20audio%20wav%20files%20and%20use%20%3CSTRONG%3Etinyplay%3C%2FSTRONG%3E%20to%20test%20speaker%20of%20audio%20codec.%3C%2FP%3E%3CP%3EAlthough%20%3CSTRONG%3Eno%20error%20messages%3C%2FSTRONG%3E%20happened%20during%20test%20prieod%20of%20the%20three%20wav%20files%2C%20%3CSTRONG%3EI%20cannot%20hear%20the%20audio%3C%2FSTRONG%3E.%3C%2FP%3E%3CP%3Eex%3A%3C%2FP%3E%3CP%3Etinyplay%20%2Fsdcard%2Frhj08-s3gh1_2.wav%20-D%202%3C%2FP%3E%3CP%3EPlaying%20sample%3A%202ch%2C%2048000%20hz%2C%2016bit%201414376%20bytes%3CBR%20%2F%3EDraining...%20Wait%2085333%20us%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EI%20also%20use%20some%20commands%2C%20i2cdetect%2C%20lsmod%2C%26nbsp%3Bcat%20%2Fproc%2Fasound%2Fcards%20%2C%26nbsp%3Btinypcminfo%20-D%202%2C%26nbsp%3Bcat%20%2Fsys%2Fkernel%2Fdebug%2Fclk%2Fclk_summary%20%7C%20grep%20%22codec-mclk%22%20and%26nbsp%3Btinyplay%20command%20to%20test%20the%20audio%20codec.%3C%2FP%3E%3CP%3EThe%20results%20are%20listed%20in%20the%20attached%20file%2C%26nbsp%3Baudio_test_commands_results.txt.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CSTRONG%3EI%20would%20like%20to%20ask%20if%26nbsp%3B%20any%20suggestion%20about%20current%20dts%20or%20linux%20command%20to%20check%20status%20of%20audio%20codec%3F%3C%2FSTRONG%3E%3C%2FP%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2377043%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20imx95%2019x19%20board%20using%20codec%20as%20master%20example%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2377043%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%2C%3C%2FP%3E%0A%3CP%3EUnfortunately%20this%20CODEC%20is%20not%20supported%20by%20default%20on%20our%20BSP%20and%20there%20is%20no%20a%20guide%20to%20port%20it.%20The%20references%20we%20have%20are%20the%20%3CA%20href%3D%22https%3A%2F%2Fwww.nxp.com%2Fdocs%2Fen%2Fuser-guide%2FUG10165.pdf%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ei.MX%20porting%20guide%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3EMy%20recommendation%20is%20declare%20the%20fixed%20clock%20configuration%20in%20CODEC%20side%20as%20follows%3A%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-c%22%3E%3CCODE%3Ecodec_mclk%3A%20codec_mclk%20%7B%0A%20%20%20%20%20%20%20%20compatible%20%3D%20%22fixed-clock%22%3B%0A%20%20%20%20%20%20%20%20%23clock-cells%20%3D%20%26lt%3B0%26gt%3B%3B%0A%20%20%20%20%20%20%20%20clock-frequency%20%3D%20%26lt%3B24000000%26gt%3B%3B%0A%7D%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EAnd%20use%20this%20properties%20to%20configure%20you%20CODEC%20as%20master%2C%20for%20example%3A%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-c%22%3E%3CCODE%3Esimple-audio-card%2Cbitclock-master%20%3D%20%26lt%3B%26amp%3Bdailink_codec%26gt%3B%3B%0Asimple-audio-card%2Cframe-master%20%3D%20%26lt%3B%26amp%3Bdailink_codec%26gt%3B%3B%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3EBest%20regards.%3C%2FP%3E%3C%2FLINGO-BODY%3E