0571-Revert-bcm2835-i2s-Changes-for-allowing-asymmetric-s.patch 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. From ba1f22a0d2179a0201e764c341d9dbf8f1c27ffe Mon Sep 17 00:00:00 2001
  2. From: Phil Elwell <phil@raspberrypi.org>
  3. Date: Mon, 16 Jan 2017 20:58:18 +0000
  4. Subject: [PATCH] Revert "bcm2835-i2s: Changes for allowing asymmetric sample
  5. formats. (#1783)"
  6. This reverts commit 4897c5c2f7adb4f77d638121e9959174dff87b9c.
  7. Signed-off-by: Phil Elwell <phil@raspberrypi.org>
  8. See: https://github.com/raspberrypi/linux/issues/1799
  9. ---
  10. sound/soc/bcm/bcm2835-i2s.c | 54 ++++++++++++++-------------------------------
  11. 1 file changed, 16 insertions(+), 38 deletions(-)
  12. --- a/sound/soc/bcm/bcm2835-i2s.c
  13. +++ b/sound/soc/bcm/bcm2835-i2s.c
  14. @@ -310,7 +310,6 @@ static int bcm2835_i2s_hw_params(struct
  15. unsigned int sampling_rate = params_rate(params);
  16. unsigned int data_length, data_delay, bclk_ratio;
  17. unsigned int ch1pos, ch2pos, mode, format;
  18. - unsigned int previous_ftxp, previous_frxp;
  19. unsigned int mash = BCM2835_CLK_MASH_1;
  20. unsigned int divi, divf, target_frequency;
  21. int clk_src = -1;
  22. @@ -321,7 +320,6 @@ static int bcm2835_i2s_hw_params(struct
  23. bool frame_master = (master == SND_SOC_DAIFMT_CBS_CFS
  24. || master == SND_SOC_DAIFMT_CBM_CFS);
  25. uint32_t csreg;
  26. - bool packed;
  27. /*
  28. * If a stream is already enabled,
  29. @@ -467,46 +465,26 @@ static int bcm2835_i2s_hw_params(struct
  30. return -EINVAL;
  31. }
  32. - /* Set the format for the matching stream direction. */
  33. - switch (substream->stream) {
  34. - case SNDRV_PCM_STREAM_PLAYBACK:
  35. - regmap_write(dev->i2s_regmap, BCM2835_I2S_TXC_A_REG, format);
  36. - break;
  37. - case SNDRV_PCM_STREAM_CAPTURE:
  38. - regmap_write(dev->i2s_regmap, BCM2835_I2S_RXC_A_REG, format);
  39. - break;
  40. - default:
  41. - return -EINVAL;
  42. - }
  43. + /*
  44. + * Set format for both streams.
  45. + * We cannot set another frame length
  46. + * (and therefore word length) anyway,
  47. + * so the format will be the same.
  48. + */
  49. + regmap_write(dev->i2s_regmap, BCM2835_I2S_RXC_A_REG, format);
  50. + regmap_write(dev->i2s_regmap, BCM2835_I2S_TXC_A_REG, format);
  51. /* Setup the I2S mode */
  52. - /* Keep existing FTXP and FRXP values. */
  53. - regmap_read(dev->i2s_regmap, BCM2835_I2S_MODE_A_REG, &mode);
  54. -
  55. - previous_ftxp = mode & BCM2835_I2S_FTXP;
  56. - previous_frxp = mode & BCM2835_I2S_FRXP;
  57. -
  58. mode = 0;
  59. - /*
  60. - * Retain the frame packed mode (2 channels per 32 bit word)
  61. - * of the other direction stream intact. The formats of each
  62. - * direction can be different as long as the frame length is
  63. - * shared for both.
  64. - */
  65. - packed = data_length <= 16;
  66. -
  67. - switch (substream->stream) {
  68. - case SNDRV_PCM_STREAM_PLAYBACK:
  69. - mode |= previous_frxp;
  70. - mode |= packed ? BCM2835_I2S_FTXP : 0;
  71. - break;
  72. - case SNDRV_PCM_STREAM_CAPTURE:
  73. - mode |= previous_ftxp;
  74. - mode |= packed ? BCM2835_I2S_FRXP : 0;
  75. - break;
  76. - default:
  77. - return -EINVAL;
  78. + if (data_length <= 16) {
  79. + /*
  80. + * Use frame packed mode (2 channels per 32 bit word)
  81. + * We cannot set another frame length in the second stream
  82. + * (and therefore word length) anyway,
  83. + * so the format will be the same.
  84. + */
  85. + mode |= BCM2835_I2S_FTXP | BCM2835_I2S_FRXP;
  86. }
  87. mode |= BCM2835_I2S_FLEN(bclk_ratio - 1);