]> git.karo-electronics.de Git - karo-tx-linux.git/blob - sound/soc/fsl/fsl_ssi.c
ce18518add3d92851515189fe4550aa6acae5078
[karo-tx-linux.git] / sound / soc / fsl / fsl_ssi.c
1 /*
2  * Freescale SSI ALSA SoC Digital Audio Interface (DAI) driver
3  *
4  * Author: Timur Tabi <timur@freescale.com>
5  *
6  * Copyright (C) 2007-2014 Freescale Semiconductor, Inc.
7  *
8  * This file is licensed under the terms of the GNU General Public License
9  * version 2.  This program is licensed "as is" without any warranty of any
10  * kind, whether express or implied.
11  */
12
13 #include <linux/busfreq-imx6.h>
14 #include <linux/init.h>
15 #include <linux/io.h>
16 #include <linux/module.h>
17 #include <linux/interrupt.h>
18 #include <linux/clk.h>
19 #include <linux/device.h>
20 #include <linux/delay.h>
21 #include <linux/slab.h>
22 #include <linux/of_address.h>
23 #include <linux/of_irq.h>
24 #include <linux/of_platform.h>
25 #include <linux/pm_runtime.h>
26
27 #include <sound/core.h>
28 #include <sound/pcm.h>
29 #include <sound/pcm_params.h>
30 #include <sound/initval.h>
31 #include <sound/soc.h>
32 #include <sound/dmaengine_pcm.h>
33
34 #include "fsl_ssi.h"
35 #include "imx-pcm.h"
36
37 #ifdef PPC
38 #define read_ssi(addr)                   in_be32(addr)
39 #define write_ssi(val, addr)             out_be32(addr, val)
40 #define write_ssi_mask(addr, clear, set) clrsetbits_be32(addr, clear, set)
41 #elif defined ARM
42 #define read_ssi(addr)                   readl(addr)
43 #define write_ssi(val, addr)             writel(val, addr)
44 /*
45  * FIXME: Proper locking should be added at write_ssi_mask caller level
46  * to ensure this register read/modify/write sequence is race free.
47  */
48 static inline void write_ssi_mask(u32 __iomem *addr, u32 clear, u32 set)
49 {
50         u32 val = readl(addr);
51         val = (val & ~clear) | set;
52         writel(val, addr);
53 }
54 #endif
55
56 #ifdef DEBUG
57 #define NUM_OF_SSI_REG (sizeof(struct ccsr_ssi) / sizeof(__be32))
58
59 void dump_reg(struct ccsr_ssi __iomem *ssi)
60 {
61         u32 val, i;
62
63         for (i = 0; i < NUM_OF_SSI_REG; i++) {
64                 if (&ssi->stx0 + i == NULL)
65                         continue;
66                 val = read_ssi(&ssi->stx0 + i);
67                 pr_debug("REG %x = %x\n", (u32)(&ssi->stx0 + i) & 0xff, val);
68         }
69 }
70 #else
71 void dump_reg(struct ccsr_ssi __iomem *ssi) {}
72 #endif
73
74 /**
75  * FSLSSI_I2S_RATES: sample rates supported by the I2S
76  *
77  * This driver currently only supports the SSI running in I2S slave mode,
78  * which means the codec determines the sample rate.  Therefore, we tell
79  * ALSA that we support all rates and let the codec driver decide what rates
80  * are really supported.
81  */
82 #define FSLSSI_I2S_RATES (SNDRV_PCM_RATE_5512 | SNDRV_PCM_RATE_8000_192000 | \
83                           SNDRV_PCM_RATE_CONTINUOUS)
84
85 /**
86  * FSLSSI_I2S_FORMATS: audio formats supported by the SSI
87  *
88  * This driver currently only supports the SSI running in I2S slave mode.
89  *
90  * The SSI has a limitation in that the samples must be in the same byte
91  * order as the host CPU.  This is because when multiple bytes are written
92  * to the STX register, the bytes and bits must be written in the same
93  * order.  The STX is a shift register, so all the bits need to be aligned
94  * (bit-endianness must match byte-endianness).  Processors typically write
95  * the bits within a byte in the same order that the bytes of a word are
96  * written in.  So if the host CPU is big-endian, then only big-endian
97  * samples will be written to STX properly.
98  */
99 #ifdef __BIG_ENDIAN
100 #define FSLSSI_I2S_FORMATS (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_BE | \
101          SNDRV_PCM_FMTBIT_S18_3BE | SNDRV_PCM_FMTBIT_S20_3BE | \
102          SNDRV_PCM_FMTBIT_S24_3BE | SNDRV_PCM_FMTBIT_S24_BE)
103 #else
104 #define FSLSSI_I2S_FORMATS (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_LE | \
105          SNDRV_PCM_FMTBIT_S18_3LE | SNDRV_PCM_FMTBIT_S20_3LE | \
106          SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S24_LE)
107 #endif
108
109 /* SIER bitflag of interrupts to enable */
110 #define SIER_FLAGS (CCSR_SSI_SIER_TFRC_EN | CCSR_SSI_SIER_TIE | \
111                     CCSR_SSI_SIER_TUE0_EN | CCSR_SSI_SIER_TUE1_EN | \
112                     CCSR_SSI_SIER_RFRC_EN | CCSR_SSI_SIER_RIE | \
113                     CCSR_SSI_SIER_ROE0_EN | CCSR_SSI_SIER_ROE1_EN)
114
115 /**
116  * fsl_ssi_private: per-SSI private data
117  *
118  * @ssi: pointer to the SSI's registers
119  * @ssi_phys: physical address of the SSI registers
120  * @irq: IRQ of this SSI
121  * @playback: the number of playback streams opened
122  * @capture: the number of capture streams opened
123  * @cpu_dai: the CPU DAI for this device
124  * @dev_attr: the sysfs device attribute structure
125  * @stats: SSI statistics
126  * @name: name for this device
127  */
128 struct fsl_ssi_private {
129         struct ccsr_ssi __iomem *ssi;
130         dma_addr_t ssi_phys;
131         unsigned int irq;
132         unsigned int fifo_depth;
133         struct snd_soc_dai_driver cpu_dai_drv;
134         struct device_attribute dev_attr;
135         struct platform_device *pdev;
136
137         unsigned long sysrate;
138         bool new_binding;
139         bool ssi_on_imx;
140         bool use_dual_fifo;
141         u8 i2s_mode;
142         struct clk *coreclk;
143         struct clk *clk;
144         struct snd_dmaengine_dai_dma_data dma_params_tx;
145         struct snd_dmaengine_dai_dma_data dma_params_rx;
146
147         struct {
148                 unsigned int rfrc;
149                 unsigned int tfrc;
150                 unsigned int cmdau;
151                 unsigned int cmddu;
152                 unsigned int rxt;
153                 unsigned int rdr1;
154                 unsigned int rdr0;
155                 unsigned int tde1;
156                 unsigned int tde0;
157                 unsigned int roe1;
158                 unsigned int roe0;
159                 unsigned int tue1;
160                 unsigned int tue0;
161                 unsigned int tfs;
162                 unsigned int rfs;
163                 unsigned int tls;
164                 unsigned int rls;
165                 unsigned int rff1;
166                 unsigned int rff0;
167                 unsigned int tfe1;
168                 unsigned int tfe0;
169         } stats;
170
171         char name[1];
172 };
173
174 /**
175  * fsl_ssi_isr: SSI interrupt handler
176  *
177  * Although it's possible to use the interrupt handler to send and receive
178  * data to/from the SSI, we use the DMA instead.  Programming is more
179  * complicated, but the performance is much better.
180  *
181  * This interrupt handler is used only to gather statistics.
182  *
183  * @irq: IRQ of the SSI device
184  * @dev_id: pointer to the ssi_private structure for this SSI device
185  */
186 static irqreturn_t fsl_ssi_isr(int irq, void *dev_id)
187 {
188         struct fsl_ssi_private *ssi_private = dev_id;
189         struct ccsr_ssi __iomem *ssi = ssi_private->ssi;
190         irqreturn_t ret = IRQ_NONE;
191         __be32 sisr;
192         __be32 sisr2 = 0;
193
194         /* We got an interrupt, so read the status register to see what we
195            were interrupted for.  We mask it with the Interrupt Enable register
196            so that we only check for events that we're interested in.
197          */
198         sisr = read_ssi(&ssi->sisr) & SIER_FLAGS;
199
200         if (sisr & CCSR_SSI_SISR_RFRC) {
201                 ssi_private->stats.rfrc++;
202                 sisr2 |= CCSR_SSI_SISR_RFRC;
203                 ret = IRQ_HANDLED;
204         }
205
206         if (sisr & CCSR_SSI_SISR_TFRC) {
207                 ssi_private->stats.tfrc++;
208                 sisr2 |= CCSR_SSI_SISR_TFRC;
209                 ret = IRQ_HANDLED;
210         }
211
212         if (sisr & CCSR_SSI_SISR_CMDAU) {
213                 ssi_private->stats.cmdau++;
214                 ret = IRQ_HANDLED;
215         }
216
217         if (sisr & CCSR_SSI_SISR_CMDDU) {
218                 ssi_private->stats.cmddu++;
219                 ret = IRQ_HANDLED;
220         }
221
222         if (sisr & CCSR_SSI_SISR_RXT) {
223                 ssi_private->stats.rxt++;
224                 ret = IRQ_HANDLED;
225         }
226
227         if (sisr & CCSR_SSI_SISR_RDR1) {
228                 ssi_private->stats.rdr1++;
229                 ret = IRQ_HANDLED;
230         }
231
232         if (sisr & CCSR_SSI_SISR_RDR0) {
233                 ssi_private->stats.rdr0++;
234                 ret = IRQ_HANDLED;
235         }
236
237         if (sisr & CCSR_SSI_SISR_TDE1) {
238                 ssi_private->stats.tde1++;
239                 ret = IRQ_HANDLED;
240         }
241
242         if (sisr & CCSR_SSI_SISR_TDE0) {
243                 ssi_private->stats.tde0++;
244                 ret = IRQ_HANDLED;
245         }
246
247         if (sisr & CCSR_SSI_SISR_ROE1) {
248                 ssi_private->stats.roe1++;
249                 sisr2 |= CCSR_SSI_SISR_ROE1;
250                 ret = IRQ_HANDLED;
251         }
252
253         if (sisr & CCSR_SSI_SISR_ROE0) {
254                 ssi_private->stats.roe0++;
255                 sisr2 |= CCSR_SSI_SISR_ROE0;
256                 ret = IRQ_HANDLED;
257         }
258
259         if (sisr & CCSR_SSI_SISR_TUE1) {
260                 ssi_private->stats.tue1++;
261                 sisr2 |= CCSR_SSI_SISR_TUE1;
262                 ret = IRQ_HANDLED;
263         }
264
265         if (sisr & CCSR_SSI_SISR_TUE0) {
266                 ssi_private->stats.tue0++;
267                 sisr2 |= CCSR_SSI_SISR_TUE0;
268                 ret = IRQ_HANDLED;
269         }
270
271         if (sisr & CCSR_SSI_SISR_TFS) {
272                 ssi_private->stats.tfs++;
273                 ret = IRQ_HANDLED;
274         }
275
276         if (sisr & CCSR_SSI_SISR_RFS) {
277                 ssi_private->stats.rfs++;
278                 ret = IRQ_HANDLED;
279         }
280
281         if (sisr & CCSR_SSI_SISR_TLS) {
282                 ssi_private->stats.tls++;
283                 ret = IRQ_HANDLED;
284         }
285
286         if (sisr & CCSR_SSI_SISR_RLS) {
287                 ssi_private->stats.rls++;
288                 ret = IRQ_HANDLED;
289         }
290
291         if (sisr & CCSR_SSI_SISR_RFF1) {
292                 ssi_private->stats.rff1++;
293                 ret = IRQ_HANDLED;
294         }
295
296         if (sisr & CCSR_SSI_SISR_RFF0) {
297                 ssi_private->stats.rff0++;
298                 ret = IRQ_HANDLED;
299         }
300
301         if (sisr & CCSR_SSI_SISR_TFE1) {
302                 ssi_private->stats.tfe1++;
303                 ret = IRQ_HANDLED;
304         }
305
306         if (sisr & CCSR_SSI_SISR_TFE0) {
307                 ssi_private->stats.tfe0++;
308                 ret = IRQ_HANDLED;
309         }
310
311         /* Clear the bits that we set */
312         if (sisr2)
313                 write_ssi(sisr2, &ssi->sisr);
314
315         return ret;
316 }
317
318 /**
319  * fsl_ssi_startup: create a new substream
320  *
321  * This is the first function called when a stream is opened.
322  *
323  * If this is the first stream open, then grab the IRQ and program most of
324  * the SSI registers.
325  */
326 static int fsl_ssi_startup(struct snd_pcm_substream *substream,
327                            struct snd_soc_dai *dai)
328 {
329         struct snd_soc_pcm_runtime *rtd = substream->private_data;
330         struct fsl_ssi_private *ssi_private =
331                 snd_soc_dai_get_drvdata(rtd->cpu_dai);
332         int synchronous = ssi_private->cpu_dai_drv.symmetric_rates;
333
334         if (ssi_private->ssi_on_imx) {
335                 pm_runtime_get_sync(dai->dev);
336
337                 clk_prepare_enable(ssi_private->coreclk);
338                 clk_prepare_enable(ssi_private->clk);
339
340                 /* When using dual fifo mode, it would be safer if we ensure
341                  * its period size to be an even number. If appearing to an
342                  * odd number, the 2nd fifo might be neglected by SDMA sciprt
343                  * at the end of each period.
344                  */
345                 if (ssi_private->use_dual_fifo)
346                         snd_pcm_hw_constraint_step(substream->runtime, 0,
347                                         SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 2);
348         }
349
350         /*
351          * If this is the first stream opened, then request the IRQ
352          * and initialize the SSI registers.
353          */
354         if (!dai->active) {
355                 struct ccsr_ssi __iomem *ssi = ssi_private->ssi;
356
357                 /*
358                  * Section 16.5 of the MPC8610 reference manual says that the
359                  * SSI needs to be disabled before updating the registers we set
360                  * here.
361                  */
362                 write_ssi_mask(&ssi->scr, CCSR_SSI_SCR_SSIEN, 0);
363
364                 /*
365                  * Program the SSI into I2S Slave Non-Network Synchronous mode.
366                  * Also enable the transmit and receive FIFO.
367                  *
368                  * FIXME: Little-endian samples require a different shift dir
369                  */
370                 ssi_private->i2s_mode = CCSR_SSI_SCR_I2S_MODE_SLAVE;
371                 write_ssi_mask(&ssi->scr,
372                         CCSR_SSI_SCR_I2S_MODE_MASK | CCSR_SSI_SCR_SYN,
373                         CCSR_SSI_SCR_TFR_CLK_DIS | ssi_private->i2s_mode
374                         | (synchronous ? CCSR_SSI_SCR_SYN : 0));
375
376                 write_ssi(CCSR_SSI_STCR_TXBIT0 | CCSR_SSI_STCR_TFEN0 |
377                          CCSR_SSI_STCR_TFSI | CCSR_SSI_STCR_TEFS |
378                          CCSR_SSI_STCR_TSCKP, &ssi->stcr);
379
380                 write_ssi(CCSR_SSI_SRCR_RXBIT0 | CCSR_SSI_SRCR_RFEN0 |
381                          CCSR_SSI_SRCR_RFSI | CCSR_SSI_SRCR_REFS |
382                          CCSR_SSI_SRCR_RSCKP, &ssi->srcr);
383
384                 /*
385                  * The DC and PM bits are only used if the SSI is the clock
386                  * master.
387                  */
388
389                 /* Enable the interrupts and DMA requests */
390                 write_ssi(SIER_FLAGS, &ssi->sier);
391
392                 /*
393                  * Set the watermark for transmit FIFI 0 and receive FIFO 0. We
394                  * don't use FIFO 1.  We program the transmit water to signal a
395                  * DMA transfer if there are only two (or fewer) elements left
396                  * in the FIFO.  Two elements equals one frame (left channel,
397                  * right channel).  This value, however, depends on the depth of
398                  * the transmit buffer.
399                  *
400                  * We program the receive FIFO to notify us if at least two
401                  * elements (one frame) have been written to the FIFO.  We could
402                  * make this value larger (and maybe we should), but this way
403                  * data will be written to memory as soon as it's available.
404                  */
405                 write_ssi(CCSR_SSI_SFCSR_TFWM0(ssi_private->fifo_depth - 2) |
406                         CCSR_SSI_SFCSR_RFWM0(ssi_private->fifo_depth - 2) |
407                         CCSR_SSI_SFCSR_TFWM1(ssi_private->fifo_depth - 2) |
408                         CCSR_SSI_SFCSR_RFWM1(ssi_private->fifo_depth - 2),
409                         &ssi->sfcsr);
410
411                 /* Select Single/Dual fifo mode */
412                 if (ssi_private->use_dual_fifo) {
413                         write_ssi_mask(&ssi->srcr, 0, CCSR_SSI_SRCR_RFEN1);
414                         write_ssi_mask(&ssi->stcr, 0, CCSR_SSI_STCR_TFEN1);
415                         write_ssi_mask(&ssi->scr, 0, CCSR_SSI_SCR_TCH_EN);
416                 } else {
417                         write_ssi_mask(&ssi->srcr, CCSR_SSI_SRCR_RFEN1, 0);
418                         write_ssi_mask(&ssi->stcr, CCSR_SSI_STCR_TFEN1, 0);
419                         write_ssi_mask(&ssi->scr, CCSR_SSI_SCR_TCH_EN, 0);
420                 }
421
422                 /*
423                  * We keep the SSI disabled because if we enable it, then the
424                  * DMA controller will start.  It's not supposed to start until
425                  * the SCR.TE (or SCR.RE) bit is set, but it does anyway.  The
426                  * DMA controller will transfer one "BWC" of data (i.e. the
427                  * amount of data that the MR.BWC bits are set to).  The reason
428                  * this is bad is because at this point, the PCM driver has not
429                  * finished initializing the DMA controller.
430                  */
431         }
432
433         return 0;
434 }
435
436 /**
437  * fsl_ssi_hw_params - program the sample size
438  *
439  * Most of the SSI registers have been programmed in the startup function,
440  * but the word length must be programmed here.  Unfortunately, programming
441  * the SxCCR.WL bits requires the SSI to be temporarily disabled.  This can
442  * cause a problem with supporting simultaneous playback and capture.  If
443  * the SSI is already playing a stream, then that stream may be temporarily
444  * stopped when you start capture.
445  *
446  * Note: The SxCCR.DC and SxCCR.PM bits are only used if the SSI is the
447  * clock master.
448  */
449 static int fsl_ssi_hw_params(struct snd_pcm_substream *substream,
450         struct snd_pcm_hw_params *hw_params, struct snd_soc_dai *cpu_dai)
451 {
452         struct fsl_ssi_private *ssi_private = snd_soc_dai_get_drvdata(cpu_dai);
453         struct ccsr_ssi __iomem *ssi = ssi_private->ssi;
454         unsigned int sample_size =
455                 snd_pcm_format_width(params_format(hw_params));
456         u32 wl = CCSR_SSI_SxCCR_WL(sample_size);
457         int enabled = read_ssi(&ssi->scr) & CCSR_SSI_SCR_SSIEN;
458         unsigned int channels = params_channels(hw_params);
459         int ret;
460
461         /*
462          * If we're in synchronous mode, and the SSI is already enabled,
463          * then STCCR is already set properly.
464          */
465         if (enabled && ssi_private->cpu_dai_drv.symmetric_rates)
466                 return 0;
467
468         if (ssi_private->sysrate) {
469                 ret = clk_set_rate(ssi_private->clk, ssi_private->sysrate);
470                 if (ret) {
471                         dev_err(cpu_dai->dev, "failed to set clock rate\n");
472                         return ret;
473                 }
474         }
475
476         /*
477          * FIXME: The documentation says that SxCCR[WL] should not be
478          * modified while the SSI is enabled.  The only time this can
479          * happen is if we're trying to do simultaneous playback and
480          * capture in asynchronous mode.  Unfortunately, I have been enable
481          * to get that to work at all on the P1022DS.  Therefore, we don't
482          * bother to disable/enable the SSI when setting SxCCR[WL], because
483          * the SSI will stop anyway.  Maybe one day, this will get fixed.
484          */
485
486         /* In synchronous mode, the SSI uses STCCR for capture */
487         if ((substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ||
488             ssi_private->cpu_dai_drv.symmetric_rates)
489                 write_ssi_mask(&ssi->stccr, CCSR_SSI_SxCCR_WL_MASK, wl);
490         else
491                 write_ssi_mask(&ssi->srccr, CCSR_SSI_SxCCR_WL_MASK, wl);
492
493         write_ssi_mask(&ssi->scr, CCSR_SSI_SCR_NET | CCSR_SSI_SCR_I2S_MODE_MASK,
494                         channels == 1 ? 0 : ssi_private->i2s_mode);
495
496         return 0;
497 }
498
499 /**
500  * fsl_ssi_trigger: start and stop the DMA transfer.
501  *
502  * This function is called by ALSA to start, stop, pause, and resume the DMA
503  * transfer of data.
504  *
505  * The DMA channel is in external master start and pause mode, which
506  * means the SSI completely controls the flow of data.
507  */
508 static int fsl_ssi_trigger(struct snd_pcm_substream *substream, int cmd,
509                            struct snd_soc_dai *dai)
510 {
511         struct snd_soc_pcm_runtime *rtd = substream->private_data;
512         struct fsl_ssi_private *ssi_private = snd_soc_dai_get_drvdata(rtd->cpu_dai);
513         struct ccsr_ssi __iomem *ssi = ssi_private->ssi;
514
515         switch (cmd) {
516         case SNDRV_PCM_TRIGGER_START:
517         case SNDRV_PCM_TRIGGER_RESUME:
518         case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
519                 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
520                         write_ssi_mask(&ssi->scr, 0,
521                                 CCSR_SSI_SCR_SSIEN | CCSR_SSI_SCR_TE);
522                         write_ssi_mask(&ssi->sier, 0, CCSR_SSI_SIER_TDMAE);
523                 } else {
524                         write_ssi_mask(&ssi->scr, 0,
525                                 CCSR_SSI_SCR_SSIEN | CCSR_SSI_SCR_RE);
526                         write_ssi_mask(&ssi->sier, 0, CCSR_SSI_SIER_RDMAE);
527                 }
528                 dump_reg(ssi);
529                 break;
530
531         case SNDRV_PCM_TRIGGER_STOP:
532         case SNDRV_PCM_TRIGGER_SUSPEND:
533         case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
534                 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
535                         write_ssi_mask(&ssi->scr, CCSR_SSI_SCR_TE, 0);
536                         write_ssi_mask(&ssi->sier, CCSR_SSI_SIER_TDMAE, 0);
537                 } else {
538                         write_ssi_mask(&ssi->scr, CCSR_SSI_SCR_RE, 0);
539                         write_ssi_mask(&ssi->sier, CCSR_SSI_SIER_RDMAE, 0);
540                 }
541                 if ((read_ssi(&ssi->scr) & (CCSR_SSI_SCR_TE | CCSR_SSI_SCR_RE)) == 0)
542                         write_ssi_mask(&ssi->scr, CCSR_SSI_SCR_SSIEN, 0);
543                 break;
544
545         default:
546                 return -EINVAL;
547         }
548
549         return 0;
550 }
551
552 static int fsl_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)
553 {
554         struct fsl_ssi_private *ssi_private = snd_soc_dai_get_drvdata(cpu_dai);
555         struct ccsr_ssi __iomem *ssi = ssi_private->ssi;
556         u32 strcr = 0, stcr, srcr, scr, mask;
557
558         scr = read_ssi(&ssi->scr) & ~(CCSR_SSI_SCR_SYN | CCSR_SSI_SCR_NET);
559
560         mask = CCSR_SSI_STCR_TXBIT0 | CCSR_SSI_STCR_TFDIR | CCSR_SSI_STCR_TXDIR
561                 | CCSR_SSI_STCR_TSCKP | CCSR_SSI_STCR_TFSI | CCSR_SSI_STCR_TFSL
562                 | CCSR_SSI_STCR_TEFS;
563         stcr = read_ssi(&ssi->stcr) & ~mask;
564         srcr = read_ssi(&ssi->srcr) & ~mask;
565
566         /* DAI format */
567         switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
568         case SND_SOC_DAIFMT_I2S:
569                 scr |= CCSR_SSI_SCR_NET;
570
571                 /* Pre-set SSI I2S mode */
572                 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
573                 case SND_SOC_DAIFMT_CBS_CFS:
574                         ssi_private->i2s_mode = CCSR_SSI_SCR_I2S_MODE_MASTER;
575                         break;
576                 case SND_SOC_DAIFMT_CBM_CFM:
577                         ssi_private->i2s_mode = CCSR_SSI_SCR_I2S_MODE_SLAVE;
578                         break;
579                 default:
580                         dev_err(cpu_dai->dev, "unsupported SND_SOC_DAIFMT_MASTER: %d",
581                                         fmt & SND_SOC_DAIFMT_MASTER_MASK);
582                         return -EINVAL;
583                 }
584                 scr &= ~CCSR_SSI_SCR_I2S_MODE_MASK;
585                 scr |= ssi_private->i2s_mode;
586
587                 /* Data on rising edge of bclk, frame low, 1clk before data */
588                 strcr |= CCSR_SSI_STCR_TFSI | CCSR_SSI_STCR_TSCKP
589                         | CCSR_SSI_STCR_TXBIT0 | CCSR_SSI_STCR_TEFS;
590                 break;
591         case SND_SOC_DAIFMT_LEFT_J:
592                 /* Data on rising edge of bclk, frame high */
593                 strcr |= CCSR_SSI_STCR_TXBIT0 | CCSR_SSI_STCR_TSCKP;
594                 break;
595         case SND_SOC_DAIFMT_DSP_A:
596                 /* Data on rising edge of bclk, frame high, 1clk before data */
597                 strcr |= CCSR_SSI_STCR_TFSL | CCSR_SSI_STCR_TSCKP
598                         | CCSR_SSI_STCR_TXBIT0 | CCSR_SSI_STCR_TEFS;
599                 break;
600         case SND_SOC_DAIFMT_DSP_B:
601                 /* Data on rising edge of bclk, frame high */
602                 strcr |= CCSR_SSI_STCR_TFSL | CCSR_SSI_STCR_TSCKP
603                         | CCSR_SSI_STCR_TXBIT0;
604                 break;
605         default:
606                 dev_err(cpu_dai->dev, "unsupported SND_SOC_DAIFMT: %d",
607                                 fmt & SND_SOC_DAIFMT_FORMAT_MASK);
608                 return -EINVAL;
609         }
610
611         /* DAI clock inversion */
612         switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
613         case SND_SOC_DAIFMT_NB_NF:
614                 /* Nothing to do for both normal cases */
615                 break;
616         case SND_SOC_DAIFMT_IB_NF:
617                 /* Invert bit clock */
618                 strcr ^= CCSR_SSI_STCR_TSCKP;
619                 break;
620         case SND_SOC_DAIFMT_NB_IF:
621                 /* Invert frame clock */
622                 strcr ^= CCSR_SSI_STCR_TFSI;
623                 break;
624         case SND_SOC_DAIFMT_IB_IF:
625                 /* Invert both clocks */
626                 strcr ^= CCSR_SSI_STCR_TSCKP;
627                 strcr ^= CCSR_SSI_STCR_TFSI;
628                 break;
629         default:
630                 dev_err(cpu_dai->dev, "unsupported SND_SOC_DAIFMT_INV: %d",
631                                 fmt & SND_SOC_DAIFMT_INV_MASK);
632                 return -EINVAL;
633         }
634
635         /* DAI clock master masks */
636         switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
637         case SND_SOC_DAIFMT_CBS_CFS:
638                 scr |= CCSR_SSI_SCR_SYS_CLK_EN;
639                 strcr |= CCSR_SSI_STCR_TFDIR | CCSR_SSI_STCR_TXDIR;
640                 break;
641         case SND_SOC_DAIFMT_CBM_CFM:
642                 scr &= ~CCSR_SSI_SCR_SYS_CLK_EN;
643                 break;
644         default:
645                 dev_err(cpu_dai->dev, "unsupported SND_SOC_DAIFMT_MASTER: %d",
646                                 fmt & SND_SOC_DAIFMT_MASTER_MASK);
647                 return -EINVAL;
648         }
649
650         stcr |= strcr;
651         srcr |= strcr;
652
653         if (ssi_private->cpu_dai_drv.symmetric_rates) {
654                 scr |= CCSR_SSI_SCR_SYN;
655
656                 /* Need to clear RXDIR when using SYNC mode */
657                 srcr &= ~CCSR_SSI_SRCR_RXDIR;
658         }
659
660         write_ssi(stcr, &ssi->stcr);
661         write_ssi(srcr, &ssi->srcr);
662         write_ssi(scr, &ssi->scr);
663
664         return 0;
665 }
666
667 static int fsl_ssi_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
668                                   int clk_id, unsigned int freq, int dir)
669 {
670         struct fsl_ssi_private *ssi_private = snd_soc_dai_get_drvdata(cpu_dai);
671         struct ccsr_ssi __iomem *ssi = ssi_private->ssi;
672         int synchronous = ssi_private->cpu_dai_drv.symmetric_rates;
673         u32 pm = 999, div2, psr, stccr, mask, afreq, factor, i;
674         unsigned long clkrate, sysrate = 0;
675         u64 sub, savesub = 100000;
676
677         /*
678          * It should be already enough to divide clock by setting pm.
679          * So we here keep psr and div2 to 0.
680          */
681         psr = 0;
682         div2 = 0;
683
684         factor = (div2 + 1) * (7 * psr + 1) * 2;
685
686         for (i = 0; i < 255; i++) {
687                 /* The bclk rate must be smaller than 1/5 sysclk rate */
688                 if (factor * (i + 1) < 5)
689                         continue;
690
691                 sysrate = freq * factor * (i + 2);
692                 clkrate = clk_round_rate(ssi_private->clk, sysrate);
693
694                 do_div(clkrate, factor);
695                 afreq = (u32)clkrate / (i + 1);
696
697                 if (freq == afreq)
698                         sub = 0;
699                 else if (freq / afreq == 1)
700                         sub = freq - afreq;
701                 else if (afreq / freq == 1)
702                         sub = afreq - freq;
703                 else
704                         continue;
705
706                 /* Calculate the fraction */
707                 sub *= 100000;
708                 do_div(sub, freq);
709
710                 if (sub < savesub) {
711                         ssi_private->sysrate = sysrate;
712                         savesub = sub;
713                         pm = i;
714                 }
715
716                 /* We are lucky */
717                 if (savesub == 0)
718                         break;
719         }
720
721         /* No proper pm found if it is still remaining the initial value */
722         if (pm == 999) {
723                 dev_err(cpu_dai->dev, "failed to handle the required sysclk\n");
724                 return -EINVAL;
725         }
726
727         stccr = CCSR_SSI_SxCCR_PM(pm + 1) | (div2 ? CCSR_SSI_SxCCR_DIV2 : 0)
728                 | (psr ? CCSR_SSI_SxCCR_PSR : 0);
729         mask = CCSR_SSI_SxCCR_PM_MASK | CCSR_SSI_SxCCR_DIV2_MASK
730                 | CCSR_SSI_SxCCR_PSR_MASK;
731
732         if (dir == SND_SOC_CLOCK_OUT || synchronous)
733                 write_ssi_mask(&ssi->stccr, mask, stccr);
734         else
735                 write_ssi_mask(&ssi->srccr, mask, stccr);
736
737         return 0;
738 }
739
740 static int fsl_ssi_set_dai_tdm_slot(struct snd_soc_dai *cpu_dai, u32 tx_mask,
741                                 u32 rx_mask, int slots, int slot_width)
742 {
743         struct fsl_ssi_private *ssi_private = snd_soc_dai_get_drvdata(cpu_dai);
744         struct ccsr_ssi __iomem *ssi = ssi_private->ssi;
745
746         write_ssi_mask(&ssi->stccr, CCSR_SSI_SxCCR_DC_MASK,
747                         CCSR_SSI_SxCCR_DC(slots));
748         write_ssi_mask(&ssi->srccr, CCSR_SSI_SxCCR_DC_MASK,
749                         CCSR_SSI_SxCCR_DC(slots));
750
751         /* The register SxMSKs need SSI to provide essential clock due to
752          * hardware design. So we here temporarily enable SSI to set them.
753          */
754         write_ssi_mask(&ssi->scr, 0, CCSR_SSI_SCR_SSIEN);
755         write_ssi(tx_mask, &ssi->stmsk);
756         write_ssi(rx_mask, &ssi->srmsk);
757         write_ssi_mask(&ssi->scr, CCSR_SSI_SCR_SSIEN, 0);
758
759         return 0;
760 }
761
762 /**
763  * fsl_ssi_shutdown: shutdown the SSI
764  *
765  * Shutdown the SSI if there are no other substreams open.
766  */
767 static void fsl_ssi_shutdown(struct snd_pcm_substream *substream,
768                              struct snd_soc_dai *dai)
769 {
770         struct snd_soc_pcm_runtime *rtd = substream->private_data;
771         struct fsl_ssi_private *ssi_private = snd_soc_dai_get_drvdata(rtd->cpu_dai);
772
773         /* If this is the last active substream, disable the interrupts. */
774         if (!dai->active) {
775                 struct ccsr_ssi __iomem *ssi = ssi_private->ssi;
776
777                 write_ssi_mask(&ssi->sier, SIER_FLAGS, 0);
778
779                 ssi_private->sysrate = 0;
780         }
781
782         if (ssi_private->ssi_on_imx) {
783                 clk_disable_unprepare(ssi_private->clk);
784                 clk_disable_unprepare(ssi_private->coreclk);
785
786                 pm_runtime_put_sync(dai->dev);
787         }
788 }
789
790 static int fsl_ssi_dai_probe(struct snd_soc_dai *dai)
791 {
792         struct fsl_ssi_private *ssi_private = snd_soc_dai_get_drvdata(dai);
793
794         if (ssi_private->ssi_on_imx) {
795                 dai->playback_dma_data = &ssi_private->dma_params_tx;
796                 dai->capture_dma_data = &ssi_private->dma_params_rx;
797         }
798
799         return 0;
800 }
801
802 static const struct snd_soc_dai_ops fsl_ssi_dai_ops = {
803         .startup        = fsl_ssi_startup,
804         .hw_params      = fsl_ssi_hw_params,
805         .set_fmt        = fsl_ssi_set_dai_fmt,
806         .set_sysclk     = fsl_ssi_set_dai_sysclk,
807         .set_tdm_slot   = fsl_ssi_set_dai_tdm_slot,
808         .shutdown       = fsl_ssi_shutdown,
809         .trigger        = fsl_ssi_trigger,
810 };
811
812 /* Template for the CPU dai driver structure */
813 static struct snd_soc_dai_driver fsl_ssi_dai_template = {
814         .probe = fsl_ssi_dai_probe,
815         .playback = {
816                 .channels_min = 1,
817                 .channels_max = 2,
818                 .rates = FSLSSI_I2S_RATES,
819                 .formats = FSLSSI_I2S_FORMATS,
820         },
821         .capture = {
822                 .channels_min = 1,
823                 .channels_max = 2,
824                 .rates = FSLSSI_I2S_RATES,
825                 .formats = FSLSSI_I2S_FORMATS,
826         },
827         .ops = &fsl_ssi_dai_ops,
828 };
829
830 static const struct snd_soc_component_driver fsl_ssi_component = {
831         .name           = "fsl-ssi",
832 };
833
834 /* Show the statistics of a flag only if its interrupt is enabled.  The
835  * compiler will optimze this code to a no-op if the interrupt is not
836  * enabled.
837  */
838 #define SIER_SHOW(flag, name) \
839         do { \
840                 if (SIER_FLAGS & CCSR_SSI_SIER_##flag) \
841                         length += sprintf(buf + length, #name "=%u\n", \
842                                 ssi_private->stats.name); \
843         } while (0)
844
845
846 /**
847  * fsl_sysfs_ssi_show: display SSI statistics
848  *
849  * Display the statistics for the current SSI device.  To avoid confusion,
850  * we only show those counts that are enabled.
851  */
852 static ssize_t fsl_sysfs_ssi_show(struct device *dev,
853         struct device_attribute *attr, char *buf)
854 {
855         struct fsl_ssi_private *ssi_private =
856                 container_of(attr, struct fsl_ssi_private, dev_attr);
857         ssize_t length = 0;
858
859         SIER_SHOW(RFRC_EN, rfrc);
860         SIER_SHOW(TFRC_EN, tfrc);
861         SIER_SHOW(CMDAU_EN, cmdau);
862         SIER_SHOW(CMDDU_EN, cmddu);
863         SIER_SHOW(RXT_EN, rxt);
864         SIER_SHOW(RDR1_EN, rdr1);
865         SIER_SHOW(RDR0_EN, rdr0);
866         SIER_SHOW(TDE1_EN, tde1);
867         SIER_SHOW(TDE0_EN, tde0);
868         SIER_SHOW(ROE1_EN, roe1);
869         SIER_SHOW(ROE0_EN, roe0);
870         SIER_SHOW(TUE1_EN, tue1);
871         SIER_SHOW(TUE0_EN, tue0);
872         SIER_SHOW(TFS_EN, tfs);
873         SIER_SHOW(RFS_EN, rfs);
874         SIER_SHOW(TLS_EN, tls);
875         SIER_SHOW(RLS_EN, rls);
876         SIER_SHOW(RFF1_EN, rff1);
877         SIER_SHOW(RFF0_EN, rff0);
878         SIER_SHOW(TFE1_EN, tfe1);
879         SIER_SHOW(TFE0_EN, tfe0);
880
881         return length;
882 }
883
884 /**
885  * Make every character in a string lower-case
886  */
887 static void make_lowercase(char *s)
888 {
889         char *p = s;
890         char c;
891
892         while ((c = *p)) {
893                 if ((c >= 'A') && (c <= 'Z'))
894                         *p = c + ('a' - 'A');
895                 p++;
896         }
897 }
898
899 static int fsl_ssi_probe(struct platform_device *pdev)
900 {
901         struct fsl_ssi_private *ssi_private;
902         int ret = 0;
903         struct device_attribute *dev_attr = NULL;
904         struct device_node *np = pdev->dev.of_node;
905         const char *p, *sprop;
906         const uint32_t *iprop;
907         struct resource res;
908         char name[64];
909
910         /* SSIs that are not connected on the board should have a
911          *      status = "disabled"
912          * property in their device tree nodes.
913          */
914         if (!of_device_is_available(np))
915                 return -ENODEV;
916
917         /* The DAI name is the last part of the full name of the node. */
918         p = strrchr(np->full_name, '/') + 1;
919         ssi_private = kzalloc(sizeof(struct fsl_ssi_private) + strlen(p),
920                               GFP_KERNEL);
921         if (!ssi_private) {
922                 dev_err(&pdev->dev, "could not allocate DAI object\n");
923                 return -ENOMEM;
924         }
925
926         strcpy(ssi_private->name, p);
927
928         /* Initialize this copy of the CPU DAI driver structure */
929         memcpy(&ssi_private->cpu_dai_drv, &fsl_ssi_dai_template,
930                sizeof(fsl_ssi_dai_template));
931         ssi_private->cpu_dai_drv.name = ssi_private->name;
932
933         /* Get the addresses and IRQ */
934         ret = of_address_to_resource(np, 0, &res);
935         if (ret) {
936                 dev_err(&pdev->dev, "could not determine device resources\n");
937                 goto error_kmalloc;
938         }
939         ssi_private->ssi = of_iomap(np, 0);
940         if (!ssi_private->ssi) {
941                 dev_err(&pdev->dev, "could not map device resources\n");
942                 ret = -ENOMEM;
943                 goto error_kmalloc;
944         }
945         ssi_private->ssi_phys = res.start;
946
947         ssi_private->irq = irq_of_parse_and_map(np, 0);
948         if (ssi_private->irq == NO_IRQ) {
949                 dev_err(&pdev->dev, "no irq for node %s\n", np->full_name);
950                 ret = -ENXIO;
951                 goto error_iomap;
952         }
953
954         /* The 'name' should not have any slashes in it. */
955         ret = request_irq(ssi_private->irq, fsl_ssi_isr, 0, ssi_private->name,
956                           ssi_private);
957         if (ret < 0) {
958                 dev_err(&pdev->dev, "could not claim irq %u\n", ssi_private->irq);
959                 goto error_irqmap;
960         }
961
962         /* Are the RX and the TX clocks locked? */
963         if (!of_find_property(np, "fsl,ssi-asynchronous", NULL)) {
964                 ssi_private->cpu_dai_drv.symmetric_rates = 1;
965                 ssi_private->cpu_dai_drv.symmetric_channels = 1;
966                 ssi_private->cpu_dai_drv.symmetric_samplebits = 1;
967         }
968
969         /* Determine the FIFO depth. */
970         iprop = of_get_property(np, "fsl,fifo-depth", NULL);
971         if (iprop)
972                 ssi_private->fifo_depth = be32_to_cpup(iprop);
973         else
974                 /* Older 8610 DTs didn't have the fifo-depth property */
975                 ssi_private->fifo_depth = 8;
976
977         if (of_device_is_compatible(pdev->dev.of_node, "fsl,imx21-ssi")) {
978                 ssi_private->ssi_on_imx = true;
979
980                 ssi_private->coreclk = devm_clk_get(&pdev->dev, "ipg");
981                 if (IS_ERR(ssi_private->coreclk)) {
982                         ret = PTR_ERR(ssi_private->coreclk);
983                         dev_err(&pdev->dev, "could not get ipg clock: %d\n", ret);
984                         goto error_irq;
985                 }
986                 ssi_private->clk = devm_clk_get(&pdev->dev, "baud");
987                 if (IS_ERR(ssi_private->clk)) {
988                         ret = PTR_ERR(ssi_private->clk);
989                         dev_err(&pdev->dev, "could not get baud clock: %d\n", ret);
990                         goto error_irq;
991                 }
992
993                 /*
994                  * We have burstsize be "fifo_depth - 2" to match the SSI
995                  * watermark setting in fsl_ssi_startup().
996                  */
997                 ssi_private->dma_params_tx.maxburst =
998                         ssi_private->fifo_depth - 2;
999                 ssi_private->dma_params_rx.maxburst =
1000                         ssi_private->fifo_depth - 2;
1001                 ssi_private->dma_params_tx.addr =
1002                         ssi_private->ssi_phys + offsetof(struct ccsr_ssi, stx0);
1003                 ssi_private->dma_params_rx.addr =
1004                         ssi_private->ssi_phys + offsetof(struct ccsr_ssi, srx0);
1005         }
1006
1007         ssi_private->sysrate = 0;
1008
1009         /* Initialize the the device_attribute structure */
1010         dev_attr = &ssi_private->dev_attr;
1011         sysfs_attr_init(&dev_attr->attr);
1012         dev_attr->attr.name = "statistics";
1013         dev_attr->attr.mode = S_IRUGO;
1014         dev_attr->show = fsl_sysfs_ssi_show;
1015
1016         ret = device_create_file(&pdev->dev, dev_attr);
1017         if (ret) {
1018                 dev_err(&pdev->dev, "could not create sysfs %s file\n",
1019                         ssi_private->dev_attr.attr.name);
1020                 goto error_irq;
1021         }
1022
1023         pm_runtime_enable(&pdev->dev);
1024
1025         /* Register with ASoC */
1026         dev_set_drvdata(&pdev->dev, ssi_private);
1027
1028         ret = snd_soc_register_component(&pdev->dev, &fsl_ssi_component,
1029                                          &ssi_private->cpu_dai_drv, 1);
1030         if (ret) {
1031                 dev_err(&pdev->dev, "failed to register DAI: %d\n", ret);
1032                 goto error_dev;
1033         }
1034
1035         if (ssi_private->ssi_on_imx) {
1036                 ret = imx_pcm_dma_init(pdev, SND_DMAENGINE_PCM_FLAG_NO_RESIDUE,
1037                                         IMX_SSI_DMABUF_SIZE);
1038                 if (ret)
1039                         goto error_dev;
1040         }
1041
1042         /* Enable dual fifo feature as default */
1043         ssi_private->use_dual_fifo = true;
1044
1045         /*
1046          * If codec-handle property is missing from SSI node, we assume
1047          * that the machine driver uses new binding which does not require
1048          * SSI driver to trigger machine driver's probe.
1049          */
1050         if (!of_get_property(np, "codec-handle", NULL)) {
1051                 ssi_private->new_binding = true;
1052                 goto done;
1053         }
1054
1055         /* Trigger the machine driver's probe function.  The platform driver
1056          * name of the machine driver is taken from /compatible property of the
1057          * device tree.  We also pass the address of the CPU DAI driver
1058          * structure.
1059          */
1060         sprop = of_get_property(of_find_node_by_path("/"), "compatible", NULL);
1061         /* Sometimes the compatible name has a "fsl," prefix, so we strip it. */
1062         p = strrchr(sprop, ',');
1063         if (p)
1064                 sprop = p + 1;
1065         snprintf(name, sizeof(name), "snd-soc-%s", sprop);
1066         make_lowercase(name);
1067
1068         ssi_private->pdev =
1069                 platform_device_register_data(&pdev->dev, name, 0, NULL, 0);
1070         if (IS_ERR(ssi_private->pdev)) {
1071                 ret = PTR_ERR(ssi_private->pdev);
1072                 dev_err(&pdev->dev, "failed to register platform: %d\n", ret);
1073                 goto error_dai;
1074         }
1075
1076 done:
1077         return 0;
1078
1079 error_dai:
1080         if (ssi_private->ssi_on_imx)
1081                 imx_pcm_dma_exit(pdev);
1082         snd_soc_unregister_component(&pdev->dev);
1083
1084 error_dev:
1085         dev_set_drvdata(&pdev->dev, NULL);
1086         device_remove_file(&pdev->dev, dev_attr);
1087
1088 error_irq:
1089         free_irq(ssi_private->irq, ssi_private);
1090
1091 error_irqmap:
1092         irq_dispose_mapping(ssi_private->irq);
1093
1094 error_iomap:
1095         iounmap(ssi_private->ssi);
1096
1097 error_kmalloc:
1098         kfree(ssi_private);
1099
1100         return ret;
1101 }
1102
1103 static int fsl_ssi_remove(struct platform_device *pdev)
1104 {
1105         struct fsl_ssi_private *ssi_private = dev_get_drvdata(&pdev->dev);
1106
1107         if (!ssi_private->new_binding)
1108                 platform_device_unregister(ssi_private->pdev);
1109         if (ssi_private->ssi_on_imx)
1110                 imx_pcm_dma_exit(pdev);
1111
1112         snd_soc_unregister_component(&pdev->dev);
1113         device_remove_file(&pdev->dev, &ssi_private->dev_attr);
1114
1115         free_irq(ssi_private->irq, ssi_private);
1116         irq_dispose_mapping(ssi_private->irq);
1117
1118         kfree(ssi_private);
1119         dev_set_drvdata(&pdev->dev, NULL);
1120
1121         return 0;
1122 }
1123
1124 #ifdef CONFIG_PM_RUNTIME
1125 static int fsl_ssi_runtime_resume(struct device *dev)
1126 {
1127         request_bus_freq(BUS_FREQ_AUDIO);
1128         return 0;
1129 }
1130
1131 static int fsl_ssi_runtime_suspend(struct device *dev)
1132 {
1133         release_bus_freq(BUS_FREQ_AUDIO);
1134         return 0;
1135 }
1136 #endif
1137
1138 static const struct dev_pm_ops fsl_ssi_pm = {
1139         SET_RUNTIME_PM_OPS(fsl_ssi_runtime_suspend,
1140                         fsl_ssi_runtime_resume,
1141                         NULL)
1142 };
1143
1144 static const struct of_device_id fsl_ssi_ids[] = {
1145         { .compatible = "fsl,mpc8610-ssi", },
1146         { .compatible = "fsl,imx21-ssi", },
1147         {}
1148 };
1149 MODULE_DEVICE_TABLE(of, fsl_ssi_ids);
1150
1151 static struct platform_driver fsl_ssi_driver = {
1152         .driver = {
1153                 .name = "fsl-ssi-dai",
1154                 .owner = THIS_MODULE,
1155                 .of_match_table = fsl_ssi_ids,
1156                 .pm = &fsl_ssi_pm,
1157         },
1158         .probe = fsl_ssi_probe,
1159         .remove = fsl_ssi_remove,
1160 };
1161
1162 module_platform_driver(fsl_ssi_driver);
1163
1164 MODULE_ALIAS("platform:fsl-ssi-dai");
1165 MODULE_AUTHOR("Timur Tabi <timur@freescale.com>");
1166 MODULE_DESCRIPTION("Freescale Synchronous Serial Interface (SSI) ASoC Driver");
1167 MODULE_LICENSE("GPL v2");