blob: 5cd85a87957912219f9c43c8565c39f94d98d486 [file] [log] [blame]
Chaithrika U Sb67f4482009-06-05 06:28:40 -04001/*
2 * ALSA SoC McASP Audio Layer for TI DAVINCI processor
3 *
4 * Multi-channel Audio Serial Port Driver
5 *
6 * Author: Nirmal Pandey <n-pandey@ti.com>,
7 * Suresh Rajashekara <suresh.r@ti.com>
8 * Steve Chen <schen@.mvista.com>
9 *
10 * Copyright: (C) 2009 MontaVista Software, Inc., <source@mvista.com>
11 * Copyright: (C) 2009 Texas Instruments, India
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as
15 * published by the Free Software Foundation.
16 */
17
18#include <linux/init.h>
19#include <linux/module.h>
20#include <linux/device.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090021#include <linux/slab.h>
Chaithrika U Sb67f4482009-06-05 06:28:40 -040022#include <linux/delay.h>
23#include <linux/io.h>
Hebbar, Gururaja10884342012-08-08 20:40:32 +053024#include <linux/pm_runtime.h>
Hebbar, Gururaja3e3b8c32012-08-27 18:56:42 +053025#include <linux/of.h>
26#include <linux/of_platform.h>
27#include <linux/of_device.h>
Chaithrika U Sb67f4482009-06-05 06:28:40 -040028
29#include <sound/core.h>
30#include <sound/pcm.h>
31#include <sound/pcm_params.h>
32#include <sound/initval.h>
33#include <sound/soc.h>
34
35#include "davinci-pcm.h"
36#include "davinci-mcasp.h"
37
38/*
39 * McASP register definitions
40 */
41#define DAVINCI_MCASP_PID_REG 0x00
42#define DAVINCI_MCASP_PWREMUMGT_REG 0x04
43
44#define DAVINCI_MCASP_PFUNC_REG 0x10
45#define DAVINCI_MCASP_PDIR_REG 0x14
46#define DAVINCI_MCASP_PDOUT_REG 0x18
47#define DAVINCI_MCASP_PDSET_REG 0x1c
48
49#define DAVINCI_MCASP_PDCLR_REG 0x20
50
51#define DAVINCI_MCASP_TLGC_REG 0x30
52#define DAVINCI_MCASP_TLMR_REG 0x34
53
54#define DAVINCI_MCASP_GBLCTL_REG 0x44
55#define DAVINCI_MCASP_AMUTE_REG 0x48
56#define DAVINCI_MCASP_LBCTL_REG 0x4c
57
58#define DAVINCI_MCASP_TXDITCTL_REG 0x50
59
60#define DAVINCI_MCASP_GBLCTLR_REG 0x60
61#define DAVINCI_MCASP_RXMASK_REG 0x64
62#define DAVINCI_MCASP_RXFMT_REG 0x68
63#define DAVINCI_MCASP_RXFMCTL_REG 0x6c
64
65#define DAVINCI_MCASP_ACLKRCTL_REG 0x70
66#define DAVINCI_MCASP_AHCLKRCTL_REG 0x74
67#define DAVINCI_MCASP_RXTDM_REG 0x78
68#define DAVINCI_MCASP_EVTCTLR_REG 0x7c
69
70#define DAVINCI_MCASP_RXSTAT_REG 0x80
71#define DAVINCI_MCASP_RXTDMSLOT_REG 0x84
72#define DAVINCI_MCASP_RXCLKCHK_REG 0x88
73#define DAVINCI_MCASP_REVTCTL_REG 0x8c
74
75#define DAVINCI_MCASP_GBLCTLX_REG 0xa0
76#define DAVINCI_MCASP_TXMASK_REG 0xa4
77#define DAVINCI_MCASP_TXFMT_REG 0xa8
78#define DAVINCI_MCASP_TXFMCTL_REG 0xac
79
80#define DAVINCI_MCASP_ACLKXCTL_REG 0xb0
81#define DAVINCI_MCASP_AHCLKXCTL_REG 0xb4
82#define DAVINCI_MCASP_TXTDM_REG 0xb8
83#define DAVINCI_MCASP_EVTCTLX_REG 0xbc
84
85#define DAVINCI_MCASP_TXSTAT_REG 0xc0
86#define DAVINCI_MCASP_TXTDMSLOT_REG 0xc4
87#define DAVINCI_MCASP_TXCLKCHK_REG 0xc8
88#define DAVINCI_MCASP_XEVTCTL_REG 0xcc
89
90/* Left(even TDM Slot) Channel Status Register File */
91#define DAVINCI_MCASP_DITCSRA_REG 0x100
92/* Right(odd TDM slot) Channel Status Register File */
93#define DAVINCI_MCASP_DITCSRB_REG 0x118
94/* Left(even TDM slot) User Data Register File */
95#define DAVINCI_MCASP_DITUDRA_REG 0x130
96/* Right(odd TDM Slot) User Data Register File */
97#define DAVINCI_MCASP_DITUDRB_REG 0x148
98
99/* Serializer n Control Register */
100#define DAVINCI_MCASP_XRSRCTL_BASE_REG 0x180
101#define DAVINCI_MCASP_XRSRCTL_REG(n) (DAVINCI_MCASP_XRSRCTL_BASE_REG + \
102 (n << 2))
103
104/* Transmit Buffer for Serializer n */
105#define DAVINCI_MCASP_TXBUF_REG 0x200
106/* Receive Buffer for Serializer n */
107#define DAVINCI_MCASP_RXBUF_REG 0x280
108
Chaithrika U S6a99fb52009-08-11 16:58:52 -0400109/* McASP FIFO Registers */
110#define DAVINCI_MCASP_WFIFOCTL (0x1010)
111#define DAVINCI_MCASP_WFIFOSTS (0x1014)
112#define DAVINCI_MCASP_RFIFOCTL (0x1018)
113#define DAVINCI_MCASP_RFIFOSTS (0x101C)
Hebbar, Gururajae5ec69d2012-09-03 13:40:40 +0530114#define MCASP_VER3_WFIFOCTL (0x1000)
115#define MCASP_VER3_WFIFOSTS (0x1004)
116#define MCASP_VER3_RFIFOCTL (0x1008)
117#define MCASP_VER3_RFIFOSTS (0x100C)
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400118
119/*
120 * DAVINCI_MCASP_PWREMUMGT_REG - Power Down and Emulation Management
121 * Register Bits
122 */
123#define MCASP_FREE BIT(0)
124#define MCASP_SOFT BIT(1)
125
126/*
127 * DAVINCI_MCASP_PFUNC_REG - Pin Function / GPIO Enable Register Bits
128 */
129#define AXR(n) (1<<n)
130#define PFUNC_AMUTE BIT(25)
131#define ACLKX BIT(26)
132#define AHCLKX BIT(27)
133#define AFSX BIT(28)
134#define ACLKR BIT(29)
135#define AHCLKR BIT(30)
136#define AFSR BIT(31)
137
138/*
139 * DAVINCI_MCASP_PDIR_REG - Pin Direction Register Bits
140 */
141#define AXR(n) (1<<n)
142#define PDIR_AMUTE BIT(25)
143#define ACLKX BIT(26)
144#define AHCLKX BIT(27)
145#define AFSX BIT(28)
146#define ACLKR BIT(29)
147#define AHCLKR BIT(30)
148#define AFSR BIT(31)
149
150/*
151 * DAVINCI_MCASP_TXDITCTL_REG - Transmit DIT Control Register Bits
152 */
153#define DITEN BIT(0) /* Transmit DIT mode enable/disable */
154#define VA BIT(2)
155#define VB BIT(3)
156
157/*
158 * DAVINCI_MCASP_TXFMT_REG - Transmit Bitstream Format Register Bits
159 */
160#define TXROT(val) (val)
161#define TXSEL BIT(3)
162#define TXSSZ(val) (val<<4)
163#define TXPBIT(val) (val<<8)
164#define TXPAD(val) (val<<13)
165#define TXORD BIT(15)
166#define FSXDLY(val) (val<<16)
167
168/*
169 * DAVINCI_MCASP_RXFMT_REG - Receive Bitstream Format Register Bits
170 */
171#define RXROT(val) (val)
172#define RXSEL BIT(3)
173#define RXSSZ(val) (val<<4)
174#define RXPBIT(val) (val<<8)
175#define RXPAD(val) (val<<13)
176#define RXORD BIT(15)
177#define FSRDLY(val) (val<<16)
178
179/*
180 * DAVINCI_MCASP_TXFMCTL_REG - Transmit Frame Control Register Bits
181 */
182#define FSXPOL BIT(0)
183#define AFSXE BIT(1)
184#define FSXDUR BIT(4)
185#define FSXMOD(val) (val<<7)
186
187/*
188 * DAVINCI_MCASP_RXFMCTL_REG - Receive Frame Control Register Bits
189 */
190#define FSRPOL BIT(0)
191#define AFSRE BIT(1)
192#define FSRDUR BIT(4)
193#define FSRMOD(val) (val<<7)
194
195/*
196 * DAVINCI_MCASP_ACLKXCTL_REG - Transmit Clock Control Register Bits
197 */
198#define ACLKXDIV(val) (val)
199#define ACLKXE BIT(5)
200#define TX_ASYNC BIT(6)
201#define ACLKXPOL BIT(7)
Daniel Mack4ed8c9b2012-10-04 15:08:39 +0200202#define ACLKXDIV_MASK 0x1f
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400203
204/*
205 * DAVINCI_MCASP_ACLKRCTL_REG Receive Clock Control Register Bits
206 */
207#define ACLKRDIV(val) (val)
208#define ACLKRE BIT(5)
209#define RX_ASYNC BIT(6)
210#define ACLKRPOL BIT(7)
Daniel Mack4ed8c9b2012-10-04 15:08:39 +0200211#define ACLKRDIV_MASK 0x1f
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400212
213/*
214 * DAVINCI_MCASP_AHCLKXCTL_REG - High Frequency Transmit Clock Control
215 * Register Bits
216 */
217#define AHCLKXDIV(val) (val)
218#define AHCLKXPOL BIT(14)
219#define AHCLKXE BIT(15)
Daniel Mack4ed8c9b2012-10-04 15:08:39 +0200220#define AHCLKXDIV_MASK 0xfff
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400221
222/*
223 * DAVINCI_MCASP_AHCLKRCTL_REG - High Frequency Receive Clock Control
224 * Register Bits
225 */
226#define AHCLKRDIV(val) (val)
227#define AHCLKRPOL BIT(14)
228#define AHCLKRE BIT(15)
Daniel Mack4ed8c9b2012-10-04 15:08:39 +0200229#define AHCLKRDIV_MASK 0xfff
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400230
231/*
232 * DAVINCI_MCASP_XRSRCTL_BASE_REG - Serializer Control Register Bits
233 */
234#define MODE(val) (val)
235#define DISMOD (val)(val<<2)
236#define TXSTATE BIT(4)
237#define RXSTATE BIT(5)
Michal Bachraty2952b272013-02-28 16:07:08 +0100238#define SRMOD_MASK 3
239#define SRMOD_INACTIVE 0
240#define SRMOD_TX 1
241#define SRMOD_RX 2
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400242
243/*
244 * DAVINCI_MCASP_LBCTL_REG - Loop Back Control Register Bits
245 */
246#define LBEN BIT(0)
247#define LBORD BIT(1)
248#define LBGENMODE(val) (val<<2)
249
250/*
251 * DAVINCI_MCASP_TXTDMSLOT_REG - Transmit TDM Slot Register configuration
252 */
253#define TXTDMS(n) (1<<n)
254
255/*
256 * DAVINCI_MCASP_RXTDMSLOT_REG - Receive TDM Slot Register configuration
257 */
258#define RXTDMS(n) (1<<n)
259
260/*
261 * DAVINCI_MCASP_GBLCTL_REG - Global Control Register Bits
262 */
263#define RXCLKRST BIT(0) /* Receiver Clock Divider Reset */
264#define RXHCLKRST BIT(1) /* Receiver High Frequency Clock Divider */
265#define RXSERCLR BIT(2) /* Receiver Serializer Clear */
266#define RXSMRST BIT(3) /* Receiver State Machine Reset */
267#define RXFSRST BIT(4) /* Frame Sync Generator Reset */
268#define TXCLKRST BIT(8) /* Transmitter Clock Divider Reset */
269#define TXHCLKRST BIT(9) /* Transmitter High Frequency Clock Divider*/
270#define TXSERCLR BIT(10) /* Transmit Serializer Clear */
271#define TXSMRST BIT(11) /* Transmitter State Machine Reset */
272#define TXFSRST BIT(12) /* Frame Sync Generator Reset */
273
274/*
275 * DAVINCI_MCASP_AMUTE_REG - Mute Control Register Bits
276 */
277#define MUTENA(val) (val)
278#define MUTEINPOL BIT(2)
279#define MUTEINENA BIT(3)
280#define MUTEIN BIT(4)
281#define MUTER BIT(5)
282#define MUTEX BIT(6)
283#define MUTEFSR BIT(7)
284#define MUTEFSX BIT(8)
285#define MUTEBADCLKR BIT(9)
286#define MUTEBADCLKX BIT(10)
287#define MUTERXDMAERR BIT(11)
288#define MUTETXDMAERR BIT(12)
289
290/*
291 * DAVINCI_MCASP_REVTCTL_REG - Receiver DMA Event Control Register bits
292 */
293#define RXDATADMADIS BIT(0)
294
295/*
296 * DAVINCI_MCASP_XEVTCTL_REG - Transmitter DMA Event Control Register bits
297 */
298#define TXDATADMADIS BIT(0)
299
Chaithrika U S6a99fb52009-08-11 16:58:52 -0400300/*
301 * DAVINCI_MCASP_W[R]FIFOCTL - Write/Read FIFO Control Register bits
302 */
303#define FIFO_ENABLE BIT(16)
304#define NUMEVT_MASK (0xFF << 8)
305#define NUMDMA_MASK (0xFF)
306
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400307#define DAVINCI_MCASP_NUM_SERIALIZER 16
308
309static inline void mcasp_set_bits(void __iomem *reg, u32 val)
310{
311 __raw_writel(__raw_readl(reg) | val, reg);
312}
313
314static inline void mcasp_clr_bits(void __iomem *reg, u32 val)
315{
316 __raw_writel((__raw_readl(reg) & ~(val)), reg);
317}
318
319static inline void mcasp_mod_bits(void __iomem *reg, u32 val, u32 mask)
320{
321 __raw_writel((__raw_readl(reg) & ~mask) | val, reg);
322}
323
324static inline void mcasp_set_reg(void __iomem *reg, u32 val)
325{
326 __raw_writel(val, reg);
327}
328
329static inline u32 mcasp_get_reg(void __iomem *reg)
330{
331 return (unsigned int)__raw_readl(reg);
332}
333
334static inline void mcasp_set_ctl_reg(void __iomem *regs, u32 val)
335{
336 int i = 0;
337
338 mcasp_set_bits(regs, val);
339
340 /* programming GBLCTL needs to read back from GBLCTL and verfiy */
341 /* loop count is to avoid the lock-up */
342 for (i = 0; i < 1000; i++) {
343 if ((mcasp_get_reg(regs) & val) == val)
344 break;
345 }
346
347 if (i == 1000 && ((mcasp_get_reg(regs) & val) != val))
348 printk(KERN_ERR "GBLCTL write error\n");
349}
350
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400351static void mcasp_start_rx(struct davinci_audio_dev *dev)
352{
353 mcasp_set_ctl_reg(dev->base + DAVINCI_MCASP_GBLCTLR_REG, RXHCLKRST);
354 mcasp_set_ctl_reg(dev->base + DAVINCI_MCASP_GBLCTLR_REG, RXCLKRST);
355 mcasp_set_ctl_reg(dev->base + DAVINCI_MCASP_GBLCTLR_REG, RXSERCLR);
356 mcasp_set_reg(dev->base + DAVINCI_MCASP_RXBUF_REG, 0);
357
358 mcasp_set_ctl_reg(dev->base + DAVINCI_MCASP_GBLCTLR_REG, RXSMRST);
359 mcasp_set_ctl_reg(dev->base + DAVINCI_MCASP_GBLCTLR_REG, RXFSRST);
360 mcasp_set_reg(dev->base + DAVINCI_MCASP_RXBUF_REG, 0);
361
362 mcasp_set_ctl_reg(dev->base + DAVINCI_MCASP_GBLCTLR_REG, RXSMRST);
363 mcasp_set_ctl_reg(dev->base + DAVINCI_MCASP_GBLCTLR_REG, RXFSRST);
364}
365
366static void mcasp_start_tx(struct davinci_audio_dev *dev)
367{
Chaithrika U S6a99fb52009-08-11 16:58:52 -0400368 u8 offset = 0, i;
369 u32 cnt;
370
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400371 mcasp_set_ctl_reg(dev->base + DAVINCI_MCASP_GBLCTLX_REG, TXHCLKRST);
372 mcasp_set_ctl_reg(dev->base + DAVINCI_MCASP_GBLCTLX_REG, TXCLKRST);
373 mcasp_set_ctl_reg(dev->base + DAVINCI_MCASP_GBLCTLX_REG, TXSERCLR);
374 mcasp_set_reg(dev->base + DAVINCI_MCASP_TXBUF_REG, 0);
375
376 mcasp_set_ctl_reg(dev->base + DAVINCI_MCASP_GBLCTLX_REG, TXSMRST);
377 mcasp_set_ctl_reg(dev->base + DAVINCI_MCASP_GBLCTLX_REG, TXFSRST);
378 mcasp_set_reg(dev->base + DAVINCI_MCASP_TXBUF_REG, 0);
Chaithrika U S6a99fb52009-08-11 16:58:52 -0400379 for (i = 0; i < dev->num_serializer; i++) {
380 if (dev->serial_dir[i] == TX_MODE) {
381 offset = i;
382 break;
383 }
384 }
385
386 /* wait for TX ready */
387 cnt = 0;
388 while (!(mcasp_get_reg(dev->base + DAVINCI_MCASP_XRSRCTL_REG(offset)) &
389 TXSTATE) && (cnt < 100000))
390 cnt++;
391
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400392 mcasp_set_reg(dev->base + DAVINCI_MCASP_TXBUF_REG, 0);
393}
394
395static void davinci_mcasp_start(struct davinci_audio_dev *dev, int stream)
396{
Chaithrika U S539d3d82009-09-23 10:12:08 -0400397 if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
Vaibhav Bedia0d624272012-08-08 20:40:31 +0530398 if (dev->txnumevt) { /* enable FIFO */
Hebbar, Gururajae5ec69d2012-09-03 13:40:40 +0530399 switch (dev->version) {
400 case MCASP_VERSION_3:
401 mcasp_clr_bits(dev->base + MCASP_VER3_WFIFOCTL,
Vaibhav Bedia0d624272012-08-08 20:40:31 +0530402 FIFO_ENABLE);
Hebbar, Gururajae5ec69d2012-09-03 13:40:40 +0530403 mcasp_set_bits(dev->base + MCASP_VER3_WFIFOCTL,
Chaithrika U S539d3d82009-09-23 10:12:08 -0400404 FIFO_ENABLE);
Hebbar, Gururajae5ec69d2012-09-03 13:40:40 +0530405 break;
406 default:
407 mcasp_clr_bits(dev->base +
408 DAVINCI_MCASP_WFIFOCTL, FIFO_ENABLE);
409 mcasp_set_bits(dev->base +
410 DAVINCI_MCASP_WFIFOCTL, FIFO_ENABLE);
411 }
Vaibhav Bedia0d624272012-08-08 20:40:31 +0530412 }
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400413 mcasp_start_tx(dev);
Chaithrika U S539d3d82009-09-23 10:12:08 -0400414 } else {
Vaibhav Bedia0d624272012-08-08 20:40:31 +0530415 if (dev->rxnumevt) { /* enable FIFO */
Hebbar, Gururajae5ec69d2012-09-03 13:40:40 +0530416 switch (dev->version) {
417 case MCASP_VERSION_3:
418 mcasp_clr_bits(dev->base + MCASP_VER3_RFIFOCTL,
Vaibhav Bedia0d624272012-08-08 20:40:31 +0530419 FIFO_ENABLE);
Hebbar, Gururajae5ec69d2012-09-03 13:40:40 +0530420 mcasp_set_bits(dev->base + MCASP_VER3_RFIFOCTL,
Chaithrika U S539d3d82009-09-23 10:12:08 -0400421 FIFO_ENABLE);
Hebbar, Gururajae5ec69d2012-09-03 13:40:40 +0530422 break;
423 default:
424 mcasp_clr_bits(dev->base +
425 DAVINCI_MCASP_RFIFOCTL, FIFO_ENABLE);
426 mcasp_set_bits(dev->base +
427 DAVINCI_MCASP_RFIFOCTL, FIFO_ENABLE);
428 }
Vaibhav Bedia0d624272012-08-08 20:40:31 +0530429 }
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400430 mcasp_start_rx(dev);
Chaithrika U S539d3d82009-09-23 10:12:08 -0400431 }
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400432}
433
434static void mcasp_stop_rx(struct davinci_audio_dev *dev)
435{
436 mcasp_set_reg(dev->base + DAVINCI_MCASP_GBLCTLR_REG, 0);
437 mcasp_set_reg(dev->base + DAVINCI_MCASP_RXSTAT_REG, 0xFFFFFFFF);
438}
439
440static void mcasp_stop_tx(struct davinci_audio_dev *dev)
441{
442 mcasp_set_reg(dev->base + DAVINCI_MCASP_GBLCTLX_REG, 0);
443 mcasp_set_reg(dev->base + DAVINCI_MCASP_TXSTAT_REG, 0xFFFFFFFF);
444}
445
446static void davinci_mcasp_stop(struct davinci_audio_dev *dev, int stream)
447{
Chaithrika U S539d3d82009-09-23 10:12:08 -0400448 if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
Hebbar, Gururajae5ec69d2012-09-03 13:40:40 +0530449 if (dev->txnumevt) { /* disable FIFO */
450 switch (dev->version) {
451 case MCASP_VERSION_3:
452 mcasp_clr_bits(dev->base + MCASP_VER3_WFIFOCTL,
Chaithrika U S539d3d82009-09-23 10:12:08 -0400453 FIFO_ENABLE);
Hebbar, Gururajae5ec69d2012-09-03 13:40:40 +0530454 break;
455 default:
456 mcasp_clr_bits(dev->base +
457 DAVINCI_MCASP_WFIFOCTL, FIFO_ENABLE);
458 }
459 }
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400460 mcasp_stop_tx(dev);
Chaithrika U S539d3d82009-09-23 10:12:08 -0400461 } else {
Hebbar, Gururajae5ec69d2012-09-03 13:40:40 +0530462 if (dev->rxnumevt) { /* disable FIFO */
463 switch (dev->version) {
464 case MCASP_VERSION_3:
465 mcasp_clr_bits(dev->base + MCASP_VER3_RFIFOCTL,
Chaithrika U S539d3d82009-09-23 10:12:08 -0400466 FIFO_ENABLE);
Hebbar, Gururajae5ec69d2012-09-03 13:40:40 +0530467 break;
468
469 default:
470 mcasp_clr_bits(dev->base +
471 DAVINCI_MCASP_RFIFOCTL, FIFO_ENABLE);
472 }
473 }
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400474 mcasp_stop_rx(dev);
Chaithrika U S539d3d82009-09-23 10:12:08 -0400475 }
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400476}
477
478static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai,
479 unsigned int fmt)
480{
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +0000481 struct davinci_audio_dev *dev = snd_soc_dai_get_drvdata(cpu_dai);
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400482 void __iomem *base = dev->base;
483
Daniel Mack5296cf22012-10-04 15:08:42 +0200484 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
485 case SND_SOC_DAIFMT_DSP_B:
486 case SND_SOC_DAIFMT_AC97:
487 mcasp_clr_bits(dev->base + DAVINCI_MCASP_TXFMCTL_REG, FSXDUR);
488 mcasp_clr_bits(dev->base + DAVINCI_MCASP_RXFMCTL_REG, FSRDUR);
489 break;
490 default:
491 /* configure a full-word SYNC pulse (LRCLK) */
492 mcasp_set_bits(dev->base + DAVINCI_MCASP_TXFMCTL_REG, FSXDUR);
493 mcasp_set_bits(dev->base + DAVINCI_MCASP_RXFMCTL_REG, FSRDUR);
494
495 /* make 1st data bit occur one ACLK cycle after the frame sync */
496 mcasp_set_bits(dev->base + DAVINCI_MCASP_TXFMT_REG, FSXDLY(1));
497 mcasp_set_bits(dev->base + DAVINCI_MCASP_RXFMT_REG, FSRDLY(1));
498 break;
499 }
500
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400501 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
502 case SND_SOC_DAIFMT_CBS_CFS:
503 /* codec is clock and frame slave */
504 mcasp_set_bits(base + DAVINCI_MCASP_ACLKXCTL_REG, ACLKXE);
505 mcasp_set_bits(base + DAVINCI_MCASP_TXFMCTL_REG, AFSXE);
506
507 mcasp_set_bits(base + DAVINCI_MCASP_ACLKRCTL_REG, ACLKRE);
508 mcasp_set_bits(base + DAVINCI_MCASP_RXFMCTL_REG, AFSRE);
509
Daniel Mack5b66aa22012-10-04 15:08:41 +0200510 mcasp_set_bits(base + DAVINCI_MCASP_PDIR_REG, ACLKX | AFSX);
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400511 break;
Chaithrika U S517ee6c2009-08-11 16:59:12 -0400512 case SND_SOC_DAIFMT_CBM_CFS:
513 /* codec is clock master and frame slave */
Ben Gardinera90f5492011-04-21 14:19:03 -0400514 mcasp_clr_bits(base + DAVINCI_MCASP_ACLKXCTL_REG, ACLKXE);
Chaithrika U S517ee6c2009-08-11 16:59:12 -0400515 mcasp_set_bits(base + DAVINCI_MCASP_TXFMCTL_REG, AFSXE);
516
Ben Gardinera90f5492011-04-21 14:19:03 -0400517 mcasp_clr_bits(base + DAVINCI_MCASP_ACLKRCTL_REG, ACLKRE);
Chaithrika U S517ee6c2009-08-11 16:59:12 -0400518 mcasp_set_bits(base + DAVINCI_MCASP_RXFMCTL_REG, AFSRE);
519
Ben Gardinerdb92f432011-04-21 14:19:04 -0400520 mcasp_clr_bits(base + DAVINCI_MCASP_PDIR_REG,
521 ACLKX | ACLKR);
Ben Gardiner9595c8f2011-04-21 14:19:02 -0400522 mcasp_set_bits(base + DAVINCI_MCASP_PDIR_REG,
Ben Gardinerdb92f432011-04-21 14:19:04 -0400523 AFSX | AFSR);
Chaithrika U S517ee6c2009-08-11 16:59:12 -0400524 break;
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400525 case SND_SOC_DAIFMT_CBM_CFM:
526 /* codec is clock and frame master */
527 mcasp_clr_bits(base + DAVINCI_MCASP_ACLKXCTL_REG, ACLKXE);
528 mcasp_clr_bits(base + DAVINCI_MCASP_TXFMCTL_REG, AFSXE);
529
530 mcasp_clr_bits(base + DAVINCI_MCASP_ACLKRCTL_REG, ACLKRE);
531 mcasp_clr_bits(base + DAVINCI_MCASP_RXFMCTL_REG, AFSRE);
532
Ben Gardiner9595c8f2011-04-21 14:19:02 -0400533 mcasp_clr_bits(base + DAVINCI_MCASP_PDIR_REG,
534 ACLKX | AHCLKX | AFSX | ACLKR | AHCLKR | AFSR);
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400535 break;
536
537 default:
538 return -EINVAL;
539 }
540
541 switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
542 case SND_SOC_DAIFMT_IB_NF:
543 mcasp_clr_bits(base + DAVINCI_MCASP_ACLKXCTL_REG, ACLKXPOL);
544 mcasp_clr_bits(base + DAVINCI_MCASP_TXFMCTL_REG, FSXPOL);
545
546 mcasp_set_bits(base + DAVINCI_MCASP_ACLKRCTL_REG, ACLKRPOL);
547 mcasp_clr_bits(base + DAVINCI_MCASP_RXFMCTL_REG, FSRPOL);
548 break;
549
550 case SND_SOC_DAIFMT_NB_IF:
551 mcasp_set_bits(base + DAVINCI_MCASP_ACLKXCTL_REG, ACLKXPOL);
552 mcasp_set_bits(base + DAVINCI_MCASP_TXFMCTL_REG, FSXPOL);
553
554 mcasp_clr_bits(base + DAVINCI_MCASP_ACLKRCTL_REG, ACLKRPOL);
555 mcasp_set_bits(base + DAVINCI_MCASP_RXFMCTL_REG, FSRPOL);
556 break;
557
558 case SND_SOC_DAIFMT_IB_IF:
559 mcasp_clr_bits(base + DAVINCI_MCASP_ACLKXCTL_REG, ACLKXPOL);
560 mcasp_set_bits(base + DAVINCI_MCASP_TXFMCTL_REG, FSXPOL);
561
562 mcasp_set_bits(base + DAVINCI_MCASP_ACLKRCTL_REG, ACLKRPOL);
563 mcasp_set_bits(base + DAVINCI_MCASP_RXFMCTL_REG, FSRPOL);
564 break;
565
566 case SND_SOC_DAIFMT_NB_NF:
567 mcasp_set_bits(base + DAVINCI_MCASP_ACLKXCTL_REG, ACLKXPOL);
568 mcasp_clr_bits(base + DAVINCI_MCASP_TXFMCTL_REG, FSXPOL);
569
570 mcasp_clr_bits(base + DAVINCI_MCASP_ACLKRCTL_REG, ACLKRPOL);
571 mcasp_clr_bits(base + DAVINCI_MCASP_RXFMCTL_REG, FSRPOL);
572 break;
573
574 default:
575 return -EINVAL;
576 }
577
578 return 0;
579}
580
Daniel Mack4ed8c9b2012-10-04 15:08:39 +0200581static int davinci_mcasp_set_clkdiv(struct snd_soc_dai *dai, int div_id, int div)
582{
583 struct davinci_audio_dev *dev = snd_soc_dai_get_drvdata(dai);
584
585 switch (div_id) {
586 case 0: /* MCLK divider */
587 mcasp_mod_bits(dev->base + DAVINCI_MCASP_AHCLKXCTL_REG,
588 AHCLKXDIV(div - 1), AHCLKXDIV_MASK);
589 mcasp_mod_bits(dev->base + DAVINCI_MCASP_AHCLKRCTL_REG,
590 AHCLKRDIV(div - 1), AHCLKRDIV_MASK);
591 break;
592
593 case 1: /* BCLK divider */
594 mcasp_mod_bits(dev->base + DAVINCI_MCASP_ACLKXCTL_REG,
595 ACLKXDIV(div - 1), ACLKXDIV_MASK);
596 mcasp_mod_bits(dev->base + DAVINCI_MCASP_ACLKRCTL_REG,
597 ACLKRDIV(div - 1), ACLKRDIV_MASK);
598 break;
599
Daniel Mack1b3bc062012-12-05 18:20:38 +0100600 case 2: /* BCLK/LRCLK ratio */
601 dev->bclk_lrclk_ratio = div;
602 break;
603
Daniel Mack4ed8c9b2012-10-04 15:08:39 +0200604 default:
605 return -EINVAL;
606 }
607
608 return 0;
609}
610
Daniel Mack5b66aa22012-10-04 15:08:41 +0200611static int davinci_mcasp_set_sysclk(struct snd_soc_dai *dai, int clk_id,
612 unsigned int freq, int dir)
613{
614 struct davinci_audio_dev *dev = snd_soc_dai_get_drvdata(dai);
615
616 if (dir == SND_SOC_CLOCK_OUT) {
617 mcasp_set_bits(dev->base + DAVINCI_MCASP_AHCLKXCTL_REG, AHCLKXE);
618 mcasp_set_bits(dev->base + DAVINCI_MCASP_AHCLKRCTL_REG, AHCLKRE);
619 mcasp_set_bits(dev->base + DAVINCI_MCASP_PDIR_REG, AHCLKX);
620 } else {
621 mcasp_clr_bits(dev->base + DAVINCI_MCASP_AHCLKXCTL_REG, AHCLKXE);
622 mcasp_clr_bits(dev->base + DAVINCI_MCASP_AHCLKRCTL_REG, AHCLKRE);
623 mcasp_clr_bits(dev->base + DAVINCI_MCASP_PDIR_REG, AHCLKX);
624 }
625
626 return 0;
627}
628
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400629static int davinci_config_channel_size(struct davinci_audio_dev *dev,
Daniel Mackba764b32012-12-05 18:20:37 +0100630 int word_length)
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400631{
Daniel Mackba764b32012-12-05 18:20:37 +0100632 u32 fmt;
Michal Bachratydde109f2013-01-18 10:17:00 +0100633 u32 rotate = (word_length / 4) & 0x7;
Daniel Mackba764b32012-12-05 18:20:37 +0100634 u32 mask = (1ULL << word_length) - 1;
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400635
Daniel Mack1b3bc062012-12-05 18:20:38 +0100636 /*
637 * if s BCLK-to-LRCLK ratio has been configured via the set_clkdiv()
638 * callback, take it into account here. That allows us to for example
639 * send 32 bits per channel to the codec, while only 16 of them carry
640 * audio payload.
641 * The clock ratio is given for a full period of data (both left and
642 * right channels), so it has to be divided by 2.
643 */
644 if (dev->bclk_lrclk_ratio)
645 word_length = dev->bclk_lrclk_ratio / 2;
646
Daniel Mackba764b32012-12-05 18:20:37 +0100647 /* mapping of the XSSZ bit-field as described in the datasheet */
648 fmt = (word_length >> 1) - 1;
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400649
650 mcasp_mod_bits(dev->base + DAVINCI_MCASP_RXFMT_REG,
651 RXSSZ(fmt), RXSSZ(0x0F));
652 mcasp_mod_bits(dev->base + DAVINCI_MCASP_TXFMT_REG,
653 TXSSZ(fmt), TXSSZ(0x0F));
Chaithrika U S0c31cf32009-09-15 18:13:29 -0400654 mcasp_mod_bits(dev->base + DAVINCI_MCASP_TXFMT_REG, TXROT(rotate),
655 TXROT(7));
656 mcasp_mod_bits(dev->base + DAVINCI_MCASP_RXFMT_REG, RXROT(rotate),
657 RXROT(7));
658 mcasp_set_reg(dev->base + DAVINCI_MCASP_TXMASK_REG, mask);
659 mcasp_set_reg(dev->base + DAVINCI_MCASP_RXMASK_REG, mask);
660
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400661 return 0;
662}
663
Michal Bachraty2952b272013-02-28 16:07:08 +0100664static int davinci_hw_common_param(struct davinci_audio_dev *dev, int stream,
665 int channels)
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400666{
667 int i;
Chaithrika U S6a99fb52009-08-11 16:58:52 -0400668 u8 tx_ser = 0;
669 u8 rx_ser = 0;
Michal Bachraty2952b272013-02-28 16:07:08 +0100670 u8 ser;
671 u8 slots = dev->tdm_slots;
672 u8 max_active_serializers = (channels + slots - 1) / slots;
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400673 /* Default configuration */
674 mcasp_set_bits(dev->base + DAVINCI_MCASP_PWREMUMGT_REG, MCASP_SOFT);
675
676 /* All PINS as McASP */
677 mcasp_set_reg(dev->base + DAVINCI_MCASP_PFUNC_REG, 0x00000000);
678
679 if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
680 mcasp_set_reg(dev->base + DAVINCI_MCASP_TXSTAT_REG, 0xFFFFFFFF);
681 mcasp_clr_bits(dev->base + DAVINCI_MCASP_XEVTCTL_REG,
682 TXDATADMADIS);
683 } else {
684 mcasp_set_reg(dev->base + DAVINCI_MCASP_RXSTAT_REG, 0xFFFFFFFF);
685 mcasp_clr_bits(dev->base + DAVINCI_MCASP_REVTCTL_REG,
686 RXDATADMADIS);
687 }
688
689 for (i = 0; i < dev->num_serializer; i++) {
Michal Bachraty2952b272013-02-28 16:07:08 +0100690 if (dev->serial_dir[i] == TX_MODE)
691 tx_ser++;
692 if (dev->serial_dir[i] == RX_MODE)
693 rx_ser++;
694 }
695
696 if (stream == SNDRV_PCM_STREAM_PLAYBACK)
697 ser = tx_ser;
698 else
699 ser = rx_ser;
700
701 if (ser < max_active_serializers) {
702 dev_warn(dev->dev, "stream has more channels (%d) than are "
703 "enabled in mcasp (%d)\n", channels, ser * slots);
704 return -EINVAL;
705 }
706
707 tx_ser = 0;
708 rx_ser = 0;
709
710 for (i = 0; i < dev->num_serializer; i++) {
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400711 mcasp_set_bits(dev->base + DAVINCI_MCASP_XRSRCTL_REG(i),
712 dev->serial_dir[i]);
Michal Bachraty2952b272013-02-28 16:07:08 +0100713 if (dev->serial_dir[i] == TX_MODE &&
714 tx_ser < max_active_serializers) {
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400715 mcasp_set_bits(dev->base + DAVINCI_MCASP_PDIR_REG,
716 AXR(i));
Chaithrika U S6a99fb52009-08-11 16:58:52 -0400717 tx_ser++;
Michal Bachraty2952b272013-02-28 16:07:08 +0100718 } else if (dev->serial_dir[i] == RX_MODE &&
719 rx_ser < max_active_serializers) {
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400720 mcasp_clr_bits(dev->base + DAVINCI_MCASP_PDIR_REG,
721 AXR(i));
Chaithrika U S6a99fb52009-08-11 16:58:52 -0400722 rx_ser++;
Michal Bachraty2952b272013-02-28 16:07:08 +0100723 } else {
724 mcasp_mod_bits(dev->base + DAVINCI_MCASP_XRSRCTL_REG(i),
725 SRMOD_INACTIVE, SRMOD_MASK);
Chaithrika U S6a99fb52009-08-11 16:58:52 -0400726 }
727 }
728
729 if (dev->txnumevt && stream == SNDRV_PCM_STREAM_PLAYBACK) {
730 if (dev->txnumevt * tx_ser > 64)
731 dev->txnumevt = 1;
732
Hebbar, Gururajae5ec69d2012-09-03 13:40:40 +0530733 switch (dev->version) {
734 case MCASP_VERSION_3:
735 mcasp_mod_bits(dev->base + MCASP_VER3_WFIFOCTL, tx_ser,
Chaithrika U S6a99fb52009-08-11 16:58:52 -0400736 NUMDMA_MASK);
Hebbar, Gururajae5ec69d2012-09-03 13:40:40 +0530737 mcasp_mod_bits(dev->base + MCASP_VER3_WFIFOCTL,
Chaithrika U S6a99fb52009-08-11 16:58:52 -0400738 ((dev->txnumevt * tx_ser) << 8), NUMEVT_MASK);
Hebbar, Gururajae5ec69d2012-09-03 13:40:40 +0530739 break;
740 default:
741 mcasp_mod_bits(dev->base + DAVINCI_MCASP_WFIFOCTL,
742 tx_ser, NUMDMA_MASK);
743 mcasp_mod_bits(dev->base + DAVINCI_MCASP_WFIFOCTL,
744 ((dev->txnumevt * tx_ser) << 8), NUMEVT_MASK);
745 }
Chaithrika U S6a99fb52009-08-11 16:58:52 -0400746 }
747
748 if (dev->rxnumevt && stream == SNDRV_PCM_STREAM_CAPTURE) {
749 if (dev->rxnumevt * rx_ser > 64)
750 dev->rxnumevt = 1;
Hebbar, Gururajae5ec69d2012-09-03 13:40:40 +0530751 switch (dev->version) {
752 case MCASP_VERSION_3:
753 mcasp_mod_bits(dev->base + MCASP_VER3_RFIFOCTL, rx_ser,
Chaithrika U S6a99fb52009-08-11 16:58:52 -0400754 NUMDMA_MASK);
Hebbar, Gururajae5ec69d2012-09-03 13:40:40 +0530755 mcasp_mod_bits(dev->base + MCASP_VER3_RFIFOCTL,
Chaithrika U S6a99fb52009-08-11 16:58:52 -0400756 ((dev->rxnumevt * rx_ser) << 8), NUMEVT_MASK);
Hebbar, Gururajae5ec69d2012-09-03 13:40:40 +0530757 break;
758 default:
759 mcasp_mod_bits(dev->base + DAVINCI_MCASP_RFIFOCTL,
760 rx_ser, NUMDMA_MASK);
761 mcasp_mod_bits(dev->base + DAVINCI_MCASP_RFIFOCTL,
762 ((dev->rxnumevt * rx_ser) << 8), NUMEVT_MASK);
763 }
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400764 }
Michal Bachraty2952b272013-02-28 16:07:08 +0100765
766 return 0;
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400767}
768
769static void davinci_hw_param(struct davinci_audio_dev *dev, int stream)
770{
771 int i, active_slots;
772 u32 mask = 0;
773
774 active_slots = (dev->tdm_slots > 31) ? 32 : dev->tdm_slots;
775 for (i = 0; i < active_slots; i++)
776 mask |= (1 << i);
777
Chaithrika U S6a99fb52009-08-11 16:58:52 -0400778 mcasp_clr_bits(dev->base + DAVINCI_MCASP_ACLKXCTL_REG, TX_ASYNC);
779
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400780 if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
781 /* bit stream is MSB first with no delay */
782 /* DSP_B mode */
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400783 mcasp_set_reg(dev->base + DAVINCI_MCASP_TXTDM_REG, mask);
784 mcasp_set_bits(dev->base + DAVINCI_MCASP_TXFMT_REG, TXORD);
785
Ben Gardiner049cfaa2011-04-21 14:19:01 -0400786 if ((dev->tdm_slots >= 2) && (dev->tdm_slots <= 32))
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400787 mcasp_mod_bits(dev->base + DAVINCI_MCASP_TXFMCTL_REG,
788 FSXMOD(dev->tdm_slots), FSXMOD(0x1FF));
789 else
790 printk(KERN_ERR "playback tdm slot %d not supported\n",
791 dev->tdm_slots);
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400792 } else {
793 /* bit stream is MSB first with no delay */
794 /* DSP_B mode */
795 mcasp_set_bits(dev->base + DAVINCI_MCASP_RXFMT_REG, RXORD);
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400796 mcasp_set_reg(dev->base + DAVINCI_MCASP_RXTDM_REG, mask);
797
Ben Gardiner049cfaa2011-04-21 14:19:01 -0400798 if ((dev->tdm_slots >= 2) && (dev->tdm_slots <= 32))
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400799 mcasp_mod_bits(dev->base + DAVINCI_MCASP_RXFMCTL_REG,
800 FSRMOD(dev->tdm_slots), FSRMOD(0x1FF));
801 else
802 printk(KERN_ERR "capture tdm slot %d not supported\n",
803 dev->tdm_slots);
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400804 }
805}
806
807/* S/PDIF */
808static void davinci_hw_dit_param(struct davinci_audio_dev *dev)
809{
810 /* Set the PDIR for Serialiser as output */
811 mcasp_set_bits(dev->base + DAVINCI_MCASP_PDIR_REG, AFSX);
812
813 /* TXMASK for 24 bits */
814 mcasp_set_reg(dev->base + DAVINCI_MCASP_TXMASK_REG, 0x00FFFFFF);
815
816 /* Set the TX format : 24 bit right rotation, 32 bit slot, Pad 0
817 and LSB first */
818 mcasp_set_bits(dev->base + DAVINCI_MCASP_TXFMT_REG,
819 TXROT(6) | TXSSZ(15));
820
821 /* Set TX frame synch : DIT Mode, 1 bit width, internal, rising edge */
822 mcasp_set_reg(dev->base + DAVINCI_MCASP_TXFMCTL_REG,
823 AFSXE | FSXMOD(0x180));
824
825 /* Set the TX tdm : for all the slots */
826 mcasp_set_reg(dev->base + DAVINCI_MCASP_TXTDM_REG, 0xFFFFFFFF);
827
828 /* Set the TX clock controls : div = 1 and internal */
829 mcasp_set_bits(dev->base + DAVINCI_MCASP_ACLKXCTL_REG,
830 ACLKXE | TX_ASYNC);
831
832 mcasp_clr_bits(dev->base + DAVINCI_MCASP_XEVTCTL_REG, TXDATADMADIS);
833
834 /* Only 44100 and 48000 are valid, both have the same setting */
835 mcasp_set_bits(dev->base + DAVINCI_MCASP_AHCLKXCTL_REG, AHCLKXDIV(3));
836
837 /* Enable the DIT */
838 mcasp_set_bits(dev->base + DAVINCI_MCASP_TXDITCTL_REG, DITEN);
839}
840
841static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream,
842 struct snd_pcm_hw_params *params,
843 struct snd_soc_dai *cpu_dai)
844{
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +0000845 struct davinci_audio_dev *dev = snd_soc_dai_get_drvdata(cpu_dai);
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400846 struct davinci_pcm_dma_params *dma_params =
Troy Kisky92e2a6f2009-09-11 14:29:03 -0700847 &dev->dma_params[substream->stream];
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400848 int word_length;
Chaithrika U S4fa9c1a2009-09-30 17:32:27 -0400849 u8 fifo_level;
Michal Bachraty2952b272013-02-28 16:07:08 +0100850 u8 slots = dev->tdm_slots;
851 int channels;
852 struct snd_interval *pcm_channels = hw_param_interval(params,
853 SNDRV_PCM_HW_PARAM_CHANNELS);
854 channels = pcm_channels->min;
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400855
Michal Bachraty2952b272013-02-28 16:07:08 +0100856 if (davinci_hw_common_param(dev, substream->stream, channels) == -EINVAL)
857 return -EINVAL;
Chaithrika U S6a99fb52009-08-11 16:58:52 -0400858 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
Chaithrika U S4fa9c1a2009-09-30 17:32:27 -0400859 fifo_level = dev->txnumevt;
Chaithrika U S6a99fb52009-08-11 16:58:52 -0400860 else
Chaithrika U S4fa9c1a2009-09-30 17:32:27 -0400861 fifo_level = dev->rxnumevt;
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400862
863 if (dev->op_mode == DAVINCI_MCASP_DIT_MODE)
864 davinci_hw_dit_param(dev);
865 else
866 davinci_hw_param(dev, substream->stream);
867
868 switch (params_format(params)) {
Ben Gardiner0a9d1382011-08-26 12:02:44 -0400869 case SNDRV_PCM_FORMAT_U8:
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400870 case SNDRV_PCM_FORMAT_S8:
871 dma_params->data_type = 1;
Daniel Mackba764b32012-12-05 18:20:37 +0100872 word_length = 8;
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400873 break;
874
Ben Gardiner0a9d1382011-08-26 12:02:44 -0400875 case SNDRV_PCM_FORMAT_U16_LE:
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400876 case SNDRV_PCM_FORMAT_S16_LE:
877 dma_params->data_type = 2;
Daniel Mackba764b32012-12-05 18:20:37 +0100878 word_length = 16;
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400879 break;
880
Daniel Mack21eb24d2012-10-09 09:35:16 +0200881 case SNDRV_PCM_FORMAT_U24_3LE:
882 case SNDRV_PCM_FORMAT_S24_3LE:
Daniel Mack21eb24d2012-10-09 09:35:16 +0200883 dma_params->data_type = 3;
Daniel Mackba764b32012-12-05 18:20:37 +0100884 word_length = 24;
Daniel Mack21eb24d2012-10-09 09:35:16 +0200885 break;
886
Daniel Mack6b7fa012012-10-09 11:56:40 +0200887 case SNDRV_PCM_FORMAT_U24_LE:
888 case SNDRV_PCM_FORMAT_S24_LE:
Ben Gardiner0a9d1382011-08-26 12:02:44 -0400889 case SNDRV_PCM_FORMAT_U32_LE:
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400890 case SNDRV_PCM_FORMAT_S32_LE:
891 dma_params->data_type = 4;
Daniel Mackba764b32012-12-05 18:20:37 +0100892 word_length = 32;
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400893 break;
894
895 default:
896 printk(KERN_WARNING "davinci-mcasp: unsupported PCM format");
897 return -EINVAL;
898 }
Chaithrika U S6a99fb52009-08-11 16:58:52 -0400899
Chaithrika U S4fa9c1a2009-09-30 17:32:27 -0400900 if (dev->version == MCASP_VERSION_2 && !fifo_level)
901 dma_params->acnt = 4;
902 else
Chaithrika U S6a99fb52009-08-11 16:58:52 -0400903 dma_params->acnt = dma_params->data_type;
904
Chaithrika U S4fa9c1a2009-09-30 17:32:27 -0400905 dma_params->fifo_level = fifo_level;
Michal Bachraty2952b272013-02-28 16:07:08 +0100906 dma_params->active_serializers = (channels + slots - 1) / slots;
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400907 davinci_config_channel_size(dev, word_length);
908
909 return 0;
910}
911
912static int davinci_mcasp_trigger(struct snd_pcm_substream *substream,
913 int cmd, struct snd_soc_dai *cpu_dai)
914{
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +0000915 struct davinci_audio_dev *dev = snd_soc_dai_get_drvdata(cpu_dai);
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400916 int ret = 0;
917
918 switch (cmd) {
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400919 case SNDRV_PCM_TRIGGER_RESUME:
Chaithrika U Se473b842010-01-20 17:06:33 +0530920 case SNDRV_PCM_TRIGGER_START:
921 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
Hebbar, Gururaja10884342012-08-08 20:40:32 +0530922 ret = pm_runtime_get_sync(dev->dev);
923 if (IS_ERR_VALUE(ret))
924 dev_err(dev->dev, "pm_runtime_get_sync() failed\n");
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400925 davinci_mcasp_start(dev, substream->stream);
926 break;
927
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400928 case SNDRV_PCM_TRIGGER_SUSPEND:
Chaithrika U Sa47979b2009-12-03 18:56:56 +0530929 davinci_mcasp_stop(dev, substream->stream);
Hebbar, Gururaja10884342012-08-08 20:40:32 +0530930 ret = pm_runtime_put_sync(dev->dev);
931 if (IS_ERR_VALUE(ret))
932 dev_err(dev->dev, "pm_runtime_put_sync() failed\n");
Chaithrika U Sa47979b2009-12-03 18:56:56 +0530933 break;
934
935 case SNDRV_PCM_TRIGGER_STOP:
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400936 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
937 davinci_mcasp_stop(dev, substream->stream);
938 break;
939
940 default:
941 ret = -EINVAL;
942 }
943
944 return ret;
945}
946
Chris Paulson-Ellisbedad0c2010-11-16 12:27:09 +0000947static int davinci_mcasp_startup(struct snd_pcm_substream *substream,
948 struct snd_soc_dai *dai)
949{
950 struct davinci_audio_dev *dev = snd_soc_dai_get_drvdata(dai);
951
952 snd_soc_dai_set_dma_data(dai, substream, dev->dma_params);
953 return 0;
954}
955
Lars-Peter Clausen85e76522011-11-23 11:40:40 +0100956static const struct snd_soc_dai_ops davinci_mcasp_dai_ops = {
Chris Paulson-Ellisbedad0c2010-11-16 12:27:09 +0000957 .startup = davinci_mcasp_startup,
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400958 .trigger = davinci_mcasp_trigger,
959 .hw_params = davinci_mcasp_hw_params,
960 .set_fmt = davinci_mcasp_set_dai_fmt,
Daniel Mack4ed8c9b2012-10-04 15:08:39 +0200961 .set_clkdiv = davinci_mcasp_set_clkdiv,
Daniel Mack5b66aa22012-10-04 15:08:41 +0200962 .set_sysclk = davinci_mcasp_set_sysclk,
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400963};
964
Ben Gardiner0a9d1382011-08-26 12:02:44 -0400965#define DAVINCI_MCASP_PCM_FMTS (SNDRV_PCM_FMTBIT_S8 | \
966 SNDRV_PCM_FMTBIT_U8 | \
967 SNDRV_PCM_FMTBIT_S16_LE | \
968 SNDRV_PCM_FMTBIT_U16_LE | \
Daniel Mack21eb24d2012-10-09 09:35:16 +0200969 SNDRV_PCM_FMTBIT_S24_LE | \
970 SNDRV_PCM_FMTBIT_U24_LE | \
971 SNDRV_PCM_FMTBIT_S24_3LE | \
972 SNDRV_PCM_FMTBIT_U24_3LE | \
Ben Gardiner0a9d1382011-08-26 12:02:44 -0400973 SNDRV_PCM_FMTBIT_S32_LE | \
974 SNDRV_PCM_FMTBIT_U32_LE)
975
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +0000976static struct snd_soc_dai_driver davinci_mcasp_dai[] = {
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400977 {
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +0000978 .name = "davinci-mcasp.0",
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400979 .playback = {
980 .channels_min = 2,
Michal Bachraty2952b272013-02-28 16:07:08 +0100981 .channels_max = 32 * 16,
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400982 .rates = DAVINCI_MCASP_RATES,
Ben Gardiner0a9d1382011-08-26 12:02:44 -0400983 .formats = DAVINCI_MCASP_PCM_FMTS,
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400984 },
985 .capture = {
986 .channels_min = 2,
Michal Bachraty2952b272013-02-28 16:07:08 +0100987 .channels_max = 32 * 16,
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400988 .rates = DAVINCI_MCASP_RATES,
Ben Gardiner0a9d1382011-08-26 12:02:44 -0400989 .formats = DAVINCI_MCASP_PCM_FMTS,
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400990 },
991 .ops = &davinci_mcasp_dai_ops,
992
993 },
994 {
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +0000995 "davinci-mcasp.1",
Chaithrika U Sb67f4482009-06-05 06:28:40 -0400996 .playback = {
997 .channels_min = 1,
998 .channels_max = 384,
999 .rates = DAVINCI_MCASP_RATES,
Ben Gardiner0a9d1382011-08-26 12:02:44 -04001000 .formats = DAVINCI_MCASP_PCM_FMTS,
Chaithrika U Sb67f4482009-06-05 06:28:40 -04001001 },
1002 .ops = &davinci_mcasp_dai_ops,
1003 },
1004
1005};
Chaithrika U Sb67f4482009-06-05 06:28:40 -04001006
Hebbar, Gururaja3e3b8c32012-08-27 18:56:42 +05301007static const struct of_device_id mcasp_dt_ids[] = {
1008 {
1009 .compatible = "ti,dm646x-mcasp-audio",
1010 .data = (void *)MCASP_VERSION_1,
1011 },
1012 {
1013 .compatible = "ti,da830-mcasp-audio",
1014 .data = (void *)MCASP_VERSION_2,
1015 },
Hebbar, Gururajae5ec69d2012-09-03 13:40:40 +05301016 {
1017 .compatible = "ti,omap2-mcasp-audio",
1018 .data = (void *)MCASP_VERSION_3,
1019 },
Hebbar, Gururaja3e3b8c32012-08-27 18:56:42 +05301020 { /* sentinel */ }
1021};
1022MODULE_DEVICE_TABLE(of, mcasp_dt_ids);
1023
1024static struct snd_platform_data *davinci_mcasp_set_pdata_from_of(
1025 struct platform_device *pdev)
1026{
1027 struct device_node *np = pdev->dev.of_node;
1028 struct snd_platform_data *pdata = NULL;
1029 const struct of_device_id *match =
1030 of_match_device(of_match_ptr(mcasp_dt_ids), &pdev->dev);
1031
1032 const u32 *of_serial_dir32;
1033 u8 *of_serial_dir;
1034 u32 val;
1035 int i, ret = 0;
1036
1037 if (pdev->dev.platform_data) {
1038 pdata = pdev->dev.platform_data;
1039 return pdata;
1040 } else if (match) {
1041 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
1042 if (!pdata) {
1043 ret = -ENOMEM;
1044 goto nodata;
1045 }
1046 } else {
1047 /* control shouldn't reach here. something is wrong */
1048 ret = -EINVAL;
1049 goto nodata;
1050 }
1051
1052 if (match->data)
1053 pdata->version = (u8)((int)match->data);
1054
1055 ret = of_property_read_u32(np, "op-mode", &val);
1056 if (ret >= 0)
1057 pdata->op_mode = val;
1058
1059 ret = of_property_read_u32(np, "tdm-slots", &val);
Michal Bachraty2952b272013-02-28 16:07:08 +01001060 if (ret >= 0) {
1061 if (val < 2 || val > 32) {
1062 dev_err(&pdev->dev,
1063 "tdm-slots must be in rage [2-32]\n");
1064 ret = -EINVAL;
1065 goto nodata;
1066 }
1067
Hebbar, Gururaja3e3b8c32012-08-27 18:56:42 +05301068 pdata->tdm_slots = val;
Michal Bachraty2952b272013-02-28 16:07:08 +01001069 }
Hebbar, Gururaja3e3b8c32012-08-27 18:56:42 +05301070
1071 ret = of_property_read_u32(np, "num-serializer", &val);
1072 if (ret >= 0)
1073 pdata->num_serializer = val;
1074
1075 of_serial_dir32 = of_get_property(np, "serial-dir", &val);
1076 val /= sizeof(u32);
1077 if (val != pdata->num_serializer) {
1078 dev_err(&pdev->dev,
1079 "num-serializer(%d) != serial-dir size(%d)\n",
1080 pdata->num_serializer, val);
1081 ret = -EINVAL;
1082 goto nodata;
1083 }
1084
1085 if (of_serial_dir32) {
1086 of_serial_dir = devm_kzalloc(&pdev->dev,
1087 (sizeof(*of_serial_dir) * val),
1088 GFP_KERNEL);
1089 if (!of_serial_dir) {
1090 ret = -ENOMEM;
1091 goto nodata;
1092 }
1093
1094 for (i = 0; i < pdata->num_serializer; i++)
1095 of_serial_dir[i] = be32_to_cpup(&of_serial_dir32[i]);
1096
1097 pdata->serial_dir = of_serial_dir;
1098 }
1099
1100 ret = of_property_read_u32(np, "tx-num-evt", &val);
1101 if (ret >= 0)
1102 pdata->txnumevt = val;
1103
1104 ret = of_property_read_u32(np, "rx-num-evt", &val);
1105 if (ret >= 0)
1106 pdata->rxnumevt = val;
1107
1108 ret = of_property_read_u32(np, "sram-size-playback", &val);
1109 if (ret >= 0)
1110 pdata->sram_size_playback = val;
1111
1112 ret = of_property_read_u32(np, "sram-size-capture", &val);
1113 if (ret >= 0)
1114 pdata->sram_size_capture = val;
1115
1116 return pdata;
1117
1118nodata:
1119 if (ret < 0) {
1120 dev_err(&pdev->dev, "Error populating platform data, err %d\n",
1121 ret);
1122 pdata = NULL;
1123 }
1124 return pdata;
1125}
1126
Chaithrika U Sb67f4482009-06-05 06:28:40 -04001127static int davinci_mcasp_probe(struct platform_device *pdev)
1128{
1129 struct davinci_pcm_dma_params *dma_data;
1130 struct resource *mem, *ioarea, *res;
1131 struct snd_platform_data *pdata;
1132 struct davinci_audio_dev *dev;
Julia Lawall96d31e22011-12-29 17:51:21 +01001133 int ret;
Chaithrika U Sb67f4482009-06-05 06:28:40 -04001134
Hebbar, Gururaja3e3b8c32012-08-27 18:56:42 +05301135 if (!pdev->dev.platform_data && !pdev->dev.of_node) {
1136 dev_err(&pdev->dev, "No platform data supplied\n");
1137 return -EINVAL;
1138 }
1139
Julia Lawall96d31e22011-12-29 17:51:21 +01001140 dev = devm_kzalloc(&pdev->dev, sizeof(struct davinci_audio_dev),
1141 GFP_KERNEL);
Chaithrika U Sb67f4482009-06-05 06:28:40 -04001142 if (!dev)
1143 return -ENOMEM;
1144
Hebbar, Gururaja3e3b8c32012-08-27 18:56:42 +05301145 pdata = davinci_mcasp_set_pdata_from_of(pdev);
1146 if (!pdata) {
1147 dev_err(&pdev->dev, "no platform data\n");
1148 return -EINVAL;
1149 }
1150
Chaithrika U Sb67f4482009-06-05 06:28:40 -04001151 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1152 if (!mem) {
1153 dev_err(&pdev->dev, "no mem resource?\n");
Julia Lawall96d31e22011-12-29 17:51:21 +01001154 return -ENODEV;
Chaithrika U Sb67f4482009-06-05 06:28:40 -04001155 }
1156
Julia Lawall96d31e22011-12-29 17:51:21 +01001157 ioarea = devm_request_mem_region(&pdev->dev, mem->start,
Vaibhav Bediad852f4462011-02-09 18:39:52 +05301158 resource_size(mem), pdev->name);
Chaithrika U Sb67f4482009-06-05 06:28:40 -04001159 if (!ioarea) {
1160 dev_err(&pdev->dev, "Audio region already claimed\n");
Julia Lawall96d31e22011-12-29 17:51:21 +01001161 return -EBUSY;
Chaithrika U Sb67f4482009-06-05 06:28:40 -04001162 }
1163
Hebbar, Gururaja10884342012-08-08 20:40:32 +05301164 pm_runtime_enable(&pdev->dev);
Chaithrika U Sb67f4482009-06-05 06:28:40 -04001165
Hebbar, Gururaja10884342012-08-08 20:40:32 +05301166 ret = pm_runtime_get_sync(&pdev->dev);
1167 if (IS_ERR_VALUE(ret)) {
1168 dev_err(&pdev->dev, "pm_runtime_get_sync() failed\n");
1169 return ret;
1170 }
Chaithrika U Sb67f4482009-06-05 06:28:40 -04001171
Julia Lawall96d31e22011-12-29 17:51:21 +01001172 dev->base = devm_ioremap(&pdev->dev, mem->start, resource_size(mem));
Vaibhav Bedia4f82f022011-02-09 18:39:54 +05301173 if (!dev->base) {
1174 dev_err(&pdev->dev, "ioremap failed\n");
1175 ret = -ENOMEM;
1176 goto err_release_clk;
1177 }
1178
Chaithrika U Sb67f4482009-06-05 06:28:40 -04001179 dev->op_mode = pdata->op_mode;
1180 dev->tdm_slots = pdata->tdm_slots;
1181 dev->num_serializer = pdata->num_serializer;
1182 dev->serial_dir = pdata->serial_dir;
Chaithrika U S6a99fb52009-08-11 16:58:52 -04001183 dev->version = pdata->version;
1184 dev->txnumevt = pdata->txnumevt;
1185 dev->rxnumevt = pdata->rxnumevt;
Hebbar, Gururaja10884342012-08-08 20:40:32 +05301186 dev->dev = &pdev->dev;
Chaithrika U Sb67f4482009-06-05 06:28:40 -04001187
Troy Kisky92e2a6f2009-09-11 14:29:03 -07001188 dma_data = &dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK];
Sekhar Nori48519f02010-07-19 12:31:16 +05301189 dma_data->asp_chan_q = pdata->asp_chan_q;
1190 dma_data->ram_chan_q = pdata->ram_chan_q;
Matt Porterb8ec56d2012-10-17 16:08:03 +02001191 dma_data->sram_pool = pdata->sram_pool;
Ben Gardinera0c83262011-05-18 09:27:45 -04001192 dma_data->sram_size = pdata->sram_size_playback;
Troy Kisky92e2a6f2009-09-11 14:29:03 -07001193 dma_data->dma_addr = (dma_addr_t) (pdata->tx_dma_offset +
Vaibhav Bedia4f82f022011-02-09 18:39:54 +05301194 mem->start);
Chaithrika U Sb67f4482009-06-05 06:28:40 -04001195
1196 /* first TX, then RX */
1197 res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
1198 if (!res) {
1199 dev_err(&pdev->dev, "no DMA resource\n");
Julia Lawall02ffc5f2010-10-18 16:11:13 +02001200 ret = -ENODEV;
Julia Lawall96d31e22011-12-29 17:51:21 +01001201 goto err_release_clk;
Chaithrika U Sb67f4482009-06-05 06:28:40 -04001202 }
1203
Troy Kisky92e2a6f2009-09-11 14:29:03 -07001204 dma_data->channel = res->start;
1205
1206 dma_data = &dev->dma_params[SNDRV_PCM_STREAM_CAPTURE];
Sekhar Nori48519f02010-07-19 12:31:16 +05301207 dma_data->asp_chan_q = pdata->asp_chan_q;
1208 dma_data->ram_chan_q = pdata->ram_chan_q;
Matt Porterb8ec56d2012-10-17 16:08:03 +02001209 dma_data->sram_pool = pdata->sram_pool;
Ben Gardinera0c83262011-05-18 09:27:45 -04001210 dma_data->sram_size = pdata->sram_size_capture;
Troy Kisky92e2a6f2009-09-11 14:29:03 -07001211 dma_data->dma_addr = (dma_addr_t)(pdata->rx_dma_offset +
Vaibhav Bedia4f82f022011-02-09 18:39:54 +05301212 mem->start);
Chaithrika U Sb67f4482009-06-05 06:28:40 -04001213
1214 res = platform_get_resource(pdev, IORESOURCE_DMA, 1);
1215 if (!res) {
1216 dev_err(&pdev->dev, "no DMA resource\n");
Julia Lawall02ffc5f2010-10-18 16:11:13 +02001217 ret = -ENODEV;
Julia Lawall96d31e22011-12-29 17:51:21 +01001218 goto err_release_clk;
Chaithrika U Sb67f4482009-06-05 06:28:40 -04001219 }
1220
Troy Kisky92e2a6f2009-09-11 14:29:03 -07001221 dma_data->channel = res->start;
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +00001222 dev_set_drvdata(&pdev->dev, dev);
1223 ret = snd_soc_register_dai(&pdev->dev, &davinci_mcasp_dai[pdata->op_mode]);
Chaithrika U Sb67f4482009-06-05 06:28:40 -04001224
1225 if (ret != 0)
Julia Lawall96d31e22011-12-29 17:51:21 +01001226 goto err_release_clk;
Hebbar, Gururajaf08095a2012-08-27 18:56:39 +05301227
1228 ret = davinci_soc_platform_register(&pdev->dev);
1229 if (ret) {
1230 dev_err(&pdev->dev, "register PCM failed: %d\n", ret);
1231 goto err_unregister_dai;
1232 }
1233
Chaithrika U Sb67f4482009-06-05 06:28:40 -04001234 return 0;
1235
Hebbar, Gururajaf08095a2012-08-27 18:56:39 +05301236err_unregister_dai:
1237 snd_soc_unregister_dai(&pdev->dev);
Vaibhav Bediaeef6d7b2011-02-09 18:39:53 +05301238err_release_clk:
Hebbar, Gururaja10884342012-08-08 20:40:32 +05301239 pm_runtime_put_sync(&pdev->dev);
1240 pm_runtime_disable(&pdev->dev);
Chaithrika U Sb67f4482009-06-05 06:28:40 -04001241 return ret;
1242}
1243
1244static int davinci_mcasp_remove(struct platform_device *pdev)
1245{
Chaithrika U Sb67f4482009-06-05 06:28:40 -04001246
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +00001247 snd_soc_unregister_dai(&pdev->dev);
Hebbar, Gururajaf08095a2012-08-27 18:56:39 +05301248 davinci_soc_platform_unregister(&pdev->dev);
Hebbar, Gururaja10884342012-08-08 20:40:32 +05301249
1250 pm_runtime_put_sync(&pdev->dev);
1251 pm_runtime_disable(&pdev->dev);
Chaithrika U Sb67f4482009-06-05 06:28:40 -04001252
Chaithrika U Sb67f4482009-06-05 06:28:40 -04001253 return 0;
1254}
1255
1256static struct platform_driver davinci_mcasp_driver = {
1257 .probe = davinci_mcasp_probe,
1258 .remove = davinci_mcasp_remove,
1259 .driver = {
1260 .name = "davinci-mcasp",
1261 .owner = THIS_MODULE,
Hebbar, Gururaja3e3b8c32012-08-27 18:56:42 +05301262 .of_match_table = of_match_ptr(mcasp_dt_ids),
Chaithrika U Sb67f4482009-06-05 06:28:40 -04001263 },
1264};
1265
Axel Linf9b8a512011-11-25 10:09:27 +08001266module_platform_driver(davinci_mcasp_driver);
Chaithrika U Sb67f4482009-06-05 06:28:40 -04001267
1268MODULE_AUTHOR("Steve Chen");
1269MODULE_DESCRIPTION("TI DAVINCI McASP SoC Interface");
1270MODULE_LICENSE("GPL");
1271