diff options
Diffstat (limited to 'arch/arm/mach-s3c24xx/simtec-audio.c')
-rw-r--r-- | arch/arm/mach-s3c24xx/simtec-audio.c | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/arch/arm/mach-s3c24xx/simtec-audio.c b/arch/arm/mach-s3c24xx/simtec-audio.c new file mode 100644 index 000000000000..11881c9a38c0 --- /dev/null +++ b/arch/arm/mach-s3c24xx/simtec-audio.c | |||
@@ -0,0 +1,79 @@ | |||
1 | /* linux/arch/arm/plat-s3c24xx/simtec-audio.c | ||
2 | * | ||
3 | * Copyright (c) 2009 Simtec Electronics | ||
4 | * http://armlinux.simtec.co.uk/ | ||
5 | * Ben Dooks <ben@simtec.co.uk> | ||
6 | * | ||
7 | * Audio setup for various Simtec S3C24XX implementations | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or modify | ||
10 | * it under the terms of the GNU General Public License version 2 as | ||
11 | * published by the Free Software Foundation. | ||
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/bast-map.h> | ||
21 | #include <mach/bast-irq.h> | ||
22 | #include <mach/bast-cpld.h> | ||
23 | |||
24 | #include <mach/hardware.h> | ||
25 | #include <mach/regs-gpio.h> | ||
26 | |||
27 | #include <plat/audio-simtec.h> | ||
28 | #include <plat/devs.h> | ||
29 | |||
30 | #include "simtec.h" | ||
31 | |||
32 | /* platform ops for audio */ | ||
33 | |||
34 | static void simtec_audio_startup_lrroute(void) | ||
35 | { | ||
36 | unsigned int tmp; | ||
37 | unsigned long flags; | ||
38 | |||
39 | local_irq_save(flags); | ||
40 | |||
41 | tmp = __raw_readb(BAST_VA_CTRL1); | ||
42 | tmp &= ~BAST_CPLD_CTRL1_LRMASK; | ||
43 | tmp |= BAST_CPLD_CTRL1_LRCDAC; | ||
44 | __raw_writeb(tmp, BAST_VA_CTRL1); | ||
45 | |||
46 | local_irq_restore(flags); | ||
47 | } | ||
48 | |||
49 | static struct s3c24xx_audio_simtec_pdata simtec_audio_platdata; | ||
50 | static char our_name[32]; | ||
51 | |||
52 | static struct platform_device simtec_audio_dev = { | ||
53 | .name = our_name, | ||
54 | .id = -1, | ||
55 | .dev = { | ||
56 | .parent = &s3c_device_iis.dev, | ||
57 | .platform_data = &simtec_audio_platdata, | ||
58 | }, | ||
59 | }; | ||
60 | |||
61 | int __init simtec_audio_add(const char *name, bool has_lr_routing, | ||
62 | struct s3c24xx_audio_simtec_pdata *spd) | ||
63 | { | ||
64 | if (!name) | ||
65 | name = "tlv320aic23"; | ||
66 | |||
67 | snprintf(our_name, sizeof(our_name)-1, "s3c24xx-simtec-%s", name); | ||
68 | |||
69 | /* copy platform data so the source can be __initdata */ | ||
70 | if (spd) | ||
71 | simtec_audio_platdata = *spd; | ||
72 | |||
73 | if (has_lr_routing) | ||
74 | simtec_audio_platdata.startup = simtec_audio_startup_lrroute; | ||
75 | |||
76 | platform_device_register(&s3c_device_iis); | ||
77 | platform_device_register(&simtec_audio_dev); | ||
78 | return 0; | ||
79 | } | ||