alexparser Posted August 13, 2018 Posted August 13, 2018 Hi Guys, After a long time after the release Linux kernel 4.x I want use the I2S on Lime2 (Armbian Stretch kernel 4.14.14), but I2S interface did not work. I was add activation of overlays i2s0 and i2s1 into/boot/armbianEnv.txt root@lime2:~# cat /boot/armbianEnv.txt verbosity=1 logo=disabled console=both disp_mode=1920x1080p60 overlay_prefix=sun7i-a20 rootdev=UUID=dcf7af80-8026-4e99-870f-f0d35f926063 rootfstype=ext4 overlays=i2s0 i2s1 usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u After reboot I can't see I2S interfaces... root@lime2:~# aplay -l aplay: device_list:270: no soundcards found... root@lime2:~# lsmod | grep snd snd_soc_core 118784 1 sun4i_i2s snd_pcm_dmaengine 16384 1 snd_soc_core snd_pcm 65536 3 sun4i_i2s,snd_pcm_dmaengine,snd_soc_core snd_timer 24576 1 snd_pcm snd 45056 3 snd_timer,snd_soc_core,snd_pcm soundcore 16384 1 snd I2S really supported in Mainline on A20?
Igor Posted August 14, 2018 Posted August 14, 2018 10 hours ago, alexparser said: I was add activation of overlays i2s0 and i2s1 into/boot/armbianEnv.txt Do you have I2S overlays in /boot/dtb/overlay ?
alexparser Posted August 14, 2018 Author Posted August 14, 2018 7 hours ago, Igor said: Do you have I2S overlays in /boot/dtb/overlay ? I was think I2S overlays present by default. How can I set up I2S overlay?
Igor Posted August 14, 2018 Posted August 14, 2018 1 minute ago, alexparser said: I was think I2S overlays present by default. How can I set up I2S overlay? Me too and ATM I don't know why they are not present.
alexparser Posted August 14, 2018 Author Posted August 14, 2018 In the overlay file sun7i-a20-i2s0.dtbo after decompilation I see only pin definitions. How I can see, PB5-PB12 pins defined only like GPIO. For I2S work need more interface specific definitions. I2S work on other A20 based boards? Spoiler /dts-v1/; / { compatible = "allwinner,sun7i-a20"; fragment@0 { target = <0xffffffff>; __overlay__ { i2s0 { pins = "PB5", "PB6", "PB7", "PB8", "PB9", "PB10", "PB11", "PB12"; function = "i2s0"; linux,phandle = <0x1>; phandle = <0x1>; }; }; }; fragment@1 { target = <0xffffffff>; __overlay__ { pinctrl-names = "default"; pinctrl-0 = <0x1>; status = "okay"; }; }; __symbols__ { i2s0_pins = "/fragment@0/__overlay__/i2s0"; }; __fixups__ { pio = "/fragment@0:target:0"; i2s0 = "/fragment@1:target:0"; }; __local_fixups__ { fragment@1 { __overlay__ { pinctrl-0 = <0x0>; }; }; }; }; UPD Got problem with DTS file compilation. Of course, Linux header are success installed from armbian-config -> software armbian-add-overlay sun7i-a20-i2s0a.dts Kernel headers are not installed properly. Please install the kernel headers package
Daan Posted January 16, 2019 Posted January 16, 2019 (edited) Hello, I've been searching for the last couple of days to get I2S audio working on my Olimex A20-SOM-EVB. I've tried many options but without luck. Let me describe the setup: Hardware I have the Olimex A20-SOM-EVB and the MikroElektronika Audio Codec Board - PROTO and I've connected these two boards according to the following connection table: A20 SoC PIN I2S signal name I2S Signal description WM8731 PIN PB5 MCLK Master clock (not connected) PB6 BCLK Bit clock BCLK PB7 LRCK Frame sync (switch between L and R) DACL PB8 DOUT0 Data output 0 DACDAT PB12 DIN Data input ADCDAT I also connected the I2C SCL and SDA lines to the I2C0 bus through the UEXT2 connector of the board. Software I've downloaded the latest Armbian, currently running kernel 4.19.13-sunxi and compiled the image from scratch. I've included the sunxi-i2s driver in the kernel configuration and I also made sure to select the WM8731 codec driver. As the A20-SOM-EVB is not in the supported devices list I'm using the LIME2 board as this is the only board with matching ethernet configuration. The image boots fine but at this point there is no audio card and no '/dev/i2s' device. Therefore I've created the following dts overlay files: sun7i-a20-i2s0.dts: /dts-v1/; /plugin/; / { compatible = "allwinner,sun7i-a20"; fragment@0 { target = <&pio>; __overlay__ { i2s0_pins: i2s0 { pins = "PB5", "PB6", "PB7", "PB8", "PB9", "PB10", "PB11", "PB12"; function = "i2s0"; }; }; }; fragment@1 { target = <&i2s0>; __overlay__ { pinctrl-names = "default"; pinctrl-0 = <&i2s0_pins>; status = "okay"; }; }; }; sun7i-a20-i2c1.dts: /dts-v1/; /plugin/; / { compatible = "allwinner,sun7i-a20"; fragment@0 { target-path = "/aliases"; __overlay__ { i2c1 = "/soc@01c00000/i2c@01c2b000"; }; }; fragment@1 { target = <&i2c1>; __overlay__ { pinctrl-names = "default"; pinctrl-0 = <&i2c1_pins_a>; status = "okay"; wm8731@1a { #sound-dai-cells = <0>; compatible = "wlf,wm8731"; reg = <0x1a>; status = "okay"; }; }; }; }; sound.dts: /dts-v1/; /plugin/; / { compatible = "allwinner,sun7i-a20"; fragment@0 { target-path = "/"; __overlay__ { wm8731: wm8731 { #sound-dai-cells = <0>; compatible = "wlf,wm8731"; status = "okay"; }; }; }; fragment@1 { target-path = "/"; __overlay__ { sound { compatible = "simple-audio-card"; simple-audio-card,format = "i2s"; simple-audio-card,cpu { sound-dai = <&i2s0>; }; simple-audio-card,codec { sound-dai = <&wm8731>; }; }; }; }; }; I then compiled these 3 dts overlay files with 'armbian-add-overlay'. These files are now correctly added by uboot as can be seen in the boot log: Boot script loaded from mmc 252 bytes read in 10 ms (24.4 KiB/s) 4914007 bytes read in 287 ms (16.3 MiB/s) 6504992 bytes read in 377 ms (16.5 MiB/s) Found mainline kernel configuration 40538 bytes read in 67 ms (590.8 KiB/s) 702 bytes read in 10 ms (68.4 KiB/s) Applying user provided DT overlay sun7i-a20-i2s0.dtbo 619 bytes read in 11 ms (54.7 KiB/s) Applying user provided DT overlay sun7i-a20-i2c1.dtbo 862 bytes read in 12 ms (69.3 KiB/s) Applying user provided DT overlay sound.dtbo 5845 bytes read in 81 ms (70.3 KiB/s) Applying kernel provided DT fixup script (sun7i-a20-fixup.scr) The I2C bus and WM8731 driver appears to be working, this is the relevant dmesg output: [ 8.264826] wm8731 1-001a: Assuming static MCLK [ 8.264869] wm8731 1-001a: 1-001a supply AVDD not found, using dummy regulator [ 8.264994] wm8731 1-001a: Linked as a consumer to regulator.0 [ 8.265013] wm8731 1-001a: 1-001a supply HPVDD not found, using dummy regulator [ 8.265066] wm8731 1-001a: 1-001a supply DCVDD not found, using dummy regulator [ 8.265133] wm8731 1-001a: 1-001a supply DBVDD not found, using dummy regulator But after all this work there is still no i2s device and no sound card in aplay -l. What am I missing, can anybody point me in the right direction? Any help would be much appreciated. As a reference this is the output of 'armbianmonitor -u': http://ix.io/1yun Kind regards, Daan Edited January 16, 2019 by Daan
Daan Posted January 17, 2019 Posted January 17, 2019 I've been working further but still no sound card I'm now using a single overlay file: /dts-v1/; /plugin/; / { compatible = "allwinner,sun7i-a20"; fragment@0 { target-path = "/aliases"; __overlay__ { i2c1 = "/soc@01c00000/i2c@01c2b000"; i2s0 = "/soc@01c00000/i2s@01c22400"; }; }; fragment@1 { target = <&i2c1>; __overlay__ { pinctrl-names = "default"; pinctrl-0 = <&i2c1_pins_a>; status = "okay"; wm8731@1a { #sound-dai-cells = <0>; compatible = "wlf,wm8731"; reg = <0x1a>; status = "okay"; }; }; }; fragment@2 { target-path = "/"; __overlay__ { wm8731: wm8731 { #sound-dai-cells = <0>; compatible = "wlf,wm8731"; status = "okay"; }; }; }; fragment@3 { target = <&pio>; __overlay__ { i2s0_pins: i2s0 { pins = "PB5", "PB6", "PB7", "PB8", "PB9", "PB10", "PB11", "PB12"; function = "i2s0"; }; }; }; fragment@4 { target = <&i2s0>; __overlay__ { status = "okay"; pinctrl-0 = <&i2s0_pins>; sound-dai = <&wm8731>; pinctrl-names = "default"; }; }; fragment@5 { target-path = "/"; __overlay__ { sound { compatible = "simple-audio-card"; simple-audio-card,name = "I2S-master"; simple-audio-card,format = "i2s"; status = "okay"; simple-audio-card,widgets = "Headphone", "Headphone Jack", "Microphone", "Microphone Jack", "Line", "Line Jack"; simple-audio-card,routing = "Headphone Jack", "RHPOUT", "Headphone Jack", "LHPOUT", "LLINEIN", "Line Jack", "MICIN", "Mic Bias", "Mic Bias", "Microphone Jack"; simple-audio-card,cpu { sound-dai = <&i2s0>; }; simple-audio-card,codec { sound-dai = <&wm8731>; }; }; }; }; }; And lsmod is showing me the correct modules (I think): root@lime2:/dev# lsmod Module Size Used by sun4i_gpadc_iio 16384 0 snd_soc_wm8731 20480 0 snd_soc_simple_card 16384 0 snd_soc_simple_card_utils 16384 1 snd_soc_simple_card at24 20480 0 axp20x_usb_power 16384 0 axp20x_battery 16384 0 axp20x_adc 16384 0 evdev 20480 1 sun4i_i2s 20480 0 industrialio 49152 4 axp20x_usb_power,axp20x_battery,sun4i_gpadc_iio,axp20x_adc snd_soc_core 106496 4 snd_soc_wm8731,sun4i_i2s,snd_soc_simple_card_utils,snd_soc_simple_card snd_pcm_dmaengine 16384 1 snd_soc_core snd_pcm 65536 4 snd_soc_wm8731,sun4i_i2s,snd_pcm_dmaengine,snd_soc_core sun4i_ts 16384 0 snd_timer 24576 1 snd_pcm sun4i_gpadc 16384 0 snd 45056 4 snd_soc_wm8731,snd_timer,snd_soc_core,snd_pcm soundcore 16384 1 snd zstd 16384 2 sun4i_ss 24576 0 cpufreq_dt 16384 0 uio_pdrv_genirq 16384 0 uio 16384 1 uio_pdrv_genirq thermal_sys 57344 3 sun4i_ts,cpufreq_dt,sun4i_gpadc_iio zram 20480 3 bonding 94208 0 ip_tables 20480 0 x_tables 20480 1 ip_tables pinctrl_axp209 16384 0 pwrseq_emmc 16384 1 realtek 16384 1 Has anybody been able to get I2S to work?
Daan Posted January 18, 2019 Posted January 18, 2019 Hi, Have you been able to get the I2S to work? Kind regards, Daan
alexparser Posted January 20, 2019 Author Posted January 20, 2019 On 1/18/2019 at 7:01 AM, Daan said: Hi, Have you been able to get the I2S to work? Kind regards, Daan Hi, It does not work I2S for me. But, if you have interest, we can try do it together.. BR,
Daan Posted January 20, 2019 Posted January 20, 2019 Hi, Thank you for the answer. I'm surely willing to do this together. For now I don't know if it's a driver problem or a device tree file problem. The next step for me is checking if the register addresses in the DTS file for I2S are correct. I also can't find any reports of anyone with a working I2S in a kernel not using fex files. Kind regards, Daan
alexparser Posted January 20, 2019 Author Posted January 20, 2019 I'm googling for solve this problem. How I can understand, need bind DAI with PCM codec driver. BR, Alex
bschwand Posted September 26, 2019 Posted September 26, 2019 Hi there, I have the same goal: get I2S sound working on a AW-A20-SOM board. Any update on this, any success ? Cheers !
alexparser Posted September 27, 2019 Author Posted September 27, 2019 On 9/26/2019 at 11:38 AM, bschwand said: Any update on this, any success ? I don't have success, but I think solution for A20 similar like this.
Recommended Posts