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-only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * simone.c -- ASoC audio for Simplemachines Sim.One board
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  * Copyright (c) 2010 Mika Westerberg
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7)  * Based on snappercl15 machine driver by Ryan Mallon.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) #include <linux/init.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <linux/soc/cirrus/ep93xx.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #include <sound/core.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) #include <sound/pcm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) #include <sound/soc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) #include <asm/mach-types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) SND_SOC_DAILINK_DEFS(hifi,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 	DAILINK_COMP_ARRAY(COMP_CPU("ep93xx-ac97")),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 	DAILINK_COMP_ARRAY(COMP_CODEC("ac97-codec", "ac97-hifi")),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 	DAILINK_COMP_ARRAY(COMP_PLATFORM("ep93xx-ac97")));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) static struct snd_soc_dai_link simone_dai = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) 	.name		= "AC97",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 	.stream_name	= "AC97 HiFi",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	SND_SOC_DAILINK_REG(hifi),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) static struct snd_soc_card snd_soc_simone = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 	.name		= "Sim.One",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 	.owner		= THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 	.dai_link	= &simone_dai,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	.num_links	= 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) static struct platform_device *simone_snd_ac97_device;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) static int simone_probe(struct platform_device *pdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) 	struct snd_soc_card *card = &snd_soc_simone;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 	simone_snd_ac97_device = platform_device_register_simple("ac97-codec",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) 								 -1, NULL, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 	if (IS_ERR(simone_snd_ac97_device))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) 		return PTR_ERR(simone_snd_ac97_device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 	card->dev = &pdev->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 	ret = snd_soc_register_card(card);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 	if (ret) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 		dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 			ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 		platform_device_unregister(simone_snd_ac97_device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 	return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) static int simone_remove(struct platform_device *pdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 	struct snd_soc_card *card = platform_get_drvdata(pdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) 	snd_soc_unregister_card(card);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) 	platform_device_unregister(simone_snd_ac97_device);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) static struct platform_driver simone_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) 	.driver		= {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) 		.name	= "simone-audio",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) 	.probe		= simone_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) 	.remove		= simone_remove,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) module_platform_driver(simone_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) MODULE_DESCRIPTION("ALSA SoC Simplemachines Sim.One");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) MODULE_AUTHOR("Mika Westerberg <mika.westerberg@iki.fi>");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) MODULE_LICENSE("GPL");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) MODULE_ALIAS("platform:simone-audio");