2 * ALSA SoC I2S (McBSP) Audio Layer for TI DAVINCI processor
4 * Author: Vladimir Barinov, <vbarinov@embeddedalley.com>
5 * Copyright: (C) 2007 MontaVista Software, Inc., <source@mvista.com>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
12 #include <linux/init.h>
13 #include <linux/module.h>
14 #include <linux/device.h>
15 #include <linux/delay.h>
17 #include <linux/clk.h>
19 #include <sound/core.h>
20 #include <sound/pcm.h>
21 #include <sound/pcm_params.h>
22 #include <sound/initval.h>
23 #include <sound/soc.h>
27 #include "davinci-pcm.h"
31 * NOTE: terminology here is confusing.
33 * - This driver supports the "Audio Serial Port" (ASP),
34 * found on dm6446, dm355, and other DaVinci chips.
36 * - But it labels it a "Multi-channel Buffered Serial Port"
37 * (McBSP) as on older chips like the dm642 ... which was
38 * backward-compatible, possibly explaining that confusion.
40 * - OMAP chips have a controller called McBSP, which is
41 * incompatible with the DaVinci flavor of McBSP.
43 * - Newer DaVinci chips have a controller called McASP,
44 * incompatible with ASP and with either McBSP.
46 * In short: this uses ASP to implement I2S, not McBSP.
47 * And it won't be the only DaVinci implemention of I2S.
49 #define DAVINCI_MCBSP_DRR_REG 0x00
50 #define DAVINCI_MCBSP_DXR_REG 0x04
51 #define DAVINCI_MCBSP_SPCR_REG 0x08
52 #define DAVINCI_MCBSP_RCR_REG 0x0c
53 #define DAVINCI_MCBSP_XCR_REG 0x10
54 #define DAVINCI_MCBSP_SRGR_REG 0x14
55 #define DAVINCI_MCBSP_PCR_REG 0x24
57 #define DAVINCI_MCBSP_SPCR_RRST (1 << 0)
58 #define DAVINCI_MCBSP_SPCR_RINTM(v) ((v) << 4)
59 #define DAVINCI_MCBSP_SPCR_XRST (1 << 16)
60 #define DAVINCI_MCBSP_SPCR_XINTM(v) ((v) << 20)
61 #define DAVINCI_MCBSP_SPCR_GRST (1 << 22)
62 #define DAVINCI_MCBSP_SPCR_FRST (1 << 23)
63 #define DAVINCI_MCBSP_SPCR_FREE (1 << 25)
65 #define DAVINCI_MCBSP_RCR_RWDLEN1(v) ((v) << 5)
66 #define DAVINCI_MCBSP_RCR_RFRLEN1(v) ((v) << 8)
67 #define DAVINCI_MCBSP_RCR_RDATDLY(v) ((v) << 16)
68 #define DAVINCI_MCBSP_RCR_RFIG (1 << 18)
69 #define DAVINCI_MCBSP_RCR_RWDLEN2(v) ((v) << 21)
71 #define DAVINCI_MCBSP_XCR_XWDLEN1(v) ((v) << 5)
72 #define DAVINCI_MCBSP_XCR_XFRLEN1(v) ((v) << 8)
73 #define DAVINCI_MCBSP_XCR_XDATDLY(v) ((v) << 16)
74 #define DAVINCI_MCBSP_XCR_XFIG (1 << 18)
75 #define DAVINCI_MCBSP_XCR_XWDLEN2(v) ((v) << 21)
77 #define DAVINCI_MCBSP_SRGR_FWID(v) ((v) << 8)
78 #define DAVINCI_MCBSP_SRGR_FPER(v) ((v) << 16)
79 #define DAVINCI_MCBSP_SRGR_FSGM (1 << 28)
81 #define DAVINCI_MCBSP_PCR_CLKRP (1 << 0)
82 #define DAVINCI_MCBSP_PCR_CLKXP (1 << 1)
83 #define DAVINCI_MCBSP_PCR_FSRP (1 << 2)
84 #define DAVINCI_MCBSP_PCR_FSXP (1 << 3)
85 #define DAVINCI_MCBSP_PCR_SCLKME (1 << 7)
86 #define DAVINCI_MCBSP_PCR_CLKRM (1 << 8)
87 #define DAVINCI_MCBSP_PCR_CLKXM (1 << 9)
88 #define DAVINCI_MCBSP_PCR_FSRM (1 << 10)
89 #define DAVINCI_MCBSP_PCR_FSXM (1 << 11)
92 DAVINCI_MCBSP_WORD_8
= 0,
93 DAVINCI_MCBSP_WORD_12
,
94 DAVINCI_MCBSP_WORD_16
,
95 DAVINCI_MCBSP_WORD_20
,
96 DAVINCI_MCBSP_WORD_24
,
97 DAVINCI_MCBSP_WORD_32
,
100 struct davinci_mcbsp_dev
{
102 * dma_params must be first because rtd->dai->cpu_dai->private_data
103 * is cast to a pointer of an array of struct davinci_pcm_dma_params in
106 struct davinci_pcm_dma_params dma_params
[2];
115 static inline void davinci_mcbsp_write_reg(struct davinci_mcbsp_dev
*dev
,
118 __raw_writel(val
, dev
->base
+ reg
);
121 static inline u32
davinci_mcbsp_read_reg(struct davinci_mcbsp_dev
*dev
, int reg
)
123 return __raw_readl(dev
->base
+ reg
);
126 static void toggle_clock(struct davinci_mcbsp_dev
*dev
, int playback
)
128 u32 m
= playback
? DAVINCI_MCBSP_PCR_CLKXP
: DAVINCI_MCBSP_PCR_CLKRP
;
129 /* The clock needs to toggle to complete reset.
130 * So, fake it by toggling the clk polarity.
132 davinci_mcbsp_write_reg(dev
, DAVINCI_MCBSP_PCR_REG
, dev
->pcr
^ m
);
133 davinci_mcbsp_write_reg(dev
, DAVINCI_MCBSP_PCR_REG
, dev
->pcr
);
136 static void davinci_mcbsp_start(struct davinci_mcbsp_dev
*dev
,
137 struct snd_pcm_substream
*substream
)
139 struct snd_soc_pcm_runtime
*rtd
= substream
->private_data
;
140 struct snd_soc_device
*socdev
= rtd
->socdev
;
141 struct snd_soc_platform
*platform
= socdev
->card
->platform
;
142 int playback
= (substream
->stream
== SNDRV_PCM_STREAM_PLAYBACK
);
144 u32 mask
= playback
? DAVINCI_MCBSP_SPCR_XRST
: DAVINCI_MCBSP_SPCR_RRST
;
145 spcr
= davinci_mcbsp_read_reg(dev
, DAVINCI_MCBSP_SPCR_REG
);
147 /* start off disabled */
148 davinci_mcbsp_write_reg(dev
, DAVINCI_MCBSP_SPCR_REG
,
150 toggle_clock(dev
, playback
);
152 if (dev
->pcr
& (DAVINCI_MCBSP_PCR_FSXM
| DAVINCI_MCBSP_PCR_FSRM
|
153 DAVINCI_MCBSP_PCR_CLKXM
| DAVINCI_MCBSP_PCR_CLKRM
)) {
154 /* Start the sample generator */
155 spcr
|= DAVINCI_MCBSP_SPCR_GRST
;
156 davinci_mcbsp_write_reg(dev
, DAVINCI_MCBSP_SPCR_REG
, spcr
);
160 /* Stop the DMA to avoid data loss */
161 /* while the transmitter is out of reset to handle XSYNCERR */
162 if (platform
->pcm_ops
->trigger
) {
163 int ret
= platform
->pcm_ops
->trigger(substream
,
164 SNDRV_PCM_TRIGGER_STOP
);
166 printk(KERN_DEBUG
"Playback DMA stop failed\n");
169 /* Enable the transmitter */
170 spcr
= davinci_mcbsp_read_reg(dev
, DAVINCI_MCBSP_SPCR_REG
);
171 spcr
|= DAVINCI_MCBSP_SPCR_XRST
;
172 davinci_mcbsp_write_reg(dev
, DAVINCI_MCBSP_SPCR_REG
, spcr
);
174 /* wait for any unexpected frame sync error to occur */
177 /* Disable the transmitter to clear any outstanding XSYNCERR */
178 spcr
= davinci_mcbsp_read_reg(dev
, DAVINCI_MCBSP_SPCR_REG
);
179 spcr
&= ~DAVINCI_MCBSP_SPCR_XRST
;
180 davinci_mcbsp_write_reg(dev
, DAVINCI_MCBSP_SPCR_REG
, spcr
);
181 toggle_clock(dev
, playback
);
183 /* Restart the DMA */
184 if (platform
->pcm_ops
->trigger
) {
185 int ret
= platform
->pcm_ops
->trigger(substream
,
186 SNDRV_PCM_TRIGGER_START
);
188 printk(KERN_DEBUG
"Playback DMA start failed\n");
192 /* Enable transmitter or receiver */
193 spcr
= davinci_mcbsp_read_reg(dev
, DAVINCI_MCBSP_SPCR_REG
);
196 if (dev
->pcr
& (DAVINCI_MCBSP_PCR_FSXM
| DAVINCI_MCBSP_PCR_FSRM
)) {
197 /* Start frame sync */
198 spcr
|= DAVINCI_MCBSP_SPCR_FRST
;
200 davinci_mcbsp_write_reg(dev
, DAVINCI_MCBSP_SPCR_REG
, spcr
);
203 static void davinci_mcbsp_stop(struct davinci_mcbsp_dev
*dev
, int playback
)
207 /* Reset transmitter/receiver and sample rate/frame sync generators */
208 spcr
= davinci_mcbsp_read_reg(dev
, DAVINCI_MCBSP_SPCR_REG
);
209 spcr
&= ~(DAVINCI_MCBSP_SPCR_GRST
| DAVINCI_MCBSP_SPCR_FRST
);
210 spcr
&= playback
? ~DAVINCI_MCBSP_SPCR_XRST
: ~DAVINCI_MCBSP_SPCR_RRST
;
211 davinci_mcbsp_write_reg(dev
, DAVINCI_MCBSP_SPCR_REG
, spcr
);
212 toggle_clock(dev
, playback
);
215 #define DEFAULT_BITPERSAMPLE 16
217 static int davinci_i2s_set_dai_fmt(struct snd_soc_dai
*cpu_dai
,
220 struct davinci_mcbsp_dev
*dev
= cpu_dai
->private_data
;
223 srgr
= DAVINCI_MCBSP_SRGR_FSGM
|
224 DAVINCI_MCBSP_SRGR_FPER(DEFAULT_BITPERSAMPLE
* 2 - 1) |
225 DAVINCI_MCBSP_SRGR_FWID(DEFAULT_BITPERSAMPLE
- 1);
227 /* set master/slave audio interface */
228 switch (fmt
& SND_SOC_DAIFMT_MASTER_MASK
) {
229 case SND_SOC_DAIFMT_CBS_CFS
:
231 pcr
= DAVINCI_MCBSP_PCR_FSXM
|
232 DAVINCI_MCBSP_PCR_FSRM
|
233 DAVINCI_MCBSP_PCR_CLKXM
|
234 DAVINCI_MCBSP_PCR_CLKRM
;
236 case SND_SOC_DAIFMT_CBM_CFS
:
237 /* McBSP CLKR pin is the input for the Sample Rate Generator.
238 * McBSP FSR and FSX are driven by the Sample Rate Generator. */
239 pcr
= DAVINCI_MCBSP_PCR_SCLKME
|
240 DAVINCI_MCBSP_PCR_FSXM
|
241 DAVINCI_MCBSP_PCR_FSRM
;
243 case SND_SOC_DAIFMT_CBM_CFM
:
244 /* codec is master */
248 printk(KERN_ERR
"%s:bad master\n", __func__
);
252 /* interface format */
253 switch (fmt
& SND_SOC_DAIFMT_FORMAT_MASK
) {
254 case SND_SOC_DAIFMT_I2S
:
255 /* Davinci doesn't support TRUE I2S, but some codecs will have
256 * the left and right channels contiguous. This allows
257 * dsp_a mode to be used with an inverted normal frame clk.
258 * If your codec is master and does not have contiguous
259 * channels, then you will have sound on only one channel.
260 * Try using a different mode, or codec as slave.
262 * The TLV320AIC33 is an example of a codec where this works.
263 * It has a variable bit clock frequency allowing it to have
264 * valid data on every bit clock.
266 * The TLV320AIC23 is an example of a codec where this does not
267 * work. It has a fixed bit clock frequency with progressively
268 * more empty bit clock slots between channels as the sample
271 fmt
^= SND_SOC_DAIFMT_NB_IF
;
272 case SND_SOC_DAIFMT_DSP_A
:
273 dev
->mode
= MOD_DSP_A
;
275 case SND_SOC_DAIFMT_DSP_B
:
276 dev
->mode
= MOD_DSP_B
;
279 printk(KERN_ERR
"%s:bad format\n", __func__
);
283 switch (fmt
& SND_SOC_DAIFMT_INV_MASK
) {
284 case SND_SOC_DAIFMT_NB_NF
:
285 /* CLKRP Receive clock polarity,
286 * 1 - sampled on rising edge of CLKR
287 * valid on rising edge
288 * CLKXP Transmit clock polarity,
289 * 1 - clocked on falling edge of CLKX
290 * valid on rising edge
291 * FSRP Receive frame sync pol, 0 - active high
292 * FSXP Transmit frame sync pol, 0 - active high
294 pcr
|= (DAVINCI_MCBSP_PCR_CLKXP
| DAVINCI_MCBSP_PCR_CLKRP
);
296 case SND_SOC_DAIFMT_IB_IF
:
297 /* CLKRP Receive clock polarity,
298 * 0 - sampled on falling edge of CLKR
299 * valid on falling edge
300 * CLKXP Transmit clock polarity,
301 * 0 - clocked on rising edge of CLKX
302 * valid on falling edge
303 * FSRP Receive frame sync pol, 1 - active low
304 * FSXP Transmit frame sync pol, 1 - active low
306 pcr
|= (DAVINCI_MCBSP_PCR_FSXP
| DAVINCI_MCBSP_PCR_FSRP
);
308 case SND_SOC_DAIFMT_NB_IF
:
309 /* CLKRP Receive clock polarity,
310 * 1 - sampled on rising edge of CLKR
311 * valid on rising edge
312 * CLKXP Transmit clock polarity,
313 * 1 - clocked on falling edge of CLKX
314 * valid on rising edge
315 * FSRP Receive frame sync pol, 1 - active low
316 * FSXP Transmit frame sync pol, 1 - active low
318 pcr
|= (DAVINCI_MCBSP_PCR_CLKXP
| DAVINCI_MCBSP_PCR_CLKRP
|
319 DAVINCI_MCBSP_PCR_FSXP
| DAVINCI_MCBSP_PCR_FSRP
);
321 case SND_SOC_DAIFMT_IB_NF
:
322 /* CLKRP Receive clock polarity,
323 * 0 - sampled on falling edge of CLKR
324 * valid on falling edge
325 * CLKXP Transmit clock polarity,
326 * 0 - clocked on rising edge of CLKX
327 * valid on falling edge
328 * FSRP Receive frame sync pol, 0 - active high
329 * FSXP Transmit frame sync pol, 0 - active high
335 davinci_mcbsp_write_reg(dev
, DAVINCI_MCBSP_SRGR_REG
, srgr
);
337 davinci_mcbsp_write_reg(dev
, DAVINCI_MCBSP_PCR_REG
, pcr
);
341 static int davinci_i2s_hw_params(struct snd_pcm_substream
*substream
,
342 struct snd_pcm_hw_params
*params
,
343 struct snd_soc_dai
*dai
)
345 struct davinci_mcbsp_dev
*dev
= dai
->private_data
;
346 struct davinci_pcm_dma_params
*dma_params
=
347 &dev
->dma_params
[substream
->stream
];
348 struct snd_interval
*i
= NULL
;
349 int mcbsp_word_length
;
350 unsigned int rcr
, xcr
, srgr
;
353 /* general line settings */
354 spcr
= davinci_mcbsp_read_reg(dev
, DAVINCI_MCBSP_SPCR_REG
);
355 if (substream
->stream
== SNDRV_PCM_STREAM_CAPTURE
) {
356 spcr
|= DAVINCI_MCBSP_SPCR_RINTM(3) | DAVINCI_MCBSP_SPCR_FREE
;
357 davinci_mcbsp_write_reg(dev
, DAVINCI_MCBSP_SPCR_REG
, spcr
);
359 spcr
|= DAVINCI_MCBSP_SPCR_XINTM(3) | DAVINCI_MCBSP_SPCR_FREE
;
360 davinci_mcbsp_write_reg(dev
, DAVINCI_MCBSP_SPCR_REG
, spcr
);
363 i
= hw_param_interval(params
, SNDRV_PCM_HW_PARAM_SAMPLE_BITS
);
364 srgr
= DAVINCI_MCBSP_SRGR_FSGM
;
365 srgr
|= DAVINCI_MCBSP_SRGR_FWID(snd_interval_value(i
) - 1);
367 i
= hw_param_interval(params
, SNDRV_PCM_HW_PARAM_FRAME_BITS
);
368 srgr
|= DAVINCI_MCBSP_SRGR_FPER(snd_interval_value(i
) - 1);
369 davinci_mcbsp_write_reg(dev
, DAVINCI_MCBSP_SRGR_REG
, srgr
);
371 rcr
= DAVINCI_MCBSP_RCR_RFIG
;
372 xcr
= DAVINCI_MCBSP_XCR_XFIG
;
373 if (dev
->mode
== MOD_DSP_B
) {
374 rcr
|= DAVINCI_MCBSP_RCR_RDATDLY(0);
375 xcr
|= DAVINCI_MCBSP_XCR_XDATDLY(0);
377 rcr
|= DAVINCI_MCBSP_RCR_RDATDLY(1);
378 xcr
|= DAVINCI_MCBSP_XCR_XDATDLY(1);
380 /* Determine xfer data type */
381 switch (params_format(params
)) {
382 case SNDRV_PCM_FORMAT_S8
:
383 dma_params
->data_type
= 1;
384 mcbsp_word_length
= DAVINCI_MCBSP_WORD_8
;
386 case SNDRV_PCM_FORMAT_S16_LE
:
387 dma_params
->data_type
= 2;
388 mcbsp_word_length
= DAVINCI_MCBSP_WORD_16
;
390 case SNDRV_PCM_FORMAT_S32_LE
:
391 dma_params
->data_type
= 4;
392 mcbsp_word_length
= DAVINCI_MCBSP_WORD_32
;
395 printk(KERN_WARNING
"davinci-i2s: unsupported PCM format\n");
399 dma_params
->acnt
= dma_params
->data_type
;
400 rcr
|= DAVINCI_MCBSP_RCR_RFRLEN1(1);
401 xcr
|= DAVINCI_MCBSP_XCR_XFRLEN1(1);
403 rcr
|= DAVINCI_MCBSP_RCR_RWDLEN1(mcbsp_word_length
) |
404 DAVINCI_MCBSP_RCR_RWDLEN2(mcbsp_word_length
);
405 xcr
|= DAVINCI_MCBSP_XCR_XWDLEN1(mcbsp_word_length
) |
406 DAVINCI_MCBSP_XCR_XWDLEN2(mcbsp_word_length
);
408 if (substream
->stream
== SNDRV_PCM_STREAM_PLAYBACK
)
409 davinci_mcbsp_write_reg(dev
, DAVINCI_MCBSP_XCR_REG
, xcr
);
411 davinci_mcbsp_write_reg(dev
, DAVINCI_MCBSP_RCR_REG
, rcr
);
415 static int davinci_i2s_prepare(struct snd_pcm_substream
*substream
,
416 struct snd_soc_dai
*dai
)
418 struct davinci_mcbsp_dev
*dev
= dai
->private_data
;
419 int playback
= (substream
->stream
== SNDRV_PCM_STREAM_PLAYBACK
);
420 davinci_mcbsp_stop(dev
, playback
);
421 if ((dev
->pcr
& DAVINCI_MCBSP_PCR_FSXM
) == 0) {
422 /* codec is master */
423 davinci_mcbsp_start(dev
, substream
);
428 static int davinci_i2s_trigger(struct snd_pcm_substream
*substream
, int cmd
,
429 struct snd_soc_dai
*dai
)
431 struct davinci_mcbsp_dev
*dev
= dai
->private_data
;
433 int playback
= (substream
->stream
== SNDRV_PCM_STREAM_PLAYBACK
);
434 if ((dev
->pcr
& DAVINCI_MCBSP_PCR_FSXM
) == 0)
435 return 0; /* return if codec is master */
438 case SNDRV_PCM_TRIGGER_START
:
439 case SNDRV_PCM_TRIGGER_RESUME
:
440 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE
:
441 davinci_mcbsp_start(dev
, substream
);
443 case SNDRV_PCM_TRIGGER_STOP
:
444 case SNDRV_PCM_TRIGGER_SUSPEND
:
445 case SNDRV_PCM_TRIGGER_PAUSE_PUSH
:
446 davinci_mcbsp_stop(dev
, playback
);
454 static void davinci_i2s_shutdown(struct snd_pcm_substream
*substream
,
455 struct snd_soc_dai
*dai
)
457 struct davinci_mcbsp_dev
*dev
= dai
->private_data
;
458 int playback
= (substream
->stream
== SNDRV_PCM_STREAM_PLAYBACK
);
459 davinci_mcbsp_stop(dev
, playback
);
462 #define DAVINCI_I2S_RATES SNDRV_PCM_RATE_8000_96000
464 static struct snd_soc_dai_ops davinci_i2s_dai_ops
= {
465 .shutdown
= davinci_i2s_shutdown
,
466 .prepare
= davinci_i2s_prepare
,
467 .trigger
= davinci_i2s_trigger
,
468 .hw_params
= davinci_i2s_hw_params
,
469 .set_fmt
= davinci_i2s_set_dai_fmt
,
473 struct snd_soc_dai davinci_i2s_dai
= {
474 .name
= "davinci-i2s",
479 .rates
= DAVINCI_I2S_RATES
,
480 .formats
= SNDRV_PCM_FMTBIT_S16_LE
,},
484 .rates
= DAVINCI_I2S_RATES
,
485 .formats
= SNDRV_PCM_FMTBIT_S16_LE
,},
486 .ops
= &davinci_i2s_dai_ops
,
489 EXPORT_SYMBOL_GPL(davinci_i2s_dai
);
491 static int davinci_i2s_probe(struct platform_device
*pdev
)
493 struct snd_platform_data
*pdata
= pdev
->dev
.platform_data
;
494 struct davinci_mcbsp_dev
*dev
;
495 struct resource
*mem
, *ioarea
, *res
;
498 mem
= platform_get_resource(pdev
, IORESOURCE_MEM
, 0);
500 dev_err(&pdev
->dev
, "no mem resource?\n");
504 ioarea
= request_mem_region(mem
->start
, (mem
->end
- mem
->start
) + 1,
507 dev_err(&pdev
->dev
, "McBSP region already claimed\n");
511 dev
= kzalloc(sizeof(struct davinci_mcbsp_dev
), GFP_KERNEL
);
514 goto err_release_region
;
517 dev
->clk
= clk_get(&pdev
->dev
, NULL
);
518 if (IS_ERR(dev
->clk
)) {
522 clk_enable(dev
->clk
);
524 dev
->base
= (void __iomem
*)IO_ADDRESS(mem
->start
);
526 dev
->dma_params
[SNDRV_PCM_STREAM_PLAYBACK
].dma_addr
=
527 (dma_addr_t
)(io_v2p(dev
->base
) + DAVINCI_MCBSP_DXR_REG
);
529 dev
->dma_params
[SNDRV_PCM_STREAM_CAPTURE
].dma_addr
=
530 (dma_addr_t
)(io_v2p(dev
->base
) + DAVINCI_MCBSP_DRR_REG
);
532 /* first TX, then RX */
533 res
= platform_get_resource(pdev
, IORESOURCE_DMA
, 0);
535 dev_err(&pdev
->dev
, "no DMA resource\n");
539 dev
->dma_params
[SNDRV_PCM_STREAM_PLAYBACK
].channel
= res
->start
;
541 res
= platform_get_resource(pdev
, IORESOURCE_DMA
, 1);
543 dev_err(&pdev
->dev
, "no DMA resource\n");
547 dev
->dma_params
[SNDRV_PCM_STREAM_CAPTURE
].channel
= res
->start
;
549 davinci_i2s_dai
.private_data
= dev
;
550 ret
= snd_soc_register_dai(&davinci_i2s_dai
);
559 release_mem_region(mem
->start
, (mem
->end
- mem
->start
) + 1);
564 static int davinci_i2s_remove(struct platform_device
*pdev
)
566 struct davinci_mcbsp_dev
*dev
= davinci_i2s_dai
.private_data
;
567 struct resource
*mem
;
569 snd_soc_unregister_dai(&davinci_i2s_dai
);
570 clk_disable(dev
->clk
);
574 mem
= platform_get_resource(pdev
, IORESOURCE_MEM
, 0);
575 release_mem_region(mem
->start
, (mem
->end
- mem
->start
) + 1);
580 static struct platform_driver davinci_mcbsp_driver
= {
581 .probe
= davinci_i2s_probe
,
582 .remove
= davinci_i2s_remove
,
584 .name
= "davinci-asp",
585 .owner
= THIS_MODULE
,
589 static int __init
davinci_i2s_init(void)
591 return platform_driver_register(&davinci_mcbsp_driver
);
593 module_init(davinci_i2s_init
);
595 static void __exit
davinci_i2s_exit(void)
597 platform_driver_unregister(&davinci_mcbsp_driver
);
599 module_exit(davinci_i2s_exit
);
601 MODULE_AUTHOR("Vladimir Barinov");
602 MODULE_DESCRIPTION("TI DAVINCI I2S (McBSP) SoC Interface");
603 MODULE_LICENSE("GPL");