I2S soundcard overlay

Hi all,

Im trying to get this i2s card to work with the rock pi E.

https://www.audiophonics.fr/en/devices-hifi-audio-adc/adc-analog-to-digital-converter-wm8782-i2s-24bit-192khz-p-13351.html

The i2s card is the master in my setup.

I’m running Debian.

Can anybody point me in the right direction as to how the overlay needs to look like ?
Thanks !

Hi,dfull89

Which image do you use, and what is the specific kernel version.

use

2021.01.26

rockpie_debian_buster_server_arm64_20210126_0056-gpt.img

  • Kernel version: 4.4.194-17-rockchip-g07288d4ebac7
  • U-Boot version: 2019.10-11661-g46695f4700

You can try this overlay

/dts-v1/;
/plugin/;

/ {
	compatible = "rockchip,rk3328";

	fragment@0 {
		target-path = "/";
		__overlay__ {
			sound {
				compatible = "simple-audio-card";
				simple-audio-card,format = "i2s";
				simple-audio-card,mclk-fs = <256>;
				simple-audio-card,name = "rockchip-rk3328";
				simple-audio-card,bitclock-master = <&sound_master>;
				simple-audio-card,frame-master = <&sound_master>;

				simple-audio-card,cpu {
					sound-dai = <&i2s1>;
				};
				sound_master:simple-audio-card,codec {
					sound-dai = <&codec>;
				};

			};
		};
	};

	fragment@1 {
		target = <&i2s1>;
		__overlay__ {
			pinctrl-names = "default";
			pinctrl-0 = <&i2s1_mclk
						 &i2s1_sclk
						 &i2s1_lrcktx
						 &i2s1_lrckrx
						 &i2s1_sdi>;
		};
	};

	
};

is this for vendor kernel or armbian kernel?

1.Write the content of the message to the rk3328-simple-audio-card.dts file
2.Convert dts to dtbo
3.Add rk3328-simple-audio-card to the /boot/uEnv.txt file
4.reboot

i2s didn’t work, and the original 3.5 output became unavailable

Can you post your dts source file and dmesg records?

dmesg.log & rk3328-simple-audio-card.dts

I2S1 is connected to ACODEC, so may not be able to make it work in two places at the same time

ALSA device list:
570 [ 2.684313] #0: rockchip-rk3328
571 [ 2.684316] #1: rockchip,hdmi

I saw the sound card in the log, so you can try the arecord command and specify the correct audio format for recording. Make sure

LRCK->I2S1_LRCK_RX
BCLK ->I2S1_SCLK

is connected correctly and the clock is present.

1.Excuse me, do you mean that I2S is set to two places?
How to modify the settings in the official IMG?
2.For the COLCK part, if I set ROCK PI E as MASTER, then LRCK and BCLK should be sent by ROCK PI E. Do I need to do any additional connections? For example, do I need to provide the frequency of MCLK externally?
3. speaker-test -D "hw:0,0" -c2
is error,

speaker-test 1.1.8
Playback device is hw:0,0
Stream parameters are 48000Hz, S16_LE, 2 channels
Using 16 octaves of pink noise
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 128 to 131072
Period size range from 64 to 65536
Using max buffer size 131072
Periods = 4
was set period_size = 32768
was set buffer_size = 131072
0 - Front Left
1 - Front Right
Write error: -5,Input/output error
xrun_recovery failed: -5,Input/output error
Transfer failed: Input/output error

  1. What I mean is that i2s1 is internally connected to the acodec, and then the acodec is output to the earphones, so if you use the overlay provided above, your earphones will not work.
  2. If you use ROCK PI E as the master, the above overlay needs to be modified. As long as your audio module is working normally, MCLK is not necessary. Connecting the two together may cause noise problems due to the slight difference in the clock.
  3. The overlay configured above uses the rock pie as a slave, and your audio module needs to provide BCLK and LRCK, taking 48KHZ input as an example. Try it with

arecord -D hw:0,0 -r 48000 -c 2 -f S32_LE -t wav test.wav
hw:0,0 means card 0 device 0

Excuse me, can you provide the i2s of rock pie as the master configuration file?

this overlay is working fine on Armbian