aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/s3c24xx/s3c64xx-i2s.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/s3c24xx/s3c64xx-i2s.c')
-rw-r--r--sound/soc/s3c24xx/s3c64xx-i2s.c69
1 files changed, 4 insertions, 65 deletions
diff --git a/sound/soc/s3c24xx/s3c64xx-i2s.c b/sound/soc/s3c24xx/s3c64xx-i2s.c
index a72c251401ac..1d85cb85a7d2 100644
--- a/sound/soc/s3c24xx/s3c64xx-i2s.c
+++ b/sound/soc/s3c24xx/s3c64xx-i2s.c
@@ -12,16 +12,12 @@
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14 14
15#include <linux/init.h>
16#include <linux/module.h>
17#include <linux/device.h>
18#include <linux/clk.h> 15#include <linux/clk.h>
19#include <linux/gpio.h> 16#include <linux/gpio.h>
20#include <linux/io.h> 17#include <linux/io.h>
21 18
22#include <sound/soc.h> 19#include <sound/soc.h>
23 20
24#include <plat/regs-s3c2412-iis.h>
25#include <mach/gpio-bank-d.h> 21#include <mach/gpio-bank-d.h>
26#include <mach/gpio-bank-e.h> 22#include <mach/gpio-bank-e.h>
27#include <plat/gpio-cfg.h> 23#include <plat/gpio-cfg.h>
@@ -30,6 +26,7 @@
30#include <mach/dma.h> 26#include <mach/dma.h>
31 27
32#include "s3c-dma.h" 28#include "s3c-dma.h"
29#include "regs-i2s-v2.h"
33#include "s3c64xx-i2s.h" 30#include "s3c64xx-i2s.h"
34 31
35/* The value should be set to maximum of the total number 32/* The value should be set to maximum of the total number
@@ -57,55 +54,6 @@ static inline struct s3c_i2sv2_info *to_info(struct snd_soc_dai *cpu_dai)
57 return cpu_dai->private_data; 54 return cpu_dai->private_data;
58} 55}
59 56
60static int s3c64xx_i2s_set_sysclk(struct snd_soc_dai *cpu_dai,
61 int clk_id, unsigned int freq, int dir)
62{
63 struct s3c_i2sv2_info *i2s = to_info(cpu_dai);
64 u32 iismod = readl(i2s->regs + S3C2412_IISMOD);
65
66 switch (clk_id) {
67 case S3C64XX_CLKSRC_PCLK:
68 iismod &= ~S3C64XX_IISMOD_IMS_SYSMUX;
69 break;
70
71 case S3C64XX_CLKSRC_MUX:
72 iismod |= S3C64XX_IISMOD_IMS_SYSMUX;
73 break;
74
75 case S3C64XX_CLKSRC_CDCLK:
76 switch (dir) {
77 case SND_SOC_CLOCK_IN:
78 iismod |= S3C64XX_IISMOD_CDCLKCON;
79 break;
80 case SND_SOC_CLOCK_OUT:
81 iismod &= ~S3C64XX_IISMOD_CDCLKCON;
82 break;
83 default:
84 return -EINVAL;
85 }
86 break;
87
88 default:
89 return -EINVAL;
90 }
91
92 writel(iismod, i2s->regs + S3C2412_IISMOD);
93
94 return 0;
95}
96
97struct clk *s3c64xx_i2s_get_clock(struct snd_soc_dai *dai)
98{
99 struct s3c_i2sv2_info *i2s = to_info(dai);
100 u32 iismod = readl(i2s->regs + S3C2412_IISMOD);
101
102 if (iismod & S3C64XX_IISMOD_IMS_SYSMUX)
103 return i2s->iis_cclk;
104 else
105 return i2s->iis_pclk;
106}
107EXPORT_SYMBOL_GPL(s3c64xx_i2s_get_clock);
108
109static int s3c64xx_i2s_probe(struct platform_device *pdev, 57static int s3c64xx_i2s_probe(struct platform_device *pdev,
110 struct snd_soc_dai *dai) 58 struct snd_soc_dai *dai)
111{ 59{
@@ -130,18 +78,7 @@ static int s3c64xx_i2s_probe(struct platform_device *pdev,
130} 78}
131 79
132 80
133#define S3C64XX_I2S_RATES \ 81static struct snd_soc_dai_ops s3c64xx_i2s_dai_ops;
134 (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 | SNDRV_PCM_RATE_16000 | \
135 SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \
136 SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000)
137
138#define S3C64XX_I2S_FMTS \
139 (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_LE |\
140 SNDRV_PCM_FMTBIT_S24_LE)
141
142static struct snd_soc_dai_ops s3c64xx_i2s_dai_ops = {
143 .set_sysclk = s3c64xx_i2s_set_sysclk,
144};
145 82
146static __devinit int s3c64xx_iis_dev_probe(struct platform_device *pdev) 83static __devinit int s3c64xx_iis_dev_probe(struct platform_device *pdev)
147{ 84{
@@ -171,6 +108,8 @@ static __devinit int s3c64xx_iis_dev_probe(struct platform_device *pdev)
171 dai->probe = s3c64xx_i2s_probe; 108 dai->probe = s3c64xx_i2s_probe;
172 dai->ops = &s3c64xx_i2s_dai_ops; 109 dai->ops = &s3c64xx_i2s_dai_ops;
173 110
111 i2s->feature |= S3C_FEATURE_CDCLKCON;
112
174 i2s->dma_capture = &s3c64xx_i2s_pcm_stereo_in[pdev->id]; 113 i2s->dma_capture = &s3c64xx_i2s_pcm_stereo_in[pdev->id];
175 i2s->dma_playback = &s3c64xx_i2s_pcm_stereo_out[pdev->id]; 114 i2s->dma_playback = &s3c64xx_i2s_pcm_stereo_out[pdev->id];
176 115