Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  1) // SPDX-License-Identifier: GPL-2.0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) //
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3) // Copyright (c) 2009 Simtec Electronics
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4) //	http://armlinux.simtec.co.uk/
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5) //	Ben Dooks <ben@simtec.co.uk>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6) //
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) // Audio setup for various Simtec S3C24XX implementations
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include "regs-gpio.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include "gpio-samsung.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include "gpio-cfg.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <linux/platform_data/asoc-s3c24xx_simtec.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include "devs.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include "bast.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #include "simtec.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) /* platform ops for audio */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) static void simtec_audio_startup_lrroute(void)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	unsigned int tmp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 	unsigned long flags;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 	local_irq_save(flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	tmp = __raw_readb(BAST_VA_CTRL1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	tmp &= ~BAST_CPLD_CTRL1_LRMASK;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	tmp |= BAST_CPLD_CTRL1_LRCDAC;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	__raw_writeb(tmp, BAST_VA_CTRL1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 	local_irq_restore(flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) static struct s3c24xx_audio_simtec_pdata simtec_audio_platdata;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) static char our_name[32];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) static struct platform_device simtec_audio_dev = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 	.name	= our_name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 	.id	= -1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 	.dev	= {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 		.parent		= &s3c_device_iis.dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 		.platform_data	= &simtec_audio_platdata,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) int __init simtec_audio_add(const char *name, bool has_lr_routing,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 			    struct s3c24xx_audio_simtec_pdata *spd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 	if (!name)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 		name = "tlv320aic23";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 	snprintf(our_name, sizeof(our_name)-1, "s3c24xx-simtec-%s", name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 	/* copy platform data so the source can be __initdata */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 	if (spd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 		simtec_audio_platdata = *spd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) 	if (has_lr_routing)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) 		simtec_audio_platdata.startup = simtec_audio_startup_lrroute;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) 	/* Configure the I2S pins (GPE0...GPE4) in correct mode */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 	s3c_gpio_cfgall_range(S3C2410_GPE(0), 5, S3C_GPIO_SFN(2),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) 			      S3C_GPIO_PULL_NONE);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) 	platform_device_register(&s3c_device_iis);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) 	platform_device_register(&simtec_audio_dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) }