aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/samsung/i2s.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/samsung/i2s.c')
-rw-r--r--sound/soc/samsung/i2s.c35
1 files changed, 17 insertions, 18 deletions
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index 2ac76fa3e742..03eec22f0f46 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -68,6 +68,8 @@ struct i2s_dai {
68#define DAI_OPENED (1 << 0) /* Dai is opened */ 68#define DAI_OPENED (1 << 0) /* Dai is opened */
69#define DAI_MANAGER (1 << 1) /* Dai is the manager */ 69#define DAI_MANAGER (1 << 1) /* Dai is the manager */
70 unsigned mode; 70 unsigned mode;
71 /* CDCLK pin direction: 0 - input, 1 - output */
72 unsigned int cdclk_out:1;
71 /* Driver for this DAI */ 73 /* Driver for this DAI */
72 struct snd_soc_dai_driver i2s_dai_drv; 74 struct snd_soc_dai_driver i2s_dai_drv;
73 /* DMA parameters */ 75 /* DMA parameters */
@@ -737,6 +739,9 @@ static int i2s_startup(struct snd_pcm_substream *substream,
737 739
738 spin_unlock_irqrestore(&lock, flags); 740 spin_unlock_irqrestore(&lock, flags);
739 741
742 if (!is_opened(other) && i2s->cdclk_out)
743 i2s_set_sysclk(dai, SAMSUNG_I2S_CDCLK,
744 0, SND_SOC_CLOCK_OUT);
740 return 0; 745 return 0;
741} 746}
742 747
@@ -752,9 +757,13 @@ static void i2s_shutdown(struct snd_pcm_substream *substream,
752 i2s->mode &= ~DAI_OPENED; 757 i2s->mode &= ~DAI_OPENED;
753 i2s->mode &= ~DAI_MANAGER; 758 i2s->mode &= ~DAI_MANAGER;
754 759
755 if (is_opened(other)) 760 if (is_opened(other)) {
756 other->mode |= DAI_MANAGER; 761 other->mode |= DAI_MANAGER;
757 762 } else {
763 u32 mod = readl(i2s->addr + I2SMOD);
764 i2s->cdclk_out = !(mod & MOD_CDCLKCON);
765 other->cdclk_out = i2s->cdclk_out;
766 }
758 /* Reset any constraint on RFS and BFS */ 767 /* Reset any constraint on RFS and BFS */
759 i2s->rfs = 0; 768 i2s->rfs = 0;
760 i2s->bfs = 0; 769 i2s->bfs = 0;
@@ -920,11 +929,9 @@ static int i2s_suspend(struct snd_soc_dai *dai)
920{ 929{
921 struct i2s_dai *i2s = to_info(dai); 930 struct i2s_dai *i2s = to_info(dai);
922 931
923 if (dai->active) { 932 i2s->suspend_i2smod = readl(i2s->addr + I2SMOD);
924 i2s->suspend_i2smod = readl(i2s->addr + I2SMOD); 933 i2s->suspend_i2scon = readl(i2s->addr + I2SCON);
925 i2s->suspend_i2scon = readl(i2s->addr + I2SCON); 934 i2s->suspend_i2spsr = readl(i2s->addr + I2SPSR);
926 i2s->suspend_i2spsr = readl(i2s->addr + I2SPSR);
927 }
928 935
929 return 0; 936 return 0;
930} 937}
@@ -933,11 +940,9 @@ static int i2s_resume(struct snd_soc_dai *dai)
933{ 940{
934 struct i2s_dai *i2s = to_info(dai); 941 struct i2s_dai *i2s = to_info(dai);
935 942
936 if (dai->active) { 943 writel(i2s->suspend_i2scon, i2s->addr + I2SCON);
937 writel(i2s->suspend_i2scon, i2s->addr + I2SCON); 944 writel(i2s->suspend_i2smod, i2s->addr + I2SMOD);
938 writel(i2s->suspend_i2smod, i2s->addr + I2SMOD); 945 writel(i2s->suspend_i2spsr, i2s->addr + I2SPSR);
939 writel(i2s->suspend_i2spsr, i2s->addr + I2SPSR);
940 }
941 946
942 return 0; 947 return 0;
943} 948}
@@ -1216,11 +1221,7 @@ static int samsung_i2s_probe(struct platform_device *pdev)
1216 1221
1217 pri_dai->dma_playback.dma_addr = regs_base + I2STXD; 1222 pri_dai->dma_playback.dma_addr = regs_base + I2STXD;
1218 pri_dai->dma_capture.dma_addr = regs_base + I2SRXD; 1223 pri_dai->dma_capture.dma_addr = regs_base + I2SRXD;
1219 pri_dai->dma_playback.client =
1220 (struct s3c_dma_client *)&pri_dai->dma_playback;
1221 pri_dai->dma_playback.ch_name = "tx"; 1224 pri_dai->dma_playback.ch_name = "tx";
1222 pri_dai->dma_capture.client =
1223 (struct s3c_dma_client *)&pri_dai->dma_capture;
1224 pri_dai->dma_capture.ch_name = "rx"; 1225 pri_dai->dma_capture.ch_name = "rx";
1225 pri_dai->dma_playback.dma_size = 4; 1226 pri_dai->dma_playback.dma_size = 4;
1226 pri_dai->dma_capture.dma_size = 4; 1227 pri_dai->dma_capture.dma_size = 4;
@@ -1238,8 +1239,6 @@ static int samsung_i2s_probe(struct platform_device *pdev)
1238 goto err; 1239 goto err;
1239 } 1240 }
1240 sec_dai->dma_playback.dma_addr = regs_base + I2STXDS; 1241 sec_dai->dma_playback.dma_addr = regs_base + I2STXDS;
1241 sec_dai->dma_playback.client =
1242 (struct s3c_dma_client *)&sec_dai->dma_playback;
1243 sec_dai->dma_playback.ch_name = "tx-sec"; 1242 sec_dai->dma_playback.ch_name = "tx-sec";
1244 1243
1245 if (!np) { 1244 if (!np) {