Hi,
after some trials and errors, I was able to enable I2S0 interface and using the GPIO pins to record with a MEMs microphone.
I am using armbian OS image with current kernel (5.3.11+) and ubuntu 18.04, I built it using armbian documentation (https://docs.armbian.com/Developer-Guide_Using-Vagrant/). I am using SD card.
The board takes some time before booting up with this image, but it works.
After getting the SD card ready, I went to the /boot directory and decompiled the device tree used by boot-loader (in my case, the file is rk3399-nanopi-m4.dtb).
dtc -I dtb -o <filename>.dts -<filename>.dtb
To check which device tree is loaded by the boot-loader, check the file armbianEnv.txt in the /boot directory (check the name of the fdtfile).
You need to modify the device tree as follows:
Go to I2S0 node and add the following two lines
pinctrl-names = "default";
pinctrl-0 = < 0x96 >;
i2s@ff880000 {
compatible = "rockchip,rk3399-i2s\0rockchip,rk3066-i2s";
reg = < 0x00 0xff880000 0x00 0x1000 >;
rockchip,grf = < 0x18 >;
interrupts = < 0x00 0x27 0x04 0x00 >;
dmas = < 0x5c 0x00 0x5c 0x01 >;
dma-names = "tx\0rx";
clock-names = "i2s_clk\0i2s_hclk";
clocks = < 0x08 0x56 0x08 0x1d4 >;
power-domains = < 0x17 0x1c >;
#sound-dai-cells = < 0x00 >;
pinctrl-names = "default";
pinctrl-0 = < 0x96 >;
rockchip,playback-channels = <8>;
rockchip,capture-channels = <8>;
status = "okay";
phandle = < 0x10d >;
};
Check that the status of driver is "okay" and not disabled.
You have then to register a simple-sound-card and link it to the i2s driver by phandle (the device tree pointer)
rockchip-i2s-sound {
compatible = "simple-audio-card";
simple-audio-card,format = "i2s";
simple-audio-card,name = "rk3399-i2s";
simple-audio-card,mclk-fs = < 0x100 >;
status = "okay";
phandle = < 0x153 >;
simple-audio-card,cpu {
sound-dai = < 0x10d > ;
};
simple-audio-card,codec {
sound-dai = < 0x10d >;
};
};
After you changed the devite tree, recompile it by running the command line
dtc -I dts -o <filename>.dtb -<filename>.dts
After that, reboot and check ALSA list of devices. You should see it listed as "rk3399-i2s".