、移植环境
主 机:Fedora 14 (kernel-2.6.33.7)
开发板:FL2440(nandflash:K9F1G08 128MB)
编译器:arm-linux-gcc-4.3.2
二、移植步骤
1. 根据FL2440赠送的光盘资料可以得知,FL2440的声卡是采用PHILIPS公司的UDA1341TS型号的声卡。在没有声卡uda驱动之前,启动开发板,从系统启动信息可以看到声卡跟s3c2440的I2S并没有映射起来。
- usbcore: registered new interface driver hiddev
- usbcore: registered new interface driver usbhid
- usbhid: USB HID core driver
- No device for DAI UDA134X
- No device for DAI s3c24xx-i2s
- ALSA device list:
- No soundcards found.
2. uda驱动的移植也主要是以linux-2.6.33.7内核中自带的驱动程序为主,我只是做少量的修改与配置。打开mach-smdk2440.c文件开始配置。
- #vim arch/arm/mach-s3c2440/mach-smdk2440.c
增加头两个用到的文件:
- #include <sound/s3c24xx_uda134x.h>
- #include <mach/gpio-fns.h>
在LCD配置信息结构体后面开始增加声卡配置的结构体:
- //uda1341 sound card driver
- 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 *smdk2440_devices[] __initdata = {
- &s3c_device_usb,
- &s3c_device_lcd,
- &s3c_device_wdt,
- &s3c_device_i2c0,
- &s3c_device_iis,
- &s3c_device_rtc,
- &s3c24xx_uda134x, //uda
- };
到这里就基本上完成了配置,剩下的就是配置内核。
3. 内核各相关项配置如下。
- Device Drivers --->
- <*> Sound card support --->
- --- Sound card support
- <*> Advanced Linux Sound Architecture --->
- --- Advanced Linux Sound Architecture
- < > 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
- [*] Verbose printk
- [ ] Debug
- [ ] Generic sound devices --->
- [ ] ARM sound devices --->
- [ ] SPI sound devices --->
- [*] USB sound devices --->
- <*> ALSA for SoC audio support --->
- --- ALSA for SoC audio support
- <*> SoC Audio for the Samsung S3C24XX chips
- < > SoC AC97 Audio support for LN2440SBC - ALC650
- <*> SoC I2S Audio support UDA134X wired to a S3C24XX
- < > Build all ASoC CODEC drivers
- < > Open Sound System (DEPRECATED) --->
4. 编译下载#make zImage。很奇怪的是好像这次配置并没有启动作用,有了LCD和RTC驱动移植的经验,我很快又找到了思路,那就是修改mach-smdk2410.c程序。
- #vim arch/arm/mach-s3c2410/mach-smdk2410.c
增加头两个用到的文件:
- #include <sound/s3c24xx_uda134x.h>
- #include <mach/gpio-fns.h>
在LCD配置信息结构体后面开始增加声卡配置的结构体:
- //uda1341 sound card driver
- 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 *smdk2410_devices[] __initdata = {
- &s3c_device_usb,
- &s3c_device_lcd,
- &s3c_device_wdt,
- &s3c_device_i2c0,
- &s3c_device_iis,
- &s3c_device_rtc,
- &s3c24xx_uda134x, //uda
- };
编译后出现如下错误:
- [skywalker@localhost linux-2.6.33]$ make zImage
- CHK include/linux/version.h
- CHK include/generated/utsrelease.h
- make[1]: “include/generated/mach-types.h”是最新的。
- CALL scripts/checksyscalls.sh
- CHK include/generated/compile.h
- CC arch/arm/mach-s3c2410/mach-smdk2410.o
- arch/arm/mach-s3c2410/mach-smdk2410.c:134: error: implicit declaration of function `S3C2410_GPB'
- arch/arm/mach-s3c2410/mach-smdk2410.c:134: error: initializer element is not constant
- arch/arm/mach-s3c2410/mach-smdk2410.c:134: error: (near initialization for `s3c24xx_uda134x_data.l3_clk')
- arch/arm/mach-s3c2410/mach-smdk2410.c:135: error: initializer element is not constant
- arch/arm/mach-s3c2410/mach-smdk2410.c:135: error: (near initialization for `s3c24xx_uda134x_data.l3_data')
- arch/arm/mach-s3c2410/mach-smdk2410.c:136: error: initializer element is not constant
- arch/arm/mach-s3c2410/mach-smdk2410.c:136: error: (near initialization for `s3c24xx_uda134x_data.l3_mode')
- arch/arm/mach-s3c2410/mach-smdk2410.c:147: warning: 'smdk2440_devices' defined but not used
- make[1]: *** [arch/arm/mach-s3c2410/mach-smdk2410.o] 错误 1
- make: *** [arch/arm/mach-s3c2410] 错误 2
被这几个错误弄得有点糊涂了,后来跟踪了一下代码,发现原来S3C2410_GPB这个宏是定义在mach/gpio-nrs.h头文件里的,于是乎增加了这个头文件,再编译,终于生成了内核映象文件。下载到开发板,从系统的启动信息可以看到声2440的I2S和uda已经关联起来了。
- sbcore: registered new interface driver hiddev
- usbcore: registered new interface driver usbhid
- usbhid: USB HID core driver
- 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)
5. 验证。先建立设备节点
- #mkdir /dev/sound
- #mknod /dev/sound/dsp c 14 4
- #cat /dev/sound/dsp > /tmp/test.wav
- ^c
- # ls -l tmp
- drwx------ 1 root root 2048 Jan 27 10:48 qtembedded-0
- drwx------ 1 root root 2048 Jan 27 10:48 qtopia-0
- -rw-r--r-- 1 root root 49152 Jan 27 10:43 test.wav
- # cat /tmp/test/wav > /dev/sound/dsp
- #
ok,声卡驱动大功告成。
阅读(402) | 评论(0) | 转发(0) |