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.

AM335x mapping PCM channels to TDM slots in McASP



Hi

We have a specific configuration for McASP0. We have 32 tdm slots and 32 PCM channels and each slot is 8 bit. we want that channel 1 to be mapped to slot 1, channel 2 be mapped to slot 2, .... channel 32 mapped to slot 32. but when i run aplay to send to only channel 1, data will be send to all slots! i want that all slots be 0 except slot 1. How can i do that?

I'm using linux kernel 3.2.0 and searched in source tree and found snd_soc_dai_set_channel_map function, but there is no code for it in davinci-mcasp.c file.

I will be really thankful if anyone can help me.

  • I will forward this to the software team.
  • Hi,

    You need to define the unsigned int channel_map[8] = {0, 1, 2,........}; in the hw_params function.
    Then you need to call the set_channel_map function, something like:
    ret = snd_soc_dai_set_channel_map(cpu_dai, X, channel_map, X channel_map) //X denotes the number of channels slots.

    You could take a reference from the following mailthread as a reference: mailman.alsa-project.org/.../021159.html
    NOTE that the above link is for a different device, but you could use the logic to modify your code to use snd_soc_dai_set_channel_map().

    Best Regards,
    Yordan
  • Yordan Kovachev said:
    Hi,

    You need to define the unsigned int channel_map[8] = {0, 1, 2,........}; in the hw_params function.
    Then you need to call the set_channel_map function, something like:
    ret = snd_soc_dai_set_channel_map(cpu_dai, X, channel_map, X channel_map) //X denotes the number of channels slots.

    You could take a reference from the following mailthread as a reference: mailman.alsa-project.org/.../021159.html
    NOTE that the above link is for a different device, but you could use the logic to modify your code to use snd_soc_dai_set_channel_map().

    Best Regards,
    Yordan

    Hi

    I found that set_channel_map function is not required in my case, because i don't want to change mapping of pcm channels and tdm slots. the function that i need is copy that is defined in snd_pcm_ops structure. I defined a function called davinci_pcm_copy in davinci-pcm.c file and added a line like below:

    static struct snd_pcm_ops davinci_pcm_ops = {

    ....

    .copy = davinci_pcm_copy,

    };

    the problem is, copy function not called at all because the format of my file is mu_law.

    when i use aplay command this format is handled by pcm_plugin and pcm_mulaw functions in alsa-lib that have different way in alsa-lib and kernel and if i want to copy function in kernel being called i should use standard wav format that uses pcm_hw in alsa-lib.

    How can i resolve this issue?