Merge tag 'gpio-for-v3.11-3' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw...
[linux-2.6.git] / arch / arm / mach-s3c24xx / simtec-audio.c
blob67cb5120dfeb5dc5cc4d7a70d44571eebcce9ab6
1 /* linux/arch/arm/plat-s3c24xx/simtec-audio.c
3 * Copyright (c) 2009 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
7 * Audio setup for various Simtec S3C24XX implementations
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.
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>
20 #include <mach/hardware.h>
21 #include <mach/regs-gpio.h>
23 #include <linux/platform_data/asoc-s3c24xx_simtec.h>
24 #include <plat/devs.h>
26 #include "bast.h"
27 #include "simtec.h"
29 /* platform ops for audio */
31 static void simtec_audio_startup_lrroute(void)
33 unsigned int tmp;
34 unsigned long flags;
36 local_irq_save(flags);
38 tmp = __raw_readb(BAST_VA_CTRL1);
39 tmp &= ~BAST_CPLD_CTRL1_LRMASK;
40 tmp |= BAST_CPLD_CTRL1_LRCDAC;
41 __raw_writeb(tmp, BAST_VA_CTRL1);
43 local_irq_restore(flags);
46 static struct s3c24xx_audio_simtec_pdata simtec_audio_platdata;
47 static char our_name[32];
49 static struct platform_device simtec_audio_dev = {
50 .name = our_name,
51 .id = -1,
52 .dev = {
53 .parent = &s3c_device_iis.dev,
54 .platform_data = &simtec_audio_platdata,
58 int __init simtec_audio_add(const char *name, bool has_lr_routing,
59 struct s3c24xx_audio_simtec_pdata *spd)
61 if (!name)
62 name = "tlv320aic23";
64 snprintf(our_name, sizeof(our_name)-1, "s3c24xx-simtec-%s", name);
66 /* copy platform data so the source can be __initdata */
67 if (spd)
68 simtec_audio_platdata = *spd;
70 if (has_lr_routing)
71 simtec_audio_platdata.startup = simtec_audio_startup_lrroute;
73 platform_device_register(&s3c_device_iis);
74 platform_device_register(&simtec_audio_dev);
75 return 0;