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