diff options
author | Ben Dooks <ben@simtec.co.uk> | 2009-11-13 17:34:20 -0500 |
---|---|---|
committer | Ben Dooks <ben-linux@fluff.org> | 2009-11-30 20:33:48 -0500 |
commit | 4d3a3469dbabbcff4dab225bc3be0b247b36401c (patch) | |
tree | fb8b419426d5fb63aa3111b6dc5fcae87e1424f6 | |
parent | cf383678242eacd6f92a48314922598ed3408355 (diff) |
ARM: S3C24XX: machine support for Simtec Audio
Add the platform/machine support for the audio devices fitted to
the Simtec range of boards since the move to ASoC.
Signed-off-by: Ben Dooks <ben@simtec.co.uk>
Signed-off-by: Simtec Linux Team <linux@simtec.co.uk>
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
-rw-r--r-- | arch/arm/mach-s3c2410/mach-bast.c | 7 | ||||
-rw-r--r-- | arch/arm/mach-s3c2410/mach-vr1000.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-s3c2440/mach-anubis.c | 15 | ||||
-rw-r--r-- | arch/arm/plat-s3c/include/plat/audio-simtec.h | 2 | ||||
-rw-r--r-- | arch/arm/plat-s3c24xx/Kconfig | 7 | ||||
-rw-r--r-- | arch/arm/plat-s3c24xx/Makefile | 1 | ||||
-rw-r--r-- | arch/arm/plat-s3c24xx/simtec-audio.c | 77 |
7 files changed, 109 insertions, 2 deletions
diff --git a/arch/arm/mach-s3c2410/mach-bast.c b/arch/arm/mach-s3c2410/mach-bast.c index 647c9adb018f..5f7837068238 100644 --- a/arch/arm/mach-s3c2410/mach-bast.c +++ b/arch/arm/mach-s3c2410/mach-bast.c | |||
@@ -61,6 +61,7 @@ | |||
61 | #include <plat/devs.h> | 61 | #include <plat/devs.h> |
62 | #include <plat/cpu.h> | 62 | #include <plat/cpu.h> |
63 | #include <plat/cpu-freq.h> | 63 | #include <plat/cpu-freq.h> |
64 | #include <plat/audio-simtec.h> | ||
64 | 65 | ||
65 | #include "usb-simtec.h" | 66 | #include "usb-simtec.h" |
66 | #include "nor-simtec.h" | 67 | #include "nor-simtec.h" |
@@ -608,6 +609,11 @@ static struct s3c_cpufreq_board __initdata bast_cpufreq = { | |||
608 | .need_io = 1, | 609 | .need_io = 1, |
609 | }; | 610 | }; |
610 | 611 | ||
612 | static struct s3c24xx_audio_simtec_pdata __initdata bast_audio = { | ||
613 | .have_mic = 1, | ||
614 | .have_lout = 1, | ||
615 | }; | ||
616 | |||
611 | static void __init bast_map_io(void) | 617 | static void __init bast_map_io(void) |
612 | { | 618 | { |
613 | /* initialise the clocks */ | 619 | /* initialise the clocks */ |
@@ -647,6 +653,7 @@ static void __init bast_init(void) | |||
647 | 653 | ||
648 | usb_simtec_init(); | 654 | usb_simtec_init(); |
649 | nor_simtec_init(); | 655 | nor_simtec_init(); |
656 | simtec_audio_add(NULL, true, &bast_audio); | ||
650 | 657 | ||
651 | s3c_cpufreq_setboard(&bast_cpufreq); | 658 | s3c_cpufreq_setboard(&bast_cpufreq); |
652 | } | 659 | } |
diff --git a/arch/arm/mach-s3c2410/mach-vr1000.c b/arch/arm/mach-s3c2410/mach-vr1000.c index 1628cc773a2c..7611472b5f1b 100644 --- a/arch/arm/mach-s3c2410/mach-vr1000.c +++ b/arch/arm/mach-s3c2410/mach-vr1000.c | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <plat/devs.h> | 49 | #include <plat/devs.h> |
50 | #include <plat/cpu.h> | 50 | #include <plat/cpu.h> |
51 | #include <plat/iic.h> | 51 | #include <plat/iic.h> |
52 | #include <plat/audio-simtec.h> | ||
52 | 53 | ||
53 | #include "usb-simtec.h" | 54 | #include "usb-simtec.h" |
54 | #include "nor-simtec.h" | 55 | #include "nor-simtec.h" |
@@ -393,6 +394,7 @@ static void __init vr1000_init(void) | |||
393 | ARRAY_SIZE(vr1000_i2c_devs)); | 394 | ARRAY_SIZE(vr1000_i2c_devs)); |
394 | 395 | ||
395 | nor_simtec_init(); | 396 | nor_simtec_init(); |
397 | simtec_audio_add(NULL, true, NULL); | ||
396 | } | 398 | } |
397 | 399 | ||
398 | MACHINE_START(VR1000, "Thorcom-VR1000") | 400 | MACHINE_START(VR1000, "Thorcom-VR1000") |
diff --git a/arch/arm/mach-s3c2440/mach-anubis.c b/arch/arm/mach-s3c2440/mach-anubis.c index 68f3870991bf..b8b9a428d497 100644 --- a/arch/arm/mach-s3c2440/mach-anubis.c +++ b/arch/arm/mach-s3c2440/mach-anubis.c | |||
@@ -53,8 +53,9 @@ | |||
53 | #include <plat/clock.h> | 53 | #include <plat/clock.h> |
54 | #include <plat/devs.h> | 54 | #include <plat/devs.h> |
55 | #include <plat/cpu.h> | 55 | #include <plat/cpu.h> |
56 | #include <plat/audio-simtec.h> | ||
56 | 57 | ||
57 | #define COPYRIGHT ", (c) 2005 Simtec Electronics" | 58 | #define COPYRIGHT ", (c) 2005-2009 Simtec Electronics" |
58 | 59 | ||
59 | static struct map_desc anubis_iodesc[] __initdata = { | 60 | static struct map_desc anubis_iodesc[] __initdata = { |
60 | /* ISA IO areas */ | 61 | /* ISA IO areas */ |
@@ -437,6 +438,17 @@ static struct i2c_board_info anubis_i2c_devs[] __initdata = { | |||
437 | } | 438 | } |
438 | }; | 439 | }; |
439 | 440 | ||
441 | /* Audio setup */ | ||
442 | static struct s3c24xx_audio_simtec_pdata __initdata anubis_audio = { | ||
443 | .have_mic = 1, | ||
444 | .have_lout = 1, | ||
445 | .output_cdclk = 1, | ||
446 | .use_mpllin = 1, | ||
447 | .amp_gpio = S3C2410_GPB(2), | ||
448 | .amp_gain[0] = S3C2410_GPD(10), | ||
449 | .amp_gain[1] = S3C2410_GPD(11), | ||
450 | }; | ||
451 | |||
440 | static void __init anubis_map_io(void) | 452 | static void __init anubis_map_io(void) |
441 | { | 453 | { |
442 | /* initialise the clocks */ | 454 | /* initialise the clocks */ |
@@ -476,6 +488,7 @@ static void __init anubis_map_io(void) | |||
476 | static void __init anubis_init(void) | 488 | static void __init anubis_init(void) |
477 | { | 489 | { |
478 | s3c_i2c0_set_platdata(NULL); | 490 | s3c_i2c0_set_platdata(NULL); |
491 | simtec_audio_add(NULL, false, &anubis_audio); | ||
479 | platform_add_devices(anubis_devices, ARRAY_SIZE(anubis_devices)); | 492 | platform_add_devices(anubis_devices, ARRAY_SIZE(anubis_devices)); |
480 | 493 | ||
481 | i2c_register_board_info(0, anubis_i2c_devs, | 494 | i2c_register_board_info(0, anubis_i2c_devs, |
diff --git a/arch/arm/plat-s3c/include/plat/audio-simtec.h b/arch/arm/plat-s3c/include/plat/audio-simtec.h index 0f440b9168db..53a93656d5db 100644 --- a/arch/arm/plat-s3c/include/plat/audio-simtec.h +++ b/arch/arm/plat-s3c/include/plat/audio-simtec.h | |||
@@ -33,5 +33,5 @@ struct s3c24xx_audio_simtec_pdata { | |||
33 | void (*startup)(void); | 33 | void (*startup)(void); |
34 | }; | 34 | }; |
35 | 35 | ||
36 | extern int simtec_audio_add(const char *codec_name, | 36 | extern int simtec_audio_add(const char *codec_name, bool has_lr_routing, |
37 | struct s3c24xx_audio_simtec_pdata *pdata); | 37 | struct s3c24xx_audio_simtec_pdata *pdata); |
diff --git a/arch/arm/plat-s3c24xx/Kconfig b/arch/arm/plat-s3c24xx/Kconfig index 9c7aca489643..20fbf936bb93 100644 --- a/arch/arm/plat-s3c24xx/Kconfig +++ b/arch/arm/plat-s3c24xx/Kconfig | |||
@@ -178,4 +178,11 @@ config MACH_SMDK | |||
178 | help | 178 | help |
179 | Common machine code for SMDK2410 and SMDK2440 | 179 | Common machine code for SMDK2410 and SMDK2440 |
180 | 180 | ||
181 | config S3C24XX_SIMTEC_AUDIO | ||
182 | bool | ||
183 | depends on (ARCH_BAST || MACH_VR1000 || MACH_OSIRIS || MACH_ANUBIS) | ||
184 | default y | ||
185 | help | ||
186 | Add audio devices for common Simtec S3C24XX boards | ||
187 | |||
181 | endif | 188 | endif |
diff --git a/arch/arm/plat-s3c24xx/Makefile b/arch/arm/plat-s3c24xx/Makefile index 7780d2dd833a..5dee8c12e8b4 100644 --- a/arch/arm/plat-s3c24xx/Makefile +++ b/arch/arm/plat-s3c24xx/Makefile | |||
@@ -55,3 +55,4 @@ obj-$(CONFIG_S3C24XX_SPI_BUS1_GPD8_GPD9_GPD10) += spi-bus1-gpd8_9_10.o | |||
55 | # machine common support | 55 | # machine common support |
56 | 56 | ||
57 | obj-$(CONFIG_MACH_SMDK) += common-smdk.o | 57 | obj-$(CONFIG_MACH_SMDK) += common-smdk.o |
58 | obj-$(CONFIG_S3C24XX_SIMTEC_AUDIO) += simtec-audio.o | ||
diff --git a/arch/arm/plat-s3c24xx/simtec-audio.c b/arch/arm/plat-s3c24xx/simtec-audio.c new file mode 100644 index 000000000000..6bc832e0d8ea --- /dev/null +++ b/arch/arm/plat-s3c24xx/simtec-audio.c | |||
@@ -0,0 +1,77 @@ | |||
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 | /* platform ops for audio */ | ||
31 | |||
32 | static void simtec_audio_startup_lrroute(void) | ||
33 | { | ||
34 | unsigned int tmp; | ||
35 | unsigned long flags; | ||
36 | |||
37 | local_irq_save(flags); | ||
38 | |||
39 | tmp = __raw_readb(BAST_VA_CTRL1); | ||
40 | tmp &= ~BAST_CPLD_CTRL1_LRMASK; | ||
41 | tmp |= BAST_CPLD_CTRL1_LRCDAC; | ||
42 | __raw_writeb(tmp, BAST_VA_CTRL1); | ||
43 | |||
44 | local_irq_restore(flags); | ||
45 | } | ||
46 | |||
47 | static struct s3c24xx_audio_simtec_pdata simtec_audio_platdata; | ||
48 | static char our_name[32]; | ||
49 | |||
50 | static struct platform_device simtec_audio_dev = { | ||
51 | .name = our_name, | ||
52 | .id = -1, | ||
53 | .dev = { | ||
54 | .parent = &s3c_device_iis.dev, | ||
55 | .platform_data = &simtec_audio_platdata, | ||
56 | }, | ||
57 | }; | ||
58 | |||
59 | int __init simtec_audio_add(const char *name, bool has_lr_routing, | ||
60 | struct s3c24xx_audio_simtec_pdata *spd) | ||
61 | { | ||
62 | if (!name) | ||
63 | name = "tlv320aic23"; | ||
64 | |||
65 | snprintf(our_name, sizeof(our_name)-1, "s3c24xx-simtec-%s", name); | ||
66 | |||
67 | /* copy platform data so the source can be __initdata */ | ||
68 | if (spd) | ||
69 | simtec_audio_platdata = *spd; | ||
70 | |||
71 | if (has_lr_routing) | ||
72 | simtec_audio_platdata.startup = simtec_audio_startup_lrroute; | ||
73 | |||
74 | platform_device_register(&s3c_device_iis); | ||
75 | platform_device_register(&simtec_audio_dev); | ||
76 | return 0; | ||
77 | } | ||