Merge tag 'locks-v3.16-2' of git://git.samba.org/jlayton/linux
[linux/fpc-iii.git] / sound / soc / sirf / sirf-audio-port.c
blobb4afa31b2bc11ea00baf93c22a6cf244d47732e5
1 /*
2 * SiRF Audio port driver
4 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
6 * Licensed under GPLv2 or later.
7 */
8 #include <linux/module.h>
9 #include <sound/soc.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);
22 snd_soc_dai_init_dma_data(dai, &port->playback_dma_data,
23 &port->capture_dma_data);
24 return 0;
27 static struct snd_soc_dai_driver sirf_audio_port_dai = {
28 .probe = sirf_audio_port_dai_probe,
29 .name = "sirf-audio-port",
30 .id = 0,
31 .playback = {
32 .channels_min = 2,
33 .channels_max = 2,
34 .rates = SNDRV_PCM_RATE_48000,
35 .formats = SNDRV_PCM_FMTBIT_S16_LE,
37 .capture = {
38 .channels_min = 1,
39 .channels_max = 2,
40 .rates = SNDRV_PCM_RATE_48000,
41 .formats = SNDRV_PCM_FMTBIT_S16_LE,
45 static const struct snd_soc_component_driver sirf_audio_port_component = {
46 .name = "sirf-audio-port",
49 static int sirf_audio_port_probe(struct platform_device *pdev)
51 int ret;
52 struct sirf_audio_port *port;
54 port = devm_kzalloc(&pdev->dev,
55 sizeof(struct sirf_audio_port), GFP_KERNEL);
56 if (!port)
57 return -ENOMEM;
59 ret = devm_snd_soc_register_component(&pdev->dev,
60 &sirf_audio_port_component, &sirf_audio_port_dai, 1);
61 if (ret)
62 return ret;
64 platform_set_drvdata(pdev, port);
65 return devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0);
68 static const struct of_device_id sirf_audio_port_of_match[] = {
69 { .compatible = "sirf,audio-port", },
72 MODULE_DEVICE_TABLE(of, sirf_audio_port_of_match);
74 static struct platform_driver sirf_audio_port_driver = {
75 .driver = {
76 .name = "sirf-audio-port",
77 .owner = THIS_MODULE,
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");