801-audio-0035-MLK-16929-1-ASoC-fsl_sai-add-bitclk_freq.patch 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. From d40566a2e9aa3c40be313b1fba9d5435c58ffd79 Mon Sep 17 00:00:00 2001
  2. From: Shengjiu Wang <[email protected]>
  3. Date: Thu, 23 Nov 2017 13:32:13 +0800
  4. Subject: [PATCH] MLK-16929-1: ASoC: fsl_sai: add bitclk_freq
  5. Allow set SAI bit clock frequency trough snd_soc_dai_set_sysclk
  6. function call on machine sound drivers.
  7. Signed-off-by: Shengjiu Wang <[email protected]>
  8. Signed-off-by: Adrian Alonso <[email protected]>
  9. ---
  10. sound/soc/fsl/fsl_sai.c | 9 ++++++++-
  11. sound/soc/fsl/fsl_sai.h | 1 +
  12. 2 files changed, 9 insertions(+), 1 deletion(-)
  13. --- a/sound/soc/fsl/fsl_sai.c
  14. +++ b/sound/soc/fsl/fsl_sai.c
  15. @@ -233,11 +233,14 @@ static int fsl_sai_set_dai_sysclk_tr(str
  16. static int fsl_sai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
  17. int clk_id, unsigned int freq, int dir)
  18. {
  19. + struct fsl_sai *sai = snd_soc_dai_get_drvdata(cpu_dai);
  20. int ret;
  21. if (dir == SND_SOC_CLOCK_IN)
  22. return 0;
  23. + sai->bitclk_freq = freq;
  24. +
  25. ret = fsl_sai_set_dai_sysclk_tr(cpu_dai, clk_id, freq,
  26. FSL_FMT_TRANSMITTER);
  27. if (ret) {
  28. @@ -499,7 +502,11 @@ static int fsl_sai_hw_params(struct snd_
  29. slot_width = sai->slot_width;
  30. if (!sai->slave_mode[tx]) {
  31. - ret = fsl_sai_set_bclk(cpu_dai, tx,
  32. + if (sai->bitclk_freq)
  33. + ret = fsl_sai_set_bclk(cpu_dai, tx,
  34. + sai->bitclk_freq);
  35. + else
  36. + ret = fsl_sai_set_bclk(cpu_dai, tx,
  37. slots * slot_width * params_rate(params));
  38. if (ret)
  39. return ret;
  40. --- a/sound/soc/fsl/fsl_sai.h
  41. +++ b/sound/soc/fsl/fsl_sai.h
  42. @@ -181,6 +181,7 @@ struct fsl_sai {
  43. unsigned int mclk_streams;
  44. unsigned int slots;
  45. unsigned int slot_width;
  46. + unsigned int bitclk_freq;
  47. struct snd_soc_dai_driver cpu_dai_drv;
  48. struct snd_dmaengine_dai_dma_data dma_params_rx;