diff options
Diffstat (limited to 'sound/soc/s3c24xx/s3c24xx-i2s.c')
-rw-r--r-- | sound/soc/s3c24xx/s3c24xx-i2s.c | 35 |
1 files changed, 26 insertions, 9 deletions
diff --git a/sound/soc/s3c24xx/s3c24xx-i2s.c b/sound/soc/s3c24xx/s3c24xx-i2s.c index ba4476b55fbc..6f4d439b57aa 100644 --- a/sound/soc/s3c24xx/s3c24xx-i2s.c +++ b/sound/soc/s3c24xx/s3c24xx-i2s.c | |||
@@ -243,7 +243,8 @@ static int s3c24xx_i2s_set_fmt(struct snd_soc_dai *cpu_dai, | |||
243 | } | 243 | } |
244 | 244 | ||
245 | static int s3c24xx_i2s_hw_params(struct snd_pcm_substream *substream, | 245 | static int s3c24xx_i2s_hw_params(struct snd_pcm_substream *substream, |
246 | struct snd_pcm_hw_params *params) | 246 | struct snd_pcm_hw_params *params, |
247 | struct snd_soc_dai *dai) | ||
247 | { | 248 | { |
248 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 249 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
249 | u32 iismod; | 250 | u32 iismod; |
@@ -261,10 +262,17 @@ static int s3c24xx_i2s_hw_params(struct snd_pcm_substream *substream, | |||
261 | 262 | ||
262 | switch (params_format(params)) { | 263 | switch (params_format(params)) { |
263 | case SNDRV_PCM_FORMAT_S8: | 264 | case SNDRV_PCM_FORMAT_S8: |
265 | iismod &= ~S3C2410_IISMOD_16BIT; | ||
266 | ((struct s3c24xx_pcm_dma_params *) | ||
267 | rtd->dai->cpu_dai->dma_data)->dma_size = 1; | ||
264 | break; | 268 | break; |
265 | case SNDRV_PCM_FORMAT_S16_LE: | 269 | case SNDRV_PCM_FORMAT_S16_LE: |
266 | iismod |= S3C2410_IISMOD_16BIT; | 270 | iismod |= S3C2410_IISMOD_16BIT; |
271 | ((struct s3c24xx_pcm_dma_params *) | ||
272 | rtd->dai->cpu_dai->dma_data)->dma_size = 2; | ||
267 | break; | 273 | break; |
274 | default: | ||
275 | return -EINVAL; | ||
268 | } | 276 | } |
269 | 277 | ||
270 | writel(iismod, s3c24xx_i2s.regs + S3C2410_IISMOD); | 278 | writel(iismod, s3c24xx_i2s.regs + S3C2410_IISMOD); |
@@ -272,7 +280,8 @@ static int s3c24xx_i2s_hw_params(struct snd_pcm_substream *substream, | |||
272 | return 0; | 280 | return 0; |
273 | } | 281 | } |
274 | 282 | ||
275 | static int s3c24xx_i2s_trigger(struct snd_pcm_substream *substream, int cmd) | 283 | static int s3c24xx_i2s_trigger(struct snd_pcm_substream *substream, int cmd, |
284 | struct snd_soc_dai *dai) | ||
276 | { | 285 | { |
277 | int ret = 0; | 286 | int ret = 0; |
278 | 287 | ||
@@ -410,8 +419,7 @@ static int s3c24xx_i2s_probe(struct platform_device *pdev, | |||
410 | } | 419 | } |
411 | 420 | ||
412 | #ifdef CONFIG_PM | 421 | #ifdef CONFIG_PM |
413 | static int s3c24xx_i2s_suspend(struct platform_device *pdev, | 422 | static int s3c24xx_i2s_suspend(struct snd_soc_dai *cpu_dai) |
414 | struct snd_soc_dai *cpu_dai) | ||
415 | { | 423 | { |
416 | DBG("Entered %s\n", __func__); | 424 | DBG("Entered %s\n", __func__); |
417 | 425 | ||
@@ -425,8 +433,7 @@ static int s3c24xx_i2s_suspend(struct platform_device *pdev, | |||
425 | return 0; | 433 | return 0; |
426 | } | 434 | } |
427 | 435 | ||
428 | static int s3c24xx_i2s_resume(struct platform_device *pdev, | 436 | static int s3c24xx_i2s_resume(struct snd_soc_dai *cpu_dai) |
429 | struct snd_soc_dai *cpu_dai) | ||
430 | { | 437 | { |
431 | DBG("Entered %s\n", __func__); | 438 | DBG("Entered %s\n", __func__); |
432 | clk_enable(s3c24xx_i2s.iis_clk); | 439 | clk_enable(s3c24xx_i2s.iis_clk); |
@@ -452,7 +459,6 @@ static int s3c24xx_i2s_resume(struct platform_device *pdev, | |||
452 | struct snd_soc_dai s3c24xx_i2s_dai = { | 459 | struct snd_soc_dai s3c24xx_i2s_dai = { |
453 | .name = "s3c24xx-i2s", | 460 | .name = "s3c24xx-i2s", |
454 | .id = 0, | 461 | .id = 0, |
455 | .type = SND_SOC_DAI_I2S, | ||
456 | .probe = s3c24xx_i2s_probe, | 462 | .probe = s3c24xx_i2s_probe, |
457 | .suspend = s3c24xx_i2s_suspend, | 463 | .suspend = s3c24xx_i2s_suspend, |
458 | .resume = s3c24xx_i2s_resume, | 464 | .resume = s3c24xx_i2s_resume, |
@@ -468,8 +474,7 @@ struct snd_soc_dai s3c24xx_i2s_dai = { | |||
468 | .formats = SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_LE,}, | 474 | .formats = SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_LE,}, |
469 | .ops = { | 475 | .ops = { |
470 | .trigger = s3c24xx_i2s_trigger, | 476 | .trigger = s3c24xx_i2s_trigger, |
471 | .hw_params = s3c24xx_i2s_hw_params,}, | 477 | .hw_params = s3c24xx_i2s_hw_params, |
472 | .dai_ops = { | ||
473 | .set_fmt = s3c24xx_i2s_set_fmt, | 478 | .set_fmt = s3c24xx_i2s_set_fmt, |
474 | .set_clkdiv = s3c24xx_i2s_set_clkdiv, | 479 | .set_clkdiv = s3c24xx_i2s_set_clkdiv, |
475 | .set_sysclk = s3c24xx_i2s_set_sysclk, | 480 | .set_sysclk = s3c24xx_i2s_set_sysclk, |
@@ -477,6 +482,18 @@ struct snd_soc_dai s3c24xx_i2s_dai = { | |||
477 | }; | 482 | }; |
478 | EXPORT_SYMBOL_GPL(s3c24xx_i2s_dai); | 483 | EXPORT_SYMBOL_GPL(s3c24xx_i2s_dai); |
479 | 484 | ||
485 | static int __init s3c24xx_i2s_init(void) | ||
486 | { | ||
487 | return snd_soc_register_dai(&s3c24xx_i2s_dai); | ||
488 | } | ||
489 | module_init(s3c24xx_i2s_init); | ||
490 | |||
491 | static void __exit s3c24xx_i2s_exit(void) | ||
492 | { | ||
493 | snd_soc_unregister_dai(&s3c24xx_i2s_dai); | ||
494 | } | ||
495 | module_exit(s3c24xx_i2s_exit); | ||
496 | |||
480 | /* Module information */ | 497 | /* Module information */ |
481 | MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>"); | 498 | MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>"); |
482 | MODULE_DESCRIPTION("s3c24xx I2S SoC Interface"); | 499 | MODULE_DESCRIPTION("s3c24xx I2S SoC Interface"); |