0
sgufa

i2s audio on cubietruck with Mainline - need help

Recommended Posts

Hi all,

any advice to enable i2s audio in mainline kernel? I'm on 5.23 cubietruck mainline v4.8.6. Cant find any reference to write DTS...any help would be appreciated. Thank you

Share this post


Link to post
Share on other sites

I've taken a look there but i'm not able to enable both i2s output  and mic1 input. No one tried it yet?

Share this post


Link to post
Share on other sites

I think proper capture support never landed in mainline kernel, and old patches will need significant rework to be applied on top of current driver.

As for I2S - here are your references: https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/Documentation/devicetree/bindings/sound

1 hour ago, sgufa said:

No one tried it yet?

Looks like some people did try it: 

 

Share this post


Link to post
Share on other sites
3 minutes ago, sgufa said:

yeah, but without success

I think @HeinrichG successfully activated I2S - check the last post.

It's not that hard - you need to activate I2S bus, add your card and connect them with "simple card", assuming there is a driver in the kernel for your I2S device.

Share this post


Link to post
Share on other sites
Guest HeinrichG

Yes, I did...

Share this post


Link to post
Share on other sites
Guest HeinrichG

First of all you have to enable i2s, so add something like this:


&i2s0 {
    pinctrl-names = "default";
    pinctrl-0 = <&i2s0_mclk_pins_a>, <&i2s0_data_pins_a>;
    status = "okay";
};

at the end of your dts-file. But, check the pinctl-0 pin names.

Then, you have to define a codec, you can do this under "i2c0" oder "i2c" or wherever your DAC/SPDIF-Transceiver/... is connected to.

After that your have to have to "connect" i2s-device (this is cpu-side) with your codec (this is your output side). So just create a sound card with "compatible = "simple-audio-card"; ".

 

To see the exactly definition format, check Documentation/devicetree/bindings/sound/simple-card.txt

 

It's pretty easy.

Share this post


Link to post
Share on other sites
Guest HeinrichG

@zador.blood.stained

Actually I'm designing an AddOn board with Cirrus/WolfsonMicro WM8741, CAN-Transceiver for LowSpeed and HighSpeed, SPDIF output (electrical and optical), FRAM ic, ... So a kind of "all in one thing".

I've activated I2S with an "pseudo codec", so connect I2S to "himself" and it looks good.

 

But my another thing with LVDS-dispay has a higher priority.

Share this post


Link to post
Share on other sites
Guest HeinrichG

@sgufa: And? Any results?

Share this post


Link to post
Share on other sites

Hello HeinrichG,

i'll try within this week and let you know. Thank you for now

Share this post


Link to post
Share on other sites

Hi,

I have similar problem. I am trying to run simple PCM5102 based DAC over I2S on BananaPro board but I got errors when I am try to play something.

I have added to dts file:

    pcm5102a: pcm5102a {
        #sound-dai-cells = <0>;
        compatible = "ti,pcm5102a";
        status = "okay";
    };
       
    sound {
        compatible = "simple-audio-card";
        simple-audio-card,format = "i2s";
        simple-audio-card,cpu {
            sound-dai = <&i2s0>;
        };
 
        simple-audio-card,codec {
            sound-dai = <&pcm5102a>;
        };  
    };

and

&i2s0 {
	pinctrl-names = "default";
	pinctrl-0 = <&i2s0_pins_a>;
	status = "okay";
};

After replacing dtb file and rebooting card is visible:

# aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
default:CARD=sun4icodec
    sun4i-codec,
    Default Audio Device
sysdefault:CARD=sun4icodec
    sun4i-codec,
    Default Audio Device
default:CARD=D1c22400i2spcm5
    1c22400.i2s-pcm5102a-hifi,
    Default Audio Device
sysdefault:CARD=D1c22400i2spcm5
    1c22400.i2s-pcm5102a-hifi,
    Default Audio Device

but when I'm trying to play something I got error messages. Below I put output from aplay and speaker-test commands.

# aplay -c 2 -D hw:1,0 /usr/share/sounds/alsa/Front_Center.wav
Playing WAVE '/usr/share/sounds/alsa/Front_Center.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
aplay: set_params:1305: Channels count non available

# speaker-test -t wav -c 2 -D hw:1

speaker-test 1.1.3

Playback device is hw:1
Stream parameters are 48000Hz, S16_LE, 2 channels
WAV file(s)
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 128 to 131072
Period size range from 64 to 16384
Using max buffer size 131072
Periods = 4
Unable to set hw params for playback: Invalid argument
Setting of hwparams failed: Invalid argument

After speaker-test I got following kernel message:

sun4i-i2s 1c22400.i2s: ASoC: can't set 1c22400.i2s hw params: -22

Anybody knows what is wrong with my configuration?

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
0