sgufa Posted November 3, 2016 Posted November 3, 2016 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
zador.blood.stained Posted November 3, 2016 Posted November 3, 2016 You may find some examples in latest commits in this branch: https://github.com/mripard/linux/commits/sunxi/wip/a20-i2s
sgufa Posted March 1, 2017 Author Posted March 1, 2017 I've taken a look there but i'm not able to enable both i2s output and mic1 input. No one tried it yet?
zador.blood.stained Posted March 1, 2017 Posted March 1, 2017 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:
zador.blood.stained Posted March 1, 2017 Posted March 1, 2017 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.
sgufa Posted March 3, 2017 Author Posted March 3, 2017 Hello HeinrichG, could you explain what exactly you did? tnx
Guest HeinrichG Posted March 3, 2017 Posted March 3, 2017 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.
zador.blood.stained Posted March 3, 2017 Posted March 3, 2017 @HeinrichG What kind of card/codec did you actually test? We are slowly collecting Device Tree overlays and we will be adding overlays for tested peripherials.
Guest HeinrichG Posted March 3, 2017 Posted March 3, 2017 @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.
sgufa Posted March 7, 2017 Author Posted March 7, 2017 Hello HeinrichG, i'll try within this week and let you know. Thank you for now
kkj Posted May 7, 2017 Posted May 7, 2017 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?
Recommended Posts