ASoC: pcm1681: Convert to params_width()
authorMark Brown <broonie@linaro.org>
Fri, 24 Jan 2014 16:07:05 +0000 (16:07 +0000)
committerMark Brown <broonie@linaro.org>
Mon, 3 Feb 2014 12:55:43 +0000 (12:55 +0000)
This will help support future enhancements in the way we negotiate
parameters in the core.

Signed-off-by: Mark Brown <broonie@linaro.org>
sound/soc/codecs/pcm1681.c

index 73f9c3630e2c8e33a56b089fa3a0d5f16e418dd3..e427544183d7f2ee095913adc0a8ad7104f4ebd4 100644 (file)
@@ -172,16 +172,21 @@ static int pcm1681_hw_params(struct snd_pcm_substream *substream,
        struct snd_soc_codec *codec = dai->codec;
        struct pcm1681_private *priv = snd_soc_codec_get_drvdata(codec);
        int val = 0, ret;
-       int pcm_format = params_format(params);
 
        priv->rate = params_rate(params);
 
        switch (priv->format & SND_SOC_DAIFMT_FORMAT_MASK) {
        case SND_SOC_DAIFMT_RIGHT_J:
-               if (pcm_format == SNDRV_PCM_FORMAT_S24_LE)
-                       val = 0x00;
-               else if (pcm_format == SNDRV_PCM_FORMAT_S16_LE)
-                       val = 0x03;
+               switch (params_width(params)) {
+               case 24:
+                       val = 0;
+                       break;
+               case 16:
+                       val = 3;
+                       break;
+               default:
+                       return -EINVAL;
+               }
                break;
        case SND_SOC_DAIFMT_I2S:
                val = 0x04;