Merge tag 'usb-5.11-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
[linux/fpc-iii.git] / arch / arm / mach-s3c / simtec-audio.c
blob487485bcc2ab53b92ae14ef1ee9fafd6d09a1513
1 // SPDX-License-Identifier: GPL-2.0
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
9 #include <linux/kernel.h>
10 #include <linux/interrupt.h>
11 #include <linux/init.h>
12 #include <linux/device.h>
13 #include <linux/io.h>
15 #include "regs-gpio.h"
16 #include "gpio-samsung.h"
17 #include "gpio-cfg.h"
19 #include <linux/platform_data/asoc-s3c24xx_simtec.h>
20 #include "devs.h"
22 #include "bast.h"
23 #include "simtec.h"
25 /* platform ops for audio */
27 static void simtec_audio_startup_lrroute(void)
29 unsigned int tmp;
30 unsigned long flags;
32 local_irq_save(flags);
34 tmp = __raw_readb(BAST_VA_CTRL1);
35 tmp &= ~BAST_CPLD_CTRL1_LRMASK;
36 tmp |= BAST_CPLD_CTRL1_LRCDAC;
37 __raw_writeb(tmp, BAST_VA_CTRL1);
39 local_irq_restore(flags);
42 static struct s3c24xx_audio_simtec_pdata simtec_audio_platdata;
43 static char our_name[32];
45 static struct platform_device simtec_audio_dev = {
46 .name = our_name,
47 .id = -1,
48 .dev = {
49 .parent = &s3c_device_iis.dev,
50 .platform_data = &simtec_audio_platdata,
54 int __init simtec_audio_add(const char *name, bool has_lr_routing,
55 struct s3c24xx_audio_simtec_pdata *spd)
57 if (!name)
58 name = "tlv320aic23";
60 snprintf(our_name, sizeof(our_name)-1, "s3c24xx-simtec-%s", name);
62 /* copy platform data so the source can be __initdata */
63 if (spd)
64 simtec_audio_platdata = *spd;
66 if (has_lr_routing)
67 simtec_audio_platdata.startup = simtec_audio_startup_lrroute;
69 /* Configure the I2S pins (GPE0...GPE4) in correct mode */
70 s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
71 S3C_GPIO_PULL_NONE);
73 platform_device_register(&s3c_device_iis);
74 platform_device_register(&simtec_audio_dev);
75 return 0;