2 * Copyright 2011 Freescale Semiconductor, Inc.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #include <linux/module.h>
20 #include <linux/init.h>
22 #include <linux/of_device.h>
23 #include <linux/platform_device.h>
24 #include <linux/slab.h>
25 #include <linux/dma-mapping.h>
26 #include <linux/clk.h>
27 #include <linux/clk-provider.h>
28 #include <linux/delay.h>
29 #include <linux/time.h>
30 #include <sound/core.h>
31 #include <sound/pcm.h>
32 #include <sound/pcm_params.h>
33 #include <sound/soc.h>
37 #define MXS_SET_ADDR 0x4
38 #define MXS_CLR_ADDR 0x8
40 static struct mxs_saif *mxs_saif[2];
43 * SAIF is a little different with other normal SOC DAIs on clock using.
45 * For MXS, two SAIF modules are instantiated on-chip.
46 * Each SAIF has a set of clock pins and can be operating in master
47 * mode simultaneously if they are connected to different off-chip codecs.
48 * Also, one of the two SAIFs can master or drive the clock pins while the
49 * other SAIF, in slave mode, receives clocking from the master SAIF.
50 * This also means that both SAIFs must operate at the same sample rate.
52 * We abstract this as each saif has a master, the master could be
53 * itself or other saifs. In the generic saif driver, saif does not need
54 * to know the different clkmux. Saif only needs to know who is its master
55 * and operating its master to generate the proper clock rate for it.
56 * The master id is provided in mach-specific layer according to different
60 static int mxs_saif_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
61 int clk_id, unsigned int freq, int dir)
63 struct mxs_saif *saif = snd_soc_dai_get_drvdata(cpu_dai);
76 * Since SAIF may work on EXTMASTER mode, IOW, it's working BITCLK&LRCLK
77 * is provided by other SAIF, we provide a interface here to get its master
79 * Note that the master could be itself.
81 static inline struct mxs_saif *mxs_saif_get_master(struct mxs_saif * saif)
83 return mxs_saif[saif->master_id];
87 * Set SAIF clock and MCLK
89 static int mxs_saif_set_clk(struct mxs_saif *saif,
95 struct mxs_saif *master_saif;
97 dev_dbg(saif->dev, "mclk %d rate %d\n", mclk, rate);
99 /* Set master saif to generate proper clock */
100 master_saif = mxs_saif_get_master(saif);
104 dev_dbg(saif->dev, "master saif%d\n", master_saif->id);
106 /* Checking if can playback and capture simutaneously */
107 if (master_saif->ongoing && rate != master_saif->cur_rate) {
109 "can not change clock, master saif%d(rate %d) is ongoing\n",
110 master_saif->id, master_saif->cur_rate);
114 scr = __raw_readl(master_saif->base + SAIF_CTRL);
115 scr &= ~BM_SAIF_CTRL_BITCLK_MULT_RATE;
116 scr &= ~BM_SAIF_CTRL_BITCLK_BASE_RATE;
121 * The SAIF clock should be either 384*fs or 512*fs.
122 * If MCLK is used, the SAIF clk ratio needs to match mclk ratio.
123 * For 256x, 128x, 64x, and 32x sub-rates, set saif clk as 512*fs.
124 * For 192x, 96x, and 48x sub-rates, set saif clk as 384*fs.
126 * If MCLK is not used, we just set saif clk to 512*fs.
128 ret = clk_prepare_enable(master_saif->clk);
132 if (master_saif->mclk_in_use) {
133 switch (mclk / rate) {
139 scr &= ~BM_SAIF_CTRL_BITCLK_BASE_RATE;
140 ret = clk_set_rate(master_saif->clk, 512 * rate);
146 scr |= BM_SAIF_CTRL_BITCLK_BASE_RATE;
147 ret = clk_set_rate(master_saif->clk, 384 * rate);
150 /* SAIF MCLK should be a sub-rate of 512x or 384x */
151 clk_disable_unprepare(master_saif->clk);
155 ret = clk_set_rate(master_saif->clk, 512 * rate);
156 scr &= ~BM_SAIF_CTRL_BITCLK_BASE_RATE;
159 clk_disable_unprepare(master_saif->clk);
164 master_saif->cur_rate = rate;
166 if (!master_saif->mclk_in_use) {
167 __raw_writel(scr, master_saif->base + SAIF_CTRL);
172 * Program the over-sample rate for MCLK output
174 * The available MCLK range is 32x, 48x... 512x. The rate
175 * could be from 8kHz to 192kH.
177 switch (mclk / rate) {
179 scr |= BF_SAIF_CTRL_BITCLK_MULT_RATE(4);
182 scr |= BF_SAIF_CTRL_BITCLK_MULT_RATE(3);
185 scr |= BF_SAIF_CTRL_BITCLK_MULT_RATE(2);
188 scr |= BF_SAIF_CTRL_BITCLK_MULT_RATE(1);
191 scr |= BF_SAIF_CTRL_BITCLK_MULT_RATE(0);
194 scr |= BF_SAIF_CTRL_BITCLK_MULT_RATE(3);
197 scr |= BF_SAIF_CTRL_BITCLK_MULT_RATE(2);
200 scr |= BF_SAIF_CTRL_BITCLK_MULT_RATE(1);
203 scr |= BF_SAIF_CTRL_BITCLK_MULT_RATE(0);
209 __raw_writel(scr, master_saif->base + SAIF_CTRL);
215 * Put and disable MCLK.
217 int mxs_saif_put_mclk(unsigned int saif_id)
219 struct mxs_saif *saif = mxs_saif[saif_id];
225 stat = __raw_readl(saif->base + SAIF_STAT);
226 if (stat & BM_SAIF_STAT_BUSY) {
227 dev_err(saif->dev, "error: busy\n");
231 clk_disable_unprepare(saif->clk);
233 /* disable MCLK output */
234 __raw_writel(BM_SAIF_CTRL_CLKGATE,
235 saif->base + SAIF_CTRL + MXS_SET_ADDR);
236 __raw_writel(BM_SAIF_CTRL_RUN,
237 saif->base + SAIF_CTRL + MXS_CLR_ADDR);
239 saif->mclk_in_use = 0;
242 EXPORT_SYMBOL_GPL(mxs_saif_put_mclk);
245 * Get MCLK and set clock rate, then enable it
247 * This interface is used for codecs who are using MCLK provided
250 int mxs_saif_get_mclk(unsigned int saif_id, unsigned int mclk,
253 struct mxs_saif *saif = mxs_saif[saif_id];
256 struct mxs_saif *master_saif;
262 __raw_writel(BM_SAIF_CTRL_SFTRST,
263 saif->base + SAIF_CTRL + MXS_CLR_ADDR);
265 /* FIXME: need clear clk gate for register r/w */
266 __raw_writel(BM_SAIF_CTRL_CLKGATE,
267 saif->base + SAIF_CTRL + MXS_CLR_ADDR);
269 master_saif = mxs_saif_get_master(saif);
270 if (saif != master_saif) {
271 dev_err(saif->dev, "can not get mclk from a non-master saif\n");
275 stat = __raw_readl(saif->base + SAIF_STAT);
276 if (stat & BM_SAIF_STAT_BUSY) {
277 dev_err(saif->dev, "error: busy\n");
281 saif->mclk_in_use = 1;
282 ret = mxs_saif_set_clk(saif, mclk, rate);
286 ret = clk_prepare_enable(saif->clk);
290 /* enable MCLK output */
291 __raw_writel(BM_SAIF_CTRL_RUN,
292 saif->base + SAIF_CTRL + MXS_SET_ADDR);
296 EXPORT_SYMBOL_GPL(mxs_saif_get_mclk);
299 * SAIF DAI format configuration.
300 * Should only be called when port is inactive.
302 static int mxs_saif_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)
306 struct mxs_saif *saif = snd_soc_dai_get_drvdata(cpu_dai);
308 stat = __raw_readl(saif->base + SAIF_STAT);
309 if (stat & BM_SAIF_STAT_BUSY) {
310 dev_err(cpu_dai->dev, "error: busy\n");
314 /* If SAIF1 is configured as slave, the clk gate needs to be cleared
315 * before the register can be written.
317 if (saif->id != saif->master_id) {
318 __raw_writel(BM_SAIF_CTRL_SFTRST,
319 saif->base + SAIF_CTRL + MXS_CLR_ADDR);
320 __raw_writel(BM_SAIF_CTRL_CLKGATE,
321 saif->base + SAIF_CTRL + MXS_CLR_ADDR);
324 scr0 = __raw_readl(saif->base + SAIF_CTRL);
325 scr0 = scr0 & ~BM_SAIF_CTRL_BITCLK_EDGE & ~BM_SAIF_CTRL_LRCLK_POLARITY \
326 & ~BM_SAIF_CTRL_JUSTIFY & ~BM_SAIF_CTRL_DELAY;
330 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
331 case SND_SOC_DAIFMT_I2S:
332 /* data frame low 1clk before data */
333 scr |= BM_SAIF_CTRL_DELAY;
334 scr &= ~BM_SAIF_CTRL_LRCLK_POLARITY;
336 case SND_SOC_DAIFMT_LEFT_J:
337 /* data frame high with data */
338 scr &= ~BM_SAIF_CTRL_DELAY;
339 scr &= ~BM_SAIF_CTRL_LRCLK_POLARITY;
340 scr &= ~BM_SAIF_CTRL_JUSTIFY;
346 /* DAI clock inversion */
347 switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
348 case SND_SOC_DAIFMT_IB_IF:
349 scr |= BM_SAIF_CTRL_BITCLK_EDGE;
350 scr |= BM_SAIF_CTRL_LRCLK_POLARITY;
352 case SND_SOC_DAIFMT_IB_NF:
353 scr |= BM_SAIF_CTRL_BITCLK_EDGE;
354 scr &= ~BM_SAIF_CTRL_LRCLK_POLARITY;
356 case SND_SOC_DAIFMT_NB_IF:
357 scr &= ~BM_SAIF_CTRL_BITCLK_EDGE;
358 scr |= BM_SAIF_CTRL_LRCLK_POLARITY;
360 case SND_SOC_DAIFMT_NB_NF:
361 scr &= ~BM_SAIF_CTRL_BITCLK_EDGE;
362 scr &= ~BM_SAIF_CTRL_LRCLK_POLARITY;
367 * Note: We simply just support master mode since SAIF TX can only
369 * Here the master is relative to codec side.
370 * Saif internally could be slave when working on EXTMASTER mode.
371 * We just hide this to machine driver.
373 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
374 case SND_SOC_DAIFMT_CBS_CFS:
375 if (saif->id == saif->master_id)
376 scr &= ~BM_SAIF_CTRL_SLAVE_MODE;
378 scr |= BM_SAIF_CTRL_SLAVE_MODE;
380 __raw_writel(scr | scr0, saif->base + SAIF_CTRL);
389 static int mxs_saif_startup(struct snd_pcm_substream *substream,
390 struct snd_soc_dai *cpu_dai)
392 struct mxs_saif *saif = snd_soc_dai_get_drvdata(cpu_dai);
395 /* clear error status to 0 for each re-open */
396 saif->fifo_underrun = 0;
397 saif->fifo_overrun = 0;
399 /* Clear Reset for normal operations */
400 __raw_writel(BM_SAIF_CTRL_SFTRST,
401 saif->base + SAIF_CTRL + MXS_CLR_ADDR);
403 /* clear clock gate */
404 __raw_writel(BM_SAIF_CTRL_CLKGATE,
405 saif->base + SAIF_CTRL + MXS_CLR_ADDR);
407 ret = clk_prepare(saif->clk);
414 static void mxs_saif_shutdown(struct snd_pcm_substream *substream,
415 struct snd_soc_dai *cpu_dai)
417 struct mxs_saif *saif = snd_soc_dai_get_drvdata(cpu_dai);
419 clk_unprepare(saif->clk);
423 * Should only be called when port is inactive.
424 * although can be called multiple times by upper layers.
426 static int mxs_saif_hw_params(struct snd_pcm_substream *substream,
427 struct snd_pcm_hw_params *params,
428 struct snd_soc_dai *cpu_dai)
430 struct mxs_saif *saif = snd_soc_dai_get_drvdata(cpu_dai);
431 struct mxs_saif *master_saif;
435 master_saif = mxs_saif_get_master(saif);
439 /* mclk should already be set */
440 if (!saif->mclk && saif->mclk_in_use) {
441 dev_err(cpu_dai->dev, "set mclk first\n");
445 stat = __raw_readl(saif->base + SAIF_STAT);
446 if (!saif->mclk_in_use && (stat & BM_SAIF_STAT_BUSY)) {
447 dev_err(cpu_dai->dev, "error: busy\n");
452 * Set saif clk based on sample rate.
453 * If mclk is used, we also set mclk, if not, saif->mclk is
454 * default 0, means not used.
456 ret = mxs_saif_set_clk(saif, saif->mclk, params_rate(params));
458 dev_err(cpu_dai->dev, "unable to get proper clk\n");
462 if (saif != master_saif) {
464 * Set an initial clock rate for the saif internal logic to work
465 * properly. This is important when working in EXTMASTER mode
466 * that uses the other saif's BITCLK&LRCLK but it still needs a
467 * basic clock which should be fast enough for the internal
470 ret = clk_enable(saif->clk);
474 ret = clk_set_rate(saif->clk, 24000000);
475 clk_disable(saif->clk);
479 ret = clk_prepare(master_saif->clk);
484 scr = __raw_readl(saif->base + SAIF_CTRL);
486 scr &= ~BM_SAIF_CTRL_WORD_LENGTH;
487 scr &= ~BM_SAIF_CTRL_BITCLK_48XFS_ENABLE;
488 switch (params_format(params)) {
489 case SNDRV_PCM_FORMAT_S16_LE:
490 scr |= BF_SAIF_CTRL_WORD_LENGTH(0);
492 case SNDRV_PCM_FORMAT_S20_3LE:
493 scr |= BF_SAIF_CTRL_WORD_LENGTH(4);
494 scr |= BM_SAIF_CTRL_BITCLK_48XFS_ENABLE;
496 case SNDRV_PCM_FORMAT_S24_LE:
497 scr |= BF_SAIF_CTRL_WORD_LENGTH(8);
498 scr |= BM_SAIF_CTRL_BITCLK_48XFS_ENABLE;
505 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
507 scr &= ~BM_SAIF_CTRL_READ_MODE;
510 scr |= BM_SAIF_CTRL_READ_MODE;
513 __raw_writel(scr, saif->base + SAIF_CTRL);
517 static int mxs_saif_prepare(struct snd_pcm_substream *substream,
518 struct snd_soc_dai *cpu_dai)
520 struct mxs_saif *saif = snd_soc_dai_get_drvdata(cpu_dai);
522 /* enable FIFO error irqs */
523 __raw_writel(BM_SAIF_CTRL_FIFO_ERROR_IRQ_EN,
524 saif->base + SAIF_CTRL + MXS_SET_ADDR);
529 static int mxs_saif_trigger(struct snd_pcm_substream *substream, int cmd,
530 struct snd_soc_dai *cpu_dai)
532 struct mxs_saif *saif = snd_soc_dai_get_drvdata(cpu_dai);
533 struct mxs_saif *master_saif;
537 master_saif = mxs_saif_get_master(saif);
542 case SNDRV_PCM_TRIGGER_START:
543 case SNDRV_PCM_TRIGGER_RESUME:
544 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
545 if (saif->state == MXS_SAIF_STATE_RUNNING)
548 dev_dbg(cpu_dai->dev, "start\n");
550 ret = clk_enable(master_saif->clk);
552 dev_err(saif->dev, "Failed to enable master clock\n");
557 * If the saif's master is not itself, we also need to enable
558 * itself clk for its internal basic logic to work.
560 if (saif != master_saif) {
561 ret = clk_enable(saif->clk);
563 dev_err(saif->dev, "Failed to enable master clock\n");
564 clk_disable(master_saif->clk);
568 __raw_writel(BM_SAIF_CTRL_RUN,
569 saif->base + SAIF_CTRL + MXS_SET_ADDR);
572 if (!master_saif->mclk_in_use)
573 __raw_writel(BM_SAIF_CTRL_RUN,
574 master_saif->base + SAIF_CTRL + MXS_SET_ADDR);
576 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
578 * write data to saif data register to trigger
580 * For 24-bit format the 32-bit FIFO register stores
581 * only one channel, so we need to write twice.
582 * This is also safe for the other non 24-bit formats.
584 __raw_writel(0, saif->base + SAIF_DATA);
585 __raw_writel(0, saif->base + SAIF_DATA);
588 * read data from saif data register to trigger
590 * For 24-bit format the 32-bit FIFO register stores
591 * only one channel, so we need to read twice.
592 * This is also safe for the other non 24-bit formats.
594 __raw_readl(saif->base + SAIF_DATA);
595 __raw_readl(saif->base + SAIF_DATA);
598 master_saif->ongoing = 1;
599 saif->state = MXS_SAIF_STATE_RUNNING;
601 dev_dbg(saif->dev, "CTRL 0x%x STAT 0x%x\n",
602 __raw_readl(saif->base + SAIF_CTRL),
603 __raw_readl(saif->base + SAIF_STAT));
605 dev_dbg(master_saif->dev, "CTRL 0x%x STAT 0x%x\n",
606 __raw_readl(master_saif->base + SAIF_CTRL),
607 __raw_readl(master_saif->base + SAIF_STAT));
609 case SNDRV_PCM_TRIGGER_SUSPEND:
610 case SNDRV_PCM_TRIGGER_STOP:
611 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
612 if (saif->state == MXS_SAIF_STATE_STOPPED)
615 dev_dbg(cpu_dai->dev, "stop\n");
617 /* wait a while for the current sample to complete */
618 delay = USEC_PER_SEC / master_saif->cur_rate;
620 if (!master_saif->mclk_in_use) {
621 __raw_writel(BM_SAIF_CTRL_RUN,
622 master_saif->base + SAIF_CTRL + MXS_CLR_ADDR);
625 clk_disable(master_saif->clk);
627 if (saif != master_saif) {
628 __raw_writel(BM_SAIF_CTRL_RUN,
629 saif->base + SAIF_CTRL + MXS_CLR_ADDR);
631 clk_disable(saif->clk);
634 master_saif->ongoing = 0;
635 saif->state = MXS_SAIF_STATE_STOPPED;
645 #define MXS_SAIF_RATES SNDRV_PCM_RATE_8000_192000
646 #define MXS_SAIF_FORMATS \
647 (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \
648 SNDRV_PCM_FMTBIT_S24_LE)
650 static const struct snd_soc_dai_ops mxs_saif_dai_ops = {
651 .startup = mxs_saif_startup,
652 .shutdown = mxs_saif_shutdown,
653 .trigger = mxs_saif_trigger,
654 .prepare = mxs_saif_prepare,
655 .hw_params = mxs_saif_hw_params,
656 .set_sysclk = mxs_saif_set_dai_sysclk,
657 .set_fmt = mxs_saif_set_dai_fmt,
660 static int mxs_saif_dai_probe(struct snd_soc_dai *dai)
662 struct mxs_saif *saif = dev_get_drvdata(dai->dev);
664 snd_soc_dai_set_drvdata(dai, saif);
669 static struct snd_soc_dai_driver mxs_saif_dai = {
671 .probe = mxs_saif_dai_probe,
675 .rates = MXS_SAIF_RATES,
676 .formats = MXS_SAIF_FORMATS,
681 .rates = MXS_SAIF_RATES,
682 .formats = MXS_SAIF_FORMATS,
684 .ops = &mxs_saif_dai_ops,
687 static const struct snd_soc_component_driver mxs_saif_component = {
691 static irqreturn_t mxs_saif_irq(int irq, void *dev_id)
693 struct mxs_saif *saif = dev_id;
696 stat = __raw_readl(saif->base + SAIF_STAT);
697 if (!(stat & (BM_SAIF_STAT_FIFO_UNDERFLOW_IRQ |
698 BM_SAIF_STAT_FIFO_OVERFLOW_IRQ)))
701 if (stat & BM_SAIF_STAT_FIFO_UNDERFLOW_IRQ) {
702 dev_dbg(saif->dev, "underrun!!! %d\n", ++saif->fifo_underrun);
703 __raw_writel(BM_SAIF_STAT_FIFO_UNDERFLOW_IRQ,
704 saif->base + SAIF_STAT + MXS_CLR_ADDR);
707 if (stat & BM_SAIF_STAT_FIFO_OVERFLOW_IRQ) {
708 dev_dbg(saif->dev, "overrun!!! %d\n", ++saif->fifo_overrun);
709 __raw_writel(BM_SAIF_STAT_FIFO_OVERFLOW_IRQ,
710 saif->base + SAIF_STAT + MXS_CLR_ADDR);
713 dev_dbg(saif->dev, "SAIF_CTRL %x SAIF_STAT %x\n",
714 __raw_readl(saif->base + SAIF_CTRL),
715 __raw_readl(saif->base + SAIF_STAT));
720 static int mxs_saif_mclk_init(struct platform_device *pdev)
722 struct mxs_saif *saif = platform_get_drvdata(pdev);
723 struct device_node *np = pdev->dev.of_node;
727 clk = clk_register_divider(&pdev->dev, "mxs_saif_mclk",
728 __clk_get_name(saif->clk), 0,
729 saif->base + SAIF_CTRL,
730 BP_SAIF_CTRL_BITCLK_MULT_RATE, 3,
736 dev_err(&pdev->dev, "failed to register mclk: %d\n", ret);
740 ret = of_clk_add_provider(np, of_clk_src_simple_get, clk);
747 static int mxs_saif_probe(struct platform_device *pdev)
749 struct device_node *np = pdev->dev.of_node;
750 struct resource *iores;
751 struct mxs_saif *saif;
753 struct device_node *master;
758 saif = devm_kzalloc(&pdev->dev, sizeof(*saif), GFP_KERNEL);
762 ret = of_alias_get_id(np, "saif");
768 if (saif->id >= ARRAY_SIZE(mxs_saif)) {
769 dev_err(&pdev->dev, "get wrong saif id\n");
774 * If there is no "fsl,saif-master" phandle, it's a saif
775 * master. Otherwise, it's a slave and its phandle points
778 master = of_parse_phandle(np, "fsl,saif-master", 0);
780 saif->master_id = saif->id;
782 ret = of_alias_get_id(master, "saif");
787 saif->master_id = ret;
789 if (saif->master_id >= ARRAY_SIZE(mxs_saif)) {
790 dev_err(&pdev->dev, "get wrong master id\n");
795 mxs_saif[saif->id] = saif;
797 saif->clk = devm_clk_get(&pdev->dev, NULL);
798 if (IS_ERR(saif->clk)) {
799 ret = PTR_ERR(saif->clk);
800 dev_err(&pdev->dev, "Cannot get the clock: %d\n",
805 iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
807 saif->base = devm_ioremap_resource(&pdev->dev, iores);
808 if (IS_ERR(saif->base))
809 return PTR_ERR(saif->base);
811 irq = platform_get_irq(pdev, 0);
814 dev_err(&pdev->dev, "failed to get irq resource: %d\n",
819 saif->dev = &pdev->dev;
820 ret = devm_request_irq(&pdev->dev, irq, mxs_saif_irq, 0,
821 dev_name(&pdev->dev), saif);
823 dev_err(&pdev->dev, "failed to request irq\n");
827 platform_set_drvdata(pdev, saif);
829 /* We only support saif0 being tx and clock master */
831 ret = mxs_saif_mclk_init(pdev);
833 dev_warn(&pdev->dev, "failed to init clocks\n");
836 ret = devm_snd_soc_register_component(&pdev->dev, &mxs_saif_component,
839 dev_err(&pdev->dev, "register DAI failed\n");
843 ret = mxs_pcm_platform_register(&pdev->dev);
845 dev_err(&pdev->dev, "register PCM failed: %d\n", ret);
852 static const struct of_device_id mxs_saif_dt_ids[] = {
853 { .compatible = "fsl,imx28-saif", },
856 MODULE_DEVICE_TABLE(of, mxs_saif_dt_ids);
858 static struct platform_driver mxs_saif_driver = {
859 .probe = mxs_saif_probe,
863 .of_match_table = mxs_saif_dt_ids,
867 module_platform_driver(mxs_saif_driver);
869 MODULE_AUTHOR("Freescale Semiconductor, Inc.");
870 MODULE_DESCRIPTION("MXS ASoC SAIF driver");
871 MODULE_LICENSE("GPL");
872 MODULE_ALIAS("platform:mxs-saif");