aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/s3c24xx/s3c64xx-i2s.c
diff options
context:
space:
mode:
authorJassi Brar <jassi.brar@samsung.com>2010-04-27 02:57:05 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2010-05-05 10:15:14 -0400
commit8a7c251871eff512fb380ea0e86c77ed901520fe (patch)
treee62703ddd593a38045ce5af8eb45dd2ca9d9faed /sound/soc/s3c24xx/s3c64xx-i2s.c
parent9e991a4bf3290b0787d33fa72144f6eec656f20d (diff)
ASoC: S3C: I2S: Move set_sysclk to common code
Now that we can specify feature of a particular controller, we can avoid multiple copies of same code by defining the CDCLKCON bit feature in controller specific code and detecting that flag in the code common to all controllers. Signed-off-by: Jassi Brar <jassi.brar@samsung.com> Acked-by: Ben Dooks <ben-linux@fluff.org> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/s3c24xx/s3c64xx-i2s.c')
-rw-r--r--sound/soc/s3c24xx/s3c64xx-i2s.c43
1 files changed, 3 insertions, 40 deletions
diff --git a/sound/soc/s3c24xx/s3c64xx-i2s.c b/sound/soc/s3c24xx/s3c64xx-i2s.c
index 6d49bd93717b..1d85cb85a7d2 100644
--- a/sound/soc/s3c24xx/s3c64xx-i2s.c
+++ b/sound/soc/s3c24xx/s3c64xx-i2s.c
@@ -54,43 +54,6 @@ static inline struct s3c_i2sv2_info *to_info(struct snd_soc_dai *cpu_dai)
54 return cpu_dai->private_data; 54 return cpu_dai->private_data;
55} 55}
56 56
57static int s3c64xx_i2s_set_sysclk(struct snd_soc_dai *cpu_dai,
58 int clk_id, unsigned int freq, int dir)
59{
60 struct s3c_i2sv2_info *i2s = to_info(cpu_dai);
61 u32 iismod = readl(i2s->regs + S3C2412_IISMOD);
62
63 switch (clk_id) {
64 case S3C64XX_CLKSRC_PCLK:
65 iismod &= ~S3C2412_IISMOD_IMS_SYSMUX;
66 break;
67
68 case S3C64XX_CLKSRC_MUX:
69 iismod |= S3C2412_IISMOD_IMS_SYSMUX;
70 break;
71
72 case S3C64XX_CLKSRC_CDCLK:
73 switch (dir) {
74 case SND_SOC_CLOCK_IN:
75 iismod |= S3C64XX_IISMOD_CDCLKCON;
76 break;
77 case SND_SOC_CLOCK_OUT:
78 iismod &= ~S3C64XX_IISMOD_CDCLKCON;
79 break;
80 default:
81 return -EINVAL;
82 }
83 break;
84
85 default:
86 return -EINVAL;
87 }
88
89 writel(iismod, i2s->regs + S3C2412_IISMOD);
90
91 return 0;
92}
93
94static int s3c64xx_i2s_probe(struct platform_device *pdev, 57static int s3c64xx_i2s_probe(struct platform_device *pdev,
95 struct snd_soc_dai *dai) 58 struct snd_soc_dai *dai)
96{ 59{
@@ -115,9 +78,7 @@ static int s3c64xx_i2s_probe(struct platform_device *pdev,
115} 78}
116 79
117 80
118static struct snd_soc_dai_ops s3c64xx_i2s_dai_ops = { 81static struct snd_soc_dai_ops s3c64xx_i2s_dai_ops;
119 .set_sysclk = s3c64xx_i2s_set_sysclk,
120};
121 82
122static __devinit int s3c64xx_iis_dev_probe(struct platform_device *pdev) 83static __devinit int s3c64xx_iis_dev_probe(struct platform_device *pdev)
123{ 84{
@@ -147,6 +108,8 @@ static __devinit int s3c64xx_iis_dev_probe(struct platform_device *pdev)
147 dai->probe = s3c64xx_i2s_probe; 108 dai->probe = s3c64xx_i2s_probe;
148 dai->ops = &s3c64xx_i2s_dai_ops; 109 dai->ops = &s3c64xx_i2s_dai_ops;
149 110
111 i2s->feature |= S3C_FEATURE_CDCLKCON;
112
150 i2s->dma_capture = &s3c64xx_i2s_pcm_stereo_in[pdev->id]; 113 i2s->dma_capture = &s3c64xx_i2s_pcm_stereo_in[pdev->id];
151 i2s->dma_playback = &s3c64xx_i2s_pcm_stereo_out[pdev->id]; 114 i2s->dma_playback = &s3c64xx_i2s_pcm_stereo_out[pdev->id];
152 115