Commit fd5ad654 authored by Jassi's avatar Jassi Committed by Mark Brown

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: default avatarJassi <jassi.brar@samsung.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 472df3cb
...@@ -308,12 +308,15 @@ static int s3c2412_i2s_set_fmt(struct snd_soc_dai *cpu_dai, ...@@ -308,12 +308,15 @@ static int s3c2412_i2s_set_fmt(struct snd_soc_dai *cpu_dai,
switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
case SND_SOC_DAIFMT_RIGHT_J: case SND_SOC_DAIFMT_RIGHT_J:
iismod |= S3C2412_IISMOD_LR_RLOW;
iismod |= S3C2412_IISMOD_SDF_MSB; iismod |= S3C2412_IISMOD_SDF_MSB;
break; break;
case SND_SOC_DAIFMT_LEFT_J: case SND_SOC_DAIFMT_LEFT_J:
iismod |= S3C2412_IISMOD_LR_RLOW;
iismod |= S3C2412_IISMOD_SDF_LSB; iismod |= S3C2412_IISMOD_SDF_LSB;
break; break;
case SND_SOC_DAIFMT_I2S: case SND_SOC_DAIFMT_I2S:
iismod &= ~S3C2412_IISMOD_LR_RLOW;
iismod |= S3C2412_IISMOD_SDF_IIS; iismod |= S3C2412_IISMOD_SDF_IIS;
break; break;
default: default:
...@@ -463,6 +466,31 @@ static int s3c2412_i2s_set_clkdiv(struct snd_soc_dai *cpu_dai, ...@@ -463,6 +466,31 @@ static int s3c2412_i2s_set_clkdiv(struct snd_soc_dai *cpu_dai,
switch (div_id) { switch (div_id) {
case S3C_I2SV2_DIV_BCLK: case S3C_I2SV2_DIV_BCLK:
if (div > 3) {
/* convert value to bit field */
switch (div) {
case 16:
div = S3C2412_IISMOD_BCLK_16FS;
break;
case 32:
div = S3C2412_IISMOD_BCLK_32FS;
break;
case 24:
div = S3C2412_IISMOD_BCLK_24FS;
break;
case 48:
div = S3C2412_IISMOD_BCLK_48FS;
break;
default:
return -EINVAL;
}
}
reg = readl(i2s->regs + S3C2412_IISMOD); reg = readl(i2s->regs + S3C2412_IISMOD);
reg &= ~S3C2412_IISMOD_BCLK_MASK; reg &= ~S3C2412_IISMOD_BCLK_MASK;
writel(reg | div, i2s->regs + S3C2412_IISMOD); writel(reg | div, i2s->regs + S3C2412_IISMOD);
...@@ -622,7 +650,7 @@ int s3c_i2sv2_probe(struct platform_device *pdev, ...@@ -622,7 +650,7 @@ int s3c_i2sv2_probe(struct platform_device *pdev,
} }
i2s->iis_pclk = clk_get(dev, "iis"); i2s->iis_pclk = clk_get(dev, "iis");
if (i2s->iis_pclk == NULL) { if (IS_ERR(i2s->iis_pclk)) {
dev_err(dev, "failed to get iis_clock\n"); dev_err(dev, "failed to get iis_clock\n");
iounmap(i2s->regs); iounmap(i2s->regs);
return -ENOENT; return -ENOENT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment