aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2009-11-04 16:43:27 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-11-04 16:43:27 -0500
commitf3d0e82fe3cce0dd3ffcd9c59e6caa671a30f929 (patch)
treeb69ea70e47ddc980fff9bd3759c18bb7b444ef83 /sound/soc
parent2dcf9fb99d4ecadecb2685a9eb82e6b85511c960 (diff)
ASoC: Update ads117x to current APIs
Probe as a platform driver (ads117x) and remove the call to snd_soc_init_card(). Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/codecs/ads117x.c76
1 files changed, 36 insertions, 40 deletions
diff --git a/sound/soc/codecs/ads117x.c b/sound/soc/codecs/ads117x.c
index f3230927dc66..cc96411ca3e6 100644
--- a/sound/soc/codecs/ads117x.c
+++ b/sound/soc/codecs/ads117x.c
@@ -37,46 +37,12 @@ struct snd_soc_dai ads117x_dai = {
37}; 37};
38EXPORT_SYMBOL_GPL(ads117x_dai); 38EXPORT_SYMBOL_GPL(ads117x_dai);
39 39
40/*
41 * initialise the ads117x driver
42 */
43static int ads117x_init(struct snd_soc_device *socdev)
44{
45 struct snd_soc_codec *codec = socdev->card->codec;
46 int ret = 0;
47
48 codec->name = "ADS117X";
49 codec->owner = THIS_MODULE;
50 codec->dai = &ads117x_dai;
51 codec->num_dai = 1;
52
53 /* register pcms */
54 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
55 if (ret < 0) {
56 printk(KERN_ERR "ads117x: failed to create pcms\n");
57 return ret;
58 }
59
60 ret = snd_soc_init_card(socdev);
61 if (ret < 0) {
62 printk(KERN_ERR "ads117x: failed to register card\n");
63 goto card_err;
64 }
65 return ret;
66
67card_err:
68 snd_soc_free_pcms(socdev);
69 return ret;
70}
71
72static int ads117x_probe(struct platform_device *pdev) 40static int ads117x_probe(struct platform_device *pdev)
73{ 41{
74 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 42 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
75 struct snd_soc_codec *codec; 43 struct snd_soc_codec *codec;
76 int ret; 44 int ret;
77 45
78 pr_info("ads117x ADC\n");
79
80 codec = kzalloc(sizeof(struct snd_soc_codec), GFP_KERNEL); 46 codec = kzalloc(sizeof(struct snd_soc_codec), GFP_KERNEL);
81 if (codec == NULL) 47 if (codec == NULL)
82 return -ENOMEM; 48 return -ENOMEM;
@@ -85,12 +51,20 @@ static int ads117x_probe(struct platform_device *pdev)
85 mutex_init(&codec->mutex); 51 mutex_init(&codec->mutex);
86 INIT_LIST_HEAD(&codec->dapm_widgets); 52 INIT_LIST_HEAD(&codec->dapm_widgets);
87 INIT_LIST_HEAD(&codec->dapm_paths); 53 INIT_LIST_HEAD(&codec->dapm_paths);
54 codec->name = "ADS117X";
55 codec->owner = THIS_MODULE;
56 codec->dai = &ads117x_dai;
57 codec->num_dai = 1;
88 58
89 ret = ads117x_init(socdev); 59 /* register pcms */
90 if (ret != 0) 60 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
61 if (ret < 0) {
62 printk(KERN_ERR "ads117x: failed to create pcms\n");
91 kfree(codec); 63 kfree(codec);
64 return ret;
65 }
92 66
93 return ret; 67 return 0;
94} 68}
95 69
96static int ads117x_remove(struct platform_device *pdev) 70static int ads117x_remove(struct platform_device *pdev)
@@ -110,15 +84,37 @@ struct snd_soc_codec_device soc_codec_dev_ads117x = {
110}; 84};
111EXPORT_SYMBOL_GPL(soc_codec_dev_ads117x); 85EXPORT_SYMBOL_GPL(soc_codec_dev_ads117x);
112 86
113static int __init ads117x_modinit(void) 87static __devinit int ads117x_platform_probe(struct platform_device *pdev)
114{ 88{
89 ads117x_dai.dev = &pdev->dev;
115 return snd_soc_register_dai(&ads117x_dai); 90 return snd_soc_register_dai(&ads117x_dai);
116} 91}
117module_init(ads117x_modinit);
118 92
119static void __exit ads117x_exit(void) 93static int __devexit ads117x_platform_remove(struct platform_device *pdev)
120{ 94{
121 snd_soc_unregister_dai(&ads117x_dai); 95 snd_soc_unregister_dai(&ads117x_dai);
96 return 0;
97}
98
99static struct platform_driver ads117x_codec_driver = {
100 .driver = {
101 .name = "ads117x",
102 .owner = THIS_MODULE,
103 },
104
105 .probe = ads117x_platform_probe,
106 .remove = __devexit_p(ads117x_platform_remove),
107};
108
109static int __init ads117x_init(void)
110{
111 return platform_driver_register(&ads117x_codec_driver);
112}
113module_init(ads117x_init);
114
115static void __exit ads117x_exit(void)
116{
117 platform_driver_unregister(&ads117x_codec_driver);
122} 118}
123module_exit(ads117x_exit); 119module_exit(ads117x_exit);
124 120