aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/ml26124.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-06-22 05:32:41 -0400
committerTakashi Iwai <tiwai@suse.de>2015-06-22 05:32:41 -0400
commit57fa8a1e22c5833fb2cae96af68fc39ec21cb017 (patch)
treeb0bb4e4a6e04a24119da30253add9fe9ffbc8d22 /sound/soc/codecs/ml26124.c
parentf267f9dff8ba00a8b11f340da3634858ad50ebab (diff)
parentc99d49a8f81fb35e67b0ffa45f320a75e0b5639d (diff)
Merge tag 'asoc-v4.2-2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next
ASoC: Further updates for v4.2 There's a bunch of additional updates and fixes that came in since my orignal pull request here, including DT support for rt5645 and fairly large serieses of cleanups and improvements to tas2552 and rcar.
Diffstat (limited to 'sound/soc/codecs/ml26124.c')
-rw-r--r--sound/soc/codecs/ml26124.c58
1 files changed, 11 insertions, 47 deletions
diff --git a/sound/soc/codecs/ml26124.c b/sound/soc/codecs/ml26124.c
index 62dda2488f14..b74118e019fb 100644
--- a/sound/soc/codecs/ml26124.c
+++ b/sound/soc/codecs/ml26124.c
@@ -341,6 +341,7 @@ static int ml26124_hw_params(struct snd_pcm_substream *substream,
341 struct snd_soc_codec *codec = dai->codec; 341 struct snd_soc_codec *codec = dai->codec;
342 struct ml26124_priv *priv = snd_soc_codec_get_drvdata(codec); 342 struct ml26124_priv *priv = snd_soc_codec_get_drvdata(codec);
343 int i = get_coeff(priv->mclk, params_rate(hw_params)); 343 int i = get_coeff(priv->mclk, params_rate(hw_params));
344 int srate;
344 345
345 if (i < 0) 346 if (i < 0)
346 return i; 347 return i;
@@ -370,53 +371,16 @@ static int ml26124_hw_params(struct snd_pcm_substream *substream,
370 BIT(0) | BIT(1), 0); 371 BIT(0) | BIT(1), 0);
371 } 372 }
372 373
373 switch (params_rate(hw_params)) { 374 srate = get_srate(params_rate(hw_params));
374 case 16000: 375 if (srate < 0)
375 snd_soc_update_bits(codec, ML26124_SMPLING_RATE, 0xf, 376 return srate;
376 get_srate(params_rate(hw_params))); 377
377 snd_soc_update_bits(codec, ML26124_PLLNL, 0xff, 378 snd_soc_update_bits(codec, ML26124_SMPLING_RATE, 0xf, srate);
378 coeff_div[i].pllnl); 379 snd_soc_update_bits(codec, ML26124_PLLNL, 0xff, coeff_div[i].pllnl);
379 snd_soc_update_bits(codec, ML26124_PLLNH, 0x1, 380 snd_soc_update_bits(codec, ML26124_PLLNH, 0x1, coeff_div[i].pllnh);
380 coeff_div[i].pllnh); 381 snd_soc_update_bits(codec, ML26124_PLLML, 0xff, coeff_div[i].pllml);
381 snd_soc_update_bits(codec, ML26124_PLLML, 0xff, 382 snd_soc_update_bits(codec, ML26124_PLLMH, 0x3f, coeff_div[i].pllmh);
382 coeff_div[i].pllml); 383 snd_soc_update_bits(codec, ML26124_PLLDIV, 0x1f, coeff_div[i].plldiv);
383 snd_soc_update_bits(codec, ML26124_PLLMH, 0x3f,
384 coeff_div[i].pllmh);
385 snd_soc_update_bits(codec, ML26124_PLLDIV, 0x1f,
386 coeff_div[i].plldiv);
387 break;
388 case 32000:
389 snd_soc_update_bits(codec, ML26124_SMPLING_RATE, 0xf,
390 get_srate(params_rate(hw_params)));
391 snd_soc_update_bits(codec, ML26124_PLLNL, 0xff,
392 coeff_div[i].pllnl);
393 snd_soc_update_bits(codec, ML26124_PLLNH, 0x1,
394 coeff_div[i].pllnh);
395 snd_soc_update_bits(codec, ML26124_PLLML, 0xff,
396 coeff_div[i].pllml);
397 snd_soc_update_bits(codec, ML26124_PLLMH, 0x3f,
398 coeff_div[i].pllmh);
399 snd_soc_update_bits(codec, ML26124_PLLDIV, 0x1f,
400 coeff_div[i].plldiv);
401 break;
402 case 48000:
403 snd_soc_update_bits(codec, ML26124_SMPLING_RATE, 0xf,
404 get_srate(params_rate(hw_params)));
405 snd_soc_update_bits(codec, ML26124_PLLNL, 0xff,
406 coeff_div[i].pllnl);
407 snd_soc_update_bits(codec, ML26124_PLLNH, 0x1,
408 coeff_div[i].pllnh);
409 snd_soc_update_bits(codec, ML26124_PLLML, 0xff,
410 coeff_div[i].pllml);
411 snd_soc_update_bits(codec, ML26124_PLLMH, 0x3f,
412 coeff_div[i].pllmh);
413 snd_soc_update_bits(codec, ML26124_PLLDIV, 0x1f,
414 coeff_div[i].plldiv);
415 break;
416 default:
417 pr_err("%s:this rate is no support for ml26124\n", __func__);
418 return -EINVAL;
419 }
420 384
421 return 0; 385 return 0;
422} 386}