[alsa-devel] [PATCH 1/5] ASoC: sn95031: Convert to params_width()
From: Mark Brown broonie@linaro.org
The CODEC doesn't care how data is laid out in memory.
Signed-off-by: Mark Brown broonie@linaro.org --- sound/soc/codecs/sn95031.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/soc/codecs/sn95031.c b/sound/soc/codecs/sn95031.c index 42dff26b3a2a..cf8fa40662f0 100644 --- a/sound/soc/codecs/sn95031.c +++ b/sound/soc/codecs/sn95031.c @@ -661,12 +661,12 @@ static int sn95031_pcm_hw_params(struct snd_pcm_substream *substream, { unsigned int format, rate;
- switch (params_format(params)) { - case SNDRV_PCM_FORMAT_S16_LE: + switch (params_width(params)) { + case 16: format = BIT(4)|BIT(5); break;
- case SNDRV_PCM_FORMAT_S24_LE: + case 24: format = 0; break; default:
From: Mark Brown broonie@linaro.org
The CODEC doesn't care how data is laid out in memory.
Signed-off-by: Mark Brown broonie@linaro.org --- sound/soc/codecs/sta32x.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-)
diff --git a/sound/soc/codecs/sta32x.c b/sound/soc/codecs/sta32x.c index 0579d187135b..48740855566d 100644 --- a/sound/soc/codecs/sta32x.c +++ b/sound/soc/codecs/sta32x.c @@ -678,15 +678,11 @@ static int sta32x_hw_params(struct snd_pcm_substream *substream,
confb = snd_soc_read(codec, STA32X_CONFB); confb &= ~(STA32X_CONFB_SAI_MASK | STA32X_CONFB_SAIFB); - switch (params_format(params)) { - case SNDRV_PCM_FORMAT_S24_LE: - case SNDRV_PCM_FORMAT_S24_BE: - case SNDRV_PCM_FORMAT_S24_3LE: - case SNDRV_PCM_FORMAT_S24_3BE: + switch (params_width(params)) { + case 24: pr_debug("24bit\n"); /* fall through */ - case SNDRV_PCM_FORMAT_S32_LE: - case SNDRV_PCM_FORMAT_S32_BE: + case 32: pr_debug("24bit or 32bit\n"); switch (sta32x->format) { case SND_SOC_DAIFMT_I2S: @@ -701,8 +697,7 @@ static int sta32x_hw_params(struct snd_pcm_substream *substream, }
break; - case SNDRV_PCM_FORMAT_S20_3LE: - case SNDRV_PCM_FORMAT_S20_3BE: + case 20: pr_debug("20bit\n"); switch (sta32x->format) { case SND_SOC_DAIFMT_I2S: @@ -717,8 +712,7 @@ static int sta32x_hw_params(struct snd_pcm_substream *substream, }
break; - case SNDRV_PCM_FORMAT_S18_3LE: - case SNDRV_PCM_FORMAT_S18_3BE: + case 18: pr_debug("18bit\n"); switch (sta32x->format) { case SND_SOC_DAIFMT_I2S: @@ -733,8 +727,7 @@ static int sta32x_hw_params(struct snd_pcm_substream *substream, }
break; - case SNDRV_PCM_FORMAT_S16_LE: - case SNDRV_PCM_FORMAT_S16_BE: + case 16: pr_debug("16bit\n"); switch (sta32x->format) { case SND_SOC_DAIFMT_I2S:
From: Mark Brown broonie@linaro.org
The CODEC doesn't care how data is laid out in memory.
Signed-off-by: Mark Brown broonie@linaro.org --- sound/soc/codecs/sta529.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/soc/codecs/sta529.c b/sound/soc/codecs/sta529.c index fcdf11026aff..9aa1323fb2ab 100644 --- a/sound/soc/codecs/sta529.c +++ b/sound/soc/codecs/sta529.c @@ -197,16 +197,16 @@ static int sta529_hw_params(struct snd_pcm_substream *substream, int pdata, play_freq_val, record_freq_val; int bclk_to_fs_ratio;
- switch (params_format(params)) { - case SNDRV_PCM_FORMAT_S16_LE: + switch (params_width(params)) { + case 16: pdata = 1; bclk_to_fs_ratio = 0; break; - case SNDRV_PCM_FORMAT_S24_LE: + case 24: pdata = 2; bclk_to_fs_ratio = 1; break; - case SNDRV_PCM_FORMAT_S32_LE: + case 32: pdata = 3; bclk_to_fs_ratio = 2; break;
From: Mark Brown broonie@linaro.org
The CODEC doesn't care how data is laid out in memory.
Signed-off-by: Mark Brown broonie@linaro.org --- sound/soc/codecs/uda134x.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/sound/soc/codecs/uda134x.c b/sound/soc/codecs/uda134x.c index 12fc0aed7503..32b2f78aa62c 100644 --- a/sound/soc/codecs/uda134x.c +++ b/sound/soc/codecs/uda134x.c @@ -243,14 +243,14 @@ static int uda134x_hw_params(struct snd_pcm_substream *substream, case SND_SOC_DAIFMT_I2S: break; case SND_SOC_DAIFMT_RIGHT_J: - switch (params_format(params)) { - case SNDRV_PCM_FORMAT_S16_LE: + switch (params_width(params)) { + case 16: hw_params |= (1<<1); break; - case SNDRV_PCM_FORMAT_S18_3LE: + case 18: hw_params |= (1<<2); break; - case SNDRV_PCM_FORMAT_S20_3LE: + case 20: hw_params |= ((1<<2) | (1<<1)); break; default:
From: Mark Brown broonie@linaro.org
The CODEC doesn't care how data is laid out in memory.
Signed-off-by: Mark Brown broonie@linaro.org --- sound/soc/codecs/wl1273.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/sound/soc/codecs/wl1273.c b/sound/soc/codecs/wl1273.c index 5d8ba779085b..f3d4e88d0b7b 100644 --- a/sound/soc/codecs/wl1273.c +++ b/sound/soc/codecs/wl1273.c @@ -341,8 +341,9 @@ static int wl1273_hw_params(struct snd_pcm_substream *substream, struct wl1273_core *core = wl1273->core; unsigned int rate, width, r;
- if (params_format(params) != SNDRV_PCM_FORMAT_S16_LE) { - pr_err("Only SNDRV_PCM_FORMAT_S16_LE supported.\n"); + if (params_width(params) != 16) { + dev_err(dai->dev, "%d bits/sample not supported\n", + params_width(params)); return -EINVAL; }
participants (1)
-
Mark Brown