Transplantation of Linux-2.6.32.2 Kernel on mini2440 (13th)-porting uda1341 audio driver

Source: Internet
Author: User

Port Environment (Bold font in redIs the modified content,Blue bold ChineseFor special attention)

1. host environment: centos 5.5 and 1 GB memory in vmare.

2. Integrated Development Environment: Elipse ide

3. compiling environment: Arm-Linux-GCC v4.4.3 and arm-None-Linux-gnueabi-GCC v4.5.1.

4. Development Board: mini2440, 2 m nor flash, 128 m nand Flash.

5, U-boot version: u-boot-2009.08

6, Linux: linux-2.6.32.2

7. References:

Complete embedded Linux application development manual, edited by Wei Dongshan.

Mini2440 Linux porting Development Practice Guide

[1] Add the uda1341 device structure to the initialization file

Linux-2.6.32.2 has perfect support for uda1341 audio chip driver, we just need to register the uda1341 platform device control port in arch/ARM/mach-s3c2440/mach-mini2440.c file on it, open the mach-mini2440.c, locate and add the following content near row 59:

# Include <Linux/dm9000.h>
// Add the header file required for the device structure of the SD card
# Include <Linux/MMC/host. h>
# Include <plat/MCI. h>
// Add a sound card header file
# Include <sound/s3c24xx_uda134x.h>

Static struct map_desc mini2440_iodesc [] _ initdata = {
/* ISA Io space map (memory space selected by A24 )*/

Go to the vicinity of Line 2 and add the following code after the SD card device structure:

/* MMC/SD */
Static struct s3c24xx_mci_pdata mini2440_mmc_cfg = {
. Gpio_detect = s3c2410_gpg (8 ),
. Gpio_wprotect = s3c2410_gph (8 ),
. Set_power = NULL,
. Ocr_avail = mmc_vdd_32_33 | mmc_vdd_33_34,
};
/* Sound card */
Static struct s3c24xx_uda134x_platform_data s3c24xx_uda134x_data = {
. L3_clk = s3c2410_gpb (4 ),
. L3_data = s3c2410_gpb (3 ),
. L3_mode = s3c2410_gpb (2 ),
. Model = uda134x_uda1341,
};
Static struct platform_device s3c24xx_uda134x = {
. Name = "s3c24xx_uda134x ",
. Dev = {
. Platform_data = & s3c24xx_uda134x_data,
}
};

Static struct platform_device * mini2440_devices [] _ initdata = {
& Initi_device_usb,
& Initi_device_sdi, // Add the SD card structure device to the device set on the Target Platform
& Amp; cloud_device_rtc,
& Amp; cloud_device_ LCD,
& Amp; cloud_device_wdt,
& Amp; cloud_device_i2c0,
& Amp; cloud_device_iis,
& Initi_device_nand, // Add the NAND flash device to the device list structure of the Development Board.
& Mini2440_device_eth, // Add the NIC platform device to the device list STRUCTURE OF THE DEVELOPMENT BOARD
& Amp; s3c24xx_uda134x,// Register the uda1341 device platform to the kernel
};

In this way, we have added the uda1341 audio device driver.

[2] configure the uda1341 device driver in the kernel

Enter the kernel source code root directory in the terminal and execute make menuconfig.

Device Drivers --->
<*> Sound card support --->

[*] Preclaim OSS device numbers

<*> Advanced Linux sound Architecture ---> // The Audio driver architecture sub-menu is displayed. Here, we select the configuration options related to the OSS interface. Note that, here, the OSS interface is actually created based on the Alsa interface, because the new kernel has now switched to the Alsa design. This is done only for compatibility with the previous software.

<> Sequencer support

<*> OSS mixer API

<*> Oss pcm (digital audio) API

[*] Oss pcm (digital audio) API-include plugin system

[*] Dynamic device file minor numbers

[] Support old ALSA API

[*] Verbose procfs Contents

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

-*-Soc I2S audio support uda134x wired to a s3c24xx

Here, we can see the configuration options specifically for the s3c24xx series chip (including S3C2410/2440/2443 and so on), open the linux-2.6.32.2/sound/soc/s3c24xx/MAKEFILE file can be seen

Our development board uses the uda1341 audio chip, here of course you need to select "-*-Soc I2S audio support uda134x wired to a s3c24xx.
Exit and save the preceding configurations.

[3] recompile and Test

After re-compilation, generate uimage, copy it to the nfsboot/kernel directory, and start the Development Board. The following startup information is displayed:

......

Usbhid: v2.6: USB hid Core Driver
Advanced Linux sound architecture driver version 1.0.21.
No device for Dai uda134x
No device for Dai s3c24xx-i2s
S3c24xx_uda134x SOC audio driver
Uda134x SOC Audio Codec
ASOC: uda134x s3c24xx-i2s mapping OK
ALSA device list:
#0: s3c24xx_uda134x (uda134x)
S3c-sdi s3c2440-sdi: running at 398 kHz (requested: 400 kHz ).

......

Test the sound card device. First, use CAT/mnt/test.wav>/dev/DSP to play the recording. The operation is as follows:

[Root @ mini2440/] # Cat/proc/devices
Character devices:
......

10 Misc
13 Input
14. Sound
29 FB

[Root @ mini2440/] # ls-L/dev/DSP
CrW-RW ---- 1 Root 14, 3 Jan 1 00:00/dev/DSP

Store a audio file test.wav in the nfsboot/nfsdirectory shared by the host, and then execute it on the serial port terminal of the Development Board.

[Root @ mini2440/] # Cat/mnt/nfs/test.wav>/dev/DSP
[Root @ mini2440/] #

You can hear the sound of a song with a lot of noise.

[3] corrected the recording code in the driver.

When using the recording program that comes with the system for recording, we find that we cannot hear any results, because the Recording Circuit of the Development Board is different from the circuit of the smdk2440 target board. Shows the Recording Circuit of the mini2440 Development Board:

It can be seen that the mini2440 Development Board uses the recording channel vin2, while the smdk2440 uses vin1, open the linux-2.6.32.2/sound/soc/codecs/uda134x. C, and add the following red code in around 201 lines:

 

Uda134x-> slave_substream = substream;
} Else
Uda134x-> master_substream = substream;

 Uda134x_write (codec, 2, 2 | (5u <2 ));// Change the recording channel to vin2.
Return 0;
}

In this way, we have completed the correction of the Recording Driver.

[4] re-compile and Test

Run make uimage in the kernel source code directory, copy the generated uimge to the/nfsboot/kernel directory, and then restart the Development Board, run CAT/dev/DSP>/mnt/nfs/test1.wav on the command terminal to test the recording, then run CAT/mnt/nfs/test1.wav>/dev/DSP to play the recorded sound.

[Root @ mini2440/] # Cat/dev/DSP>/mnt/nfs/test1.wav
^ C
[Root @ mini2440/] # ls-L/mnt/nfs/test1.wav
-RW-r -- 1 Root 45056 Jun 28 2011/mnt/nfs/test1.wav
[Root @ mini2440/] # Cat/mnt/nfs/test1.wav>/dev/DSP
[Root @ mini2440/] #
You can hear the noisy sound just recorded.

Next, the dog driver will be transplanted.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.