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
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.
After a lot of effort, I have finally solved this.
The problem was that the mcasp module can operate with synchronous or
asynchronous transmit and receive clocks. The default setting hardcoded
in the linux mcasp driver is synchronous. That means that both receive
and transmit use the transmit clock signals FSX and ACLKX.
You received this message because you are subscribed to a topic in the Google Groups "BeagleBoard" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/beagleboard/pptZ_9PTqMY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to beagleboard...@googlegroups.com.
On 10 janv. 2016, at 01:48, Pablo Fonovich <pablo7f...@gmail.com> wrote:Hi Robin:with printk statements, i've isolated the error to this instruction:
ret = snd_soc_dai_set_sysclk(codec_dai, 0, sysclk, SND_SOC_CLOCK_OUT);but i don't know what is wrong... the sysclk variable is:
unsigned int sysclk = ((struct snd_soc_card_drvdata_davinci *)
snd_soc_card_get_drvdata(soc_card))->sysclk;Just linke in the evm_hw_params
I've noticed that you used:
ret = snd_soc_dai_set_sysclk(cpu_dai, 0, 0, SND_SOC_CLOCK_IN);If i'm getting it right, this is to set the cpu_dai sysclock, but i dont get why you used 0 in the frequency parameter. Also you never used the function to set the codec_dai sysclk... Is it not necessary? I'll try commenting this line
Hi: im using 24Mhz, that is provided by de beaglebone... i used printk to see that sysclk value and it is correct... i get the value as is stated in the evm_hw_params function.
I dont see why the function returns error... but is there a list of error codes to see what -524 means?
Thanks very much
static int pcm3168_hw_params(struct snd_pcm_substream *substream,struct snd_pcm_hw_params *params){struct snd_soc_pcm_runtime *rtd = substream->private_data;struct snd_soc_dai *codec_dai = rtd->codec_dai;struct snd_soc_dai *cpu_dai = rtd->cpu_dai;struct snd_soc_codec *codec = rtd->codec;struct snd_soc_card *soc_card = rtd->card;struct platform_device *pdev = to_platform_device(soc_card->dev);int ret = 0;unsigned sysclk = ((struct snd_soc_card_drvdata_davinci *)snd_soc_card_get_drvdata(soc_card))->sysclk;/* set the codec system clock */
ret = snd_soc_dai_set_sysclk(codec_dai, 0, sysclk, SND_SOC_CLOCK_OUT);
if (ret < 0)return ret;/* set the CPU system clock */ret = snd_soc_dai_set_sysclk(cpu_dai, 0, sysclk, SND_SOC_CLOCK_OUT);if (ret < 0)return ret;return 0;}
/* set the codec system clock */
ret = snd_soc_dai_set_sysclk(codec_dai, 0, sysclk, SND_SOC_CLOCK_OUT);
if (ret < 0)return ret;