Commit 88ce1465 authored by Tushar Behera's avatar Tushar Behera Committed by Mark Brown

ASoC: samsung: Use params_width()

commit 8c5178fc ("ALSA: Add params_width() helpers") introduces
a helper to get the sample width. Updating Samsung related sound
drivers to use this helper.
Signed-off-by: default avatarTushar Behera <tushar.behera@linaro.org>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent a6aba536
...@@ -676,8 +676,8 @@ static int i2s_hw_params(struct snd_pcm_substream *substream, ...@@ -676,8 +676,8 @@ static int i2s_hw_params(struct snd_pcm_substream *substream,
if (is_manager(i2s)) if (is_manager(i2s))
mod &= ~MOD_BLC_MASK; mod &= ~MOD_BLC_MASK;
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S8: case 8:
if (is_secondary(i2s)) if (is_secondary(i2s))
mod |= MOD_BLCS_8BIT; mod |= MOD_BLCS_8BIT;
else else
...@@ -685,7 +685,7 @@ static int i2s_hw_params(struct snd_pcm_substream *substream, ...@@ -685,7 +685,7 @@ static int i2s_hw_params(struct snd_pcm_substream *substream,
if (is_manager(i2s)) if (is_manager(i2s))
mod |= MOD_BLC_8BIT; mod |= MOD_BLC_8BIT;
break; break;
case SNDRV_PCM_FORMAT_S16_LE: case 16:
if (is_secondary(i2s)) if (is_secondary(i2s))
mod |= MOD_BLCS_16BIT; mod |= MOD_BLCS_16BIT;
else else
...@@ -693,7 +693,7 @@ static int i2s_hw_params(struct snd_pcm_substream *substream, ...@@ -693,7 +693,7 @@ static int i2s_hw_params(struct snd_pcm_substream *substream,
if (is_manager(i2s)) if (is_manager(i2s))
mod |= MOD_BLC_16BIT; mod |= MOD_BLC_16BIT;
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
if (is_secondary(i2s)) if (is_secondary(i2s))
mod |= MOD_BLCS_24BIT; mod |= MOD_BLCS_24BIT;
else else
......
...@@ -283,8 +283,8 @@ static int s3c_pcm_hw_params(struct snd_pcm_substream *substream, ...@@ -283,8 +283,8 @@ static int s3c_pcm_hw_params(struct snd_pcm_substream *substream,
dev_dbg(pcm->dev, "Entered %s\n", __func__); dev_dbg(pcm->dev, "Entered %s\n", __func__);
/* Strictly check for sample size */ /* Strictly check for sample size */
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
break; break;
default: default:
return -EINVAL; return -EINVAL;
......
...@@ -322,13 +322,13 @@ static int s3c_i2sv2_hw_params(struct snd_pcm_substream *substream, ...@@ -322,13 +322,13 @@ static int s3c_i2sv2_hw_params(struct snd_pcm_substream *substream,
iismod &= ~S3C64XX_IISMOD_BLC_MASK; iismod &= ~S3C64XX_IISMOD_BLC_MASK;
/* Sample size */ /* Sample size */
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S8: case 8:
iismod |= S3C64XX_IISMOD_BLC_8BIT; iismod |= S3C64XX_IISMOD_BLC_8BIT;
break; break;
case SNDRV_PCM_FORMAT_S16_LE: case 16:
break; break;
case SNDRV_PCM_FORMAT_S24_LE: case 24:
iismod |= S3C64XX_IISMOD_BLC_24BIT; iismod |= S3C64XX_IISMOD_BLC_24BIT;
break; break;
} }
......
...@@ -120,11 +120,11 @@ static int s3c2412_i2s_hw_params(struct snd_pcm_substream *substream, ...@@ -120,11 +120,11 @@ static int s3c2412_i2s_hw_params(struct snd_pcm_substream *substream,
iismod = readl(i2s->regs + S3C2412_IISMOD); iismod = readl(i2s->regs + S3C2412_IISMOD);
pr_debug("%s: r: IISMOD: %x\n", __func__, iismod); pr_debug("%s: r: IISMOD: %x\n", __func__, iismod);
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S8: case 8:
iismod |= S3C2412_IISMOD_8BIT; iismod |= S3C2412_IISMOD_8BIT;
break; break;
case SNDRV_PCM_FORMAT_S16_LE: case 16:
iismod &= ~S3C2412_IISMOD_8BIT; iismod &= ~S3C2412_IISMOD_8BIT;
break; break;
} }
......
...@@ -248,12 +248,12 @@ static int s3c24xx_i2s_hw_params(struct snd_pcm_substream *substream, ...@@ -248,12 +248,12 @@ static int s3c24xx_i2s_hw_params(struct snd_pcm_substream *substream,
iismod = readl(s3c24xx_i2s.regs + S3C2410_IISMOD); iismod = readl(s3c24xx_i2s.regs + S3C2410_IISMOD);
pr_debug("hw_params r: IISMOD: %x\n", iismod); pr_debug("hw_params r: IISMOD: %x\n", iismod);
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S8: case 8:
iismod &= ~S3C2410_IISMOD_16BIT; iismod &= ~S3C2410_IISMOD_16BIT;
dma_data->dma_size = 1; dma_data->dma_size = 1;
break; break;
case SNDRV_PCM_FORMAT_S16_LE: case 16:
iismod |= S3C2410_IISMOD_16BIT; iismod |= S3C2410_IISMOD_16BIT;
dma_data->dma_size = 2; dma_data->dma_size = 2;
break; break;
......
...@@ -37,13 +37,11 @@ static int smdk_hw_params(struct snd_pcm_substream *substream, ...@@ -37,13 +37,11 @@ static int smdk_hw_params(struct snd_pcm_substream *substream,
unsigned int pll_out; unsigned int pll_out;
int bfs, rfs, ret; int bfs, rfs, ret;
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_U8: case 8:
case SNDRV_PCM_FORMAT_S8:
bfs = 16; bfs = 16;
break; break;
case SNDRV_PCM_FORMAT_U16_LE: case 16:
case SNDRV_PCM_FORMAT_S16_LE:
bfs = 32; bfs = 32;
break; break;
default: default:
......
...@@ -57,7 +57,7 @@ static int smdk_hw_params(struct snd_pcm_substream *substream, ...@@ -57,7 +57,7 @@ static int smdk_hw_params(struct snd_pcm_substream *substream,
int ret; int ret;
/* AIF1CLK should be >=3MHz for optimal performance */ /* AIF1CLK should be >=3MHz for optimal performance */
if (params_format(params) == SNDRV_PCM_FORMAT_S24_LE) if (params_width(params) == 24)
pll_out = params_rate(params) * 384; pll_out = params_rate(params) * 384;
else if (params_rate(params) == 8000 || params_rate(params) == 11025) else if (params_rate(params) == 8000 || params_rate(params) == 11025)
pll_out = params_rate(params) * 512; pll_out = params_rate(params) * 512;
......
...@@ -211,8 +211,8 @@ static int spdif_hw_params(struct snd_pcm_substream *substream, ...@@ -211,8 +211,8 @@ static int spdif_hw_params(struct snd_pcm_substream *substream,
con |= CON_PCM_DATA; con |= CON_PCM_DATA;
con &= ~CON_PCM_MASK; con &= ~CON_PCM_MASK;
switch (params_format(params)) { switch (params_width(params)) {
case SNDRV_PCM_FORMAT_S16_LE: case 16:
con |= CON_PCM_16BIT; con |= CON_PCM_16BIT;
break; break;
default: default:
......
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