diff options
author | Jassi Brar <jassi.brar@samsung.com> | 2010-03-10 02:48:58 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-03-10 13:48:18 -0500 |
commit | 9c9b125736db934b98aa7e16b675767ed4fcf5ce (patch) | |
tree | 8015b01db36b7357405fb91339102c5977a65f27 /sound/soc/s3c24xx | |
parent | bf3288260288160e22f85bbf00b281523c14b587 (diff) |
ASoC: S3C: I2Sv2: Segregate hw_params callback
Towards having build for multiple SoCs segregate hw_params callback
for s3c2412 and s3c64xx.
Since, all new SoCs have s3c64xx like register map, we keep that as
default implementation if no SoC specific callback is already defined.
Signed-off-by: Jassi Brar <jassi.brar@samsung.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/s3c24xx')
-rw-r--r-- | sound/soc/s3c24xx/s3c-i2s-v2.c | 18 | ||||
-rw-r--r-- | sound/soc/s3c24xx/s3c2412-i2s.c | 37 |
2 files changed, 40 insertions, 15 deletions
diff --git a/sound/soc/s3c24xx/s3c-i2s-v2.c b/sound/soc/s3c24xx/s3c-i2s-v2.c index 667431c824d0..c3fcb63cbf25 100644 --- a/sound/soc/s3c24xx/s3c-i2s-v2.c +++ b/sound/soc/s3c24xx/s3c-i2s-v2.c | |||
@@ -326,7 +326,7 @@ static int s3c2412_i2s_set_fmt(struct snd_soc_dai *cpu_dai, | |||
326 | return 0; | 326 | return 0; |
327 | } | 327 | } |
328 | 328 | ||
329 | static int s3c2412_i2s_hw_params(struct snd_pcm_substream *substream, | 329 | static int s3c_i2sv2_hw_params(struct snd_pcm_substream *substream, |
330 | struct snd_pcm_hw_params *params, | 330 | struct snd_pcm_hw_params *params, |
331 | struct snd_soc_dai *socdai) | 331 | struct snd_soc_dai *socdai) |
332 | { | 332 | { |
@@ -346,18 +346,6 @@ static int s3c2412_i2s_hw_params(struct snd_pcm_substream *substream, | |||
346 | iismod = readl(i2s->regs + S3C2412_IISMOD); | 346 | iismod = readl(i2s->regs + S3C2412_IISMOD); |
347 | pr_debug("%s: r: IISMOD: %x\n", __func__, iismod); | 347 | pr_debug("%s: r: IISMOD: %x\n", __func__, iismod); |
348 | 348 | ||
349 | #if defined(CONFIG_CPU_S3C2412) || defined(CONFIG_CPU_S3C2413) | ||
350 | switch (params_format(params)) { | ||
351 | case SNDRV_PCM_FORMAT_S8: | ||
352 | iismod |= S3C2412_IISMOD_8BIT; | ||
353 | break; | ||
354 | case SNDRV_PCM_FORMAT_S16_LE: | ||
355 | iismod &= ~S3C2412_IISMOD_8BIT; | ||
356 | break; | ||
357 | } | ||
358 | #endif | ||
359 | |||
360 | #ifdef CONFIG_PLAT_S3C64XX | ||
361 | iismod &= ~S3C64XX_IISMOD_BLC_MASK; | 349 | iismod &= ~S3C64XX_IISMOD_BLC_MASK; |
362 | /* Sample size */ | 350 | /* Sample size */ |
363 | switch (params_format(params)) { | 351 | switch (params_format(params)) { |
@@ -370,7 +358,6 @@ static int s3c2412_i2s_hw_params(struct snd_pcm_substream *substream, | |||
370 | iismod |= S3C64XX_IISMOD_BLC_24BIT; | 358 | iismod |= S3C64XX_IISMOD_BLC_24BIT; |
371 | break; | 359 | break; |
372 | } | 360 | } |
373 | #endif | ||
374 | 361 | ||
375 | writel(iismod, i2s->regs + S3C2412_IISMOD); | 362 | writel(iismod, i2s->regs + S3C2412_IISMOD); |
376 | pr_debug("%s: w: IISMOD: %x\n", __func__, iismod); | 363 | pr_debug("%s: w: IISMOD: %x\n", __func__, iismod); |
@@ -730,7 +717,8 @@ int s3c_i2sv2_register_dai(struct snd_soc_dai *dai) | |||
730 | struct snd_soc_dai_ops *ops = dai->ops; | 717 | struct snd_soc_dai_ops *ops = dai->ops; |
731 | 718 | ||
732 | ops->trigger = s3c2412_i2s_trigger; | 719 | ops->trigger = s3c2412_i2s_trigger; |
733 | ops->hw_params = s3c2412_i2s_hw_params; | 720 | if (!ops->hw_params) |
721 | ops->hw_params = s3c_i2sv2_hw_params; | ||
734 | ops->set_fmt = s3c2412_i2s_set_fmt; | 722 | ops->set_fmt = s3c2412_i2s_set_fmt; |
735 | ops->set_clkdiv = s3c2412_i2s_set_clkdiv; | 723 | ops->set_clkdiv = s3c2412_i2s_set_clkdiv; |
736 | 724 | ||
diff --git a/sound/soc/s3c24xx/s3c2412-i2s.c b/sound/soc/s3c24xx/s3c2412-i2s.c index 359e59346ba2..a5b21f63261f 100644 --- a/sound/soc/s3c24xx/s3c2412-i2s.c +++ b/sound/soc/s3c24xx/s3c2412-i2s.c | |||
@@ -103,6 +103,10 @@ struct clk *s3c2412_get_iisclk(void) | |||
103 | } | 103 | } |
104 | EXPORT_SYMBOL_GPL(s3c2412_get_iisclk); | 104 | EXPORT_SYMBOL_GPL(s3c2412_get_iisclk); |
105 | 105 | ||
106 | static inline struct s3c_i2sv2_info *to_info(struct snd_soc_dai *cpu_dai) | ||
107 | { | ||
108 | return cpu_dai->private_data; | ||
109 | } | ||
106 | 110 | ||
107 | static int s3c2412_i2s_probe(struct platform_device *pdev, | 111 | static int s3c2412_i2s_probe(struct platform_device *pdev, |
108 | struct snd_soc_dai *dai) | 112 | struct snd_soc_dai *dai) |
@@ -142,6 +146,38 @@ static int s3c2412_i2s_probe(struct platform_device *pdev, | |||
142 | return 0; | 146 | return 0; |
143 | } | 147 | } |
144 | 148 | ||
149 | static int s3c2412_i2s_hw_params(struct snd_pcm_substream *substream, | ||
150 | struct snd_pcm_hw_params *params, | ||
151 | struct snd_soc_dai *cpu_dai) | ||
152 | { | ||
153 | struct s3c_i2sv2_info *i2s = to_info(cpu_dai); | ||
154 | u32 iismod; | ||
155 | |||
156 | pr_debug("Entered %s\n", __func__); | ||
157 | |||
158 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | ||
159 | cpu_dai->dma_data = i2s->dma_playback; | ||
160 | else | ||
161 | cpu_dai->dma_data = i2s->dma_capture; | ||
162 | |||
163 | iismod = readl(i2s->regs + S3C2412_IISMOD); | ||
164 | pr_debug("%s: r: IISMOD: %x\n", __func__, iismod); | ||
165 | |||
166 | switch (params_format(params)) { | ||
167 | case SNDRV_PCM_FORMAT_S8: | ||
168 | iismod |= S3C2412_IISMOD_8BIT; | ||
169 | break; | ||
170 | case SNDRV_PCM_FORMAT_S16_LE: | ||
171 | iismod &= ~S3C2412_IISMOD_8BIT; | ||
172 | break; | ||
173 | } | ||
174 | |||
175 | writel(iismod, i2s->regs + S3C2412_IISMOD); | ||
176 | pr_debug("%s: w: IISMOD: %x\n", __func__, iismod); | ||
177 | |||
178 | return 0; | ||
179 | } | ||
180 | |||
145 | #define S3C2412_I2S_RATES \ | 181 | #define S3C2412_I2S_RATES \ |
146 | (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 | SNDRV_PCM_RATE_16000 | \ | 182 | (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 | SNDRV_PCM_RATE_16000 | \ |
147 | SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \ | 183 | SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \ |
@@ -149,6 +185,7 @@ static int s3c2412_i2s_probe(struct platform_device *pdev, | |||
149 | 185 | ||
150 | static struct snd_soc_dai_ops s3c2412_i2s_dai_ops = { | 186 | static struct snd_soc_dai_ops s3c2412_i2s_dai_ops = { |
151 | .set_sysclk = s3c2412_i2s_set_sysclk, | 187 | .set_sysclk = s3c2412_i2s_set_sysclk, |
188 | .hw_params = s3c2412_i2s_hw_params, | ||
152 | }; | 189 | }; |
153 | 190 | ||
154 | struct snd_soc_dai s3c2412_i2s_dai = { | 191 | struct snd_soc_dai s3c2412_i2s_dai = { |