SAI driver TDM slot shuffling

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SAI driver TDM slot shuffling

3,805 Views
rajeshkorabandi
Contributor I

Hi All,

I am seeing an issue with TDM data slot mapping in my Audio system.

in my System the IMX8 is transferring the data to Audio Card over SAI interface.

the Audio card has 8-TDM lines and 2-slots per TDM line.

i am seeing different TDM line allocation and TDM slots for the same channel when the number of channels programmed in alsa is different

when i have a 4-channel design , i set the number of channels to alsa to 4 through alsa API. In this case the TDM line number and TDM slot number are allocated like the following.

Audio Card Channel

TDM Line Number

TDM Slot Number

0

0

0

1

1

0

2

0

1

3

1

1

 

In case of 16-channel design . i set the number of channels to alsa to 16 through alsa API. In this case the TDM line number and TDM slot number are allocated like the following .

 

Audio Card Channel

TDM Line Number

TDM Slot Number

0

0

0

1

1

0

2

2

0

3

3

0

4

4

0

5

5

0

6

6

0

7

7

0

8

0

1

9

1

1

10

2

1

11

3

1

12

4

1

13

5

1

14

6

1

15

7

1

 

As you can see The TDM line Allocation for channels are different in different scenarios.

in 4-channel design

channel 2  is allocated to TDM line 0 and TDM slot-1

in 16-channel design

Channel 2 is allocated to TDM line 2 and TDM slot-0

this discrepancy is causing a problem when i dynamically change the number of channels in alsa.

i want to see the SAI driver allocation like this

CPU Card Channel

TDM Line Number

TDM Slot Number

0

0

0

1

0

1

2

1

0

3

1

1

4

2

0

5

2

1

6

3

0

7

3

1

8

4

0

9

4

1

10

5

0

11

5

1

12

6

0

13

6

1

14

7

0

15

7

1

 

Could you someone suggest me how to get this allocation in the fsl_sai.c driver ?

0 Kudos
Reply
6 Replies

3,755 Views
JorgeCas
NXP TechSupport
NXP TechSupport

Hello,

I apologize for the delayed reply.

Our documentation does not show how are configured audio channels on TDM line/slot. On reference manual, it is described an example for 8 channels:

JorgeCas_0-1721332239600.png

On source code, is mentioned here. But is not too clear about how is done.

Could you please share me which OS version and processor are you using?

Best regards.

0 Kudos
Reply

3,738 Views
rajeshkorabandi
Contributor I
Thank you Jorge .

Here is the configuration

Linux version -
4.14.98imx_4.14.98_2.0.0

CPU - imx8MM
0 Kudos
Reply

3,650 Views
JorgeCas
NXP TechSupport
NXP TechSupport

Hello,

According to internal team, this is defined on device tree:

dai-tdm-slot-tx-mask : Transmit direction slot mask, optional
dai-tdm-slot-rx-mask : Receive direction slot mask, optional

There is a .of_xlate_tdm_slot_mask() to specify an explicit mapping of the channels and the slots. If it's absent the default snd_soc_of_xlate_tdm_slot_mask() will be used to generating the tx and rx masks.

Best regards.

0 Kudos
Reply

3,644 Views
rajeshkorabandi
Contributor I
Thank you. i will make changes in the kernel and update you with my results
0 Kudos
Reply

3,734 Views
JorgeCas
NXP TechSupport
NXP TechSupport

Hello,

Thank you for the information, as I mentioned before, is not too clear in documentation how this is configured. I will check internally where is configured or if it is hardcoded to move forward on this matter.

I will update you as soon as possible.

Best regards.

0 Kudos
Reply

3,768 Views
rajeshkorabandi
Contributor I

can someone help with this problem?

0 Kudos
Reply