Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12603 Discussions

uClinux: I need help in implementing sound (ALSA, i2c-ocores, wm8731)

Honored Contributor II

Hello everyone! (At first sorry for my English)  


Currently I'm doing small project, which is to run all peripherals on the de2-115 board. Successfully I ran most of the components (framebuffer,touchscreen, USB, keyboard/mouse, sd-card), but unfortunately I got stuck when trying to run sound. In my system design (in qsys) for i2c I usedi2c-opencore, and for audio controller the "Audio Interface" component, which is used as standard in Terasic example designs. These components areneeded, because on de2-115 board wm8731 codec is communicating with FPGA via i2c. 


My next step was to write device-tree file. I was not able to find any example of dts file for any de2 board, which would describe how correctlydefine both components (and devicetree documentation is poor). So I declared the two mentioned components as follows: 


peripheral_subsystem_audio_ctrl: unknown <at> 0x0 { // This is Audio controller (wm8731) 

compatible = "unknown,unknown-1.0"; // no clue what to write here  

reg = < 0x00000000 0x00000020 >;  

interrupt-parent = < &cpu >; 

interrupts = < 10 >;  

}; //end unknown <at> 0x0 (peripheral_subsystem_audio_ctrl)  


peripheral_subsystem_i2c_0: i2c <at> 0x90 {  

# address-cells = <1>; 

# size-cells = <0>; 

compatible = "opencores,i2c-ocores-1.0","opencores,i2c-ocores";  

reg = < 0x00000090 0x00000008 >; 

interrupt-parent = < &cpu >; 

interrupts = < 9 >; 

clock-frequency = < 50000000 >; 

reg-shift = <0>; /* 8 bit registers */  

reg-io-width = <1>; /* 8 bit read/write */  


wm8731: wm8731 <at> 0x1a {  

compatible = "wlf,wm8731";  

reg = <0x1a>;  


}; //end i2c <at> 0x90 (peripheral_subsystem_i2c_0) 


How can you see, i do not know how correctly declare audio controller. I amalmost sure, that this is wrong declaration of audio components, but I cannot find proper. In example in the file"/uClinux/linux-2.6/Documentation/devicetree/usage-model.txt" there isexample for nvidia tegra audio declaration, which specify both components(i2c and audio controller) and also possess "sound" node, which combinesthese two component into one device.  


My kernel configuration for audio is as follows:  

Device Drivers --->  

<*> I2C support --->  


[*] Enable compatibility bits for old user-space  

<*> I2C device interface 


[*] Autoselect pertinent helper modules I2C  

Hardware Bus support --->  

<*> OpenCores I2C Controller  

<*> Sound card support --->  

<*> Advanced Linux Sound Architecture --->  


[*] Support old ALSA API 


[*] Verbose procfs contents 


[*] Generic sound devices ---> 

<*> ALSA for SoC audio support ---> 

<*> Build all ASoC CODEC driver 

<*> ASoC Simple sound card support  


Blackfin app programs --->  

[*] ALSA utils 


When I compile configured kernel, I download everything on the board,system loads, but ALSA prints that "No soundcard was found". But driver isinstalled (/sys/bus/i2c/drivers/wm8731) and device is on the i2c bus(/sys/bus/i2c/devices/0-001a). Can someone give me some hints how to solve this problem? I am almost surethat this is only fault of my badly declared dts file. But mabey I justneed to configure audio after system load? I am beginner in the linuxworld, and i do not know how to do it :/  


Please help!  


Regards, Kamil
0 Kudos
2 Replies
Honored Contributor II

Ok, I think that what I miss is the driver for audio IP that I use in my project. I use "TERASIC_AUDIO" IP. Is anyone is in the possession of a driver for that IP?

0 Kudos
Honored Contributor II

On other post Kazuyasu answer my question. Now I have to think about it. As I get results, I will try to describe how to run sound for DE2 boards.

0 Kudos