I2S drivers not loading

Started by per, September 28, 2017, 03:20:39 PM

Previous topic - Next topic

per

Hi,
I'm new in this forum. Im also pretty new with Linux, so please forgive me if I'm asking questions with obvious answers.

I have just purchased an A20-Lime2 board and is currently evaluating it. I also purchased an SD card with a Debian image from Olimex and have successfully transferred it to the onboard eMMC memory. My kernel version is 3.4.103 (which if I understand it correctly is legacy, but should have the necessary hardware support: GPIO, SPI, I2C, I2S).

I want to use the I2S bus to interface an AD-converter but doesn't seem to have any drivers loaded for I2S.
I have modified /boot/script.bin to enable I2S:
 
[i2s_para]
i2s_used = 1
i2s_channel = 2
i2s_mclk = port:PB05<2><1><default><default>
i2s_bclk = port:PB06<2><1><default><default>
i2s_lrclk = port:PB07<2><1><default><default>
i2s_dout0 = port:PB08<2><1><default><default>
i2s_dout1 =
i2s_dout2 =
i2s_dout3 =
i2s_din = port:PB12<2><1><default><default>
 
But this doesn't seem to help. I would have expected to find sndi2s, sunxi-i2sdma, sunxi-i2s and sunxi-sndi2s, but I can't.
# lsmod shows nothing regarding i2s and neither do the boot messages (#dmesg | grep "i2s").

Am I missing something here? Any other configuration to be made? Or do I need a newer kernel, which one in that case?

Grateful for any input!
Per


per


per

Hi again

I have been working with this now and then and have so far done the following:


1. I have setup a machine with Ubuntu 16.04 and installed the Armbian build tool (a great tool by the way, makes life simpler)

2. I have successfully recompiled u-boot, rootfs, kernel (3.4.113-sun7i), added a Debian desktop and got it all on a SD card.

3. My Lime2 board boots OK and the I2S drivers are now there,
#sudo cat /lib/modules/$(uname -r)/modules.builtin | grep i2s gives me:
   kernel/sound/soc/sunxi/i2s/sunxi-i2s.ko
   kernel/sound/soc/sunxi/i2s/sunxi-i2sdma.ko
   kernel/sound/soc/sunxi/i2s/sndi2s.ko
   kernel/sound/soc/sunxi/i2s/sunxi-i2s.ko

4. The I2S interface also appears as an ALSA hardware device (#sudo arecord -l)
I have briefly tested it without anyting electrically connected to it, using arecord and an oscilloscope, observing how for instance LRCLK changes frequnency when I change the sampling frequency in the call to arecord.

5. So far so good, but what I really want to do is to interface an AD-converter (AD7768 from Analog Devices). This is an 8 channel 24bit ADC. It works in I2S master mode, so I have configured my A20 as slave (is done in the fex file)
The ADC outputs data from all channels in an interleaved manner, 32bits/channel, on the same data line (I2S_DI). Timing looks something like the following (one LRCLK data strobe per 8 channels of data):

                     _                                                                                                                                     _
   LRCLK:  _|  |__________________________________________________________________|  |______________

               
   DIN:     ------< CH1 >< CH2 >< CH3 >< CH4 >< CH5 >< CH6 >< CH7 >< CH8 >------------------------< CH1 >< CH2 >...


6. I have written a small c code that uses the alsa/asound library to interface the ADC.
My problem is that the sunxi I2S drivers only seems to support only S16_LE and S24_LE format and furthermore only up to 2 channels. Given the timing above I think I'll need S32_LE and 8 channels.

7. My guess (pls correct me I'm wrong) is that I need to update the I2S drivers to accomplish this.
Beeing new to Linux and absolute noob on Linux drivers, I don't really know where to start. I have looked into the source code of sunxi-i2s, sunxi-i2sdma, sndi2s and sunxi-i2s and at least three of them have settings regarding bit format and number of channels, should I change them all?

8. Furtermore I have looked into the Allwinner A20 manual and in this it's stated that the I2S interface supports 16, 20 and 24 bits resolution, so I'm not even sure that A20 supports 32 bit data words.


I would really appreciate If anyone could point me in the right direction here.
   

JohnS

#4
http://linux-sunxi.org has a mailing list (as does the kernel) which may be your best bet.  The armbian site may have help, too.

There's a Google Groups "linux-sunxi" group which may or may not be the same as the ML.

John

per

Thanks John,

I'll try the sunxi mailing list.

Regards
Per