franzflasch / ar9331-i2s-alsa Goto Github PK
View Code? Open in Web Editor NEWI2S alsa device drivers for the popular MIPS ar9331 SOC (Carambola2, Arduino Yun...)
I2S alsa device drivers for the popular MIPS ar9331 SOC (Carambola2, Arduino Yun...)
Github has FranzFlasch and enc-X, which version is most current and/or what are the differences ??
also, what is the difference between I2S and PCM.... Ar9331 has these two, but i am not sure when connecting to a gsm modem, whether i2S or pcm should be used ?
thanks
Hi Franz
(thank you for share your job)
I've been using this driver module without problems. It works flawlessly with all the software I've tested (mpd, ffmpeg, madplay, alsa, pulseaudio).
Now I want to use audio input. For such purpose I've modified wm8727.c file in order to add a capture interface like this:
static const struct snd_soc_dapm_widget wm8727_dapm_widgets[] = {
SND_SOC_DAPM_OUTPUT("VOUTL"),
SND_SOC_DAPM_OUTPUT("VOUTR"),
SND_SOC_DAPM_INPUT("VINL"),
SND_SOC_DAPM_INPUT("VINR"),
};
static const struct snd_soc_dapm_route wm8727_dapm_routes[] = {
{ "VOUTL", NULL, "Playback" },
{ "VOUTR", NULL, "Playback" },
{ "VINL", NULL, "Capture" },
{ "VINR", NULL, "Capture" },
};
/*
* Note this is a simple chip with no configuration interface, sample rate is
* determined automatically by examining the Master clock and Bit clock ratios
*/
#define WM8727_RATES (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 |\
SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000 |\
SNDRV_PCM_RATE_192000)
static struct snd_soc_dai_driver wm8727_dai = {
.name = "wm8727-hifi",
.playback = {
.stream_name = "Playback",
.channels_min = 2,
.channels_max = 2,
.rates = WM8727_RATES,
.formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE,
},
.capture = {
.stream_name = "Capture",
.channels_min = 2,
.channels_max = 2,
.rates = WM8727_RATES,
.formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE,
},
};
Now besides the playback interface, I can see the capture interface:
cat /proc/asound/Carambola2/pcm0c/info
card: 0
device: 0
subdevice: 0
stream: CAPTURE
id: Carambola2 audio wm8727-hifi-0
name:
subname: subdevice #0
class: 0
subclass: 0
subdevices_count: 1
subdevices_avail: 1
But when I run "arecord -fcd" command all I get is:
root@OpenWrt:/# arecord -f cd
[68255.670000] ath79_i2s_startup
[68255.670000] ath79_stereo_reset
Recording WAVE 'stdin' : Signed 16 bit Little Endian, Rate 44100 Hz, [68255.680000] ath79_i2s_hw_params
[68255.690000] Set clk config: 11-b726-2 for freq: 44100
[68255.690000] ath79_stereo_reset
[68255.690000] ath79_stereo_reset
[68255.700000] ath79_i2s_trigger
Stereo
RIFF$�WAVEfmt D��data�[68256.270000] ath79_i2s_trigger
[68256.780000] ath79_stereo_reset
[68256.780000] ath79_i2s_trigger
overrun!!! (at least 476.617 ms long)
[68257.330000] ath79_i2s_trigger
[68257.510000] ath79_stereo_reset
[68257.510000] ath79_i2s_trigger
overrun!!! (at least 143.291 ms long)
[68258.050000] ath79_i2s_trigger
[68258.230000] ath79_stereo_reset
[68258.240000] ath79_i2s_trigger
overrun!!! (at least 143.281 ms long)
[68258.480000] ath79_i2s_trigger
[68258.510000] ath79_i2s_shutdown
...
Please, could you help me in order to debug further such situation or give some clue in order to resolve it?
Regards,
Sergios
Hi franz
I've detected that running an arecord command, and connecting audio source to left channel, sometimes stores data on the left buffer, and sometimes stores data on the right buffer.
Basically I run a command like "arecord -fcd -vumeter = stereo > / dev / null " and sometimes it returns (I use /dev/null to discard audio but same result writing to temporary storage, thank you for the tip).
This behaviour seems to be random, not sure about any cause of it.
Could you please give some clue in order to debug further this issue?
Regards,
Sergio
Hi franz
Thank you for share this git repo.
I'm trying to test audio in my AR9331 board (SKW71),with 3.10.44 kernel version and whenever I run:
root@OpenWrt:/# insmod ath79-i2s.ko
[30030.600000] ath79_i2s: Unknown symbol snd_soc_unregister_component (err 0)
[30030.610000] ath79_i2s: Unknown symbol snd_soc_register_component (err 0)
kmod: failed to insert /lib/modules/3.10.44/ath79-i2s.ko
Seems like snd-soc-core module isn't loaded. Then i run
insmod snd-soc-core.ko
[29845.960000] snd_soc_core: Unknown symbol snd_jack_report (err 0)
[29845.970000] snd_soc_core: Unknown symbol snd_jack_new (err 0)
kmod: failed to insert /lib/modules/3.10.44/snd-soc-core.ko
Seems like jack.c file isn't not linked together with the kernel, but my .config file it's showing CONFIG_SND_JACK=y.
Please can you guide me on how to debug it or go forward in order to test your module?
sergio
I have build openwrt SDK for source for AR9331 soc. I have successfully build helloworld program with this SDK. I kept the helloworld folder in package folder of SDK topdir. inside helloworld folder there is a src filder containing helloworld.c along with a Makefile. I run make command from SDK topdir.
To build your i2s module I unzip ar9331-i2s-alsa-master.zip at package folder and run make V=s from SDK topdir but nothing build. console message make[2]: Nothing to be done for `package/compile'.
Please help me to build the kernel module. I am using Ubuntu 14.04 host
Thanks & regards
/jags
franz:
I've migrated this code to lower version kernel of 2.6.31, the audio codec is wm8731,control interface is i2c that is simulated by gpio,but only DC noise output when play music file, can you give some debug hint ?
Hi Franz,
I run this code on linux3.38 ,snd_soc_register_component cannot find when compiling,so I changed "return snd_soc_register_component(&pdev->dev, &ath79_i2s_component, &ath79_i2s_dai, 1);" to "return snd_soc_register_dai(&pdev->dev, &ath79_i2s_dai);" ,but when insmod ath79-i2s.ko I got some error as below:
Apr 2 16:43:11 OpenWrt kern.warn kernel: [ 3075.270000] ath79_i2s: Unknown symbol snd_soc_register_dai (err 0)
Apr 2 16:43:11 OpenWrt kern.warn kernel: [ 3075.280000] ath79_i2s: Unknown symbol snd_soc_unregister_dai (err 0)
what should I do to fix above error? thanks
Hi Franz,
all the modules have been inserted , but seems not works. there is no controlC0,seq etc under /dev/snd/ ,below are some information ,thanks very much if you can help
root@OpenWrt:~# dmesg
.................only print those info
[ 185.900000] ath_audio_init
[ 242.710000] ath79_i2s_drv_probe
[ 242.710000] ath79_stereo_reset
[ 267.790000] ath79_soc_platform_probe
root@OpenWrt:# cat /proc/s# cat /proc/asound/devices
self/ softirqs stat swaps sys/ sysrq-trigger sysvipc/
root@OpenWrt:
33: : timer
root@OpenWrt:~# ls -l /dev/snd/
crw-r--r-- 1 root root 116, 33 Jan 1 1970 timer
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.