blob: 542538d10ab7df46b02fc2b6bb3630c8bed45322 [file] [log] [blame]
apatard@mandriva.comf9b95982010-05-31 13:49:14 +02001/*
2 * kirkwood-i2s.c
3 *
4 * (c) 2010 Arnaud Patard <apatard@mandriva.com>
Arnaud Patard (Rtp)69737892010-09-09 14:10:33 +02005 * (c) 2010 Arnaud Patard <arnaud.patard@rtp-net.org>
apatard@mandriva.comf9b95982010-05-31 13:49:14 +02006 *
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.
11 */
12
13#include <linux/init.h>
14#include <linux/module.h>
15#include <linux/platform_device.h>
16#include <linux/io.h>
17#include <linux/slab.h>
18#include <linux/mbus.h>
19#include <linux/delay.h>
Andrew Lunne919c712012-03-09 09:56:41 +010020#include <linux/clk.h>
apatard@mandriva.comf9b95982010-05-31 13:49:14 +020021#include <sound/pcm.h>
22#include <sound/pcm_params.h>
23#include <sound/soc.h>
Arnd Bergmannc02cecb2012-08-24 15:21:54 +020024#include <linux/platform_data/asoc-kirkwood.h>
apatard@mandriva.comf9b95982010-05-31 13:49:14 +020025#include "kirkwood.h"
26
27#define DRV_NAME "kirkwood-i2s"
28
29#define KIRKWOOD_I2S_RATES \
30 (SNDRV_PCM_RATE_44100 | \
31 SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000)
32#define KIRKWOOD_I2S_FORMATS \
33 (SNDRV_PCM_FMTBIT_S16_LE | \
34 SNDRV_PCM_FMTBIT_S24_LE | \
35 SNDRV_PCM_FMTBIT_S32_LE)
36
apatard@mandriva.comf9b95982010-05-31 13:49:14 +020037static int kirkwood_i2s_set_fmt(struct snd_soc_dai *cpu_dai,
38 unsigned int fmt)
39{
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +000040 struct kirkwood_dma_data *priv = snd_soc_dai_get_drvdata(cpu_dai);
apatard@mandriva.comf9b95982010-05-31 13:49:14 +020041 unsigned long mask;
42 unsigned long value;
43
44 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
45 case SND_SOC_DAIFMT_RIGHT_J:
46 mask = KIRKWOOD_I2S_CTL_RJ;
47 break;
48 case SND_SOC_DAIFMT_LEFT_J:
49 mask = KIRKWOOD_I2S_CTL_LJ;
50 break;
51 case SND_SOC_DAIFMT_I2S:
52 mask = KIRKWOOD_I2S_CTL_I2S;
53 break;
54 default:
55 return -EINVAL;
56 }
57
58 /*
59 * Set same format for playback and record
60 * This avoids some troubles.
61 */
62 value = readl(priv->io+KIRKWOOD_I2S_PLAYCTL);
63 value &= ~KIRKWOOD_I2S_CTL_JUST_MASK;
64 value |= mask;
65 writel(value, priv->io+KIRKWOOD_I2S_PLAYCTL);
66
67 value = readl(priv->io+KIRKWOOD_I2S_RECCTL);
68 value &= ~KIRKWOOD_I2S_CTL_JUST_MASK;
69 value |= mask;
70 writel(value, priv->io+KIRKWOOD_I2S_RECCTL);
71
72 return 0;
73}
74
75static inline void kirkwood_set_dco(void __iomem *io, unsigned long rate)
76{
77 unsigned long value;
78
79 value = KIRKWOOD_DCO_CTL_OFFSET_0;
80 switch (rate) {
81 default:
82 case 44100:
83 value |= KIRKWOOD_DCO_CTL_FREQ_11;
84 break;
85 case 48000:
86 value |= KIRKWOOD_DCO_CTL_FREQ_12;
87 break;
88 case 96000:
89 value |= KIRKWOOD_DCO_CTL_FREQ_24;
90 break;
91 }
92 writel(value, io + KIRKWOOD_DCO_CTL);
93
94 /* wait for dco locked */
95 do {
96 cpu_relax();
97 value = readl(io + KIRKWOOD_DCO_SPCR_STATUS);
98 value &= KIRKWOOD_DCO_SPCR_STATUS;
99 } while (value == 0);
100}
101
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +0000102static int kirkwood_i2s_startup(struct snd_pcm_substream *substream,
103 struct snd_soc_dai *dai)
104{
105 struct kirkwood_dma_data *priv = snd_soc_dai_get_drvdata(dai);
106
107 snd_soc_dai_set_dma_data(dai, substream, priv);
108 return 0;
109}
110
apatard@mandriva.comf9b95982010-05-31 13:49:14 +0200111static int kirkwood_i2s_hw_params(struct snd_pcm_substream *substream,
112 struct snd_pcm_hw_params *params,
113 struct snd_soc_dai *dai)
114{
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +0000115 struct kirkwood_dma_data *priv = snd_soc_dai_get_drvdata(dai);
apatard@mandriva.comf9b95982010-05-31 13:49:14 +0200116 unsigned int i2s_reg, reg;
117 unsigned long i2s_value, value;
118
119 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
120 i2s_reg = KIRKWOOD_I2S_PLAYCTL;
121 reg = KIRKWOOD_PLAYCTL;
122 } else {
123 i2s_reg = KIRKWOOD_I2S_RECCTL;
124 reg = KIRKWOOD_RECCTL;
125 }
126
127 /* set dco conf */
128 kirkwood_set_dco(priv->io, params_rate(params));
129
130 i2s_value = readl(priv->io+i2s_reg);
131 i2s_value &= ~KIRKWOOD_I2S_CTL_SIZE_MASK;
132
133 value = readl(priv->io+reg);
134 value &= ~KIRKWOOD_PLAYCTL_SIZE_MASK;
135
136 /*
137 * Size settings in play/rec i2s control regs and play/rec control
138 * regs must be the same.
139 */
140 switch (params_format(params)) {
141 case SNDRV_PCM_FORMAT_S16_LE:
142 i2s_value |= KIRKWOOD_I2S_CTL_SIZE_16;
143 value |= KIRKWOOD_PLAYCTL_SIZE_16_C;
144 break;
145 /*
146 * doesn't work... S20_3LE != kirkwood 20bit format ?
147 *
148 case SNDRV_PCM_FORMAT_S20_3LE:
149 i2s_value |= KIRKWOOD_I2S_CTL_SIZE_20;
150 value |= KIRKWOOD_PLAYCTL_SIZE_20;
151 break;
152 */
153 case SNDRV_PCM_FORMAT_S24_LE:
154 i2s_value |= KIRKWOOD_I2S_CTL_SIZE_24;
155 value |= KIRKWOOD_PLAYCTL_SIZE_24;
156 break;
157 case SNDRV_PCM_FORMAT_S32_LE:
158 i2s_value |= KIRKWOOD_I2S_CTL_SIZE_32;
159 value |= KIRKWOOD_PLAYCTL_SIZE_32;
160 break;
161 default:
162 return -EINVAL;
163 }
arnaud.patard@rtp-net.orgdfe4c932010-07-11 23:28:31 +0200164
165 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
166 value &= ~KIRKWOOD_PLAYCTL_MONO_MASK;
167 if (params_channels(params) == 1)
168 value |= KIRKWOOD_PLAYCTL_MONO_BOTH;
169 else
170 value |= KIRKWOOD_PLAYCTL_MONO_OFF;
171 }
172
apatard@mandriva.comf9b95982010-05-31 13:49:14 +0200173 writel(i2s_value, priv->io+i2s_reg);
174 writel(value, priv->io+reg);
175
176 return 0;
177}
178
179static int kirkwood_i2s_play_trigger(struct snd_pcm_substream *substream,
180 int cmd, struct snd_soc_dai *dai)
181{
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +0000182 struct kirkwood_dma_data *priv = snd_soc_dai_get_drvdata(dai);
apatard@mandriva.comf9b95982010-05-31 13:49:14 +0200183 unsigned long value;
184
185 /*
186 * specs says KIRKWOOD_PLAYCTL must be read 2 times before
187 * changing it. So read 1 time here and 1 later.
188 */
189 value = readl(priv->io + KIRKWOOD_PLAYCTL);
190
191 switch (cmd) {
192 case SNDRV_PCM_TRIGGER_START:
193 /* stop audio, enable interrupts */
194 value = readl(priv->io + KIRKWOOD_PLAYCTL);
195 value |= KIRKWOOD_PLAYCTL_PAUSE;
196 writel(value, priv->io + KIRKWOOD_PLAYCTL);
197
198 value = readl(priv->io + KIRKWOOD_INT_MASK);
199 value |= KIRKWOOD_INT_CAUSE_PLAY_BYTES;
200 writel(value, priv->io + KIRKWOOD_INT_MASK);
201
202 /* configure audio & enable i2s playback */
203 value = readl(priv->io + KIRKWOOD_PLAYCTL);
204 value &= ~KIRKWOOD_PLAYCTL_BURST_MASK;
arnaud.patard@rtp-net.orgb424ec92010-07-11 23:28:32 +0200205 value &= ~(KIRKWOOD_PLAYCTL_PAUSE | KIRKWOOD_PLAYCTL_I2S_MUTE
206 | KIRKWOOD_PLAYCTL_SPDIF_EN);
apatard@mandriva.comf9b95982010-05-31 13:49:14 +0200207
208 if (priv->burst == 32)
209 value |= KIRKWOOD_PLAYCTL_BURST_32;
210 else
211 value |= KIRKWOOD_PLAYCTL_BURST_128;
212 value |= KIRKWOOD_PLAYCTL_I2S_EN;
213 writel(value, priv->io + KIRKWOOD_PLAYCTL);
214 break;
215
216 case SNDRV_PCM_TRIGGER_STOP:
217 /* stop audio, disable interrupts */
218 value = readl(priv->io + KIRKWOOD_PLAYCTL);
arnaud.patard@rtp-net.orgb424ec92010-07-11 23:28:32 +0200219 value |= KIRKWOOD_PLAYCTL_PAUSE | KIRKWOOD_PLAYCTL_I2S_MUTE;
apatard@mandriva.comf9b95982010-05-31 13:49:14 +0200220 writel(value, priv->io + KIRKWOOD_PLAYCTL);
221
222 value = readl(priv->io + KIRKWOOD_INT_MASK);
223 value &= ~KIRKWOOD_INT_CAUSE_PLAY_BYTES;
224 writel(value, priv->io + KIRKWOOD_INT_MASK);
225
226 /* disable all playbacks */
227 value = readl(priv->io + KIRKWOOD_PLAYCTL);
228 value &= ~(KIRKWOOD_PLAYCTL_I2S_EN | KIRKWOOD_PLAYCTL_SPDIF_EN);
229 writel(value, priv->io + KIRKWOOD_PLAYCTL);
230 break;
231
232 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
233 case SNDRV_PCM_TRIGGER_SUSPEND:
234 value = readl(priv->io + KIRKWOOD_PLAYCTL);
arnaud.patard@rtp-net.orgb424ec92010-07-11 23:28:32 +0200235 value |= KIRKWOOD_PLAYCTL_PAUSE | KIRKWOOD_PLAYCTL_I2S_MUTE;
apatard@mandriva.comf9b95982010-05-31 13:49:14 +0200236 writel(value, priv->io + KIRKWOOD_PLAYCTL);
237 break;
238
239 case SNDRV_PCM_TRIGGER_RESUME:
240 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
241 value = readl(priv->io + KIRKWOOD_PLAYCTL);
arnaud.patard@rtp-net.orgb424ec92010-07-11 23:28:32 +0200242 value &= ~(KIRKWOOD_PLAYCTL_PAUSE | KIRKWOOD_PLAYCTL_I2S_MUTE);
apatard@mandriva.comf9b95982010-05-31 13:49:14 +0200243 writel(value, priv->io + KIRKWOOD_PLAYCTL);
244 break;
245
246 default:
247 return -EINVAL;
248 }
249
250 return 0;
251}
252
253static int kirkwood_i2s_rec_trigger(struct snd_pcm_substream *substream,
254 int cmd, struct snd_soc_dai *dai)
255{
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +0000256 struct kirkwood_dma_data *priv = snd_soc_dai_get_drvdata(dai);
apatard@mandriva.comf9b95982010-05-31 13:49:14 +0200257 unsigned long value;
258
259 value = readl(priv->io + KIRKWOOD_RECCTL);
260
261 switch (cmd) {
262 case SNDRV_PCM_TRIGGER_START:
263 /* stop audio, enable interrupts */
264 value = readl(priv->io + KIRKWOOD_RECCTL);
265 value |= KIRKWOOD_RECCTL_PAUSE;
266 writel(value, priv->io + KIRKWOOD_RECCTL);
267
268 value = readl(priv->io + KIRKWOOD_INT_MASK);
269 value |= KIRKWOOD_INT_CAUSE_REC_BYTES;
270 writel(value, priv->io + KIRKWOOD_INT_MASK);
271
272 /* configure audio & enable i2s record */
273 value = readl(priv->io + KIRKWOOD_RECCTL);
274 value &= ~KIRKWOOD_RECCTL_BURST_MASK;
275 value &= ~KIRKWOOD_RECCTL_MONO;
arnaud.patard@rtp-net.orgb424ec92010-07-11 23:28:32 +0200276 value &= ~(KIRKWOOD_RECCTL_PAUSE | KIRKWOOD_RECCTL_MUTE
277 | KIRKWOOD_RECCTL_SPDIF_EN);
apatard@mandriva.comf9b95982010-05-31 13:49:14 +0200278
279 if (priv->burst == 32)
280 value |= KIRKWOOD_RECCTL_BURST_32;
281 else
282 value |= KIRKWOOD_RECCTL_BURST_128;
283 value |= KIRKWOOD_RECCTL_I2S_EN;
284
285 writel(value, priv->io + KIRKWOOD_RECCTL);
286 break;
287
288 case SNDRV_PCM_TRIGGER_STOP:
289 /* stop audio, disable interrupts */
290 value = readl(priv->io + KIRKWOOD_RECCTL);
arnaud.patard@rtp-net.orgb424ec92010-07-11 23:28:32 +0200291 value |= KIRKWOOD_RECCTL_PAUSE | KIRKWOOD_RECCTL_MUTE;
apatard@mandriva.comf9b95982010-05-31 13:49:14 +0200292 writel(value, priv->io + KIRKWOOD_RECCTL);
293
294 value = readl(priv->io + KIRKWOOD_INT_MASK);
295 value &= ~KIRKWOOD_INT_CAUSE_REC_BYTES;
296 writel(value, priv->io + KIRKWOOD_INT_MASK);
297
298 /* disable all records */
299 value = readl(priv->io + KIRKWOOD_RECCTL);
300 value &= ~(KIRKWOOD_RECCTL_I2S_EN | KIRKWOOD_RECCTL_SPDIF_EN);
301 writel(value, priv->io + KIRKWOOD_RECCTL);
302 break;
303
304 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
305 case SNDRV_PCM_TRIGGER_SUSPEND:
306 value = readl(priv->io + KIRKWOOD_RECCTL);
arnaud.patard@rtp-net.orgb424ec92010-07-11 23:28:32 +0200307 value |= KIRKWOOD_RECCTL_PAUSE | KIRKWOOD_RECCTL_MUTE;
apatard@mandriva.comf9b95982010-05-31 13:49:14 +0200308 writel(value, priv->io + KIRKWOOD_RECCTL);
309 break;
310
311 case SNDRV_PCM_TRIGGER_RESUME:
312 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
313 value = readl(priv->io + KIRKWOOD_RECCTL);
arnaud.patard@rtp-net.orgb424ec92010-07-11 23:28:32 +0200314 value &= ~(KIRKWOOD_RECCTL_PAUSE | KIRKWOOD_RECCTL_MUTE);
apatard@mandriva.comf9b95982010-05-31 13:49:14 +0200315 writel(value, priv->io + KIRKWOOD_RECCTL);
316 break;
317
318 default:
319 return -EINVAL;
apatard@mandriva.comf9b95982010-05-31 13:49:14 +0200320 }
321
322 return 0;
323}
324
325static int kirkwood_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
326 struct snd_soc_dai *dai)
327{
328 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
329 return kirkwood_i2s_play_trigger(substream, cmd, dai);
330 else
331 return kirkwood_i2s_rec_trigger(substream, cmd, dai);
332
333 return 0;
334}
335
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +0000336static int kirkwood_i2s_probe(struct snd_soc_dai *dai)
apatard@mandriva.comf9b95982010-05-31 13:49:14 +0200337{
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +0000338 struct kirkwood_dma_data *priv = snd_soc_dai_get_drvdata(dai);
apatard@mandriva.comf9b95982010-05-31 13:49:14 +0200339 unsigned long value;
340 unsigned int reg_data;
341
342 /* put system in a "safe" state : */
343 /* disable audio interrupts */
344 writel(0xffffffff, priv->io + KIRKWOOD_INT_CAUSE);
345 writel(0, priv->io + KIRKWOOD_INT_MASK);
346
347 reg_data = readl(priv->io + 0x1200);
348 reg_data &= (~(0x333FF8));
349 reg_data |= 0x111D18;
350 writel(reg_data, priv->io + 0x1200);
351
352 msleep(500);
353
354 reg_data = readl(priv->io + 0x1200);
355 reg_data &= (~(0x333FF8));
356 reg_data |= 0x111D18;
357 writel(reg_data, priv->io + 0x1200);
358
359 /* disable playback/record */
360 value = readl(priv->io + KIRKWOOD_PLAYCTL);
361 value &= ~(KIRKWOOD_PLAYCTL_I2S_EN|KIRKWOOD_PLAYCTL_SPDIF_EN);
362 writel(value, priv->io + KIRKWOOD_PLAYCTL);
363
364 value = readl(priv->io + KIRKWOOD_RECCTL);
365 value &= ~(KIRKWOOD_RECCTL_I2S_EN | KIRKWOOD_RECCTL_SPDIF_EN);
366 writel(value, priv->io + KIRKWOOD_RECCTL);
367
368 return 0;
369
370}
371
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +0000372static int kirkwood_i2s_remove(struct snd_soc_dai *dai)
apatard@mandriva.comf9b95982010-05-31 13:49:14 +0200373{
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +0000374 return 0;
apatard@mandriva.comf9b95982010-05-31 13:49:14 +0200375}
376
Lars-Peter Clausen85e76522011-11-23 11:40:40 +0100377static const struct snd_soc_dai_ops kirkwood_i2s_dai_ops = {
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +0000378 .startup = kirkwood_i2s_startup,
apatard@mandriva.comf9b95982010-05-31 13:49:14 +0200379 .trigger = kirkwood_i2s_trigger,
380 .hw_params = kirkwood_i2s_hw_params,
381 .set_fmt = kirkwood_i2s_set_fmt,
382};
383
384
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +0000385static struct snd_soc_dai_driver kirkwood_i2s_dai = {
apatard@mandriva.comf9b95982010-05-31 13:49:14 +0200386 .probe = kirkwood_i2s_probe,
387 .remove = kirkwood_i2s_remove,
388 .playback = {
389 .channels_min = 1,
390 .channels_max = 2,
391 .rates = KIRKWOOD_I2S_RATES,
392 .formats = KIRKWOOD_I2S_FORMATS,},
393 .capture = {
394 .channels_min = 1,
395 .channels_max = 2,
396 .rates = KIRKWOOD_I2S_RATES,
397 .formats = KIRKWOOD_I2S_FORMATS,},
398 .ops = &kirkwood_i2s_dai_ops,
399};
apatard@mandriva.comf9b95982010-05-31 13:49:14 +0200400
401static __devinit int kirkwood_i2s_dev_probe(struct platform_device *pdev)
402{
403 struct resource *mem;
404 struct kirkwood_asoc_platform_data *data =
405 pdev->dev.platform_data;
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +0000406 struct kirkwood_dma_data *priv;
apatard@mandriva.comf9b95982010-05-31 13:49:14 +0200407 int err;
408
409 priv = kzalloc(sizeof(struct kirkwood_dma_data), GFP_KERNEL);
410 if (!priv) {
411 dev_err(&pdev->dev, "allocation failed\n");
412 err = -ENOMEM;
413 goto error;
414 }
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +0000415 dev_set_drvdata(&pdev->dev, priv);
apatard@mandriva.comf9b95982010-05-31 13:49:14 +0200416
417 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
418 if (!mem) {
419 dev_err(&pdev->dev, "platform_get_resource failed\n");
420 err = -ENXIO;
421 goto err_alloc;
422 }
423
424 priv->mem = request_mem_region(mem->start, SZ_16K, DRV_NAME);
425 if (!priv->mem) {
426 dev_err(&pdev->dev, "request_mem_region failed\n");
427 err = -EBUSY;
Arnd Bergmann50139512011-09-11 20:07:30 +0200428 goto err_alloc;
apatard@mandriva.comf9b95982010-05-31 13:49:14 +0200429 }
430
431 priv->io = ioremap(priv->mem->start, SZ_16K);
432 if (!priv->io) {
433 dev_err(&pdev->dev, "ioremap failed\n");
434 err = -ENOMEM;
435 goto err_iomem;
436 }
437
438 priv->irq = platform_get_irq(pdev, 0);
439 if (priv->irq <= 0) {
440 dev_err(&pdev->dev, "platform_get_irq failed\n");
441 err = -ENXIO;
442 goto err_ioremap;
443 }
444
Axel Lind4d98202011-12-28 16:05:22 +0800445 if (!data) {
apatard@mandriva.comf9b95982010-05-31 13:49:14 +0200446 dev_err(&pdev->dev, "no platform data ?!\n");
447 err = -EINVAL;
448 goto err_ioremap;
449 }
450
apatard@mandriva.comf9b95982010-05-31 13:49:14 +0200451 priv->burst = data->burst;
452
Andrew Lunne919c712012-03-09 09:56:41 +0100453 priv->clk = clk_get(&pdev->dev, NULL);
454 if (IS_ERR(priv->clk)) {
455 dev_err(&pdev->dev, "no clock\n");
456 err = PTR_ERR(priv->clk);
457 goto err_ioremap;
458 }
459 clk_prepare_enable(priv->clk);
460
Simon Baatzbaffab22012-07-19 00:04:09 +0200461 err = snd_soc_register_dai(&pdev->dev, &kirkwood_i2s_dai);
462 if (!err)
463 return 0;
464 dev_err(&pdev->dev, "snd_soc_register_dai failed\n");
465
466 clk_disable_unprepare(priv->clk);
467 clk_put(priv->clk);
apatard@mandriva.comf9b95982010-05-31 13:49:14 +0200468
469err_ioremap:
470 iounmap(priv->io);
471err_iomem:
472 release_mem_region(priv->mem->start, SZ_16K);
473err_alloc:
474 kfree(priv);
475error:
476 return err;
477}
478
479static __devexit int kirkwood_i2s_dev_remove(struct platform_device *pdev)
480{
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +0000481 struct kirkwood_dma_data *priv = dev_get_drvdata(&pdev->dev);
482
483 snd_soc_unregister_dai(&pdev->dev);
Andrew Lunne919c712012-03-09 09:56:41 +0100484
485 clk_disable_unprepare(priv->clk);
486 clk_put(priv->clk);
487
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +0000488 iounmap(priv->io);
489 release_mem_region(priv->mem->start, SZ_16K);
490 kfree(priv);
491
apatard@mandriva.comf9b95982010-05-31 13:49:14 +0200492 return 0;
493}
494
495static struct platform_driver kirkwood_i2s_driver = {
496 .probe = kirkwood_i2s_dev_probe,
Axel Lin48860e42011-10-02 09:18:17 +0800497 .remove = __devexit_p(kirkwood_i2s_dev_remove),
apatard@mandriva.comf9b95982010-05-31 13:49:14 +0200498 .driver = {
499 .name = DRV_NAME,
500 .owner = THIS_MODULE,
501 },
502};
503
Axel Lin41b10222011-11-24 11:43:09 +0800504module_platform_driver(kirkwood_i2s_driver);
apatard@mandriva.comf9b95982010-05-31 13:49:14 +0200505
506/* Module information */
Arnaud Patard (Rtp)69737892010-09-09 14:10:33 +0200507MODULE_AUTHOR("Arnaud Patard, <arnaud.patard@rtp-net.org>");
apatard@mandriva.comf9b95982010-05-31 13:49:14 +0200508MODULE_DESCRIPTION("Kirkwood I2S SoC Interface");
509MODULE_LICENSE("GPL");
510MODULE_ALIAS("platform:kirkwood-i2s");