diff options
Diffstat (limited to 'sound/soc/nuc900/nuc900-ac97.c')
-rw-r--r-- | sound/soc/nuc900/nuc900-ac97.c | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/sound/soc/nuc900/nuc900-ac97.c b/sound/soc/nuc900/nuc900-ac97.c index caa7c901bc2e..dac6732da969 100644 --- a/sound/soc/nuc900/nuc900-ac97.c +++ b/sound/soc/nuc900/nuc900-ac97.c | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <sound/pcm.h> | 20 | #include <sound/pcm.h> |
21 | #include <sound/initval.h> | 21 | #include <sound/initval.h> |
22 | #include <sound/soc.h> | 22 | #include <sound/soc.h> |
23 | #include <linux/device.h> | ||
24 | #include <linux/clk.h> | 23 | #include <linux/clk.h> |
25 | 24 | ||
26 | #include <mach/mfp.h> | 25 | #include <mach/mfp.h> |
@@ -50,7 +49,7 @@ static unsigned short nuc900_ac97_read(struct snd_ac97 *ac97, | |||
50 | mutex_lock(&ac97_mutex); | 49 | mutex_lock(&ac97_mutex); |
51 | 50 | ||
52 | val = nuc900_checkready(); | 51 | val = nuc900_checkready(); |
53 | if (!!val) { | 52 | if (val) { |
54 | dev_err(nuc900_audio->dev, "AC97 codec is not ready\n"); | 53 | dev_err(nuc900_audio->dev, "AC97 codec is not ready\n"); |
55 | goto out; | 54 | goto out; |
56 | } | 55 | } |
@@ -103,7 +102,7 @@ static void nuc900_ac97_write(struct snd_ac97 *ac97, unsigned short reg, | |||
103 | mutex_lock(&ac97_mutex); | 102 | mutex_lock(&ac97_mutex); |
104 | 103 | ||
105 | tmp = nuc900_checkready(); | 104 | tmp = nuc900_checkready(); |
106 | if (!!tmp) | 105 | if (tmp) |
107 | dev_err(nuc900_audio->dev, "AC97 codec is not ready\n"); | 106 | dev_err(nuc900_audio->dev, "AC97 codec is not ready\n"); |
108 | 107 | ||
109 | /* clear the R_WB bit and write register index */ | 108 | /* clear the R_WB bit and write register index */ |
@@ -150,7 +149,7 @@ static void nuc900_ac97_warm_reset(struct snd_ac97 *ac97) | |||
150 | udelay(100); | 149 | udelay(100); |
151 | 150 | ||
152 | val = nuc900_checkready(); | 151 | val = nuc900_checkready(); |
153 | if (!!val) | 152 | if (val) |
154 | dev_err(nuc900_audio->dev, "AC97 codec is not ready\n"); | 153 | dev_err(nuc900_audio->dev, "AC97 codec is not ready\n"); |
155 | 154 | ||
156 | mutex_unlock(&ac97_mutex); | 155 | mutex_unlock(&ac97_mutex); |
@@ -264,8 +263,7 @@ static int nuc900_ac97_trigger(struct snd_pcm_substream *substream, | |||
264 | return ret; | 263 | return ret; |
265 | } | 264 | } |
266 | 265 | ||
267 | static int nuc900_ac97_probe(struct platform_device *pdev, | 266 | static int nuc900_ac97_probe(struct snd_soc_dai *dai) |
268 | struct snd_soc_dai *dai) | ||
269 | { | 267 | { |
270 | struct nuc900_audio *nuc900_audio = nuc900_ac97_data; | 268 | struct nuc900_audio *nuc900_audio = nuc900_ac97_data; |
271 | unsigned long val; | 269 | unsigned long val; |
@@ -285,20 +283,19 @@ static int nuc900_ac97_probe(struct platform_device *pdev, | |||
285 | return 0; | 283 | return 0; |
286 | } | 284 | } |
287 | 285 | ||
288 | static void nuc900_ac97_remove(struct platform_device *pdev, | 286 | static int nuc900_ac97_remove(struct snd_soc_dai *dai) |
289 | struct snd_soc_dai *dai) | ||
290 | { | 287 | { |
291 | struct nuc900_audio *nuc900_audio = nuc900_ac97_data; | 288 | struct nuc900_audio *nuc900_audio = nuc900_ac97_data; |
292 | 289 | ||
293 | clk_disable(nuc900_audio->clk); | 290 | clk_disable(nuc900_audio->clk); |
291 | return 0; | ||
294 | } | 292 | } |
295 | 293 | ||
296 | static struct snd_soc_dai_ops nuc900_ac97_dai_ops = { | 294 | static struct snd_soc_dai_ops nuc900_ac97_dai_ops = { |
297 | .trigger = nuc900_ac97_trigger, | 295 | .trigger = nuc900_ac97_trigger, |
298 | }; | 296 | }; |
299 | 297 | ||
300 | struct snd_soc_dai nuc900_ac97_dai = { | 298 | static struct snd_soc_dai_driver nuc900_ac97_dai = { |
301 | .name = "nuc900-ac97", | ||
302 | .probe = nuc900_ac97_probe, | 299 | .probe = nuc900_ac97_probe, |
303 | .remove = nuc900_ac97_remove, | 300 | .remove = nuc900_ac97_remove, |
304 | .ac97_control = 1, | 301 | .ac97_control = 1, |
@@ -315,8 +312,7 @@ struct snd_soc_dai nuc900_ac97_dai = { | |||
315 | .channels_max = 2, | 312 | .channels_max = 2, |
316 | }, | 313 | }, |
317 | .ops = &nuc900_ac97_dai_ops, | 314 | .ops = &nuc900_ac97_dai_ops, |
318 | } | 315 | }; |
319 | EXPORT_SYMBOL_GPL(nuc900_ac97_dai); | ||
320 | 316 | ||
321 | static int __devinit nuc900_ac97_drvprobe(struct platform_device *pdev) | 317 | static int __devinit nuc900_ac97_drvprobe(struct platform_device *pdev) |
322 | { | 318 | { |
@@ -365,9 +361,7 @@ static int __devinit nuc900_ac97_drvprobe(struct platform_device *pdev) | |||
365 | 361 | ||
366 | nuc900_ac97_data = nuc900_audio; | 362 | nuc900_ac97_data = nuc900_audio; |
367 | 363 | ||
368 | nuc900_audio->dev = nuc900_ac97_dai.dev = &pdev->dev; | 364 | ret = snd_soc_register_dai(&pdev->dev, &nuc900_ac97_dai); |
369 | |||
370 | ret = snd_soc_register_dai(&nuc900_ac97_dai); | ||
371 | if (ret) | 365 | if (ret) |
372 | goto out3; | 366 | goto out3; |
373 | 367 | ||
@@ -389,14 +383,14 @@ out0: | |||
389 | 383 | ||
390 | static int __devexit nuc900_ac97_drvremove(struct platform_device *pdev) | 384 | static int __devexit nuc900_ac97_drvremove(struct platform_device *pdev) |
391 | { | 385 | { |
392 | 386 | snd_soc_unregister_dai(&pdev->dev); | |
393 | snd_soc_unregister_dai(&nuc900_ac97_dai); | ||
394 | 387 | ||
395 | clk_put(nuc900_ac97_data->clk); | 388 | clk_put(nuc900_ac97_data->clk); |
396 | iounmap(nuc900_ac97_data->mmio); | 389 | iounmap(nuc900_ac97_data->mmio); |
397 | release_mem_region(nuc900_ac97_data->res->start, | 390 | release_mem_region(nuc900_ac97_data->res->start, |
398 | resource_size(nuc900_ac97_data->res)); | 391 | resource_size(nuc900_ac97_data->res)); |
399 | 392 | ||
393 | kfree(nuc900_ac97_data); | ||
400 | nuc900_ac97_data = NULL; | 394 | nuc900_ac97_data = NULL; |
401 | 395 | ||
402 | return 0; | 396 | return 0; |
@@ -404,7 +398,7 @@ static int __devexit nuc900_ac97_drvremove(struct platform_device *pdev) | |||
404 | 398 | ||
405 | static struct platform_driver nuc900_ac97_driver = { | 399 | static struct platform_driver nuc900_ac97_driver = { |
406 | .driver = { | 400 | .driver = { |
407 | .name = "nuc900-audio", | 401 | .name = "nuc900-ac97", |
408 | .owner = THIS_MODULE, | 402 | .owner = THIS_MODULE, |
409 | }, | 403 | }, |
410 | .probe = nuc900_ac97_drvprobe, | 404 | .probe = nuc900_ac97_drvprobe, |