This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Codec drivers and alsa support for custom cape with sta321mp

Dear all,

I have created a custom cape around the STA321MP chip from ST Microelectronics. It has 6 MEMS microphones and outputs them on an I2S bus with 3 data lines. I am trying to use mcasp0 on the boneblack side to receive the data. I am now to the point where the codec configuration happens correctly (I can see the i2s signals with a logic analyzer) and a soundcard is detected. However, when I try to record sound with arecord, I get the following error:

root@beaglebone:~# arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: EVM [STA321MP EVM], device 0: STA321MP sta321mp-audio-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
root@beaglebone:~# arecord -D hw:0,0 -f S24_LE -c 6 -r 44100 -t wav test.wav
Recording WAVE 'test.wav' : Signed 24 bit Little Endian, Rate 44100 Hz, Channels 6
arecord: pcm_read:1801: read error: Input/output error

Let me know provide more details.
  • The codec is frame and bit clocks master
  • The connection to mcasp0 is the following:
  • Bit clock <=> P9_12 (mcasp0_aclkr_mux3)
  • Frame sync clock (L/R) <=>  P9_27 (mcasp0_fsr)
  • Data <=> P9_28 (mcasp0_axr2)
  • Data <=> P9_30 (mcasp0_axr0)
  • Data <=> P9_25 (mcasp0_axr3)
  • I am using kernel 3.14.41 (because 3.8 doesn't have support for mcasp with >2 channels)
  • I am using dtb-builder to add my device to the device tree

All the code I have added to the kernel (codec and machine code) and to the device tree is on github. Here are the links to the specific changes I have made.

kernel: https://github.com/fakufaku/linux/commit/3a6680960412ef0fc3fbcc6f2c0021350039cc92

device tree: https://github.com/fakufaku/dtb-rebuilder/commit/127dbf3c82c78cc602058308ed72978b170c99a6

It is my first time trying to code audio driver so please be indulgent :) I have spent a lot of time on this but it seems I am now completely stuck. I'd really appreciate some help. I'd be happy to provide more clarifications on anything.

One thing I do not understand is if I need to add mixer bindings. And also the audio routing (jack vs codec pins, etc).

Thank you in advance!
Robin