diff options
author | Jassi <jassi.brar@samsung.com> | 2009-09-15 06:02:38 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-09-15 08:33:55 -0400 |
commit | fd5ad654e665b5c30c8d755a106309c8ea9f3e7b (patch) | |
tree | 660fefceea502b38ba7115f1694a4d449cf36e39 | |
parent | 472df3cbae8da6a949f1392a11958b8d21383735 (diff) |
ASoC: S3C I2S LRCLK polarity option.
1) Explicitly set LRCLK polarity for I2S Vs LSM/MSB modes.
2) Convert from numerical to bit-field values for BCLK selection.
3) Use proper error checking for return value from clk_get
Signed-off-by: Jassi <jassi.brar@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r-- | sound/soc/s3c24xx/s3c-i2s-v2.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/sound/soc/s3c24xx/s3c-i2s-v2.c b/sound/soc/s3c24xx/s3c-i2s-v2.c index aa7af0b8d421..819c3c086d69 100644 --- a/sound/soc/s3c24xx/s3c-i2s-v2.c +++ b/sound/soc/s3c24xx/s3c-i2s-v2.c | |||
@@ -308,12 +308,15 @@ static int s3c2412_i2s_set_fmt(struct snd_soc_dai *cpu_dai, | |||
308 | 308 | ||
309 | switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { | 309 | switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { |
310 | case SND_SOC_DAIFMT_RIGHT_J: | 310 | case SND_SOC_DAIFMT_RIGHT_J: |
311 | iismod |= S3C2412_IISMOD_LR_RLOW; | ||
311 | iismod |= S3C2412_IISMOD_SDF_MSB; | 312 | iismod |= S3C2412_IISMOD_SDF_MSB; |
312 | break; | 313 | break; |
313 | case SND_SOC_DAIFMT_LEFT_J: | 314 | case SND_SOC_DAIFMT_LEFT_J: |
315 | iismod |= S3C2412_IISMOD_LR_RLOW; | ||
314 | iismod |= S3C2412_IISMOD_SDF_LSB; | 316 | iismod |= S3C2412_IISMOD_SDF_LSB; |
315 | break; | 317 | break; |
316 | case SND_SOC_DAIFMT_I2S: | 318 | case SND_SOC_DAIFMT_I2S: |
319 | iismod &= ~S3C2412_IISMOD_LR_RLOW; | ||
317 | iismod |= S3C2412_IISMOD_SDF_IIS; | 320 | iismod |= S3C2412_IISMOD_SDF_IIS; |
318 | break; | 321 | break; |
319 | default: | 322 | default: |
@@ -463,6 +466,31 @@ static int s3c2412_i2s_set_clkdiv(struct snd_soc_dai *cpu_dai, | |||
463 | 466 | ||
464 | switch (div_id) { | 467 | switch (div_id) { |
465 | case S3C_I2SV2_DIV_BCLK: | 468 | case S3C_I2SV2_DIV_BCLK: |
469 | if (div > 3) { | ||
470 | /* convert value to bit field */ | ||
471 | |||
472 | switch (div) { | ||
473 | case 16: | ||
474 | div = S3C2412_IISMOD_BCLK_16FS; | ||
475 | break; | ||
476 | |||
477 | case 32: | ||
478 | div = S3C2412_IISMOD_BCLK_32FS; | ||
479 | break; | ||
480 | |||
481 | case 24: | ||
482 | div = S3C2412_IISMOD_BCLK_24FS; | ||
483 | break; | ||
484 | |||
485 | case 48: | ||
486 | div = S3C2412_IISMOD_BCLK_48FS; | ||
487 | break; | ||
488 | |||
489 | default: | ||
490 | return -EINVAL; | ||
491 | } | ||
492 | } | ||
493 | |||
466 | reg = readl(i2s->regs + S3C2412_IISMOD); | 494 | reg = readl(i2s->regs + S3C2412_IISMOD); |
467 | reg &= ~S3C2412_IISMOD_BCLK_MASK; | 495 | reg &= ~S3C2412_IISMOD_BCLK_MASK; |
468 | writel(reg | div, i2s->regs + S3C2412_IISMOD); | 496 | writel(reg | div, i2s->regs + S3C2412_IISMOD); |
@@ -622,7 +650,7 @@ int s3c_i2sv2_probe(struct platform_device *pdev, | |||
622 | } | 650 | } |
623 | 651 | ||
624 | i2s->iis_pclk = clk_get(dev, "iis"); | 652 | i2s->iis_pclk = clk_get(dev, "iis"); |
625 | if (i2s->iis_pclk == NULL) { | 653 | if (IS_ERR(i2s->iis_pclk)) { |
626 | dev_err(dev, "failed to get iis_clock\n"); | 654 | dev_err(dev, "failed to get iis_clock\n"); |
627 | iounmap(i2s->regs); | 655 | iounmap(i2s->regs); |
628 | return -ENOENT; | 656 | return -ENOENT; |