1
2
3
4
5
6
7
8
9
10
11
12
13
14#include <linux/kernel.h>
15#include <linux/interrupt.h>
16#include <linux/init.h>
17#include <linux/device.h>
18#include <linux/io.h>
19
20#include <mach/hardware.h>
21#include <mach/regs-gpio.h>
22
23#include <linux/platform_data/asoc-s3c24xx_simtec.h>
24#include <plat/devs.h>
25
26#include "bast.h"
27#include "simtec.h"
28
29
30
31static void simtec_audio_startup_lrroute(void)
32{
33 unsigned int tmp;
34 unsigned long flags;
35
36 local_irq_save(flags);
37
38 tmp = __raw_readb(BAST_VA_CTRL1);
39 tmp &= ~BAST_CPLD_CTRL1_LRMASK;
40 tmp |= BAST_CPLD_CTRL1_LRCDAC;
41 __raw_writeb(tmp, BAST_VA_CTRL1);
42
43 local_irq_restore(flags);
44}
45
46static struct s3c24xx_audio_simtec_pdata simtec_audio_platdata;
47static char our_name[32];
48
49static struct platform_device simtec_audio_dev = {
50 .name = our_name,
51 .id = -1,
52 .dev = {
53 .parent = &s3c_device_iis.dev,
54 .platform_data = &simtec_audio_platdata,
55 },
56};
57
58int __init simtec_audio_add(const char *name, bool has_lr_routing,
59 struct s3c24xx_audio_simtec_pdata *spd)
60{
61 if (!name)
62 name = "tlv320aic23";
63
64 snprintf(our_name, sizeof(our_name)-1, "s3c24xx-simtec-%s", name);
65
66
67 if (spd)
68 simtec_audio_platdata = *spd;
69
70 if (has_lr_routing)
71 simtec_audio_platdata.startup = simtec_audio_startup_lrroute;
72
73 platform_device_register(&s3c_device_iis);
74 platform_device_register(&simtec_audio_dev);
75 return 0;
76}
77