ASoC: adav80x: Use params_width() rather than memory format
authorMark Brown <broonie@linaro.org>
Wed, 8 Jan 2014 18:50:40 +0000 (18:50 +0000)
committerMark Brown <broonie@linaro.org>
Thu, 9 Jan 2014 13:59:33 +0000 (13:59 +0000)
Signed-off-by: Mark Brown <broonie@linaro.org>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
sound/soc/codecs/adav80x.c

index 14a7c169d004ebf97fabbbccfd8df0434327c639..371a0e9e1af6ce9d4bb1afabf627f2e3099e76e6 100644 (file)
@@ -453,22 +453,22 @@ static int adav80x_set_dac_clock(struct snd_soc_codec *codec,
 }
 
 static int adav80x_set_capture_pcm_format(struct snd_soc_codec *codec,
-               struct snd_soc_dai *dai, snd_pcm_format_t format)
+               struct snd_soc_dai *dai, struct snd_pcm_hw_params *params)
 {
        struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec);
        unsigned int val;
 
-       switch (format) {
-       case SNDRV_PCM_FORMAT_S16_LE:
+       switch (params_width(params)) {
+       case 16:
                val = ADAV80X_CAPTURE_WORD_LEN16;
                break;
-       case SNDRV_PCM_FORMAT_S18_3LE:
+       case 18:
                val = ADAV80X_CAPTRUE_WORD_LEN18;
                break;
-       case SNDRV_PCM_FORMAT_S20_3LE:
+       case 20:
                val = ADAV80X_CAPTURE_WORD_LEN20;
                break;
-       case SNDRV_PCM_FORMAT_S24_LE:
+       case 24:
                val = ADAV80X_CAPTURE_WORD_LEN24;
                break;
        default:
@@ -482,7 +482,7 @@ static int adav80x_set_capture_pcm_format(struct snd_soc_codec *codec,
 }
 
 static int adav80x_set_playback_pcm_format(struct snd_soc_codec *codec,
-               struct snd_soc_dai *dai, snd_pcm_format_t format)
+               struct snd_soc_dai *dai, struct snd_pcm_hw_params *params)
 {
        struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec);
        unsigned int val;
@@ -490,17 +490,17 @@ static int adav80x_set_playback_pcm_format(struct snd_soc_codec *codec,
        if (adav80x->dai_fmt[dai->id] != SND_SOC_DAIFMT_RIGHT_J)
                return 0;
 
-       switch (format) {
-       case SNDRV_PCM_FORMAT_S16_LE:
+       switch (params_width(params)) {
+       case 16:
                val = ADAV80X_PLAYBACK_MODE_RIGHT_J_16;
                break;
-       case SNDRV_PCM_FORMAT_S18_3LE:
+       case 18:
                val = ADAV80X_PLAYBACK_MODE_RIGHT_J_18;
                break;
-       case SNDRV_PCM_FORMAT_S20_3LE:
+       case 20:
                val = ADAV80X_PLAYBACK_MODE_RIGHT_J_20;
                break;
-       case SNDRV_PCM_FORMAT_S24_LE:
+       case 24:
                val = ADAV80X_PLAYBACK_MODE_RIGHT_J_24;
                break;
        default:
@@ -524,12 +524,10 @@ static int adav80x_hw_params(struct snd_pcm_substream *substream,
                return -EINVAL;
 
        if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
-               adav80x_set_playback_pcm_format(codec, dai,
-                       params_format(params));
+               adav80x_set_playback_pcm_format(codec, dai, params);
                adav80x_set_dac_clock(codec, rate);
        } else {
-               adav80x_set_capture_pcm_format(codec, dai,
-                       params_format(params));
+               adav80x_set_capture_pcm_format(codec, dai, params);
                adav80x_set_adc_clock(codec, rate);
        }
        adav80x->rate = rate;