分类: 嵌入式
2010-01-09 12:20:53
一、开发平台
主 机:VMWare--Fedora 8
开发板:utu2440--64MB Nand / linux-
编译器:arm-linux-gcc-
二、移植步骤
1. 定义并添加声卡设备到系统平台设备初始化列表中
修改arch/arm/plat-s3c24xx/devs.c,添加如下内容
#include
#include
/* UDA1341 */
static struct s3c24xx_uda134x_platform_data s3c24xx_uda134x_data = {
.l3_clk = S3C2410_GPB4,
.l3_data = S3C2410_GPB3,
.l3_mode = S3C2410_GPB2,
.model = UDA134X_UDA1341,
};
struct platform_device s3c_device_uda134x = {
.name = "s3c24xx_uda134x",
.dev = {
.platform_data = &s3c24xx_uda134x_data,
}
};
EXPORT_SYMBOL(s3c_device_uda134x);
修改 arch/arm/plat-s3c/include/plat/devs.h,添加如下内容
extern struct platform_device s3c_device_uda134x;
修改vi arch/arm/mach-s3c2440/mach-smdk2440.c,找到*smdk2440_devices[],添加&s3c_device_uda134x,
2. 配置内核
Device Drivers --->
<*> Sound card support --->
<*> Advanced Linux Sound Architecture --->
<*>
<*>
[*]
[*] Support old ALSA API
[*] Verbose procfs contents
[*] Verbose printk
[*] Generic sound devices --->
<*> ALSA for SoC audio support --->
<*> SoC Audio for the Samsung S3C24XX chips
<*> SoC I2S Audio support UDA134X wired to a S3C24XX
3. 编译内核并下载到开发板,在启动信息中可以看到uda1341驱动已加载成功
Advanced Linux Sound Architecture Driver Version
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)
# cat /proc/devices
可以看到多了主设备号为14的设备名sound, 并且在/dev下多了dsp和mixer两个设备结点
# ls /dev/dsp –l
crw-rw---- 1 root root 14, 3 Jan 9 11:41 /dev/dsp
# ls /dev/mixer –l
crw-rw---- 1 root root 14, 0 Jan 9 11:41 /dev/mixer
挂载U盘,拷贝一首歌曲到开发板home目录中,
# cat music.mp3 > /dev/dsp,可以听到耳机发出噪声,至此声卡驱动移植完成