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

91 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

65 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

47 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

23 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