GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / sound / soc / codecs / ad73311.c
blob475807bea2c229d04e4e3ed91dd8647ffa26d259
1 /*
2 * ad73311.c -- ALSA Soc AD73311 codec support
4 * Copyright: Analog Device Inc.
5 * Author: Cliff Cai <cliff.cai@analog.com>
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
13 #include <linux/init.h>
14 #include <linux/slab.h>
15 #include <linux/module.h>
16 #include <linux/kernel.h>
17 #include <linux/device.h>
18 #include <sound/core.h>
19 #include <sound/pcm.h>
20 #include <sound/ac97_codec.h>
21 #include <sound/initval.h>
22 #include <sound/soc.h>
24 #include "ad73311.h"
26 struct snd_soc_dai ad73311_dai = {
27 .name = "AD73311",
28 .playback = {
29 .stream_name = "Playback",
30 .channels_min = 1,
31 .channels_max = 1,
32 .rates = SNDRV_PCM_RATE_8000,
33 .formats = SNDRV_PCM_FMTBIT_S16_LE, },
34 .capture = {
35 .stream_name = "Capture",
36 .channels_min = 1,
37 .channels_max = 1,
38 .rates = SNDRV_PCM_RATE_8000,
39 .formats = SNDRV_PCM_FMTBIT_S16_LE, },
41 EXPORT_SYMBOL_GPL(ad73311_dai);
43 static int ad73311_soc_probe(struct platform_device *pdev)
45 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
46 struct snd_soc_codec *codec;
47 int ret = 0;
49 codec = kzalloc(sizeof(struct snd_soc_codec), GFP_KERNEL);
50 if (codec == NULL)
51 return -ENOMEM;
52 mutex_init(&codec->mutex);
53 codec->name = "AD73311";
54 codec->owner = THIS_MODULE;
55 codec->dai = &ad73311_dai;
56 codec->num_dai = 1;
57 socdev->card->codec = codec;
58 INIT_LIST_HEAD(&codec->dapm_widgets);
59 INIT_LIST_HEAD(&codec->dapm_paths);
61 /* register pcms */
62 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
63 if (ret < 0) {
64 printk(KERN_ERR "ad73311: failed to create pcms\n");
65 goto pcm_err;
68 return ret;
70 pcm_err:
71 kfree(socdev->card->codec);
72 socdev->card->codec = NULL;
73 return ret;
76 static int ad73311_soc_remove(struct platform_device *pdev)
78 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
79 struct snd_soc_codec *codec = socdev->card->codec;
81 if (codec == NULL)
82 return 0;
83 snd_soc_free_pcms(socdev);
84 kfree(codec);
85 return 0;
88 struct snd_soc_codec_device soc_codec_dev_ad73311 = {
89 .probe = ad73311_soc_probe,
90 .remove = ad73311_soc_remove,
92 EXPORT_SYMBOL_GPL(soc_codec_dev_ad73311);
94 static int __init ad73311_init(void)
96 return snd_soc_register_dai(&ad73311_dai);
98 module_init(ad73311_init);
100 static void __exit ad73311_exit(void)
102 snd_soc_unregister_dai(&ad73311_dai);
104 module_exit(ad73311_exit);
106 MODULE_DESCRIPTION("ASoC ad73311 driver");
107 MODULE_AUTHOR("Cliff Cai ");
108 MODULE_LICENSE("GPL");