This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM5718: Linux: Audio CodecTLV320AIC3206 by using MCASP, SPI

Part Number: AM5718
Other Parts Discussed in Thread: TLV320AIC3206,

Hi,
I'm using SDK-LINUX-AM57X 06_03_00_106 on our custom board.
It has 3 sound devices. All of them are TLV320AIC3206.
One is selected I2C interface, others are SPI.
I2C works good, as shown my post.
e2e.ti.com/.../am5718-linux-am5718-audio-codectlv320aic3206-by-using-mcasp-i2c

SPIs do not work.
Driver is loaded, but can not set parameters in 'amixer' command.

######## Console ########
[   11.126455] of_get_named_gpiod_flags: can't parse 'simple-audio-card,hp-det-gpio' property of node '/sound0[0]'
[   11.126469] of_get_named_gpiod_flags: can't parse 'simple-audio-card,mic-det-gpio' property of node '/sound0[0]'
[   11.224056] asoc-simple-card sound0: tlv320aic32x4-hifi <-> 4847c000.mcasp mapping ok
[   11.270199] asoc-simple-card sound0: ASoC: no DMI vendor name!
[   11.328602] of_get_named_gpiod_flags: can't parse 'simple-audio-card,hp-det-gpio' property of node '/sound1[0]'
[   11.328616] of_get_named_gpiod_flags: can't parse 'simple-audio-card,mic-det-gpio' property of node '/sound1[0]'
[   11.376264] asoc-simple-card sound1: tlv320aic32x4-hifi <-> 48464000.mcasp mapping ok
[   11.419000] asoc-simple-card sound1: ASoC: no DMI vendor name!
[   11.480263] of_get_named_gpiod_flags: can't parse 'simple-audio-card,hp-det-gpio' property of node '/sound2[0]'
[   11.480277] of_get_named_gpiod_flags: can't parse 'simple-audio-card,mic-det-gpio' property of node '/sound2[0]'
[   11.533210] asoc-simple-card sound2: tlv320aic32x4-hifi <-> 48470000.mcasp mapping ok
[   11.541089] asoc-simple-card sound2: ASoC: no DMI vendor name!

root@am57xx-evm:~# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: AM57xSoundCard0 [AM57x-SoundCard0], device 0: davinci-mcasp.0-tlv320aic32x4-hifi tlv320aic32x4-hifi-0 [davinci-mcasp.0-tlv320aic32x4-hifi tlv320aic32x4-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: AM57xSoundCard1 [AM57x-SoundCard1], device 0: davinci-mcasp.0-tlv320aic32x4-hifi tlv320aic32x4-hifi-0 [davinci-mcasp.0-tlv320aic32x4-hifi tlv320aic32x4-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: AM57xSoundCard2 [AM57x-SoundCard2], device 0: davinci-mcasp.0-tlv320aic32x4-hifi tlv320aic32x4-hifi-0 [davinci-mcasp.0-tlv320aic32x4-hifi tlv320aic32x4-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

root@am57xx-evm:~# amixer -c 1 sset 'LOR Output Mixer R_DAC' on
Simple mixer control 'LOR Output Mixer R_DAC',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
root@am57xx-evm:~# amixer -c 1 sget 'LOR Output Mixer R_DAC'   
Simple mixer control 'LOR Output Mixer R_DAC',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]   <==================== Not set
######## End ########

TLV320AIC3206 is Bit and Frame Master.
Hardware connection is as below.

[AM5718]      <->  [TLV320AIC3206]
(McASP2 & SPI3)
spi3_sclk     -->  SCLK
spi3_cs0      -->  /SS
spi3_d0       -->  MOSI
spi3_d1       <--  MISO
gpio3_30      -->  /RESET
mcasp2_axr0   -->  DIN
mcasp2_axr1   <--  DOUT
mcasp2_aclkr  <--  BCLK
mcasp2_fsr    <--  WCLK
<25MHz Osc>   -->  MCLK
(McASP5 & SPI4)
spi4_sclk     -->  SCLK
spi4_cs0      -->  /SS
spi4_d0       -->  MOSI
spi4_d1       <--  MISO
gpio3_31      -->  /RESET
mcasp5_axr0   -->  DIN
mcasp5_axr1   <--  DOUT
mcasp5_aclkx  <--  BCLK
mcasp5_fsx    <--  WCLK
<25MHz Osc>   -->  MCLK


######## tisdk_am57xx-evm_defconfig file ########
CONFIG_SND_SOC_TLV320AIC32X4_SPI=m
######## End ########

######## am571x-idk.dts file ########
/* Sound Card 1 McASP2 SPI3 */
&mcasp2 {
        #sound-dai-cells = <0>;
        status = "okay";
        op-mode = <0>;  /* MCASP_IIS_MODE */
        tdm-slots = <2>;
        /* 4 serializers */
        serial-dir = <  /* 0: INACTIVE, 1: TX, 2: RX */
                1 2 0 0
        >;
        tx-num-evt = <32>;
        rx-num-evt = <32>;
};

&mcspi3 {
        status = "okay";
        ti,pindir-d0-out-d1-in;

        tlv320aic3206_1: codec@0 {
                compatible = "ti,tlv320aic32x6";
                reg = <0>;
                #sound-dai-cells = <0>;
                status = "okay";
                spi-max-frequency = <10000000>;
                spi-cpha;
                reset-gpios = <&gpio5 30 GPIO_ACTIVE_LOW>;
                clock-names = "mclk";
                clocks = <&tlv320_mclk>;
                dv-supply = <&ldo2_reg>;
                av-supply = <&ldo2_reg>;
                iov-supply = <&v3_3d>;
        };
};

/* Sound Card 2 McASP5 SPI4 */
&mcasp5 {
        #sound-dai-cells = <0>;
        status = "okay";
        op-mode = <0>;  /* MCASP_IIS_MODE */
        tdm-slots = <2>;
        /* 4 serializers */
        serial-dir = <  /* 0: INACTIVE, 1: TX, 2: RX */
                1 2 0 0
        >;
        tx-num-evt = <32>;
        rx-num-evt = <32>;
};

&mcspi4 {
        status = "okay";
        ti,pindir-d0-out-d1-in;

        tlv320aic3206_2: codec@0 {
                compatible = "ti,tlv320aic32x6";
                reg = <0>;
                #sound-dai-cells = <0>;
                status = "okay";
                spi-max-frequency = <10000000>;
                spi-cpha;
                reset-gpios = <&gpio5 31 GPIO_ACTIVE_LOW>;
                clock-names = "mclk";
                clocks = <&tlv320_mclk>;
                dv-supply = <&ldo2_reg>;
                av-supply = <&ldo2_reg>;
                iov-supply = <&v3_3d>;
        };
};
######## End ########

Please give me some advice.

Regards,

Toshio Masuchi


  • Hi,

    We gave up on controling SPI. We changed the board to contorol I2C.

    We can set McASP2 and McASP5 parameters by amixer comannd.

    But aplay and arecord do not work. (Input/output error)

    TLV320AIC3206 output BCLK and WCLK correctly.

    It seems that McASP2 and McASP5 do not respond to BCLK or WCLK.

    (McASP8 is good.)

    Please give me some advice.

    Regards,

    Toshio Masuchi