blob: 897040016e9eeaeefa35861c242630f123e74775 [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13
14#include <linux/init.h>
15#include <linux/module.h>
16#include <linux/device.h>
17#include <linux/platform_device.h>
18#include <sound/core.h>
19#include <sound/pcm.h>
20#include <sound/soc.h>
21
22static struct snd_soc_dai_ops msm_fe_dai_ops = {};
23
24static struct snd_soc_dai_driver msm_fe_dais[] = {
25 {
26 .playback = {
27 .stream_name = "Multimedia1 Playback",
28 .rates = SNDRV_PCM_RATE_8000_48000,
29 .formats = SNDRV_PCM_FMTBIT_S16_LE,
30 .channels_min = 1,
31 .channels_max = 2,
32 .rate_min = 8000,
33 .rate_max = 48000,
34 },
35 .capture = {
36 .stream_name = "Multimedia1 Capture",
37 .rates = SNDRV_PCM_RATE_8000_48000,
38 .formats = SNDRV_PCM_FMTBIT_S16_LE,
39 .channels_min = 1,
40 .channels_max = 2,
41 .rate_min = 8000,
42 .rate_max = 48000,
43 },
44 .ops = &msm_fe_dai_ops,
45 .name = "MultiMedia1",
46 },
47 {
48 .playback = {
49 .stream_name = "Multimedia2 Playback",
50 .rates = SNDRV_PCM_RATE_8000_48000,
51 .formats = SNDRV_PCM_FMTBIT_S16_LE,
52 .channels_min = 1,
53 .channels_max = 2,
54 .rate_min = 8000,
55 .rate_max = 48000,
56 },
57 .capture = {
58 .stream_name = "Multimedia2 Capture",
59 .rates = SNDRV_PCM_RATE_8000_48000,
60 .formats = SNDRV_PCM_FMTBIT_S16_LE,
61 .channels_min = 1,
62 .channels_max = 2,
63 .rate_min = 8000,
64 .rate_max = 48000,
65 },
66 .ops = &msm_fe_dai_ops,
67 .name = "MultiMedia2",
68 },
69 {
70 .playback = {
71 .stream_name = "Voice Playback",
72 .rates = SNDRV_PCM_RATE_8000_48000,
73 .formats = SNDRV_PCM_FMTBIT_S16_LE,
74 .channels_min = 1,
75 .channels_max = 2,
76 .rate_min = 8000,
77 .rate_max = 48000,
78 },
79 .capture = {
80 .stream_name = "Voice Capture",
81 .rates = SNDRV_PCM_RATE_8000_48000,
82 .formats = SNDRV_PCM_FMTBIT_S16_LE,
83 .channels_min = 1,
84 .channels_max = 2,
85 .rate_min = 8000,
86 .rate_max = 48000,
87 },
88 .ops = &msm_fe_dai_ops,
89 .name = "CS-VOICE",
90 },
91 {
92 .playback = {
93 .stream_name = "VoIP Playback",
94 .rates = SNDRV_PCM_RATE_8000_48000,
95 .formats = SNDRV_PCM_FMTBIT_S16_LE,
96 .channels_min = 1,
97 .channels_max = 2,
98 .rate_min = 8000,
99 .rate_max = 48000,
100 },
101 .capture = {
102 .stream_name = "VoIP Capture",
103 .rates = SNDRV_PCM_RATE_8000_48000,
104 .formats = SNDRV_PCM_FMTBIT_S16_LE,
105 .channels_min = 1,
106 .channels_max = 2,
107 .rate_min = 8000,
108 .rate_max = 48000,
109 },
110 .ops = &msm_fe_dai_ops,
111 .name = "VoIP",
112 },
113 {
114 .playback = {
115 .stream_name = "MultiMedia3 Playback",
116 .rates = SNDRV_PCM_RATE_8000_48000,
117 .formats = SNDRV_PCM_FMTBIT_S16_LE,
118 .channels_min = 1,
119 .channels_max = 2,
120 .rate_min = 8000,
121 .rate_max = 48000,
122 },
123 .ops = &msm_fe_dai_ops,
124 .name = "MultiMedia3",
125 },
126 /* FE DAIs created for hostless operation purpose */
127 {
128 .playback = {
129 .stream_name = "SLIMBUS0 Hostless Playback",
130 .rates = SNDRV_PCM_RATE_8000_48000,
131 .formats = SNDRV_PCM_FMTBIT_S16_LE,
132 .channels_min = 1,
133 .channels_max = 2,
134 .rate_min = 8000,
135 .rate_max = 48000,
136 },
137 .capture = {
138 .stream_name = "SLIMBUS0 Hostless Capture",
139 .rates = SNDRV_PCM_RATE_8000_48000,
140 .formats = SNDRV_PCM_FMTBIT_S16_LE,
141 .channels_min = 1,
142 .channels_max = 2,
143 .rate_min = 8000,
144 .rate_max = 48000,
145 },
146 .ops = &msm_fe_dai_ops,
147 .name = "SLIMBUS0_HOSTLESS",
148 },
149 {
150 .playback = {
151 .stream_name = "INT_FM Hostless Playback",
152 .rates = SNDRV_PCM_RATE_8000_48000,
153 .formats = SNDRV_PCM_FMTBIT_S16_LE,
154 .channels_min = 1,
155 .channels_max = 2,
156 .rate_min = 8000,
157 .rate_max = 48000,
158 },
159 .capture = {
160 .stream_name = "INT_FM Hostless Capture",
161 .rates = SNDRV_PCM_RATE_8000_48000,
162 .formats = SNDRV_PCM_FMTBIT_S16_LE,
163 .channels_min = 1,
164 .channels_max = 2,
165 .rate_min = 8000,
166 .rate_max = 48000,
167 },
168 .ops = &msm_fe_dai_ops,
169 .name = "INT_FM_HOSTLESS",
170 },
Laxminath Kasam32657ec2011-08-01 19:26:57 +0530171 {
172 .playback = {
173 .stream_name = "AFE-PROXY Playback",
174 .rates = (SNDRV_PCM_RATE_8000 |
175 SNDRV_PCM_RATE_16000 |
176 SNDRV_PCM_RATE_48000),
177 .formats = SNDRV_PCM_FMTBIT_S16_LE,
178 .channels_min = 1,
179 .channels_max = 2,
180 .rate_min = 8000,
181 .rate_max = 48000,
182 },
183 .capture = {
184 .stream_name = "AFE-PROXY Capture",
185 .rates = (SNDRV_PCM_RATE_8000 |
186 SNDRV_PCM_RATE_16000 |
187 SNDRV_PCM_RATE_48000),
188 .formats = SNDRV_PCM_FMTBIT_S16_LE,
189 .channels_min = 1,
190 .channels_max = 2,
191 .rate_min = 8000,
192 .rate_max = 48000,
193 },
194 .ops = &msm_fe_dai_ops,
195 .name = "AFE-PROXY",
196 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700197};
198
199static __devinit int msm_fe_dai_dev_probe(struct platform_device *pdev)
200{
201 dev_dbg(&pdev->dev, "%s: dev name %s\n", __func__,
202 dev_name(&pdev->dev));
203 return snd_soc_register_dais(&pdev->dev, msm_fe_dais,
204 ARRAY_SIZE(msm_fe_dais));
205}
206
207static __devexit int msm_fe_dai_dev_remove(struct platform_device *pdev)
208{
209 snd_soc_unregister_dai(&pdev->dev);
210 return 0;
211}
212
213static struct platform_driver msm_fe_dai_driver = {
214 .probe = msm_fe_dai_dev_probe,
215 .remove = msm_fe_dai_dev_remove,
216 .driver = {
217 .name = "msm-dai-fe",
218 .owner = THIS_MODULE,
219 },
220};
221
222static int __init msm_fe_dai_init(void)
223{
224 return platform_driver_register(&msm_fe_dai_driver);
225}
226module_init(msm_fe_dai_init);
227
228static void __exit msm_fe_dai_exit(void)
229{
230 platform_driver_unregister(&msm_fe_dai_driver);
231}
232module_exit(msm_fe_dai_exit);
233
234/* Module information */
235MODULE_DESCRIPTION("MSM Frontend DAI driver");
236MODULE_LICENSE("GPL v2");