diff options
Diffstat (limited to 'sound/soc/atmel/sam9g20_wm8731.c')
-rw-r--r-- | sound/soc/atmel/sam9g20_wm8731.c | 59 |
1 files changed, 17 insertions, 42 deletions
diff --git a/sound/soc/atmel/sam9g20_wm8731.c b/sound/soc/atmel/sam9g20_wm8731.c index e028744c32ce..293569dfd0ed 100644 --- a/sound/soc/atmel/sam9g20_wm8731.c +++ b/sound/soc/atmel/sam9g20_wm8731.c | |||
@@ -69,8 +69,8 @@ static int at91sam9g20ek_hw_params(struct snd_pcm_substream *substream, | |||
69 | struct snd_pcm_hw_params *params) | 69 | struct snd_pcm_hw_params *params) |
70 | { | 70 | { |
71 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 71 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
72 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | 72 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
73 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | 73 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
74 | int ret; | 74 | int ret; |
75 | 75 | ||
76 | /* set codec DAI configuration */ | 76 | /* set codec DAI configuration */ |
@@ -136,16 +136,17 @@ static const struct snd_soc_dapm_route intercon[] = { | |||
136 | /* | 136 | /* |
137 | * Logic for a wm8731 as connected on a at91sam9g20ek board. | 137 | * Logic for a wm8731 as connected on a at91sam9g20ek board. |
138 | */ | 138 | */ |
139 | static int at91sam9g20ek_wm8731_init(struct snd_soc_codec *codec) | 139 | static int at91sam9g20ek_wm8731_init(struct snd_soc_pcm_runtime *rtd) |
140 | { | 140 | { |
141 | struct snd_soc_dai *codec_dai = &codec->dai[0]; | 141 | struct snd_soc_codec *codec = rtd->codec; |
142 | struct snd_soc_dai *codec_dai = rtd->codec_dai; | ||
142 | int ret; | 143 | int ret; |
143 | 144 | ||
144 | printk(KERN_DEBUG | 145 | printk(KERN_DEBUG |
145 | "at91sam9g20ek_wm8731 " | 146 | "at91sam9g20ek_wm8731 " |
146 | ": at91sam9g20ek_wm8731_init() called\n"); | 147 | ": at91sam9g20ek_wm8731_init() called\n"); |
147 | 148 | ||
148 | ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK, | 149 | ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK_XTAL, |
149 | MCLK_RATE, SND_SOC_CLOCK_IN); | 150 | MCLK_RATE, SND_SOC_CLOCK_IN); |
150 | if (ret < 0) { | 151 | if (ret < 0) { |
151 | printk(KERN_ERR "Failed to set WM8731 SYSCLK: %d\n", ret); | 152 | printk(KERN_ERR "Failed to set WM8731 SYSCLK: %d\n", ret); |
@@ -179,37 +180,37 @@ static int at91sam9g20ek_wm8731_init(struct snd_soc_codec *codec) | |||
179 | static struct snd_soc_dai_link at91sam9g20ek_dai = { | 180 | static struct snd_soc_dai_link at91sam9g20ek_dai = { |
180 | .name = "WM8731", | 181 | .name = "WM8731", |
181 | .stream_name = "WM8731 PCM", | 182 | .stream_name = "WM8731 PCM", |
182 | .cpu_dai = &atmel_ssc_dai[0], | 183 | .cpu_dai_name = "atmel-ssc-dai.0", |
183 | .codec_dai = &wm8731_dai, | 184 | .codec_dai_name = "wm8731-hifi", |
184 | .init = at91sam9g20ek_wm8731_init, | 185 | .init = at91sam9g20ek_wm8731_init, |
186 | .platform_name = "atmel-pcm-audio", | ||
187 | .codec_name = "wm8731-codec.0-001b", | ||
185 | .ops = &at91sam9g20ek_ops, | 188 | .ops = &at91sam9g20ek_ops, |
186 | }; | 189 | }; |
187 | 190 | ||
188 | static struct snd_soc_card snd_soc_at91sam9g20ek = { | 191 | static struct snd_soc_card snd_soc_at91sam9g20ek = { |
189 | .name = "AT91SAMG20-EK", | 192 | .name = "AT91SAMG20-EK", |
190 | .platform = &atmel_soc_platform, | ||
191 | .dai_link = &at91sam9g20ek_dai, | 193 | .dai_link = &at91sam9g20ek_dai, |
192 | .num_links = 1, | 194 | .num_links = 1, |
193 | .set_bias_level = at91sam9g20ek_set_bias_level, | 195 | .set_bias_level = at91sam9g20ek_set_bias_level, |
194 | }; | 196 | }; |
195 | 197 | ||
196 | static struct snd_soc_device at91sam9g20ek_snd_devdata = { | ||
197 | .card = &snd_soc_at91sam9g20ek, | ||
198 | .codec_dev = &soc_codec_dev_wm8731, | ||
199 | }; | ||
200 | |||
201 | static struct platform_device *at91sam9g20ek_snd_device; | 198 | static struct platform_device *at91sam9g20ek_snd_device; |
202 | 199 | ||
203 | static int __init at91sam9g20ek_init(void) | 200 | static int __init at91sam9g20ek_init(void) |
204 | { | 201 | { |
205 | struct atmel_ssc_info *ssc_p = at91sam9g20ek_dai.cpu_dai->private_data; | ||
206 | struct ssc_device *ssc = NULL; | ||
207 | struct clk *pllb; | 202 | struct clk *pllb; |
208 | int ret; | 203 | int ret; |
209 | 204 | ||
210 | if (!(machine_is_at91sam9g20ek() || machine_is_at91sam9g20ek_2mmc())) | 205 | if (!(machine_is_at91sam9g20ek() || machine_is_at91sam9g20ek_2mmc())) |
211 | return -ENODEV; | 206 | return -ENODEV; |
212 | 207 | ||
208 | ret = atmel_ssc_set_audio(0); | ||
209 | if (ret != 0) { | ||
210 | pr_err("Failed to set SSC 0 for audio: %d\n", ret); | ||
211 | return ret; | ||
212 | } | ||
213 | |||
213 | /* | 214 | /* |
214 | * Codec MCLK is supplied by PCK0 - set it up. | 215 | * Codec MCLK is supplied by PCK0 - set it up. |
215 | */ | 216 | */ |
@@ -235,18 +236,6 @@ static int __init at91sam9g20ek_init(void) | |||
235 | 236 | ||
236 | clk_set_rate(mclk, MCLK_RATE); | 237 | clk_set_rate(mclk, MCLK_RATE); |
237 | 238 | ||
238 | /* | ||
239 | * Request SSC device | ||
240 | */ | ||
241 | ssc = ssc_request(0); | ||
242 | if (IS_ERR(ssc)) { | ||
243 | printk(KERN_ERR "ASoC: Failed to request SSC 0\n"); | ||
244 | ret = PTR_ERR(ssc); | ||
245 | ssc = NULL; | ||
246 | goto err_ssc; | ||
247 | } | ||
248 | ssc_p->ssc = ssc; | ||
249 | |||
250 | at91sam9g20ek_snd_device = platform_device_alloc("soc-audio", -1); | 239 | at91sam9g20ek_snd_device = platform_device_alloc("soc-audio", -1); |
251 | if (!at91sam9g20ek_snd_device) { | 240 | if (!at91sam9g20ek_snd_device) { |
252 | printk(KERN_ERR "ASoC: Platform device allocation failed\n"); | 241 | printk(KERN_ERR "ASoC: Platform device allocation failed\n"); |
@@ -254,8 +243,7 @@ static int __init at91sam9g20ek_init(void) | |||
254 | } | 243 | } |
255 | 244 | ||
256 | platform_set_drvdata(at91sam9g20ek_snd_device, | 245 | platform_set_drvdata(at91sam9g20ek_snd_device, |
257 | &at91sam9g20ek_snd_devdata); | 246 | &snd_soc_at91sam9g20ek); |
258 | at91sam9g20ek_snd_devdata.dev = &at91sam9g20ek_snd_device->dev; | ||
259 | 247 | ||
260 | ret = platform_device_add(at91sam9g20ek_snd_device); | 248 | ret = platform_device_add(at91sam9g20ek_snd_device); |
261 | if (ret) { | 249 | if (ret) { |
@@ -265,9 +253,6 @@ static int __init at91sam9g20ek_init(void) | |||
265 | 253 | ||
266 | return ret; | 254 | return ret; |
267 | 255 | ||
268 | err_ssc: | ||
269 | ssc_free(ssc); | ||
270 | ssc_p->ssc = NULL; | ||
271 | err_mclk: | 256 | err_mclk: |
272 | clk_put(mclk); | 257 | clk_put(mclk); |
273 | mclk = NULL; | 258 | mclk = NULL; |
@@ -277,16 +262,6 @@ err: | |||
277 | 262 | ||
278 | static void __exit at91sam9g20ek_exit(void) | 263 | static void __exit at91sam9g20ek_exit(void) |
279 | { | 264 | { |
280 | struct atmel_ssc_info *ssc_p = at91sam9g20ek_dai.cpu_dai->private_data; | ||
281 | struct ssc_device *ssc; | ||
282 | |||
283 | if (ssc_p != NULL) { | ||
284 | ssc = ssc_p->ssc; | ||
285 | if (ssc != NULL) | ||
286 | ssc_free(ssc); | ||
287 | ssc_p->ssc = NULL; | ||
288 | } | ||
289 | |||
290 | platform_device_unregister(at91sam9g20ek_snd_device); | 265 | platform_device_unregister(at91sam9g20ek_snd_device); |
291 | at91sam9g20ek_snd_device = NULL; | 266 | at91sam9g20ek_snd_device = NULL; |
292 | clk_put(mclk); | 267 | clk_put(mclk); |