Quantcast
Channel: Active questions tagged kernel - Stack Overflow
Viewing all articles
Browse latest Browse all 6334

NanoPI NEO / NEO AIR I2S DAudio WS2812 DeviceTree Issues

$
0
0

I'm trying to get the WS2812 LED's via I2S bus to work, using a NanoPI NEO AIRI found a nice library which utilizes ALSA-Audio for pushing data to the WS2812.

The library is quite old and uses a 3.4.113 kernel with Armbian. It works like it should when I'm using this old Linux image, but I want to use a more modern system which comes with a 5.4.28 kernel and therefore using a DeviceTree instead of script.bin/fex.

Old kernel

In the old kernel, these options have to be set:

[twi1]twi_used = 0[pcm0]daudio_used = 1sample_resolution = 16slot_width_select = 16pcm_lrck_period = 16slot_width = 16

Listing audio devices with

aplay -l

results in:

card 1: snddaudio [snddaudio], device 0: SUNXI-TDM0 snddaudio-0 []

New Kernel

With the new kernel, the script.bin is missing and DeviceTree is used instead.

It seems like there is no good documentation for I2S DAudio devices, so I took an dts overlay from armbian forum:

/dts-v1/;/plugin/;/ {    compatible = "allwinner,sun8i-h3";    fragment@0 {         target-path = "/";         __overlay__ {             pcm5102a: pcm5102a {            #sound-dai-cells = <0>;            compatible = "ti,pcm5102a";            pcm510x,format = "i2s";            };        };     };     fragment@1 {        target = <&i2s0>;        __overlay__ {            status = "okay";            pinctrl-0 = <&i2s0_pins>;            sound-dai = <&pcm5102a>;            pinctrl-names = "default";        };    };    fragment@2 {        target-path = "/";        __overlay__ {            sound_i2s {                compatible = "simple-audio-card";                simple-audio-card,name = "I2S-master";                simple-audio-card,mclk-fs = <256>;                simple-audio-card,format = "i2s";                        status = "okay";                simple-audio-card,cpu {                    sound-dai = <&i2s0>;                };                simple-audio-card,codec {                    sound-dai = <&pcm5102a>;                };            };        };    };};

And enabled the I2S device in the board dts:

        i2s@1c22000 {            #sound-dai-cells = <0x00>;            compatible = "allwinner,sun8i-h3-i2s";            reg = <0x1c22000 0x400>;            interrupts = <0x00 0x0d 0x04>;            clocks = <0x03 0x38 0x03 0x54>;            clock-names = "apb\0mod";            dmas = <0x15 0x03 0x15 0x03>;            resets = <0x03 0x2b>;            dma-names = "rx\0tx";            status = "okay";            phandle = <0x5c>;        };

I'm able to see the I2S device with

aplay -l

card 0: I2Smaster [I2S-master], device 0: 1c22000.i2s-pcm5102a-hifi pcm5102a-hifi-0 [1c22000.i2s-pcm5102a-hifi pcm5102a-hifi-0]

But the output is not right, and I'm missing the configuration which was set in the script.bin.

I found a piece of DeviceTree, which seems to be exactly what I need, but I'm not sure how to integrate that into my DeviceTree/Overlay.

        daudio@0x01c22000 {            audio_format = <0x1>;            clocks = <0x3 0x3b>;            compatible = "allwinner,sunxi-daudio";            daudio_master = <0x4>;            device_type = "daudio0";            frametype = <0x0>;            linux,phandle = <0x52>;            mclk_div = <0x0>;            pcm_lrckr_period = <0x1>;            pcm_lrck_period = <0x20>;            pcm_lsb_first = <0x0>;            phandle = <0x52>;            pinctrl-0 = <0x3c>;            pinctrl-1 = <0x3d>;            pinctrl-names = "default", "sleep";            reg = <0x0 0x1c22000 0x0 0x70>;            rx_data_mode = <0x0>;            signal_inversion = <0x1>;            slot_width_select = <0x10>;            status = "disabled";            tdm_config = <0x1>;            tdm_num = <0x0>;            tx_data_mode = <0x0>;        };

I tried to insert it in the board devicetree like so:

        i2s@1c22000 {            #sound-dai-cells = <0x00>;            compatible = "allwinner,sun8i-h3-i2s";            reg = <0x1c22000 0x400>;            interrupts = <0x00 0x0d 0x04>;            clocks = <0x03 0x38 0x03 0x54>;            clock-names = "apb\0mod";            dmas = <0x15 0x03 0x15 0x03>;            resets = <0x03 0x2b>;            dma-names = "rx\0tx";            status = "disabled";            phandle = <0x5c>;            slot_width_select = <0x10>;            device_type = "daudio0";            pcm_lrckr_period = <0x1>;            pcm_lrck_period = <0x10>;            audio_format = <0x1>;        };

It did compile to dtb and no errors shown in dmesg, but the signal output is still not right.

Can sombody help me, or give me a good place of documentation ?Thanks in advance !


Viewing all articles
Browse latest Browse all 6334

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>