imx8 sai2 interface edma0 configuration missing in current dtsi?

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

imx8 sai2 interface edma0 configuration missing in current dtsi?

1,522 Views
maxipenna
Contributor III

Hi,

I'm using a i.MX 8QuadXPlus on a custom board. I'm having problems using a custom

audio card driver, which uses sai2 peripheral (rx only).

The error I'm getting is:

fsl-sai 59060000.sai: ASoC: can't open platform 59060000.sai: -6

I've found this error (ENXIO) to be generated from

snd_dmaengine_pcm_open(substream, chan)

function called in imx-pcm-dma-v2.c while opening pcm stream.

Since I think it's a dma related problem, I've looked into fsl-imx8dx.dtsi and it seems that edma0 definition is missing 

sai2 and sai3 configuration, so I've added it on my own, but I'm getting the same error again and again.

I'm using linux-imx 4.9.88-r0 from codeaurora.org.

Tags (4)
0 Kudos
2 Replies

1,066 Views
maxipenna
Contributor III

I've solved the platform error, it was missing configuration for channels 16 and 17 into edma0 definition into dtsi

edma0: dma-controller@591F0000 {
compatible = "fsl,imx8qm-edma";
reg = <0x0 0x59200000 0x0 0x10000>, /* asrc0 */
<0x0 0x59210000 0x0 0x10000>,
<0x0 0x59220000 0x0 0x10000>,
<0x0 0x59230000 0x0 0x10000>,
<0x0 0x59240000 0x0 0x10000>,
<0x0 0x59250000 0x0 0x10000>,
<0x0 0x59260000 0x0 0x10000>, /* esai0 rx */
<0x0 0x59270000 0x0 0x10000>, /* esai0 tx */
<0x0 0x59280000 0x0 0x10000>, /* spdif0 rx */
<0x0 0x59290000 0x0 0x10000>, /* spdif0 tx */
<0x0 0x592c0000 0x0 0x10000>, /* sai0 rx */
<0x0 0x592d0000 0x0 0x10000>, /* sai0 tx */
<0x0 0x592e0000 0x0 0x10000>, /* sai1 rx */
<0x0 0x592f0000 0x0 0x10000>, /* sai1 tx */
<0x0 0x59300000 0x0 0x10000>, /* sai2 rx */
<0x0 0x59310000 0x0 0x10000>, /* sai3 rx */
<0x0 0x59350000 0x0 0x10000>,
<0x0 0x59370000 0x0 0x10000>;
#dma-cells = <3>;
shared-interrupt;
dma-channels = <18>;
interrupts = <GIC_SPI 374 IRQ_TYPE_LEVEL_HIGH>, /* asrc 0 */
<GIC_SPI 375 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 376 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 377 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 378 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 379 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 410 IRQ_TYPE_LEVEL_HIGH>, /* esai0 */
<GIC_SPI 410 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 457 IRQ_TYPE_LEVEL_HIGH>, /* spdif0 */
<GIC_SPI 459 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 315 IRQ_TYPE_LEVEL_HIGH>, /* sai0 */
<GIC_SPI 315 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 317 IRQ_TYPE_LEVEL_HIGH>, /* sai1 */
<GIC_SPI 317 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 319 IRQ_TYPE_LEVEL_HIGH>, /* sai2 */
<GIC_SPI 324 IRQ_TYPE_LEVEL_HIGH>, /* sai3 */
<GIC_SPI 391 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 393 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "edma0-chan0-rx", "edma0-chan1-rx", /* asrc0 */
"edma0-chan2-rx", "edma0-chan3-tx",
"edma0-chan4-tx", "edma0-chan5-tx",
"edma0-chan6-rx", "edma0-chan7-tx", /* esai0 */
"edma0-chan8-rx", "edma0-chan9-tx", /* spdif0 */
"edma0-chan12-rx", "edma0-chan13-tx", /* sai0 */
"edma0-chan14-rx", "edma0-chan15-tx", /* sai1 */
"edma0-chan16-rx", /* sai2 */
"edma0-chan17-rx", /* sai3 */
"edma0-chan21-tx", /* gpt5 */
"edma0-chan23-rx"; /* gpt7 */
status = "okay";
};

the parts with sai2 and sai3 configuration are the ones added by me. Now when using arecord on the sound card the dma channel is assigned properly but I'm still working on this issue

arecord -d 3 -f dat -t wav -D hw:2,0 ngtcuaudiobt.wav         
[ 2170.416343] ASoC: snd-soc-dummy-dai <-> 59060000.sai info:             
[ 2170.421871] ASoC: rate mask 0x1ffe              
[ 2170.425327] ASoC: min ch 1 max ch 32              
[ 2170.428941] ASoC: min rate 8000 max rate 192000              
Recording WAVE 'ngtcuaudiobt.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo arecord: pcm_read:2143: read error: Input/output error

1,066 Views
m_syed_ahmed
Contributor III

Hi Massimo,

We also needs to use SAI2 interface for communication. we were facing the same platform error you were facing. Then, We have modified fsl-imx8dx.dtsi as follows, but we are still getting that platform error. Can you please share what other files you changed for SAI2 interface to work.

<0x0 0x592d0000 0x0 0x10000>, / sai0 tx /
<0x0 0x592e0000 0x0 0x10000>, / sai1 rx /
<0x0 0x592f0000 0x0 0x10000>, / sai1 tx /
+ <0x0 0x59300000 0x0 0x10000>, / sai2 rx /
+ <0x0 0x59310000 0x0 0x10000>, / sai3 rx /
<0x0 0x59350000 0x0 0x10000>,
<0x0 0x59370000 0x0 0x10000>;
#dma-cells = <3>;
shared-interrupt;
- dma-channels = <16>;
+ dma-channels = <18>;
interrupts = <GIC_SPI 374 IRQ_TYPE_LEVEL_HIGH>, / asrc 0 /
<GIC_SPI 375 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 376 IRQ_TYPE_LEVEL_HIGH>,
@@ -2813,6 +2815,8 @@
<GIC_SPI 315 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 317 IRQ_TYPE_LEVEL_HIGH>, / sai1 /
<GIC_SPI 317 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 319 IRQ_TYPE_LEVEL_HIGH>, / sai2 /
+ <GIC_SPI 324 IRQ_TYPE_LEVEL_HIGH>, / sai3 /
<GIC_SPI 391 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 393 IRQ_TYPE_LEVEL_HIGH>;
interrupt-names = "edma0-chan0-rx", "edma0-chan1-rx", / asrc0 /
@@ -2822,6 +2826,8 @@
"edma0-chan8-rx", "edma0-chan9-tx", / spdif0 /
"edma0-chan12-rx", "edma0-chan13-tx", / sai0 /
"edma0-chan14-rx", "edma0-chan15-tx", / sai1 /
+ "edma0-chan16-rx", / sai2 /
+ "edma0-chan17-rx", / sai3 /
"edma0-chan21-tx", / gpt5 /
"edma0-chan23-rx"; / gpt7 /
status = "okay";

0 Kudos