aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/pxa/pxa2xx-ac97.c
diff options
context:
space:
mode:
authorJames Morris <jmorris@namei.org>2009-03-26 17:28:11 -0400
committerJames Morris <jmorris@namei.org>2009-03-26 17:28:11 -0400
commit1987f17d2266e882862528841429b5bf67bc8fe5 (patch)
tree5c3fbee88018ab7259a18c10e6320e575d0ed679 /sound/soc/pxa/pxa2xx-ac97.c
parent7198e2eeb44b3fe7cc97f997824002da47a9c644 (diff)
parent0384e2959127a56d0640505d004d8dd92f9c29f5 (diff)
Merge branch 'master' into next
Diffstat (limited to 'sound/soc/pxa/pxa2xx-ac97.c')
-rw-r--r--sound/soc/pxa/pxa2xx-ac97.c59
1 files changed, 49 insertions, 10 deletions
diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c
index 812c2b4d3e07..01c21c6cdbbc 100644
--- a/sound/soc/pxa/pxa2xx-ac97.c
+++ b/sound/soc/pxa/pxa2xx-ac97.c
@@ -106,13 +106,13 @@ static int pxa2xx_ac97_resume(struct snd_soc_dai *dai)
106static int pxa2xx_ac97_probe(struct platform_device *pdev, 106static int pxa2xx_ac97_probe(struct platform_device *pdev,
107 struct snd_soc_dai *dai) 107 struct snd_soc_dai *dai)
108{ 108{
109 return pxa2xx_ac97_hw_probe(pdev); 109 return pxa2xx_ac97_hw_probe(to_platform_device(dai->dev));
110} 110}
111 111
112static void pxa2xx_ac97_remove(struct platform_device *pdev, 112static void pxa2xx_ac97_remove(struct platform_device *pdev,
113 struct snd_soc_dai *dai) 113 struct snd_soc_dai *dai)
114{ 114{
115 pxa2xx_ac97_hw_remove(pdev); 115 pxa2xx_ac97_hw_remove(to_platform_device(dai->dev));
116} 116}
117 117
118static int pxa2xx_ac97_hw_params(struct snd_pcm_substream *substream, 118static int pxa2xx_ac97_hw_params(struct snd_pcm_substream *substream,
@@ -164,6 +164,18 @@ static int pxa2xx_ac97_hw_mic_params(struct snd_pcm_substream *substream,
164 SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 | \ 164 SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 | \
165 SNDRV_PCM_RATE_48000) 165 SNDRV_PCM_RATE_48000)
166 166
167static struct snd_soc_dai_ops pxa_ac97_hifi_dai_ops = {
168 .hw_params = pxa2xx_ac97_hw_params,
169};
170
171static struct snd_soc_dai_ops pxa_ac97_aux_dai_ops = {
172 .hw_params = pxa2xx_ac97_hw_aux_params,
173};
174
175static struct snd_soc_dai_ops pxa_ac97_mic_dai_ops = {
176 .hw_params = pxa2xx_ac97_hw_mic_params,
177};
178
167/* 179/*
168 * There is only 1 physical AC97 interface for pxa2xx, but it 180 * There is only 1 physical AC97 interface for pxa2xx, but it
169 * has extra fifo's that can be used for aux DACs and ADCs. 181 * has extra fifo's that can be used for aux DACs and ADCs.
@@ -189,8 +201,7 @@ struct snd_soc_dai pxa_ac97_dai[] = {
189 .channels_max = 2, 201 .channels_max = 2,
190 .rates = PXA2XX_AC97_RATES, 202 .rates = PXA2XX_AC97_RATES,
191 .formats = SNDRV_PCM_FMTBIT_S16_LE,}, 203 .formats = SNDRV_PCM_FMTBIT_S16_LE,},
192 .ops = { 204 .ops = &pxa_ac97_hifi_dai_ops,
193 .hw_params = pxa2xx_ac97_hw_params,},
194}, 205},
195{ 206{
196 .name = "pxa2xx-ac97-aux", 207 .name = "pxa2xx-ac97-aux",
@@ -208,8 +219,7 @@ struct snd_soc_dai pxa_ac97_dai[] = {
208 .channels_max = 1, 219 .channels_max = 1,
209 .rates = PXA2XX_AC97_RATES, 220 .rates = PXA2XX_AC97_RATES,
210 .formats = SNDRV_PCM_FMTBIT_S16_LE,}, 221 .formats = SNDRV_PCM_FMTBIT_S16_LE,},
211 .ops = { 222 .ops = &pxa_ac97_aux_dai_ops,
212 .hw_params = pxa2xx_ac97_hw_aux_params,},
213}, 223},
214{ 224{
215 .name = "pxa2xx-ac97-mic", 225 .name = "pxa2xx-ac97-mic",
@@ -221,23 +231,52 @@ struct snd_soc_dai pxa_ac97_dai[] = {
221 .channels_max = 1, 231 .channels_max = 1,
222 .rates = PXA2XX_AC97_RATES, 232 .rates = PXA2XX_AC97_RATES,
223 .formats = SNDRV_PCM_FMTBIT_S16_LE,}, 233 .formats = SNDRV_PCM_FMTBIT_S16_LE,},
224 .ops = { 234 .ops = &pxa_ac97_mic_dai_ops,
225 .hw_params = pxa2xx_ac97_hw_mic_params,},
226}, 235},
227}; 236};
228 237
229EXPORT_SYMBOL_GPL(pxa_ac97_dai); 238EXPORT_SYMBOL_GPL(pxa_ac97_dai);
230EXPORT_SYMBOL_GPL(soc_ac97_ops); 239EXPORT_SYMBOL_GPL(soc_ac97_ops);
231 240
232static int __init pxa_ac97_init(void) 241static int __devinit pxa2xx_ac97_dev_probe(struct platform_device *pdev)
233{ 242{
243 int i;
244
245 for (i = 0; i < ARRAY_SIZE(pxa_ac97_dai); i++)
246 pxa_ac97_dai[i].dev = &pdev->dev;
247
248 /* Punt most of the init to the SoC probe; we may need the machine
249 * driver to do interesting things with the clocking to get us up
250 * and running.
251 */
234 return snd_soc_register_dais(pxa_ac97_dai, ARRAY_SIZE(pxa_ac97_dai)); 252 return snd_soc_register_dais(pxa_ac97_dai, ARRAY_SIZE(pxa_ac97_dai));
235} 253}
254
255static int __devexit pxa2xx_ac97_dev_remove(struct platform_device *pdev)
256{
257 snd_soc_unregister_dais(pxa_ac97_dai, ARRAY_SIZE(pxa_ac97_dai));
258
259 return 0;
260}
261
262static struct platform_driver pxa2xx_ac97_driver = {
263 .probe = pxa2xx_ac97_dev_probe,
264 .remove = __devexit_p(pxa2xx_ac97_dev_remove),
265 .driver = {
266 .name = "pxa2xx-ac97",
267 .owner = THIS_MODULE,
268 },
269};
270
271static int __init pxa_ac97_init(void)
272{
273 return platform_driver_register(&pxa2xx_ac97_driver);
274}
236module_init(pxa_ac97_init); 275module_init(pxa_ac97_init);
237 276
238static void __exit pxa_ac97_exit(void) 277static void __exit pxa_ac97_exit(void)
239{ 278{
240 snd_soc_unregister_dais(pxa_ac97_dai, ARRAY_SIZE(pxa_ac97_dai)); 279 platform_driver_unregister(&pxa2xx_ac97_driver);
241} 280}
242module_exit(pxa_ac97_exit); 281module_exit(pxa_ac97_exit);
243 282