Skip to content

Commit

Permalink
ASoC: samsung: Use params_width()
Browse files Browse the repository at this point in the history
commit 8c5178f ("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: Tushar Behera <tushar.behera@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
  • Loading branch information
Tushar Behera authored and Mark Brown committed May 26, 2014
1 parent a6aba53 commit 88ce146
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 24 deletions.
8 changes: 4 additions & 4 deletions sound/soc/samsung/i2s.c
Original file line number Diff line number Diff line change
Expand Up @@ -676,24 +676,24 @@ static int i2s_hw_params(struct snd_pcm_substream *substream,
if (is_manager(i2s))
mod &= ~MOD_BLC_MASK;

switch (params_format(params)) {
case SNDRV_PCM_FORMAT_S8:
switch (params_width(params)) {
case 8:
if (is_secondary(i2s))
mod |= MOD_BLCS_8BIT;
else
mod |= MOD_BLCP_8BIT;
if (is_manager(i2s))
mod |= MOD_BLC_8BIT;
break;
case SNDRV_PCM_FORMAT_S16_LE:
case 16:
if (is_secondary(i2s))
mod |= MOD_BLCS_16BIT;
else
mod |= MOD_BLCP_16BIT;
if (is_manager(i2s))
mod |= MOD_BLC_16BIT;
break;
case SNDRV_PCM_FORMAT_S24_LE:
case 24:
if (is_secondary(i2s))
mod |= MOD_BLCS_24BIT;
else
Expand Down
4 changes: 2 additions & 2 deletions sound/soc/samsung/pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,8 @@ static int s3c_pcm_hw_params(struct snd_pcm_substream *substream,
dev_dbg(pcm->dev, "Entered %s\n", __func__);

/* Strictly check for sample size */
switch (params_format(params)) {
case SNDRV_PCM_FORMAT_S16_LE:
switch (params_width(params)) {
case 16:
break;
default:
return -EINVAL;
Expand Down
8 changes: 4 additions & 4 deletions sound/soc/samsung/s3c-i2s-v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -322,13 +322,13 @@ static int s3c_i2sv2_hw_params(struct snd_pcm_substream *substream,

iismod &= ~S3C64XX_IISMOD_BLC_MASK;
/* Sample size */
switch (params_format(params)) {
case SNDRV_PCM_FORMAT_S8:
switch (params_width(params)) {
case 8:
iismod |= S3C64XX_IISMOD_BLC_8BIT;
break;
case SNDRV_PCM_FORMAT_S16_LE:
case 16:
break;
case SNDRV_PCM_FORMAT_S24_LE:
case 24:
iismod |= S3C64XX_IISMOD_BLC_24BIT;
break;
}
Expand Down
6 changes: 3 additions & 3 deletions sound/soc/samsung/s3c2412-i2s.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,11 @@ static int s3c2412_i2s_hw_params(struct snd_pcm_substream *substream,
iismod = readl(i2s->regs + S3C2412_IISMOD);
pr_debug("%s: r: IISMOD: %x\n", __func__, iismod);

switch (params_format(params)) {
case SNDRV_PCM_FORMAT_S8:
switch (params_width(params)) {
case 8:
iismod |= S3C2412_IISMOD_8BIT;
break;
case SNDRV_PCM_FORMAT_S16_LE:
case 16:
iismod &= ~S3C2412_IISMOD_8BIT;
break;
}
Expand Down
6 changes: 3 additions & 3 deletions sound/soc/samsung/s3c24xx-i2s.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,12 +248,12 @@ static int s3c24xx_i2s_hw_params(struct snd_pcm_substream *substream,
iismod = readl(s3c24xx_i2s.regs + S3C2410_IISMOD);
pr_debug("hw_params r: IISMOD: %x\n", iismod);

switch (params_format(params)) {
case SNDRV_PCM_FORMAT_S8:
switch (params_width(params)) {
case 8:
iismod &= ~S3C2410_IISMOD_16BIT;
dma_data->dma_size = 1;
break;
case SNDRV_PCM_FORMAT_S16_LE:
case 16:
iismod |= S3C2410_IISMOD_16BIT;
dma_data->dma_size = 2;
break;
Expand Down
8 changes: 3 additions & 5 deletions sound/soc/samsung/smdk_wm8580.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,11 @@ static int smdk_hw_params(struct snd_pcm_substream *substream,
unsigned int pll_out;
int bfs, rfs, ret;

switch (params_format(params)) {
case SNDRV_PCM_FORMAT_U8:
case SNDRV_PCM_FORMAT_S8:
switch (params_width(params)) {
case 8:
bfs = 16;
break;
case SNDRV_PCM_FORMAT_U16_LE:
case SNDRV_PCM_FORMAT_S16_LE:
case 16:
bfs = 32;
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/samsung/smdk_wm8994.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static int smdk_hw_params(struct snd_pcm_substream *substream,
int ret;

/* 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;
else if (params_rate(params) == 8000 || params_rate(params) == 11025)
pll_out = params_rate(params) * 512;
Expand Down
4 changes: 2 additions & 2 deletions sound/soc/samsung/spdif.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,8 @@ static int spdif_hw_params(struct snd_pcm_substream *substream,
con |= CON_PCM_DATA;

con &= ~CON_PCM_MASK;
switch (params_format(params)) {
case SNDRV_PCM_FORMAT_S16_LE:
switch (params_width(params)) {
case 16:
con |= CON_PCM_16BIT;
break;
default:
Expand Down

0 comments on commit 88ce146

Please sign in to comment.