aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2014-01-08 13:50:25 -0500
committerMark Brown <broonie@linaro.org>2014-01-09 08:59:30 -0500
commit9b58e7163407f75ec150dc2f91f561fcb681753e (patch)
tree86f1a07d84f20955bf13aed4be2225b3353892f9 /sound/soc
parent7c2aff6ab53a24d6a688fd7ae45fc14a97f48eda (diff)
ASoC: adau1701: Use params_width() rather than memory format
Signed-off-by: Mark Brown <broonie@linaro.org> Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/codecs/adau1701.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/sound/soc/codecs/adau1701.c b/sound/soc/codecs/adau1701.c
index ebff1128be59..52e3d83e26e6 100644
--- a/sound/soc/codecs/adau1701.c
+++ b/sound/soc/codecs/adau1701.c
@@ -299,20 +299,20 @@ static int adau1701_reset(struct snd_soc_codec *codec, unsigned int clkdiv)
299} 299}
300 300
301static int adau1701_set_capture_pcm_format(struct snd_soc_codec *codec, 301static int adau1701_set_capture_pcm_format(struct snd_soc_codec *codec,
302 snd_pcm_format_t format) 302 struct snd_pcm_hw_params *params)
303{ 303{
304 struct adau1701 *adau1701 = snd_soc_codec_get_drvdata(codec); 304 struct adau1701 *adau1701 = snd_soc_codec_get_drvdata(codec);
305 unsigned int mask = ADAU1701_SEROCTL_WORD_LEN_MASK; 305 unsigned int mask = ADAU1701_SEROCTL_WORD_LEN_MASK;
306 unsigned int val; 306 unsigned int val;
307 307
308 switch (format) { 308 switch (params_width(params)) {
309 case SNDRV_PCM_FORMAT_S16_LE: 309 case 16:
310 val = ADAU1701_SEROCTL_WORD_LEN_16; 310 val = ADAU1701_SEROCTL_WORD_LEN_16;
311 break; 311 break;
312 case SNDRV_PCM_FORMAT_S20_3LE: 312 case 20:
313 val = ADAU1701_SEROCTL_WORD_LEN_20; 313 val = ADAU1701_SEROCTL_WORD_LEN_20;
314 break; 314 break;
315 case SNDRV_PCM_FORMAT_S24_LE: 315 case 24:
316 val = ADAU1701_SEROCTL_WORD_LEN_24; 316 val = ADAU1701_SEROCTL_WORD_LEN_24;
317 break; 317 break;
318 default: 318 default:
@@ -320,14 +320,14 @@ static int adau1701_set_capture_pcm_format(struct snd_soc_codec *codec,
320 } 320 }
321 321
322 if (adau1701->dai_fmt == SND_SOC_DAIFMT_RIGHT_J) { 322 if (adau1701->dai_fmt == SND_SOC_DAIFMT_RIGHT_J) {
323 switch (format) { 323 switch (params_width(params)) {
324 case SNDRV_PCM_FORMAT_S16_LE: 324 case 16:
325 val |= ADAU1701_SEROCTL_MSB_DEALY16; 325 val |= ADAU1701_SEROCTL_MSB_DEALY16;
326 break; 326 break;
327 case SNDRV_PCM_FORMAT_S20_3LE: 327 case 20:
328 val |= ADAU1701_SEROCTL_MSB_DEALY12; 328 val |= ADAU1701_SEROCTL_MSB_DEALY12;
329 break; 329 break;
330 case SNDRV_PCM_FORMAT_S24_LE: 330 case 24:
331 val |= ADAU1701_SEROCTL_MSB_DEALY8; 331 val |= ADAU1701_SEROCTL_MSB_DEALY8;
332 break; 332 break;
333 } 333 }
@@ -340,7 +340,7 @@ static int adau1701_set_capture_pcm_format(struct snd_soc_codec *codec,
340} 340}
341 341
342static int adau1701_set_playback_pcm_format(struct snd_soc_codec *codec, 342static int adau1701_set_playback_pcm_format(struct snd_soc_codec *codec,
343 snd_pcm_format_t format) 343 struct snd_pcm_hw_params *params)
344{ 344{
345 struct adau1701 *adau1701 = snd_soc_codec_get_drvdata(codec); 345 struct adau1701 *adau1701 = snd_soc_codec_get_drvdata(codec);
346 unsigned int val; 346 unsigned int val;
@@ -348,14 +348,14 @@ static int adau1701_set_playback_pcm_format(struct snd_soc_codec *codec,
348 if (adau1701->dai_fmt != SND_SOC_DAIFMT_RIGHT_J) 348 if (adau1701->dai_fmt != SND_SOC_DAIFMT_RIGHT_J)
349 return 0; 349 return 0;
350 350
351 switch (format) { 351 switch (params_width(params)) {
352 case SNDRV_PCM_FORMAT_S16_LE: 352 case 16:
353 val = ADAU1701_SERICTL_RIGHTJ_16; 353 val = ADAU1701_SERICTL_RIGHTJ_16;
354 break; 354 break;
355 case SNDRV_PCM_FORMAT_S20_3LE: 355 case 20:
356 val = ADAU1701_SERICTL_RIGHTJ_20; 356 val = ADAU1701_SERICTL_RIGHTJ_20;
357 break; 357 break;
358 case SNDRV_PCM_FORMAT_S24_LE: 358 case 24:
359 val = ADAU1701_SERICTL_RIGHTJ_24; 359 val = ADAU1701_SERICTL_RIGHTJ_24;
360 break; 360 break;
361 default: 361 default:
@@ -374,7 +374,6 @@ static int adau1701_hw_params(struct snd_pcm_substream *substream,
374 struct snd_soc_codec *codec = dai->codec; 374 struct snd_soc_codec *codec = dai->codec;
375 struct adau1701 *adau1701 = snd_soc_codec_get_drvdata(codec); 375 struct adau1701 *adau1701 = snd_soc_codec_get_drvdata(codec);
376 unsigned int clkdiv = adau1701->sysclk / params_rate(params); 376 unsigned int clkdiv = adau1701->sysclk / params_rate(params);
377 snd_pcm_format_t format;
378 unsigned int val; 377 unsigned int val;
379 int ret; 378 int ret;
380 379
@@ -406,11 +405,10 @@ static int adau1701_hw_params(struct snd_pcm_substream *substream,
406 regmap_update_bits(adau1701->regmap, ADAU1701_DSPCTRL, 405 regmap_update_bits(adau1701->regmap, ADAU1701_DSPCTRL,
407 ADAU1701_DSPCTRL_SR_MASK, val); 406 ADAU1701_DSPCTRL_SR_MASK, val);
408 407
409 format = params_format(params);
410 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 408 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
411 return adau1701_set_playback_pcm_format(codec, format); 409 return adau1701_set_playback_pcm_format(codec, params);
412 else 410 else
413 return adau1701_set_capture_pcm_format(codec, format); 411 return adau1701_set_capture_pcm_format(codec, params);
414} 412}
415 413
416static int adau1701_set_dai_fmt(struct snd_soc_dai *codec_dai, 414static int adau1701_set_dai_fmt(struct snd_soc_dai *codec_dai,