aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2014-01-08 13:50:40 -0500
committerMark Brown <broonie@linaro.org>2014-01-09 08:59:33 -0500
commitcf7d8b274f152f289bf9ef821f656133cd3401e4 (patch)
tree21ffb30579e7b8f8c41d7b67a09d8008cee9f75a /sound
parent9b58e7163407f75ec150dc2f91f561fcb681753e (diff)
ASoC: adav80x: 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')
-rw-r--r--sound/soc/codecs/adav80x.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/sound/soc/codecs/adav80x.c b/sound/soc/codecs/adav80x.c
index 14a7c169d004..371a0e9e1af6 100644
--- a/sound/soc/codecs/adav80x.c
+++ b/sound/soc/codecs/adav80x.c
@@ -453,22 +453,22 @@ static int adav80x_set_dac_clock(struct snd_soc_codec *codec,
453} 453}
454 454
455static int adav80x_set_capture_pcm_format(struct snd_soc_codec *codec, 455static int adav80x_set_capture_pcm_format(struct snd_soc_codec *codec,
456 struct snd_soc_dai *dai, snd_pcm_format_t format) 456 struct snd_soc_dai *dai, struct snd_pcm_hw_params *params)
457{ 457{
458 struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec); 458 struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec);
459 unsigned int val; 459 unsigned int val;
460 460
461 switch (format) { 461 switch (params_width(params)) {
462 case SNDRV_PCM_FORMAT_S16_LE: 462 case 16:
463 val = ADAV80X_CAPTURE_WORD_LEN16; 463 val = ADAV80X_CAPTURE_WORD_LEN16;
464 break; 464 break;
465 case SNDRV_PCM_FORMAT_S18_3LE: 465 case 18:
466 val = ADAV80X_CAPTRUE_WORD_LEN18; 466 val = ADAV80X_CAPTRUE_WORD_LEN18;
467 break; 467 break;
468 case SNDRV_PCM_FORMAT_S20_3LE: 468 case 20:
469 val = ADAV80X_CAPTURE_WORD_LEN20; 469 val = ADAV80X_CAPTURE_WORD_LEN20;
470 break; 470 break;
471 case SNDRV_PCM_FORMAT_S24_LE: 471 case 24:
472 val = ADAV80X_CAPTURE_WORD_LEN24; 472 val = ADAV80X_CAPTURE_WORD_LEN24;
473 break; 473 break;
474 default: 474 default:
@@ -482,7 +482,7 @@ static int adav80x_set_capture_pcm_format(struct snd_soc_codec *codec,
482} 482}
483 483
484static int adav80x_set_playback_pcm_format(struct snd_soc_codec *codec, 484static int adav80x_set_playback_pcm_format(struct snd_soc_codec *codec,
485 struct snd_soc_dai *dai, snd_pcm_format_t format) 485 struct snd_soc_dai *dai, struct snd_pcm_hw_params *params)
486{ 486{
487 struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec); 487 struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec);
488 unsigned int val; 488 unsigned int val;
@@ -490,17 +490,17 @@ static int adav80x_set_playback_pcm_format(struct snd_soc_codec *codec,
490 if (adav80x->dai_fmt[dai->id] != SND_SOC_DAIFMT_RIGHT_J) 490 if (adav80x->dai_fmt[dai->id] != SND_SOC_DAIFMT_RIGHT_J)
491 return 0; 491 return 0;
492 492
493 switch (format) { 493 switch (params_width(params)) {
494 case SNDRV_PCM_FORMAT_S16_LE: 494 case 16:
495 val = ADAV80X_PLAYBACK_MODE_RIGHT_J_16; 495 val = ADAV80X_PLAYBACK_MODE_RIGHT_J_16;
496 break; 496 break;
497 case SNDRV_PCM_FORMAT_S18_3LE: 497 case 18:
498 val = ADAV80X_PLAYBACK_MODE_RIGHT_J_18; 498 val = ADAV80X_PLAYBACK_MODE_RIGHT_J_18;
499 break; 499 break;
500 case SNDRV_PCM_FORMAT_S20_3LE: 500 case 20:
501 val = ADAV80X_PLAYBACK_MODE_RIGHT_J_20; 501 val = ADAV80X_PLAYBACK_MODE_RIGHT_J_20;
502 break; 502 break;
503 case SNDRV_PCM_FORMAT_S24_LE: 503 case 24:
504 val = ADAV80X_PLAYBACK_MODE_RIGHT_J_24; 504 val = ADAV80X_PLAYBACK_MODE_RIGHT_J_24;
505 break; 505 break;
506 default: 506 default:
@@ -524,12 +524,10 @@ static int adav80x_hw_params(struct snd_pcm_substream *substream,
524 return -EINVAL; 524 return -EINVAL;
525 525
526 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 526 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
527 adav80x_set_playback_pcm_format(codec, dai, 527 adav80x_set_playback_pcm_format(codec, dai, params);
528 params_format(params));
529 adav80x_set_dac_clock(codec, rate); 528 adav80x_set_dac_clock(codec, rate);
530 } else { 529 } else {
531 adav80x_set_capture_pcm_format(codec, dai, 530 adav80x_set_capture_pcm_format(codec, dai, params);
532 params_format(params));
533 adav80x_set_adc_clock(codec, rate); 531 adav80x_set_adc_clock(codec, rate);
534 } 532 }
535 adav80x->rate = rate; 533 adav80x->rate = rate;