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-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  3)  * SiRF Audio port driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  5)  * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  6)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  7) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  8) #include <sound/soc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  9) #include <sound/dmaengine_pcm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) struct sirf_audio_port {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) 	struct regmap *regmap;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) 	struct snd_dmaengine_dai_dma_data playback_dma_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) 	struct snd_dmaengine_dai_dma_data capture_dma_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) static int sirf_audio_port_dai_probe(struct snd_soc_dai *dai)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) 	struct sirf_audio_port *port = snd_soc_dai_get_drvdata(dai);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) 	snd_soc_dai_init_dma_data(dai, &port->playback_dma_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) 			&port->capture_dma_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) static struct snd_soc_dai_driver sirf_audio_port_dai = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) 	.probe = sirf_audio_port_dai_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) 	.name = "sirf-audio-port",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) 	.id = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) 	.playback = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) 		.channels_min = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) 		.channels_max = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) 		.rates = SNDRV_PCM_RATE_48000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) 		.formats = SNDRV_PCM_FMTBIT_S16_LE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 	.capture = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) 		.channels_min = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) 		.channels_max = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) 		.rates = SNDRV_PCM_RATE_48000,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) 		.formats = SNDRV_PCM_FMTBIT_S16_LE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) static const struct snd_soc_component_driver sirf_audio_port_component = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) 	.name       = "sirf-audio-port",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) static int sirf_audio_port_probe(struct platform_device *pdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) 	int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) 	struct sirf_audio_port *port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) 	port = devm_kzalloc(&pdev->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) 			sizeof(struct sirf_audio_port), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) 	if (!port)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) 	ret = devm_snd_soc_register_component(&pdev->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) 			&sirf_audio_port_component, &sirf_audio_port_dai, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) 	if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) 		return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) 	platform_set_drvdata(pdev, port);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65) 	return devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) static const struct of_device_id sirf_audio_port_of_match[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) 	{ .compatible = "sirf,audio-port", },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) 	{}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) MODULE_DEVICE_TABLE(of, sirf_audio_port_of_match);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) static struct platform_driver sirf_audio_port_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75) 	.driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) 		.name = "sirf-audio-port",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) 		.of_match_table = sirf_audio_port_of_match,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) 	},
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) 	.probe = sirf_audio_port_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) module_platform_driver(sirf_audio_port_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) MODULE_DESCRIPTION("SiRF Audio Port driver");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) MODULE_AUTHOR("RongJun Ying <Rongjun.Ying@csr.com>");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) MODULE_LICENSE("GPL v2");