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.

McAsp AXRn line selection.

Dear All,

In my project I will have both McAsp0 and McAsp1 interfaces running, and each of them will have multiple transmit lines enabled.

I am currently trying to implement a simple version where I have only McAsp1 interface and I want to run 2 or 3 serializers.

I have two amplifiers connected to the same McAsp but different AXRn lines. the problem is that data is always passed to the first serializer that is specified in DT: serial-dir = < 0 1 1 1 >, for both instantiated Amplifiers.

The question is:

How to specify (select) a desired serializer (AXR) for concrete playback device? 

I am running linux 4.1.6 used in processor-sdk-linux-am335x v.02.

DT:

&mcasp1 {
pinctrl-names = "default";
pinctrl-0 = <&mcasp1_pins>;

status = "okay";

op-mode = <0>; 
tdm-slots = <8>;
num-serializer = <4>;
serial-dir = < 0 1 1 1 >;
tx-num-evt = <32>; /* FIFO levels */
rx-num-evt = <32>;
};

sound {

compatible = "ti,tas5720-evm-audio";
ti,model = "TI TAS5720";
ti,audio-codec = <&tas5720_1a
&tas5720_1b>; 
ti,mcasp-controller = <&mcasp1>; 
ti,codec-clock-rate = <24000000>; 
ti,audio-routing = "Speaker", "OUT"; 
};

Looking forward to your replies,

Best regards,

Ilja.

  • Hi Ilja,

    Each serializer (up to 4) is mapped to axr pin, in example serializer0 is mapped to pin axr0. To select McASP1 serializer0 (axr0) for playback (transmit):

    &mcasp1 {
    serial-dir = < 1 x x x >;

    See the below wiki pages for more info:

    processors.wiki.ti.com/index.php
    processors.wiki.ti.com/index.php

    BR
    Pavel
  • Hi Pavel,

    Thank you very much for the reply.

    In your case as well as in the wiki page example only one transmit serializer is used (axr0, serial-dir = < 1 x x x >;)

    But my problem is to have, e.g. three serializers enabled (AXR0, AXR1, AXR2, serial-dir = < 1 1 1 x >;)) and 3 playback devices (hw:0,0, hw:0,1, hw:0,2). 

    The question is how to specify, if I start to play hw:0,1 playback device, to transmit data to AXR1 line.???

    Currently, all playback devices I use, transmit data to AXR0 line, or to the one which is the first one specified as TX in serial-dir = < 0 0 1 1> (AXR2 in this case.).

    BR,

    Ilja.

  • Hi Ilja,

    I do not think hw:0,0 correspond to AXR0, hw:0,1 to AXR1 and hw0:2 to AXR2.

    hw:0,0 is card 0, device 0 - which can be McASP0/1/2, this is not AXR0

    hw:0,1 is card 0, device 1 - which can be McASP0/1/2, this is not AXR1

    hw:0,2 is card 0, device 2 - which can be mcASP0/1/2, this is not AXR2

    The first number is the number of the soundcard, the second number is the number of the device. use "aplay -l" or "arecord -l" to get list of available audio devices

    BR
    Pavel

  • Hi Pavel,

    Yes this is clear that this hw:0,0 corresponds to card 0 and device 0. What changes I have to apply, in device tree or platform driver or machine driver to make a usecase where: "When I play hw:0,0" it sends data to AXR3, and when I play, for example" hw:0,2 send data to AXR0.
    The problem is:
    Currently I have instantiated hw0,0 and hw:0,1 but both of them send data to AXR0. I need one of them to send data to different AXR.

    BR,
    Ilja.
  • Ilja,

    Usually when you play hw0:1, it should send/play/transmit data on all the serializers configured for transmit.

    To configure hw0:1 to send data to AXR1 only, configure AXR0/2/3 to inactive/receive.

    BR
    Pavel
  • This is something I also expected,but:

    When I do serial-dir = < 1 1 0 0>; I can see data coming only on AXR0 line,
    If I do serial-dir = < 0 1 1 0 >; I can see data comming only on AXR1 line.

    Any ideas what could be wrong here?

    BR,
    Ilja.
  • Ilja,

    Are you using TI EVM or custom board?

    See if the below e2e threads will be in help:

    e2e.ti.com/.../1303015
    e2e.ti.com/.../1294292

    BR
    Pavel
  • Pavel,

    I have tried already different combinations of different pins and AXR lines for McAsp, always plays the first active serializer and it is the only one filled with data.

    Unfortunatelly, I am using a custom board right now, and it doesn't look like it is hardware problems, because all the serializers work, but only separatelly and only the first one which is set to be active.

    The threads you sent me doesn't give any solution for me, the posts there are also pretty old once on old kernel versions.

    King regards,
    Ilja.
  • Ilja,

    There was similar request for J5Eco device, see the below e2e thread, you can find something you can apply on the AM335x:

    e2e.ti.com/.../1646924

    BR
    Pavel
  • See also something similar from the Sitara forum:

    e2e.ti.com/.../456196
    e2e.ti.com/.../285775
    e2e.ti.com/.../470497

    BR
    Pavel
  • Unfortunatelly still no luck with that.

    There should be something in the linux platform or machine driver that is responsible for the AXR pins.
    I will keep digging, but if you have any more suggestions, then looking forward to hear from you about them.

    Best regards,
    Ilja.
  • Ilja,

    I would suggest you to make McASP module and pinmux register dump and compare between the cases. There should be a difference.

    BR
    Pavel
  • Hi Pavel,

    I followed you advise and made a memory dump (see attached file).

    One problem was that: when I use mem_utils or devmem2 while audio is not played I get Bus Error message. so file contains registers dump when audio is running.

    Some observations I have found:

    1. SRCTL0 is only active for serializer 0, another one is inactive. If I try to activate that while I an running I get a lot of underrrun messages and data on AXR1 still missing.

    2. WFIFOCTL register shows only one write word count per DMA event (32-bit). And there is a comment in technical reference manual that this number must be equal to number of serializers. So either the davinci-mcasp.c configures this number wrong way, or there is something I am missing in my configuration.

    Looking forward to your comment,

    King regards,

    Ilja.

    6052.McAsp_Reg_dump.txt

  • UPDATE:

    A file davinci-mcasp.c has a function mcasp_common_hw_param
    This function contains this line.
    u8 max_active_serializers = (channels + slots - 1) / slots;
    This gives a max_active_serializer value 1 and it limits the number of serializers that can be activated:
    here is my printouts from this place: max_ser=1, chann=8, slots=8, per_words = 4096.

    I am not sure what channels parameter stands for, maybe this is the problem?
    At the same time I don't want to increase slots number. And eventually I want to have different data on every serializer. Is that doable?

    King regards,
    Ilja.
  • Hi Ilja,

    We have something similar in the below e2e thread (already provided to you), please have a look again:

    e2e.ti.com/.../1667368

    BR
    Pavel