Transplant the uda1341 driver to s3c2440 (tq2440 board).
First,let's analysis the source code of uda1341 driver.
sound/soc/s3c24xx/s3c24xx_uda134x.c
242static struct s3c24xx_uda134x_platform_data *s3c24xx_uda134x_l3_pins;
290static int s3c24xx_uda134x_probe(struct platform_device *pdev)
291{
292 int ret;
293
294 printk(KERN_INFO "S3C24XX_UDA134X SoC Audio driver\n");
295
296 s3c24xx_uda134x_l3_pins = pdev->dev.platform_data;
/*here the probe() only take the platform_data from platform_device, and the corresponding type is s3c24xx_uda134x_paltform_data, and search the source we find that it is defined in include/sound/s3c24xx_uda134x.h */
297 if (s3c24xx_uda134x_l3_pins == NULL) {
298 printk(KERN_ERR "S3C24XX_UDA134X SoC Audio: "
299 "unable to find platform data\n");
300 return -ENODEV;
301 }
302 s3c24xx_uda134x.power = s3c24xx_uda134x_l3_pins->power;
303 s3c24xx_uda134x.model = s3c24xx_uda134x_l3_pins->model;
304
305 if (s3c24xx_uda134x_setup_pin(s3c24xx_uda134x_l3_pins->l3_data,
306 "data") < 0)
307 return -EBUSY;
308 if (s3c24xx_uda134x_setup_pin(s3c24xx_uda134x_l3_pins->l3_clk,
309 "clk") < 0) {
310 gpio_free(s3c24xx_uda134x_l3_pins->l3_data);
311 return -EBUSY;
312 }
313 if (s3c24xx_uda134x_setup_pin(s3c24xx_uda134x_l3_pins->l3_mode,
314 "mode") < 0) {
315 gpio_free(s3c24xx_uda134x_l3_pins->l3_data);
316 gpio_free(s3c24xx_uda134x_l3_pins->l3_clk);
317 return -EBUSY;
318 }
319
320 s3c24xx_uda134x_snd_device = platform_device_alloc("soc-audio", -1);
321 if (!s3c24xx_uda134x_snd_device) {
322 printk(KERN_ERR "S3C24XX_UDA134X SoC Audio: "
323 "Unable to register\n");
324 return -ENOMEM;
325 }
326
327 platform_set_drvdata(s3c24xx_uda134x_snd_device,
328 &s3c24xx_uda134x_snd_devdata);
329 s3c24xx_uda134x_snd_devdata.dev = &s3c24xx_uda134x_snd_device->dev;
330 ret = platform_device_add(s3c24xx_uda134x_snd_device);
331 if (ret) {
332 printk(KERN_ERR "S3C24XX_UDA134X SoC Audio: Unable to add\n");
333 platform_device_put(s3c24xx_uda134x_snd_device);
334 }
335
336 return ret;
337}
include/sound/s3c24xx_uda134x.h
1#ifndef _S3C24XX_UDA134X_H_
2#define _S3C24XX_UDA134X_H_ 1
3
4#include <sound/uda134x.h>
5
6struct s3c24xx_uda134x_platform_data {
7 int l3_clk;
8 int l3_mode;
9 int l3_data;
/*the three member above is a l3 interface, and we must register io port to them.*/
10 void (*power) (int);
11 int model;
/*the model is used to identify different types of uda134x, and the Marco is defined in include/sound/uda134x.h */
12};
13
14#endif
include/sound/uda134x.h
1/*
2 * uda134x.h -- UDA134x ALSA SoC Codec driver
3 *
4 * Copyright 2007 Dension Audio Systems Ltd.
5 * Author: Zoltan Devai
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef _UDA134X_H
13#define _UDA134X_H
14
15#include <sound/l3.h>
16
17struct uda134x_platform_data {
18 struct l3_pins l3;
19 void (*power) (int);
20 int model;
21#define UDA134X_UDA1340 1
22#define UDA134X_UDA1341 2
23#define UDA134X_UDA1344 3
24#define UDA134X_UDA1345 4
25};
26
27#endif /* _UDA134X_H */
28 Next, initialize the platform_device in mach-s3c2440/tq2440.c (your board specified file)
/*for sound car UDA 1341*/
#include <sound/s3c24xx_uda134x.h>
/*for sound card uda1341*/
static struct s3c24xx_uda134x_platform_data tq2440_uda1341_platform_data = {
.l3_clk = S3C2410_GPB(4),
.l3_mode = S3C2410_GPB(2),
.l3_data = S3C2410_GPB(3),
.model = UDA134X_UDA1341,
};
static struct platform_device tq2440_device_uda1341 = {
.name = "s3c24xx_uda1341",/*the name must be confronted to the driver*/
.id = 0,
.dev = {
.platform_data = &tq2440_uda1341_platform_data,
}
};
static struct platform_device *tq2440_devices[] __initdata = {
&s3c_device_usb,
&s3c_device_lcd,
&s3c_device_wdt,
&s3c_device_i2c0,
&s3c_device_iis,
&tq2440_device_dm9000, //for DM9000//
&s3c_device_usbgadget, //for s3c USB device, the struct already included in plat/devs.h
&s3c_device_ac97, //for s3c AC97
&tq2440_device_uda1341 //for soundcard uda1341
};
And don't forget to enable the uda134x driver in the kernel configure.
After compiling the the kernel, if you built it as a module, and then just run “modprobe snd-soc-s3c24xx-uda134x”.By the way, if you need oss support, for example, mplayer was built without alsa support, you can load oss module with the command “modprobe snd-pcm-oss”.