1 // SPDX-License-Identifier: GPL-2.0
3 // ALSA SoC Audio Layer - Samsung I2S Controller driver
5 // Copyright (c) 2010 Samsung Electronics Co. Ltd.
6 // Jaswinder Singh <jassisinghbrar@gmail.com>
8 #include <dt-bindings/sound/samsung-i2s.h>
9 #include <linux/delay.h>
10 #include <linux/slab.h>
11 #include <linux/clk.h>
12 #include <linux/clk-provider.h>
14 #include <linux/module.h>
16 #include <linux/of_device.h>
17 #include <linux/of_gpio.h>
18 #include <linux/pm_runtime.h>
20 #include <sound/soc.h>
21 #include <sound/pcm_params.h>
23 #include <linux/platform_data/asoc-s3c.h>
30 #define msecs_to_loops(t) (loops_per_jiffy / 1000 * HZ * t)
32 #define SAMSUNG_I2S_ID_PRIMARY 1
33 #define SAMSUNG_I2S_ID_SECONDARY 2
35 struct samsung_i2s_variant_regs {
40 unsigned int rclksrc_off;
42 unsigned int cdclkcon_off;
44 unsigned int bfs_mask;
45 unsigned int rfs_mask;
46 unsigned int ftx0cnt_off;
49 struct samsung_i2s_dai_data {
51 unsigned int pcm_rates;
52 const struct samsung_i2s_variant_regs *i2s_variant_regs;
56 /* Platform device for this DAI */
57 struct platform_device *pdev;
62 * Specifically requested RCLK, BCLK by machine driver.
63 * 0 indicates CPU driver is free to choose any value.
66 /* Pointer to the Primary_Fifo if this is Sec_Fifo, NULL otherwise */
67 struct i2s_dai *pri_dai;
68 /* Pointer to the Secondary_Fifo if it has one, NULL otherwise */
69 struct i2s_dai *sec_dai;
71 #define DAI_OPENED (1 << 0) /* DAI is opened */
72 #define DAI_MANAGER (1 << 1) /* DAI is the manager */
75 /* Driver for this DAI */
76 struct snd_soc_dai_driver *drv;
79 struct snd_dmaengine_dai_dma_data dma_playback;
80 struct snd_dmaengine_dai_dma_data dma_capture;
81 struct snd_dmaengine_dai_dma_data idma_playback;
84 struct samsung_i2s_priv *priv;
87 struct samsung_i2s_priv {
88 struct platform_device *pdev;
89 struct platform_device *pdev_sec;
91 /* Memory mapped SFR region */
94 /* Spinlock protecting access to the device's registers */
97 /* Lock for cross interface checks */
100 /* CPU DAIs and their corresponding drivers */
102 struct snd_soc_dai_driver *dai_drv;
105 /* The I2S controller's core clock */
108 /* Clock for generating I2S signals */
111 /* Rate of RCLK source clock */
112 unsigned long rclk_srcrate;
114 /* Cache of selected I2S registers for system suspend */
119 const struct samsung_i2s_variant_regs *variant_regs;
122 /* The clock provider's data */
123 struct clk *clk_table[3];
124 struct clk_onecell_data clk_data;
127 /* Returns true if this is the 'overlay' stereo DAI */
128 static inline bool is_secondary(struct i2s_dai *i2s)
130 return i2s->drv->id == SAMSUNG_I2S_ID_SECONDARY;
133 /* If operating in SoC-Slave mode */
134 static inline bool is_slave(struct i2s_dai *i2s)
136 struct samsung_i2s_priv *priv = i2s->priv;
138 u32 mod = readl(priv->addr + I2SMOD);
139 return (mod & (1 << priv->variant_regs->mss_off)) ? true : false;
142 /* If this interface of the controller is transmitting data */
143 static inline bool tx_active(struct i2s_dai *i2s)
150 active = readl(i2s->priv->addr + I2SCON);
152 if (is_secondary(i2s))
153 active &= CON_TXSDMA_ACTIVE;
155 active &= CON_TXDMA_ACTIVE;
157 return active ? true : false;
160 /* Return pointer to the other DAI */
161 static inline struct i2s_dai *get_other_dai(struct i2s_dai *i2s)
163 return i2s->pri_dai ? : i2s->sec_dai;
166 /* If the other interface of the controller is transmitting data */
167 static inline bool other_tx_active(struct i2s_dai *i2s)
169 struct i2s_dai *other = get_other_dai(i2s);
171 return tx_active(other);
174 /* If any interface of the controller is transmitting data */
175 static inline bool any_tx_active(struct i2s_dai *i2s)
177 return tx_active(i2s) || other_tx_active(i2s);
180 /* If this interface of the controller is receiving data */
181 static inline bool rx_active(struct i2s_dai *i2s)
188 active = readl(i2s->priv->addr + I2SCON) & CON_RXDMA_ACTIVE;
190 return active ? true : false;
193 /* If the other interface of the controller is receiving data */
194 static inline bool other_rx_active(struct i2s_dai *i2s)
196 struct i2s_dai *other = get_other_dai(i2s);
198 return rx_active(other);
201 /* If any interface of the controller is receiving data */
202 static inline bool any_rx_active(struct i2s_dai *i2s)
204 return rx_active(i2s) || other_rx_active(i2s);
207 /* If the other DAI is transmitting or receiving data */
208 static inline bool other_active(struct i2s_dai *i2s)
210 return other_rx_active(i2s) || other_tx_active(i2s);
213 /* If this DAI is transmitting or receiving data */
214 static inline bool this_active(struct i2s_dai *i2s)
216 return tx_active(i2s) || rx_active(i2s);
219 /* If the controller is active anyway */
220 static inline bool any_active(struct i2s_dai *i2s)
222 return this_active(i2s) || other_active(i2s);
225 static inline struct i2s_dai *to_info(struct snd_soc_dai *dai)
227 struct samsung_i2s_priv *priv = snd_soc_dai_get_drvdata(dai);
229 return &priv->dai[dai->id - 1];
232 static inline bool is_opened(struct i2s_dai *i2s)
234 if (i2s && (i2s->mode & DAI_OPENED))
240 static inline bool is_manager(struct i2s_dai *i2s)
242 if (is_opened(i2s) && (i2s->mode & DAI_MANAGER))
248 /* Read RCLK of I2S (in multiples of LRCLK) */
249 static inline unsigned get_rfs(struct i2s_dai *i2s)
251 struct samsung_i2s_priv *priv = i2s->priv;
254 rfs = readl(priv->addr + I2SMOD) >> priv->variant_regs->rfs_off;
255 rfs &= priv->variant_regs->rfs_mask;
269 /* Write RCLK of I2S (in multiples of LRCLK) */
270 static inline void set_rfs(struct i2s_dai *i2s, unsigned rfs)
272 struct samsung_i2s_priv *priv = i2s->priv;
273 u32 mod = readl(priv->addr + I2SMOD);
274 int rfs_shift = priv->variant_regs->rfs_off;
276 mod &= ~(priv->variant_regs->rfs_mask << rfs_shift);
280 mod |= (EXYNOS7_MOD_RCLK_192FS << rfs_shift);
283 mod |= (EXYNOS7_MOD_RCLK_96FS << rfs_shift);
286 mod |= (EXYNOS7_MOD_RCLK_128FS << rfs_shift);
289 mod |= (EXYNOS7_MOD_RCLK_64FS << rfs_shift);
292 mod |= (MOD_RCLK_768FS << rfs_shift);
295 mod |= (MOD_RCLK_512FS << rfs_shift);
298 mod |= (MOD_RCLK_384FS << rfs_shift);
301 mod |= (MOD_RCLK_256FS << rfs_shift);
305 writel(mod, priv->addr + I2SMOD);
308 /* Read bit-clock of I2S (in multiples of LRCLK) */
309 static inline unsigned get_bfs(struct i2s_dai *i2s)
311 struct samsung_i2s_priv *priv = i2s->priv;
314 bfs = readl(priv->addr + I2SMOD) >> priv->variant_regs->bfs_off;
315 bfs &= priv->variant_regs->bfs_mask;
330 /* Write bit-clock of I2S (in multiples of LRCLK) */
331 static inline void set_bfs(struct i2s_dai *i2s, unsigned bfs)
333 struct samsung_i2s_priv *priv = i2s->priv;
334 u32 mod = readl(priv->addr + I2SMOD);
335 int tdm = priv->quirks & QUIRK_SUPPORTS_TDM;
336 int bfs_shift = priv->variant_regs->bfs_off;
338 /* Non-TDM I2S controllers do not support BCLK > 48 * FS */
339 if (!tdm && bfs > 48) {
340 dev_err(&i2s->pdev->dev, "Unsupported BCLK divider\n");
344 mod &= ~(priv->variant_regs->bfs_mask << bfs_shift);
348 mod |= (MOD_BCLK_48FS << bfs_shift);
351 mod |= (MOD_BCLK_32FS << bfs_shift);
354 mod |= (MOD_BCLK_24FS << bfs_shift);
357 mod |= (MOD_BCLK_16FS << bfs_shift);
360 mod |= (EXYNOS5420_MOD_BCLK_64FS << bfs_shift);
363 mod |= (EXYNOS5420_MOD_BCLK_96FS << bfs_shift);
366 mod |= (EXYNOS5420_MOD_BCLK_128FS << bfs_shift);
369 mod |= (EXYNOS5420_MOD_BCLK_192FS << bfs_shift);
372 mod |= (EXYNOS5420_MOD_BCLK_256FS << bfs_shift);
375 dev_err(&i2s->pdev->dev, "Wrong BCLK Divider!\n");
379 writel(mod, priv->addr + I2SMOD);
383 static inline int get_blc(struct i2s_dai *i2s)
385 int blc = readl(i2s->priv->addr + I2SMOD);
387 blc = (blc >> 13) & 0x3;
396 /* TX channel control */
397 static void i2s_txctrl(struct i2s_dai *i2s, int on)
399 struct samsung_i2s_priv *priv = i2s->priv;
400 void __iomem *addr = priv->addr;
401 int txr_off = priv->variant_regs->txr_off;
402 u32 con = readl(addr + I2SCON);
403 u32 mod = readl(addr + I2SMOD) & ~(3 << txr_off);
407 con &= ~CON_TXCH_PAUSE;
409 if (is_secondary(i2s)) {
410 con |= CON_TXSDMA_ACTIVE;
411 con &= ~CON_TXSDMA_PAUSE;
413 con |= CON_TXDMA_ACTIVE;
414 con &= ~CON_TXDMA_PAUSE;
417 if (any_rx_active(i2s))
422 if (is_secondary(i2s)) {
423 con |= CON_TXSDMA_PAUSE;
424 con &= ~CON_TXSDMA_ACTIVE;
426 con |= CON_TXDMA_PAUSE;
427 con &= ~CON_TXDMA_ACTIVE;
430 if (other_tx_active(i2s)) {
431 writel(con, addr + I2SCON);
435 con |= CON_TXCH_PAUSE;
437 if (any_rx_active(i2s))
443 writel(mod, addr + I2SMOD);
444 writel(con, addr + I2SCON);
447 /* RX Channel Control */
448 static void i2s_rxctrl(struct i2s_dai *i2s, int on)
450 struct samsung_i2s_priv *priv = i2s->priv;
451 void __iomem *addr = priv->addr;
452 int txr_off = priv->variant_regs->txr_off;
453 u32 con = readl(addr + I2SCON);
454 u32 mod = readl(addr + I2SMOD) & ~(3 << txr_off);
457 con |= CON_RXDMA_ACTIVE | CON_ACTIVE;
458 con &= ~(CON_RXDMA_PAUSE | CON_RXCH_PAUSE);
460 if (any_tx_active(i2s))
465 con |= CON_RXDMA_PAUSE | CON_RXCH_PAUSE;
466 con &= ~CON_RXDMA_ACTIVE;
468 if (any_tx_active(i2s))
474 writel(mod, addr + I2SMOD);
475 writel(con, addr + I2SCON);
478 /* Flush FIFO of an interface */
479 static inline void i2s_fifo(struct i2s_dai *i2s, u32 flush)
487 if (is_secondary(i2s))
488 fic = i2s->priv->addr + I2SFICS;
490 fic = i2s->priv->addr + I2SFIC;
493 writel(readl(fic) | flush, fic);
496 val = msecs_to_loops(1) / 1000; /* 1 usec */
500 writel(readl(fic) & ~flush, fic);
503 static int i2s_set_sysclk(struct snd_soc_dai *dai, int clk_id, unsigned int rfs,
506 struct samsung_i2s_priv *priv = snd_soc_dai_get_drvdata(dai);
507 struct i2s_dai *i2s = to_info(dai);
508 struct i2s_dai *other = get_other_dai(i2s);
509 const struct samsung_i2s_variant_regs *i2s_regs = priv->variant_regs;
510 unsigned int cdcon_mask = 1 << i2s_regs->cdclkcon_off;
511 unsigned int rsrc_mask = 1 << i2s_regs->rclksrc_off;
512 u32 mod, mask, val = 0;
516 pm_runtime_get_sync(dai->dev);
518 spin_lock_irqsave(&priv->lock, flags);
519 mod = readl(priv->addr + I2SMOD);
520 spin_unlock_irqrestore(&priv->lock, flags);
523 case SAMSUNG_I2S_OPCLK:
524 mask = MOD_OPCLK_MASK;
525 val = (dir << MOD_OPCLK_SHIFT) & MOD_OPCLK_MASK;
527 case SAMSUNG_I2S_CDCLK:
528 mask = 1 << i2s_regs->cdclkcon_off;
529 /* Shouldn't matter in GATING(CLOCK_IN) mode */
530 if (dir == SND_SOC_CLOCK_IN)
533 if ((rfs && other && other->rfs && (other->rfs != rfs)) ||
535 (((dir == SND_SOC_CLOCK_IN)
536 && !(mod & cdcon_mask)) ||
537 ((dir == SND_SOC_CLOCK_OUT)
538 && (mod & cdcon_mask))))) {
539 dev_err(&i2s->pdev->dev,
540 "%s:%d Other DAI busy\n", __func__, __LINE__);
545 if (dir == SND_SOC_CLOCK_IN)
546 val = 1 << i2s_regs->cdclkcon_off;
551 case SAMSUNG_I2S_RCLKSRC_0: /* clock corrsponding to IISMOD[10] := 0 */
552 case SAMSUNG_I2S_RCLKSRC_1: /* clock corrsponding to IISMOD[10] := 1 */
553 mask = 1 << i2s_regs->rclksrc_off;
555 if ((priv->quirks & QUIRK_NO_MUXPSR)
556 || (clk_id == SAMSUNG_I2S_RCLKSRC_0))
561 if (!any_active(i2s)) {
562 if (priv->op_clk && !IS_ERR(priv->op_clk)) {
563 if ((clk_id && !(mod & rsrc_mask)) ||
564 (!clk_id && (mod & rsrc_mask))) {
565 clk_disable_unprepare(priv->op_clk);
566 clk_put(priv->op_clk);
569 clk_get_rate(priv->op_clk);
575 priv->op_clk = clk_get(&i2s->pdev->dev,
578 priv->op_clk = clk_get(&i2s->pdev->dev,
581 if (WARN_ON(IS_ERR(priv->op_clk))) {
582 ret = PTR_ERR(priv->op_clk);
587 ret = clk_prepare_enable(priv->op_clk);
589 clk_put(priv->op_clk);
593 priv->rclk_srcrate = clk_get_rate(priv->op_clk);
595 } else if ((!clk_id && (mod & rsrc_mask))
596 || (clk_id && !(mod & rsrc_mask))) {
597 dev_err(&i2s->pdev->dev,
598 "%s:%d Other DAI busy\n", __func__, __LINE__);
602 /* Call can't be on the active DAI */
607 val = 1 << i2s_regs->rclksrc_off;
610 dev_err(&i2s->pdev->dev, "We don't serve that!\n");
615 spin_lock_irqsave(&priv->lock, flags);
616 mod = readl(priv->addr + I2SMOD);
617 mod = (mod & ~mask) | val;
618 writel(mod, priv->addr + I2SMOD);
619 spin_unlock_irqrestore(&priv->lock, flags);
621 pm_runtime_put(dai->dev);
625 pm_runtime_put(dai->dev);
629 static int i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
631 struct samsung_i2s_priv *priv = snd_soc_dai_get_drvdata(dai);
632 struct i2s_dai *i2s = to_info(dai);
633 int lrp_shift, sdf_shift, sdf_mask, lrp_rlow, mod_slave;
637 lrp_shift = priv->variant_regs->lrp_off;
638 sdf_shift = priv->variant_regs->sdf_off;
639 mod_slave = 1 << priv->variant_regs->mss_off;
641 sdf_mask = MOD_SDF_MASK << sdf_shift;
642 lrp_rlow = MOD_LR_RLOW << lrp_shift;
644 /* Format is priority */
645 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
646 case SND_SOC_DAIFMT_RIGHT_J:
648 tmp |= (MOD_SDF_MSB << sdf_shift);
650 case SND_SOC_DAIFMT_LEFT_J:
652 tmp |= (MOD_SDF_LSB << sdf_shift);
654 case SND_SOC_DAIFMT_I2S:
655 tmp |= (MOD_SDF_IIS << sdf_shift);
658 dev_err(&i2s->pdev->dev, "Format not supported\n");
663 * INV flag is relative to the FORMAT flag - if set it simply
664 * flips the polarity specified by the Standard
666 switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
667 case SND_SOC_DAIFMT_NB_NF:
669 case SND_SOC_DAIFMT_NB_IF:
676 dev_err(&i2s->pdev->dev, "Polarity not supported\n");
680 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
681 case SND_SOC_DAIFMT_CBM_CFM:
684 case SND_SOC_DAIFMT_CBS_CFS:
686 * Set default source clock in Master mode, only when the
687 * CLK_I2S_RCLK_SRC clock is not exposed so we ensure any
688 * clock configuration assigned in DT is not overwritten.
690 if (priv->rclk_srcrate == 0 && priv->clk_data.clks == NULL)
691 i2s_set_sysclk(dai, SAMSUNG_I2S_RCLKSRC_0,
692 0, SND_SOC_CLOCK_IN);
695 dev_err(&i2s->pdev->dev, "master/slave format not supported\n");
699 pm_runtime_get_sync(dai->dev);
700 spin_lock_irqsave(&priv->lock, flags);
701 mod = readl(priv->addr + I2SMOD);
703 * Don't change the I2S mode if any controller is active on this
706 if (any_active(i2s) &&
707 ((mod & (sdf_mask | lrp_rlow | mod_slave)) != tmp)) {
708 spin_unlock_irqrestore(&priv->lock, flags);
709 pm_runtime_put(dai->dev);
710 dev_err(&i2s->pdev->dev,
711 "%s:%d Other DAI busy\n", __func__, __LINE__);
715 mod &= ~(sdf_mask | lrp_rlow | mod_slave);
717 writel(mod, priv->addr + I2SMOD);
718 spin_unlock_irqrestore(&priv->lock, flags);
719 pm_runtime_put(dai->dev);
724 static int i2s_hw_params(struct snd_pcm_substream *substream,
725 struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
727 struct samsung_i2s_priv *priv = snd_soc_dai_get_drvdata(dai);
728 struct i2s_dai *i2s = to_info(dai);
729 u32 mod, mask = 0, val = 0;
733 WARN_ON(!pm_runtime_active(dai->dev));
735 if (!is_secondary(i2s))
736 mask |= (MOD_DC2_EN | MOD_DC1_EN);
738 switch (params_channels(params)) {
746 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
747 i2s->dma_playback.addr_width = 4;
749 i2s->dma_capture.addr_width = 4;
752 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
753 i2s->dma_playback.addr_width = 2;
755 i2s->dma_capture.addr_width = 2;
759 dev_err(&i2s->pdev->dev, "%d channels not supported\n",
760 params_channels(params));
764 if (is_secondary(i2s))
765 mask |= MOD_BLCS_MASK;
767 mask |= MOD_BLCP_MASK;
770 mask |= MOD_BLC_MASK;
772 switch (params_width(params)) {
774 if (is_secondary(i2s))
775 val |= MOD_BLCS_8BIT;
777 val |= MOD_BLCP_8BIT;
782 if (is_secondary(i2s))
783 val |= MOD_BLCS_16BIT;
785 val |= MOD_BLCP_16BIT;
787 val |= MOD_BLC_16BIT;
790 if (is_secondary(i2s))
791 val |= MOD_BLCS_24BIT;
793 val |= MOD_BLCP_24BIT;
795 val |= MOD_BLC_24BIT;
798 dev_err(&i2s->pdev->dev, "Format(%d) not supported\n",
799 params_format(params));
803 spin_lock_irqsave(&priv->lock, flags);
804 mod = readl(priv->addr + I2SMOD);
805 mod = (mod & ~mask) | val;
806 writel(mod, priv->addr + I2SMOD);
807 spin_unlock_irqrestore(&priv->lock, flags);
809 snd_soc_dai_init_dma_data(dai, &i2s->dma_playback, &i2s->dma_capture);
811 i2s->frmclk = params_rate(params);
813 rclksrc = priv->clk_table[CLK_I2S_RCLK_SRC];
814 if (rclksrc && !IS_ERR(rclksrc))
815 priv->rclk_srcrate = clk_get_rate(rclksrc);
820 /* We set constraints on the substream according to the version of I2S */
821 static int i2s_startup(struct snd_pcm_substream *substream,
822 struct snd_soc_dai *dai)
824 struct samsung_i2s_priv *priv = snd_soc_dai_get_drvdata(dai);
825 struct i2s_dai *i2s = to_info(dai);
826 struct i2s_dai *other = get_other_dai(i2s);
829 pm_runtime_get_sync(dai->dev);
831 spin_lock_irqsave(&priv->pcm_lock, flags);
833 i2s->mode |= DAI_OPENED;
835 if (is_manager(other))
836 i2s->mode &= ~DAI_MANAGER;
838 i2s->mode |= DAI_MANAGER;
840 if (!any_active(i2s) && (priv->quirks & QUIRK_NEED_RSTCLR))
841 writel(CON_RSTCLR, i2s->priv->addr + I2SCON);
843 spin_unlock_irqrestore(&priv->pcm_lock, flags);
848 static void i2s_shutdown(struct snd_pcm_substream *substream,
849 struct snd_soc_dai *dai)
851 struct samsung_i2s_priv *priv = snd_soc_dai_get_drvdata(dai);
852 struct i2s_dai *i2s = to_info(dai);
853 struct i2s_dai *other = get_other_dai(i2s);
856 spin_lock_irqsave(&priv->pcm_lock, flags);
858 i2s->mode &= ~DAI_OPENED;
859 i2s->mode &= ~DAI_MANAGER;
861 if (is_opened(other))
862 other->mode |= DAI_MANAGER;
864 /* Reset any constraint on RFS and BFS */
868 spin_unlock_irqrestore(&priv->pcm_lock, flags);
870 pm_runtime_put(dai->dev);
873 static int config_setup(struct i2s_dai *i2s)
875 struct samsung_i2s_priv *priv = i2s->priv;
876 struct i2s_dai *other = get_other_dai(i2s);
877 unsigned rfs, bfs, blc;
887 /* Select least possible multiple(2) if no constraint set */
896 if ((rfs == 256 || rfs == 512) && (blc == 24)) {
897 dev_err(&i2s->pdev->dev,
898 "%d-RFS not supported for 24-blc\n", rfs);
903 if (bfs == 16 || bfs == 32)
909 /* If already setup and running */
910 if (any_active(i2s) && (get_rfs(i2s) != rfs || get_bfs(i2s) != bfs)) {
911 dev_err(&i2s->pdev->dev,
912 "%s:%d Other DAI busy\n", __func__, __LINE__);
919 /* Don't bother with PSR in Slave mode */
923 if (!(priv->quirks & QUIRK_NO_MUXPSR)) {
924 psr = priv->rclk_srcrate / i2s->frmclk / rfs;
925 writel(((psr - 1) << 8) | PSR_PSREN, priv->addr + I2SPSR);
926 dev_dbg(&i2s->pdev->dev,
927 "RCLK_SRC=%luHz PSR=%u, RCLK=%dfs, BCLK=%dfs\n",
928 priv->rclk_srcrate, psr, rfs, bfs);
934 static int i2s_trigger(struct snd_pcm_substream *substream,
935 int cmd, struct snd_soc_dai *dai)
937 struct samsung_i2s_priv *priv = snd_soc_dai_get_drvdata(dai);
938 int capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE);
939 struct snd_soc_pcm_runtime *rtd = substream->private_data;
940 struct i2s_dai *i2s = to_info(rtd->cpu_dai);
944 case SNDRV_PCM_TRIGGER_START:
945 case SNDRV_PCM_TRIGGER_RESUME:
946 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
947 pm_runtime_get_sync(dai->dev);
948 spin_lock_irqsave(&priv->lock, flags);
950 if (config_setup(i2s)) {
951 spin_unlock_irqrestore(&priv->lock, flags);
960 spin_unlock_irqrestore(&priv->lock, flags);
962 case SNDRV_PCM_TRIGGER_STOP:
963 case SNDRV_PCM_TRIGGER_SUSPEND:
964 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
965 spin_lock_irqsave(&priv->lock, flags);
969 i2s_fifo(i2s, FIC_RXFLUSH);
972 i2s_fifo(i2s, FIC_TXFLUSH);
975 spin_unlock_irqrestore(&priv->lock, flags);
976 pm_runtime_put(dai->dev);
983 static int i2s_set_clkdiv(struct snd_soc_dai *dai,
986 struct i2s_dai *i2s = to_info(dai);
987 struct i2s_dai *other = get_other_dai(i2s);
990 case SAMSUNG_I2S_DIV_BCLK:
991 pm_runtime_get_sync(dai->dev);
992 if ((any_active(i2s) && div && (get_bfs(i2s) != div))
993 || (other && other->bfs && (other->bfs != div))) {
994 pm_runtime_put(dai->dev);
995 dev_err(&i2s->pdev->dev,
996 "%s:%d Other DAI busy\n", __func__, __LINE__);
1000 pm_runtime_put(dai->dev);
1003 dev_err(&i2s->pdev->dev,
1004 "Invalid clock divider(%d)\n", div_id);
1011 static snd_pcm_sframes_t
1012 i2s_delay(struct snd_pcm_substream *substream, struct snd_soc_dai *dai)
1014 struct samsung_i2s_priv *priv = snd_soc_dai_get_drvdata(dai);
1015 struct i2s_dai *i2s = to_info(dai);
1016 u32 reg = readl(priv->addr + I2SFIC);
1017 snd_pcm_sframes_t delay;
1019 WARN_ON(!pm_runtime_active(dai->dev));
1021 if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
1022 delay = FIC_RXCOUNT(reg);
1023 else if (is_secondary(i2s))
1024 delay = FICS_TXCOUNT(readl(priv->addr + I2SFICS));
1026 delay = (reg >> priv->variant_regs->ftx0cnt_off) & 0x7f;
1032 static int i2s_suspend(struct snd_soc_dai *dai)
1034 return pm_runtime_force_suspend(dai->dev);
1037 static int i2s_resume(struct snd_soc_dai *dai)
1039 return pm_runtime_force_resume(dai->dev);
1042 #define i2s_suspend NULL
1043 #define i2s_resume NULL
1046 static int samsung_i2s_dai_probe(struct snd_soc_dai *dai)
1048 struct samsung_i2s_priv *priv = snd_soc_dai_get_drvdata(dai);
1049 struct i2s_dai *i2s = to_info(dai);
1050 struct i2s_dai *other = get_other_dai(i2s);
1051 unsigned long flags;
1053 pm_runtime_get_sync(dai->dev);
1055 if (is_secondary(i2s)) {
1056 /* If this is probe on the secondary DAI */
1057 snd_soc_dai_init_dma_data(dai, &i2s->dma_playback, NULL);
1059 snd_soc_dai_init_dma_data(dai, &i2s->dma_playback,
1062 if (priv->quirks & QUIRK_NEED_RSTCLR)
1063 writel(CON_RSTCLR, priv->addr + I2SCON);
1065 if (priv->quirks & QUIRK_SUPPORTS_IDMA)
1066 idma_reg_addr_init(priv->addr,
1067 other->idma_playback.addr);
1070 /* Reset any constraint on RFS and BFS */
1074 spin_lock_irqsave(&priv->lock, flags);
1077 i2s_fifo(i2s, FIC_TXFLUSH);
1078 i2s_fifo(other, FIC_TXFLUSH);
1079 i2s_fifo(i2s, FIC_RXFLUSH);
1080 spin_unlock_irqrestore(&priv->lock, flags);
1082 /* Gate CDCLK by default */
1083 if (!is_opened(other))
1084 i2s_set_sysclk(dai, SAMSUNG_I2S_CDCLK,
1085 0, SND_SOC_CLOCK_IN);
1086 pm_runtime_put(dai->dev);
1091 static int samsung_i2s_dai_remove(struct snd_soc_dai *dai)
1093 struct samsung_i2s_priv *priv = snd_soc_dai_get_drvdata(dai);
1094 struct i2s_dai *i2s = to_info(dai);
1095 unsigned long flags;
1097 pm_runtime_get_sync(dai->dev);
1099 if (!is_secondary(i2s)) {
1100 if (priv->quirks & QUIRK_NEED_RSTCLR) {
1101 spin_lock_irqsave(&priv->lock, flags);
1102 writel(0, priv->addr + I2SCON);
1103 spin_unlock_irqrestore(&priv->lock, flags);
1107 pm_runtime_put(dai->dev);
1112 static const struct snd_soc_dai_ops samsung_i2s_dai_ops = {
1113 .trigger = i2s_trigger,
1114 .hw_params = i2s_hw_params,
1115 .set_fmt = i2s_set_fmt,
1116 .set_clkdiv = i2s_set_clkdiv,
1117 .set_sysclk = i2s_set_sysclk,
1118 .startup = i2s_startup,
1119 .shutdown = i2s_shutdown,
1123 static const struct snd_soc_dapm_widget samsung_i2s_widgets[] = {
1125 SND_SOC_DAPM_AIF_OUT("Mixer DAI TX", NULL, 0, SND_SOC_NOPM, 0, 0),
1126 SND_SOC_DAPM_AIF_IN("Mixer DAI RX", NULL, 0, SND_SOC_NOPM, 0, 0),
1128 /* Playback Mixer */
1129 SND_SOC_DAPM_MIXER("Playback Mixer", SND_SOC_NOPM, 0, 0, NULL, 0),
1132 static const struct snd_soc_dapm_route samsung_i2s_dapm_routes[] = {
1133 { "Playback Mixer", NULL, "Primary" },
1134 { "Playback Mixer", NULL, "Secondary" },
1136 { "Mixer DAI TX", NULL, "Playback Mixer" },
1137 { "Playback Mixer", NULL, "Mixer DAI RX" },
1140 static const struct snd_soc_component_driver samsung_i2s_component = {
1141 .name = "samsung-i2s",
1143 .dapm_widgets = samsung_i2s_widgets,
1144 .num_dapm_widgets = ARRAY_SIZE(samsung_i2s_widgets),
1146 .dapm_routes = samsung_i2s_dapm_routes,
1147 .num_dapm_routes = ARRAY_SIZE(samsung_i2s_dapm_routes),
1150 #define SAMSUNG_I2S_FMTS (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_LE | \
1151 SNDRV_PCM_FMTBIT_S24_LE)
1153 static int i2s_alloc_dais(struct samsung_i2s_priv *priv,
1154 const struct samsung_i2s_dai_data *i2s_dai_data,
1157 static const char *dai_names[] = { "samsung-i2s", "samsung-i2s-sec" };
1158 static const char *stream_names[] = { "Primary", "Secondary" };
1159 struct snd_soc_dai_driver *dai_drv;
1160 struct i2s_dai *dai;
1163 priv->dai = devm_kcalloc(&priv->pdev->dev, num_dais,
1164 sizeof(*dai), GFP_KERNEL);
1168 priv->dai_drv = devm_kcalloc(&priv->pdev->dev, num_dais,
1169 sizeof(*dai_drv), GFP_KERNEL);
1173 for (i = 0; i < num_dais; i++) {
1174 dai_drv = &priv->dai_drv[i];
1176 dai_drv->probe = samsung_i2s_dai_probe;
1177 dai_drv->remove = samsung_i2s_dai_remove;
1178 dai_drv->suspend = i2s_suspend;
1179 dai_drv->resume = i2s_resume;
1181 dai_drv->symmetric_rates = 1;
1182 dai_drv->ops = &samsung_i2s_dai_ops;
1184 dai_drv->playback.channels_min = 1;
1185 dai_drv->playback.channels_max = 2;
1186 dai_drv->playback.rates = i2s_dai_data->pcm_rates;
1187 dai_drv->playback.formats = SAMSUNG_I2S_FMTS;
1188 dai_drv->playback.stream_name = stream_names[i];
1190 dai_drv->id = i + 1;
1191 dai_drv->name = dai_names[i];
1193 priv->dai[i].drv = &priv->dai_drv[i];
1194 priv->dai[i].pdev = priv->pdev;
1197 /* Initialize capture only for the primary DAI */
1198 dai_drv = &priv->dai_drv[SAMSUNG_I2S_ID_PRIMARY - 1];
1200 dai_drv->capture.channels_min = 1;
1201 dai_drv->capture.channels_max = 2;
1202 dai_drv->capture.rates = i2s_dai_data->pcm_rates;
1203 dai_drv->capture.formats = SAMSUNG_I2S_FMTS;
1209 static int i2s_runtime_suspend(struct device *dev)
1211 struct samsung_i2s_priv *priv = dev_get_drvdata(dev);
1213 priv->suspend_i2smod = readl(priv->addr + I2SMOD);
1214 priv->suspend_i2scon = readl(priv->addr + I2SCON);
1215 priv->suspend_i2spsr = readl(priv->addr + I2SPSR);
1218 clk_disable_unprepare(priv->op_clk);
1219 clk_disable_unprepare(priv->clk);
1224 static int i2s_runtime_resume(struct device *dev)
1226 struct samsung_i2s_priv *priv = dev_get_drvdata(dev);
1229 ret = clk_prepare_enable(priv->clk);
1234 ret = clk_prepare_enable(priv->op_clk);
1236 clk_disable_unprepare(priv->clk);
1241 writel(priv->suspend_i2scon, priv->addr + I2SCON);
1242 writel(priv->suspend_i2smod, priv->addr + I2SMOD);
1243 writel(priv->suspend_i2spsr, priv->addr + I2SPSR);
1247 #endif /* CONFIG_PM */
1249 static void i2s_unregister_clocks(struct samsung_i2s_priv *priv)
1253 for (i = 0; i < priv->clk_data.clk_num; i++) {
1254 if (!IS_ERR(priv->clk_table[i]))
1255 clk_unregister(priv->clk_table[i]);
1259 static void i2s_unregister_clock_provider(struct samsung_i2s_priv *priv)
1261 of_clk_del_provider(priv->pdev->dev.of_node);
1262 i2s_unregister_clocks(priv);
1266 static int i2s_register_clock_provider(struct samsung_i2s_priv *priv)
1269 const char * const i2s_clk_desc[] = { "cdclk", "rclk_src", "prescaler" };
1270 const char *clk_name[2] = { "i2s_opclk0", "i2s_opclk1" };
1271 const char *p_names[2] = { NULL };
1272 struct device *dev = &priv->pdev->dev;
1273 const struct samsung_i2s_variant_regs *reg_info = priv->variant_regs;
1274 const char *i2s_clk_name[ARRAY_SIZE(i2s_clk_desc)];
1275 struct clk *rclksrc;
1278 /* Register the clock provider only if it's expected in the DTB */
1279 if (!of_find_property(dev->of_node, "#clock-cells", NULL))
1282 /* Get the RCLKSRC mux clock parent clock names */
1283 for (i = 0; i < ARRAY_SIZE(p_names); i++) {
1284 rclksrc = clk_get(dev, clk_name[i]);
1285 if (IS_ERR(rclksrc))
1287 p_names[i] = __clk_get_name(rclksrc);
1291 for (i = 0; i < ARRAY_SIZE(i2s_clk_desc); i++) {
1292 i2s_clk_name[i] = devm_kasprintf(dev, GFP_KERNEL, "%s_%s",
1293 dev_name(dev), i2s_clk_desc[i]);
1294 if (!i2s_clk_name[i])
1298 if (!(priv->quirks & QUIRK_NO_MUXPSR)) {
1299 /* Activate the prescaler */
1300 u32 val = readl(priv->addr + I2SPSR);
1301 writel(val | PSR_PSREN, priv->addr + I2SPSR);
1303 priv->clk_table[CLK_I2S_RCLK_SRC] = clk_register_mux(dev,
1304 i2s_clk_name[CLK_I2S_RCLK_SRC], p_names,
1305 ARRAY_SIZE(p_names),
1306 CLK_SET_RATE_NO_REPARENT | CLK_SET_RATE_PARENT,
1307 priv->addr + I2SMOD, reg_info->rclksrc_off,
1310 priv->clk_table[CLK_I2S_RCLK_PSR] = clk_register_divider(dev,
1311 i2s_clk_name[CLK_I2S_RCLK_PSR],
1312 i2s_clk_name[CLK_I2S_RCLK_SRC],
1313 CLK_SET_RATE_PARENT,
1314 priv->addr + I2SPSR, 8, 6, 0, &priv->lock);
1316 p_names[0] = i2s_clk_name[CLK_I2S_RCLK_PSR];
1317 priv->clk_data.clk_num = 2;
1320 priv->clk_table[CLK_I2S_CDCLK] = clk_register_gate(dev,
1321 i2s_clk_name[CLK_I2S_CDCLK], p_names[0],
1322 CLK_SET_RATE_PARENT,
1323 priv->addr + I2SMOD, reg_info->cdclkcon_off,
1324 CLK_GATE_SET_TO_DISABLE, &priv->lock);
1326 priv->clk_data.clk_num += 1;
1327 priv->clk_data.clks = priv->clk_table;
1329 ret = of_clk_add_provider(dev->of_node, of_clk_src_onecell_get,
1332 dev_err(dev, "failed to add clock provider: %d\n", ret);
1333 i2s_unregister_clocks(priv);
1339 /* Create platform device for the secondary PCM */
1340 static int i2s_create_secondary_device(struct samsung_i2s_priv *priv)
1342 struct platform_device *pdev;
1345 pdev = platform_device_register_simple("samsung-i2s-sec", -1, NULL, 0);
1349 ret = device_attach(&pdev->dev);
1351 dev_info(&pdev->dev, "device_attach() failed\n");
1355 priv->pdev_sec = pdev;
1360 static void i2s_delete_secondary_device(struct samsung_i2s_priv *priv)
1362 if (priv->pdev_sec) {
1363 platform_device_del(priv->pdev_sec);
1364 priv->pdev_sec = NULL;
1367 static int samsung_i2s_probe(struct platform_device *pdev)
1369 struct i2s_dai *pri_dai, *sec_dai = NULL;
1370 struct s3c_audio_pdata *i2s_pdata = pdev->dev.platform_data;
1371 struct resource *res;
1372 u32 regs_base, quirks = 0, idma_addr = 0;
1373 struct device_node *np = pdev->dev.of_node;
1374 const struct samsung_i2s_dai_data *i2s_dai_data;
1376 struct samsung_i2s_priv *priv;
1378 if (IS_ENABLED(CONFIG_OF) && pdev->dev.of_node)
1379 i2s_dai_data = of_device_get_match_data(&pdev->dev);
1381 i2s_dai_data = (struct samsung_i2s_dai_data *)
1382 platform_get_device_id(pdev)->driver_data;
1384 /* Nothing to do if it is the secondary device probe */
1388 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
1392 quirks = np ? i2s_dai_data->quirks : i2s_pdata->type.quirks;
1393 num_dais = (quirks & QUIRK_SEC_DAI) ? 2 : 1;
1395 priv->variant_regs = i2s_dai_data->i2s_variant_regs;
1396 priv->quirks = quirks;
1398 ret = i2s_alloc_dais(priv, i2s_dai_data, num_dais);
1402 pri_dai = &priv->dai[SAMSUNG_I2S_ID_PRIMARY - 1];
1404 spin_lock_init(&priv->lock);
1405 spin_lock_init(&priv->pcm_lock);
1408 if (i2s_pdata == NULL) {
1409 dev_err(&pdev->dev, "Can't work without s3c_audio_pdata\n");
1413 pri_dai->dma_playback.filter_data = i2s_pdata->dma_playback;
1414 pri_dai->dma_capture.filter_data = i2s_pdata->dma_capture;
1415 pri_dai->filter = i2s_pdata->dma_filter;
1417 idma_addr = i2s_pdata->type.idma_addr;
1419 if (of_property_read_u32(np, "samsung,idma-addr",
1421 if (quirks & QUIRK_SUPPORTS_IDMA) {
1422 dev_info(&pdev->dev, "idma address is not"\
1428 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1429 priv->addr = devm_ioremap_resource(&pdev->dev, res);
1430 if (IS_ERR(priv->addr))
1431 return PTR_ERR(priv->addr);
1433 regs_base = res->start;
1435 priv->clk = devm_clk_get(&pdev->dev, "iis");
1436 if (IS_ERR(priv->clk)) {
1437 dev_err(&pdev->dev, "Failed to get iis clock\n");
1438 return PTR_ERR(priv->clk);
1441 ret = clk_prepare_enable(priv->clk);
1443 dev_err(&pdev->dev, "failed to enable clock: %d\n", ret);
1446 pri_dai->dma_playback.addr = regs_base + I2STXD;
1447 pri_dai->dma_capture.addr = regs_base + I2SRXD;
1448 pri_dai->dma_playback.chan_name = "tx";
1449 pri_dai->dma_capture.chan_name = "rx";
1450 pri_dai->dma_playback.addr_width = 4;
1451 pri_dai->dma_capture.addr_width = 4;
1452 pri_dai->priv = priv;
1454 if (quirks & QUIRK_PRI_6CHAN)
1455 pri_dai->drv->playback.channels_max = 6;
1457 ret = samsung_asoc_dma_platform_register(&pdev->dev, pri_dai->filter,
1460 goto err_disable_clk;
1462 if (quirks & QUIRK_SEC_DAI) {
1463 sec_dai = &priv->dai[SAMSUNG_I2S_ID_SECONDARY - 1];
1465 sec_dai->dma_playback.addr = regs_base + I2STXDS;
1466 sec_dai->dma_playback.chan_name = "tx-sec";
1469 sec_dai->dma_playback.filter_data = i2s_pdata->dma_play_sec;
1470 sec_dai->filter = i2s_pdata->dma_filter;
1473 sec_dai->dma_playback.addr_width = 4;
1474 sec_dai->idma_playback.addr = idma_addr;
1475 sec_dai->pri_dai = pri_dai;
1476 sec_dai->priv = priv;
1477 pri_dai->sec_dai = sec_dai;
1479 ret = i2s_create_secondary_device(priv);
1481 goto err_disable_clk;
1483 ret = samsung_asoc_dma_platform_register(&priv->pdev_sec->dev,
1484 sec_dai->filter, "tx-sec", NULL,
1487 goto err_disable_clk;
1491 if (i2s_pdata && i2s_pdata->cfg_gpio && i2s_pdata->cfg_gpio(pdev)) {
1492 dev_err(&pdev->dev, "Unable to configure gpio\n");
1494 goto err_disable_clk;
1497 dev_set_drvdata(&pdev->dev, priv);
1499 ret = devm_snd_soc_register_component(&pdev->dev,
1500 &samsung_i2s_component,
1501 priv->dai_drv, num_dais);
1503 goto err_disable_clk;
1505 pm_runtime_set_active(&pdev->dev);
1506 pm_runtime_enable(&pdev->dev);
1508 ret = i2s_register_clock_provider(priv);
1510 goto err_disable_pm;
1512 priv->op_clk = clk_get_parent(priv->clk_table[CLK_I2S_RCLK_SRC]);
1517 pm_runtime_disable(&pdev->dev);
1519 clk_disable_unprepare(priv->clk);
1520 i2s_delete_secondary_device(priv);
1524 static int samsung_i2s_remove(struct platform_device *pdev)
1526 struct samsung_i2s_priv *priv = dev_get_drvdata(&pdev->dev);
1528 /* The secondary device has no driver data assigned */
1532 pm_runtime_get_sync(&pdev->dev);
1533 pm_runtime_disable(&pdev->dev);
1535 i2s_unregister_clock_provider(priv);
1536 clk_disable_unprepare(priv->clk);
1537 pm_runtime_put_noidle(&pdev->dev);
1538 i2s_delete_secondary_device(priv);
1543 static const struct samsung_i2s_variant_regs i2sv3_regs = {
1557 static const struct samsung_i2s_variant_regs i2sv6_regs = {
1571 static const struct samsung_i2s_variant_regs i2sv7_regs = {
1585 static const struct samsung_i2s_variant_regs i2sv5_i2s1_regs = {
1599 static const struct samsung_i2s_dai_data i2sv3_dai_type = {
1600 .quirks = QUIRK_NO_MUXPSR,
1601 .pcm_rates = SNDRV_PCM_RATE_8000_96000,
1602 .i2s_variant_regs = &i2sv3_regs,
1605 static const struct samsung_i2s_dai_data i2sv5_dai_type = {
1606 .quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI | QUIRK_NEED_RSTCLR |
1607 QUIRK_SUPPORTS_IDMA,
1608 .pcm_rates = SNDRV_PCM_RATE_8000_96000,
1609 .i2s_variant_regs = &i2sv3_regs,
1612 static const struct samsung_i2s_dai_data i2sv6_dai_type = {
1613 .quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI | QUIRK_NEED_RSTCLR |
1614 QUIRK_SUPPORTS_TDM | QUIRK_SUPPORTS_IDMA,
1615 .pcm_rates = SNDRV_PCM_RATE_8000_96000,
1616 .i2s_variant_regs = &i2sv6_regs,
1619 static const struct samsung_i2s_dai_data i2sv7_dai_type = {
1620 .quirks = QUIRK_PRI_6CHAN | QUIRK_SEC_DAI | QUIRK_NEED_RSTCLR |
1622 .pcm_rates = SNDRV_PCM_RATE_8000_192000,
1623 .i2s_variant_regs = &i2sv7_regs,
1626 static const struct samsung_i2s_dai_data i2sv5_dai_type_i2s1 = {
1627 .quirks = QUIRK_PRI_6CHAN | QUIRK_NEED_RSTCLR,
1628 .pcm_rates = SNDRV_PCM_RATE_8000_96000,
1629 .i2s_variant_regs = &i2sv5_i2s1_regs,
1632 static const struct platform_device_id samsung_i2s_driver_ids[] = {
1634 .name = "samsung-i2s",
1635 .driver_data = (kernel_ulong_t)&i2sv3_dai_type,
1637 .name = "samsung-i2s-sec",
1641 MODULE_DEVICE_TABLE(platform, samsung_i2s_driver_ids);
1644 static const struct of_device_id exynos_i2s_match[] = {
1646 .compatible = "samsung,s3c6410-i2s",
1647 .data = &i2sv3_dai_type,
1649 .compatible = "samsung,s5pv210-i2s",
1650 .data = &i2sv5_dai_type,
1652 .compatible = "samsung,exynos5420-i2s",
1653 .data = &i2sv6_dai_type,
1655 .compatible = "samsung,exynos7-i2s",
1656 .data = &i2sv7_dai_type,
1658 .compatible = "samsung,exynos7-i2s1",
1659 .data = &i2sv5_dai_type_i2s1,
1663 MODULE_DEVICE_TABLE(of, exynos_i2s_match);
1666 static const struct dev_pm_ops samsung_i2s_pm = {
1667 SET_RUNTIME_PM_OPS(i2s_runtime_suspend,
1668 i2s_runtime_resume, NULL)
1669 SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
1670 pm_runtime_force_resume)
1673 static struct platform_driver samsung_i2s_driver = {
1674 .probe = samsung_i2s_probe,
1675 .remove = samsung_i2s_remove,
1676 .id_table = samsung_i2s_driver_ids,
1678 .name = "samsung-i2s",
1679 .of_match_table = of_match_ptr(exynos_i2s_match),
1680 .pm = &samsung_i2s_pm,
1684 module_platform_driver(samsung_i2s_driver);
1686 /* Module information */
1687 MODULE_AUTHOR("Jaswinder Singh, <jassisinghbrar@gmail.com>");
1688 MODULE_DESCRIPTION("Samsung I2S Interface");
1689 MODULE_ALIAS("platform:samsung-i2s");
1690 MODULE_LICENSE("GPL");