0016-bcm2835-i2s-setup-clock-only-if-CPU-is-clock-master.patch 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. From e1eb1da5932b40e8a201b6b47d7ca2f72119e6e0 Mon Sep 17 00:00:00 2001
  2. From: Matthias Reichl <hias@horus.com>
  3. Date: Sun, 11 Oct 2015 15:25:51 +0200
  4. Subject: [PATCH 016/381] bcm2835-i2s: setup clock only if CPU is clock master
  5. Code ported from bcm2708-i2s driver in Raspberry Pi tree.
  6. RPi commit c14827ecdaa36607f6110f9ce8df96e698672191 ("bcm2708: Allow
  7. option card devices to be configured via DT")
  8. Original work by Zoltan Szenczi, committed to RPi tree by
  9. Phil Elwell.
  10. Signed-off-by: Matthias Reichl <hias@horus.com>
  11. ---
  12. sound/soc/bcm/bcm2835-i2s.c | 28 +++++++++++++++++++---------
  13. 1 file changed, 19 insertions(+), 9 deletions(-)
  14. --- a/sound/soc/bcm/bcm2835-i2s.c
  15. +++ b/sound/soc/bcm/bcm2835-i2s.c
  16. @@ -411,15 +411,25 @@ static int bcm2835_i2s_hw_params(struct
  17. divf = dividend & BCM2835_CLK_DIVF_MASK;
  18. }
  19. - /* Set clock divider */
  20. - regmap_write(dev->clk_regmap, BCM2835_CLK_PCMDIV_REG, BCM2835_CLK_PASSWD
  21. - | BCM2835_CLK_DIVI(divi)
  22. - | BCM2835_CLK_DIVF(divf));
  23. + /* Clock should only be set up here if CPU is clock master */
  24. + switch (dev->fmt & SND_SOC_DAIFMT_MASTER_MASK) {
  25. + case SND_SOC_DAIFMT_CBS_CFS:
  26. + case SND_SOC_DAIFMT_CBS_CFM:
  27. + /* Set clock divider */
  28. + regmap_write(dev->clk_regmap, BCM2835_CLK_PCMDIV_REG,
  29. + BCM2835_CLK_PASSWD
  30. + | BCM2835_CLK_DIVI(divi)
  31. + | BCM2835_CLK_DIVF(divf));
  32. - /* Setup clock, but don't start it yet */
  33. - regmap_write(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG, BCM2835_CLK_PASSWD
  34. - | BCM2835_CLK_MASH(mash)
  35. - | BCM2835_CLK_SRC(clk_src));
  36. + /* Setup clock, but don't start it yet */
  37. + regmap_write(dev->clk_regmap, BCM2835_CLK_PCMCTL_REG,
  38. + BCM2835_CLK_PASSWD
  39. + | BCM2835_CLK_MASH(mash)
  40. + | BCM2835_CLK_SRC(clk_src));
  41. + break;
  42. + default:
  43. + break;
  44. + }
  45. /* Setup the frame format */
  46. format = BCM2835_I2S_CHEN;