aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/omap/osk5912.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/omap/osk5912.c')
-rw-r--r--sound/soc/omap/osk5912.c49
1 files changed, 24 insertions, 25 deletions
diff --git a/sound/soc/omap/osk5912.c b/sound/soc/omap/osk5912.c
index 498ca2e03519..7e75e775fb4a 100644
--- a/sound/soc/omap/osk5912.c
+++ b/sound/soc/omap/osk5912.c
@@ -26,7 +26,6 @@
26#include <sound/core.h> 26#include <sound/core.h>
27#include <sound/pcm.h> 27#include <sound/pcm.h>
28#include <sound/soc.h> 28#include <sound/soc.h>
29#include <sound/soc-dapm.h>
30 29
31#include <asm/mach-types.h> 30#include <asm/mach-types.h>
32#include <mach/hardware.h> 31#include <mach/hardware.h>
@@ -55,8 +54,8 @@ static int osk_hw_params(struct snd_pcm_substream *substream,
55 struct snd_pcm_hw_params *params) 54 struct snd_pcm_hw_params *params)
56{ 55{
57 struct snd_soc_pcm_runtime *rtd = substream->private_data; 56 struct snd_soc_pcm_runtime *rtd = substream->private_data;
58 struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; 57 struct snd_soc_dai *codec_dai = rtd->codec_dai;
59 struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; 58 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
60 int err; 59 int err;
61 60
62 /* Set codec DAI configuration */ 61 /* Set codec DAI configuration */
@@ -113,21 +112,23 @@ static const struct snd_soc_dapm_route audio_map[] = {
113 {"MICIN", NULL, "Mic Jack"}, 112 {"MICIN", NULL, "Mic Jack"},
114}; 113};
115 114
116static int osk_tlv320aic23_init(struct snd_soc_codec *codec) 115static int osk_tlv320aic23_init(struct snd_soc_pcm_runtime *rtd)
117{ 116{
117 struct snd_soc_codec *codec = rtd->codec;
118 struct snd_soc_dapm_context *dapm = &codec->dapm;
118 119
119 /* Add osk5912 specific widgets */ 120 /* Add osk5912 specific widgets */
120 snd_soc_dapm_new_controls(codec, tlv320aic23_dapm_widgets, 121 snd_soc_dapm_new_controls(dapm, tlv320aic23_dapm_widgets,
121 ARRAY_SIZE(tlv320aic23_dapm_widgets)); 122 ARRAY_SIZE(tlv320aic23_dapm_widgets));
122 123
123 /* Set up osk5912 specific audio path audio_map */ 124 /* Set up osk5912 specific audio path audio_map */
124 snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); 125 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
125 126
126 snd_soc_dapm_enable_pin(codec, "Headphone Jack"); 127 snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
127 snd_soc_dapm_enable_pin(codec, "Line In"); 128 snd_soc_dapm_enable_pin(dapm, "Line In");
128 snd_soc_dapm_enable_pin(codec, "Mic Jack"); 129 snd_soc_dapm_enable_pin(dapm, "Mic Jack");
129 130
130 snd_soc_dapm_sync(codec); 131 snd_soc_dapm_sync(dapm);
131 132
132 return 0; 133 return 0;
133} 134}
@@ -136,8 +137,10 @@ static int osk_tlv320aic23_init(struct snd_soc_codec *codec)
136static struct snd_soc_dai_link osk_dai = { 137static struct snd_soc_dai_link osk_dai = {
137 .name = "TLV320AIC23", 138 .name = "TLV320AIC23",
138 .stream_name = "AIC23", 139 .stream_name = "AIC23",
139 .cpu_dai = &omap_mcbsp_dai[0], 140 .cpu_dai_name = "omap-mcbsp-dai.0",
140 .codec_dai = &tlv320aic23_dai, 141 .codec_dai_name = "tlv320aic23-hifi",
142 .platform_name = "omap-pcm-audio",
143 .codec_name = "tlv320aic23-codec",
141 .init = osk_tlv320aic23_init, 144 .init = osk_tlv320aic23_init,
142 .ops = &osk_ops, 145 .ops = &osk_ops,
143}; 146};
@@ -145,17 +148,10 @@ static struct snd_soc_dai_link osk_dai = {
145/* Audio machine driver */ 148/* Audio machine driver */
146static struct snd_soc_card snd_soc_card_osk = { 149static struct snd_soc_card snd_soc_card_osk = {
147 .name = "OSK5912", 150 .name = "OSK5912",
148 .platform = &omap_soc_platform,
149 .dai_link = &osk_dai, 151 .dai_link = &osk_dai,
150 .num_links = 1, 152 .num_links = 1,
151}; 153};
152 154
153/* Audio subsystem */
154static struct snd_soc_device osk_snd_devdata = {
155 .card = &snd_soc_card_osk,
156 .codec_dev = &soc_codec_dev_tlv320aic23,
157};
158
159static struct platform_device *osk_snd_device; 155static struct platform_device *osk_snd_device;
160 156
161static int __init osk_soc_init(void) 157static int __init osk_soc_init(void)
@@ -171,9 +167,7 @@ static int __init osk_soc_init(void)
171 if (!osk_snd_device) 167 if (!osk_snd_device)
172 return -ENOMEM; 168 return -ENOMEM;
173 169
174 platform_set_drvdata(osk_snd_device, &osk_snd_devdata); 170 platform_set_drvdata(osk_snd_device, &snd_soc_card_osk);
175 osk_snd_devdata.dev = &osk_snd_device->dev;
176 *(unsigned int *)osk_dai.cpu_dai->private_data = 0; /* McBSP1 */
177 err = platform_device_add(osk_snd_device); 171 err = platform_device_add(osk_snd_device);
178 if (err) 172 if (err)
179 goto err1; 173 goto err1;
@@ -183,7 +177,8 @@ static int __init osk_soc_init(void)
183 tlv320aic23_mclk = clk_get(dev, "mclk"); 177 tlv320aic23_mclk = clk_get(dev, "mclk");
184 if (IS_ERR(tlv320aic23_mclk)) { 178 if (IS_ERR(tlv320aic23_mclk)) {
185 printk(KERN_ERR "Could not get mclk clock\n"); 179 printk(KERN_ERR "Could not get mclk clock\n");
186 return -ENODEV; 180 err = PTR_ERR(tlv320aic23_mclk);
181 goto err2;
187 } 182 }
188 183
189 /* 184 /*
@@ -194,7 +189,7 @@ static int __init osk_soc_init(void)
194 if (clk_set_rate(tlv320aic23_mclk, CODEC_CLOCK)) { 189 if (clk_set_rate(tlv320aic23_mclk, CODEC_CLOCK)) {
195 printk(KERN_ERR "Cannot set MCLK for AIC23 CODEC\n"); 190 printk(KERN_ERR "Cannot set MCLK for AIC23 CODEC\n");
196 err = -ECANCELED; 191 err = -ECANCELED;
197 goto err1; 192 goto err3;
198 } 193 }
199 } 194 }
200 195
@@ -202,9 +197,12 @@ static int __init osk_soc_init(void)
202 (uint) clk_get_rate(tlv320aic23_mclk), CODEC_CLOCK); 197 (uint) clk_get_rate(tlv320aic23_mclk), CODEC_CLOCK);
203 198
204 return 0; 199 return 0;
205err1: 200
201err3:
206 clk_put(tlv320aic23_mclk); 202 clk_put(tlv320aic23_mclk);
203err2:
207 platform_device_del(osk_snd_device); 204 platform_device_del(osk_snd_device);
205err1:
208 platform_device_put(osk_snd_device); 206 platform_device_put(osk_snd_device);
209 207
210 return err; 208 return err;
@@ -213,6 +211,7 @@ err1:
213 211
214static void __exit osk_soc_exit(void) 212static void __exit osk_soc_exit(void)
215{ 213{
214 clk_put(tlv320aic23_mclk);
216 platform_device_unregister(osk_snd_device); 215 platform_device_unregister(osk_snd_device);
217} 216}
218 217