From: Ben Dooks Date: Fri, 13 Nov 2009 22:34:20 +0000 (+0000) Subject: ARM: S3C24XX: machine support for Simtec Audio X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=4d3a3469dbabbcff4dab225bc3be0b247b36401c;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: Simtec Linux Team Signed-off-by: Ben Dooks --- 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 @@ #include #include #include +#include #include "usb-simtec.h" #include "nor-simtec.h" @@ -608,6 +609,11 @@ static struct s3c_cpufreq_board __initdata bast_cpufreq = { .need_io = 1, }; +static struct s3c24xx_audio_simtec_pdata __initdata bast_audio = { + .have_mic = 1, + .have_lout = 1, +}; + static void __init bast_map_io(void) { /* initialise the clocks */ @@ -647,6 +653,7 @@ static void __init bast_init(void) usb_simtec_init(); nor_simtec_init(); + simtec_audio_add(NULL, true, &bast_audio); s3c_cpufreq_setboard(&bast_cpufreq); } 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 @@ #include #include #include +#include #include "usb-simtec.h" #include "nor-simtec.h" @@ -393,6 +394,7 @@ static void __init vr1000_init(void) ARRAY_SIZE(vr1000_i2c_devs)); nor_simtec_init(); + simtec_audio_add(NULL, true, NULL); } 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 @@ #include #include #include +#include -#define COPYRIGHT ", (c) 2005 Simtec Electronics" +#define COPYRIGHT ", (c) 2005-2009 Simtec Electronics" static struct map_desc anubis_iodesc[] __initdata = { /* ISA IO areas */ @@ -437,6 +438,17 @@ static struct i2c_board_info anubis_i2c_devs[] __initdata = { } }; +/* Audio setup */ +static struct s3c24xx_audio_simtec_pdata __initdata anubis_audio = { + .have_mic = 1, + .have_lout = 1, + .output_cdclk = 1, + .use_mpllin = 1, + .amp_gpio = S3C2410_GPB(2), + .amp_gain[0] = S3C2410_GPD(10), + .amp_gain[1] = S3C2410_GPD(11), +}; + static void __init anubis_map_io(void) { /* initialise the clocks */ @@ -476,6 +488,7 @@ static void __init anubis_map_io(void) static void __init anubis_init(void) { s3c_i2c0_set_platdata(NULL); + simtec_audio_add(NULL, false, &anubis_audio); platform_add_devices(anubis_devices, ARRAY_SIZE(anubis_devices)); 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 { void (*startup)(void); }; -extern int simtec_audio_add(const char *codec_name, +extern int simtec_audio_add(const char *codec_name, bool has_lr_routing, 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 help Common machine code for SMDK2410 and SMDK2440 +config S3C24XX_SIMTEC_AUDIO + bool + depends on (ARCH_BAST || MACH_VR1000 || MACH_OSIRIS || MACH_ANUBIS) + default y + help + Add audio devices for common Simtec S3C24XX boards + 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 # machine common support obj-$(CONFIG_MACH_SMDK) += common-smdk.o +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 @@ +/* linux/arch/arm/plat-s3c24xx/simtec-audio.c + * + * Copyright (c) 2009 Simtec Electronics + * http://armlinux.simtec.co.uk/ + * Ben Dooks + * + * Audio setup for various Simtec S3C24XX implementations + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. +*/ + +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include +#include + +/* platform ops for audio */ + +static void simtec_audio_startup_lrroute(void) +{ + unsigned int tmp; + unsigned long flags; + + local_irq_save(flags); + + tmp = __raw_readb(BAST_VA_CTRL1); + tmp &= ~BAST_CPLD_CTRL1_LRMASK; + tmp |= BAST_CPLD_CTRL1_LRCDAC; + __raw_writeb(tmp, BAST_VA_CTRL1); + + local_irq_restore(flags); +} + +static struct s3c24xx_audio_simtec_pdata simtec_audio_platdata; +static char our_name[32]; + +static struct platform_device simtec_audio_dev = { + .name = our_name, + .id = -1, + .dev = { + .parent = &s3c_device_iis.dev, + .platform_data = &simtec_audio_platdata, + }, +}; + +int __init simtec_audio_add(const char *name, bool has_lr_routing, + struct s3c24xx_audio_simtec_pdata *spd) +{ + if (!name) + name = "tlv320aic23"; + + snprintf(our_name, sizeof(our_name)-1, "s3c24xx-simtec-%s", name); + + /* copy platform data so the source can be __initdata */ + if (spd) + simtec_audio_platdata = *spd; + + if (has_lr_routing) + simtec_audio_platdata.startup = simtec_audio_startup_lrroute; + + platform_device_register(&s3c_device_iis); + platform_device_register(&simtec_audio_dev); + return 0; +}