Skip to content

Commit

Permalink
ARM: S3C24XX: machine support for Simtec Audio
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ben Dooks authored and Ben Dooks committed Dec 1, 2009
1 parent cf38367 commit 4d3a346
Show file tree
Hide file tree
Showing 7 changed files with 109 additions and 2 deletions.
7 changes: 7 additions & 0 deletions arch/arm/mach-s3c2410/mach-bast.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
#include <plat/devs.h>
#include <plat/cpu.h>
#include <plat/cpu-freq.h>
#include <plat/audio-simtec.h>

#include "usb-simtec.h"
#include "nor-simtec.h"
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 2 additions & 0 deletions arch/arm/mach-s3c2410/mach-vr1000.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#include <plat/devs.h>
#include <plat/cpu.h>
#include <plat/iic.h>
#include <plat/audio-simtec.h>

#include "usb-simtec.h"
#include "nor-simtec.h"
Expand Down Expand Up @@ -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")
Expand Down
15 changes: 14 additions & 1 deletion arch/arm/mach-s3c2440/mach-anubis.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@
#include <plat/clock.h>
#include <plat/devs.h>
#include <plat/cpu.h>
#include <plat/audio-simtec.h>

#define COPYRIGHT ", (c) 2005 Simtec Electronics"
#define COPYRIGHT ", (c) 2005-2009 Simtec Electronics"

static struct map_desc anubis_iodesc[] __initdata = {
/* ISA IO areas */
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/plat-s3c/include/plat/audio-simtec.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
7 changes: 7 additions & 0 deletions arch/arm/plat-s3c24xx/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions arch/arm/plat-s3c24xx/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
77 changes: 77 additions & 0 deletions arch/arm/plat-s3c24xx/simtec-audio.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/* linux/arch/arm/plat-s3c24xx/simtec-audio.c
*
* Copyright (c) 2009 Simtec Electronics
* http://armlinux.simtec.co.uk/
* Ben Dooks <ben@simtec.co.uk>
*
* 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 <linux/kernel.h>
#include <linux/interrupt.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/io.h>

#include <mach/bast-map.h>
#include <mach/bast-irq.h>
#include <mach/bast-cpld.h>

#include <mach/hardware.h>
#include <mach/regs-gpio.h>

#include <plat/audio-simtec.h>
#include <plat/devs.h>

/* 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;
}

0 comments on commit 4d3a346

Please sign in to comment.