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.

AM625: ti-linux-6.6.58 mcasp: unable to use two rx serializers for codec with dual rate mode

Part Number: AM625
Other Parts Discussed in Thread: PCM3168A

Tool/software:

As codec the pcm3168a is used and connected with DOUT1/2 ports.

Codec configuration:
Format: Left-Justified Mode
Sampling-Rate: 96 kHz
SCKI Rate: 256

The mcasp is configured in 4 Slot TDM mode over two rx serializers.
I would expect to receive all 6 ADC channels from the codec.
However, I'm only able to receive four channels over the first serializer.

$ arecord -f s24_3le -r 96000 -c 6 -D hw:0,0 a.wav
arecord: set_params:1398: Channels count non available

The used device tree:
simple-audio-card,dai-link {
    format = "left_j";
    mclk-fs = <256>;

    cpu {
        bitclock-master;
        frame-master;
        dai-tdm-slot-num = <6>;
        dai-tdm-slot-width = <32>;
        dai-tdm-slot-tx-mask = <0 0 0 0 0 0>;
        dai-tdm-slot-rx-mask = <1 1 1 1 1 1>;
        sound-dai = <&mcasp1>;
    };

    codec {
        clocks = <&audio_refclk0>;
        sound-dai = <&pcm3168a 1>;
    };
};

&mcasp1 {
    pinctrl-names = "default";
    pinctrl-0 = <&mcasp1_pins>;
    op-mode = <0>;
    serial-dir = <  /* 0: INACTIVE, 1: TX, 2: RX */
        2 2 0 0
        0 0 0 0
        0 0 0 0
        0 0 0 0
    >;
    tdm-slots = <4>;
    #sound-dai-cells = <0>;

    /*
     * assign mcasp0 clocks because pcm3168a uses audio_refclk0
     */
    clocks = <&k3_clks 190 0>;
    clock-names = "fck";
    assigned-clocks = <&k3_clks 190 0>;
    assigned-clock-parents = <&k3_clks 190 2>;
    assigned-clock-rates = <24576000>;

    status = "okay";
};

After some digging in the `davinci-mcasp.c` driver I found that I had to set the rx/tx masks but this made the driver complain about mismatched tdm_slot size and mask size.
davinci-mcasp 2b10000.audio-controller: Bad tdm mask tx: 0x00000000 rx: 0x0000003f slots 4

I saw that the `dai-tdm-slot-num` property will overwrite the mcasp `tdm-slots` property. This seems to make it impossible to configure the drive the way I want, so I removed the overwrite.
I read the `dai-tdm-slot-num` property as the total number of required tdm-slots and `tdm-slots` property as the tdm-slots per serializer.
davinci-mcasp.c
-    mcasp->tdm_slots = slots;
+    // mcasp->tdm_slots = slots;

With this patch applied, I was able to record audio from the 6th channel, but the samples were scattered over 3 channels.
This was recorded with a signal generator connected to ADC channel six on the codec.



  • Hi,

    If each ADC is giving you stereo channels on each of the data lines of MCASP, then you would need 3 serializers configured to receive 6 channels. 

    Are you able to capture 4 channel audio since you are configuring 2 serializers? Does arecord command with -c 4 work correctly in the above setup?

    Best Regards,

    Suren