2 * SiRF Audio port driver
4 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
6 * Licensed under GPLv2 or later.
8 #include <linux/module.h>
10 #include <sound/dmaengine_pcm.h>
12 struct sirf_audio_port {
13 struct regmap *regmap;
14 struct snd_dmaengine_dai_dma_data playback_dma_data;
15 struct snd_dmaengine_dai_dma_data capture_dma_data;
19 static int sirf_audio_port_dai_probe(struct snd_soc_dai *dai)
21 struct sirf_audio_port *port = snd_soc_dai_get_drvdata(dai);
23 snd_soc_dai_init_dma_data(dai, &port->playback_dma_data,
24 &port->capture_dma_data);
28 static struct snd_soc_dai_driver sirf_audio_port_dai = {
29 .probe = sirf_audio_port_dai_probe,
30 .name = "sirf-audio-port",
35 .rates = SNDRV_PCM_RATE_48000,
36 .formats = SNDRV_PCM_FMTBIT_S16_LE,
41 .rates = SNDRV_PCM_RATE_48000,
42 .formats = SNDRV_PCM_FMTBIT_S16_LE,
46 static const struct snd_soc_component_driver sirf_audio_port_component = {
47 .name = "sirf-audio-port",
50 static int sirf_audio_port_probe(struct platform_device *pdev)
53 struct sirf_audio_port *port;
55 port = devm_kzalloc(&pdev->dev,
56 sizeof(struct sirf_audio_port), GFP_KERNEL);
60 ret = devm_snd_soc_register_component(&pdev->dev,
61 &sirf_audio_port_component, &sirf_audio_port_dai, 1);
65 platform_set_drvdata(pdev, port);
66 return devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0);
69 static const struct of_device_id sirf_audio_port_of_match[] = {
70 { .compatible = "sirf,audio-port", },
73 MODULE_DEVICE_TABLE(of, sirf_audio_port_of_match);
75 static struct platform_driver sirf_audio_port_driver = {
77 .name = "sirf-audio-port",
78 .of_match_table = sirf_audio_port_of_match,
80 .probe = sirf_audio_port_probe,
83 module_platform_driver(sirf_audio_port_driver);
85 MODULE_DESCRIPTION("SiRF Audio Port driver");
86 MODULE_AUTHOR("RongJun Ying <Rongjun.Ying@csr.com>");
87 MODULE_LICENSE("GPL v2");