0548-Audioinjector-Fix-bit-offsets-for-equal-volume-and-a.patch 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. From 80531f433182a0db5da749045a6e3f48bf4277db Mon Sep 17 00:00:00 2001
  2. From: Matt Flax <flatmax@flatmax.org>
  3. Date: Sun, 20 Nov 2016 19:15:24 +1100
  4. Subject: [PATCH] [Audioinjector] Fix bit offsets for equal volume and add 8
  5. kHz operation (#1727)
  6. Applying to the audioinjector sound card only. This patch offsets channel
  7. 2 correctly from the LR clock. This ensures that channel 2 doesn't loose
  8. any bits during capture. It also results in both channels 1 and 2 having
  9. the same volume. This commit also adds 8 kHz operation.
  10. Signed-off-by: Matt Flax <flatmax@flatmax.org>
  11. ---
  12. sound/soc/bcm/audioinjector-pi-soundcard.c | 16 +++++++++-------
  13. 1 file changed, 9 insertions(+), 7 deletions(-)
  14. --- a/sound/soc/bcm/audioinjector-pi-soundcard.c
  15. +++ b/sound/soc/bcm/audioinjector-pi-soundcard.c
  16. @@ -30,7 +30,7 @@
  17. #include "../codecs/wm8731.h"
  18. static const unsigned int bcm2835_rates_12000000[] = {
  19. - 32000, 44100, 48000, 96000, 88200,
  20. + 8000, 16000, 32000, 44100, 48000, 96000, 88200,
  21. };
  22. static struct snd_pcm_hw_constraint_list bcm2835_constraints_12000000 = {
  23. @@ -55,19 +55,21 @@ static int snd_audioinjector_pi_soundcar
  24. switch (params_rate(params)){
  25. case 8000:
  26. - return snd_soc_dai_set_bclk_ratio(cpu_dai, 1508);
  27. + return snd_soc_dai_set_bclk_ratio(cpu_dai, 1);
  28. + case 16000:
  29. + return snd_soc_dai_set_bclk_ratio(cpu_dai, 750);
  30. case 32000:
  31. - return snd_soc_dai_set_bclk_ratio(cpu_dai, 378);
  32. + return snd_soc_dai_set_bclk_ratio(cpu_dai, 375);
  33. case 44100:
  34. - return snd_soc_dai_set_bclk_ratio(cpu_dai, 274);
  35. + return snd_soc_dai_set_bclk_ratio(cpu_dai, 272);
  36. case 48000:
  37. - return snd_soc_dai_set_bclk_ratio(cpu_dai, 252);
  38. + return snd_soc_dai_set_bclk_ratio(cpu_dai, 250);
  39. case 88200:
  40. return snd_soc_dai_set_bclk_ratio(cpu_dai, 136);
  41. case 96000:
  42. - return snd_soc_dai_set_bclk_ratio(cpu_dai, 126);
  43. + return snd_soc_dai_set_bclk_ratio(cpu_dai, 125);
  44. default:
  45. - return snd_soc_dai_set_bclk_ratio(cpu_dai, 126);
  46. + return snd_soc_dai_set_bclk_ratio(cpu_dai, 125);
  47. }
  48. }