MT7628 DMA buswidth issue when playing WAV file

Hi,

We are using Mediatek MT7628AN ver:1 ECO-2 based SKYLAB EVB with LEDE 17.01.2 ( 4.4 kernel) SDK. We have enabled the ALSA and sound drivers to play WAV file by configuring the I2S pins as PCM interface. When we play the a wave file like below.. we are seeing GDMA errors saying " gdma: only support 4 byte buswidth" and the WAV file play termintate with errors.. ( see below ). Please let us know how to support 16 bit GDMA transfers ( GDMA being used to transfer the PCM data from ALSA to external CODEC) over PCM enabled I2S pins.

aplay -D plughw:1,0 /etc/config/8k16bitpcm.wav
Playing WAVE '/etc/config/8k16bi[ 1013.839294] BITS1: 16, buswidth1: 2
tpcm.wav' : Sign
[ 1013.847645] gdma-rt2880 10002800.gdma: only support 4 byte buswidth
ed 16 bit Little
[ 1013.862797] mt7628-pcm 10002000.pcm: ASoC: 10002000.pcm hw params failed: -22
Endian, Rate 8000 Hz, Mono
aplay: set_params:1297: Unable to install hw params:

Thanks,
Sai

1 Like

You can't.
You must use 4 bytes for each DMA transfer.

So the real problem is in your I2S or PCM interface driver.

Thanks for the information ElektromAn..
We will check from the I2S/PCM interface driver. The requirement is that.. on the other side of CPU, which is the CODED only supports 16 bit PCM. So, do you suggest to club two 16bit samples in one 32 bit src/dst DMA address to do DMA?

Regards,
Sai

A quick look at the data sheet suggests that I2S data can be 24 or 16 bits. The 32 byte FIFO buffer can use either direct writes or GDMA. The register is one word (wide). Stereo sound is accomplished by alternating 1 word left, then 1 word right based on the WS signal (Word Select line).

GDMA channel 2 (tx) and 3 (rx) seem to be assigned to I2S.

Hi drbrains,

Thanks for the response.. Our requirement is to use only PCM interface( not I2S) on MT7628, since the CODEC only supports 13 bit PCM . So we are trying to play 16bit Mono Wave file. GDMA for PCM is TX- 6, and RX-4 . Aplay is setting the format as 16 bit LE. But the DMA driver throwing the below error. (saying only support 32 bit buswidth )

gdma-rt2880 10002800.gdma: only support 4 byte buswidth
mt7628-pcm 10002000.pcm: ASoC: 10002000.pcm hw params failed: -22

We are seeing for the ways of playing 16bit Mono wave file using 32 bit DMA on Mt7628.

Thanks,
Sai

I think you don't understand DMA ...

Fill your data as needed for 16Bit Mono, into a dword.
Maybe you must pack the data, i.e. 2 * 16Bit samples into one dword.
The datasheet is bluerred in this section,
I assume the first sample is for bit 0-15 and the second is bit 16-31

Thanks for the information ElektromAn..

Since we are using aplay to play a WAV file.. we have to see at which layer we need this 16 bit packing into 32 bit data. Probably we have to do this at around ALSA layer before we give the buffer to DMA. Let us know any existing implementation which is used for PCM interface.

Also.. any particular reason.. the PCM interface driver is not available/discontinues in LEDE code branches? Only I2S interface driver (ralink-i2s.c ) is available in 17.01 ( linux-4.4 ) SDK.

Thanks,
Sai

in current master

0048-asoc-add-mt7620-support.patch

As form the addresses I2S and PCM are alread in ..

		i2s: i2s@a00 {
			compatible = "mediatek,mt7628-i2s";
			reg = <0xa00 0x100>;

			resets = <&rstctrl 17>;
			reset-names = "i2s";

			interrupt-parent = <&intc>;
			interrupts = <10>;

			txdma-req = <2>;
			rxdma-req = <3>;

			dmas = <&gdma 4>,
				<&gdma 6>;
			dma-names = "tx", "rx";

			status = "disabled";
		};
		pcm: pcm@2000 {
			compatible = "ralink,mt7620a-pcm";
			reg = <0x2000 0x800>;

			resets = <&rstctrl 11>;
			reset-names = "pcm";

			interrupt-parent = <&intc>;
			interrupts = <4>;

			status = "disabled";
		};

Thank you ElektromAn..

We will check with this patch..

Regards,
Sai

do you using alsa ?

Yes.. we are using ALSA

Hi!

Sorry to bump this thread, but you have been working with mt7628 DMA and, if you're so kind, I need you help on mt7628 i2s issue. I hope you could help on it.

Basically: when playing 1KHz tone using aplay the audio starts crackling every time I write to flash using echo "test" > /some_file_in_squash_fs.txt

Thanks