0131-bcm2835-always-use-2-4-8-channels-for-multichannel-l.patch 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. From b5a3fcac12091441ee4d692ad90b7cb7afe7c83d Mon Sep 17 00:00:00 2001
  2. From: wm4 <wm4@nowhere>
  3. Date: Wed, 13 Jan 2016 19:44:03 +0100
  4. Subject: [PATCH 131/381] bcm2835: always use 2/4/8 channels for multichannel
  5. layouts
  6. Pad the unused channels with NA. This means userspace needs to write
  7. additional, silent padding channels, which is not ideal, but better
  8. than noise.
  9. Works around noise at the following channel counts: 3, 5, 6, 7
  10. ---
  11. sound/arm/bcm2835-ctl.c | 89 +++++++++++++++++++++++++------------------------
  12. 1 file changed, 45 insertions(+), 44 deletions(-)
  13. --- a/sound/arm/bcm2835-ctl.c
  14. +++ b/sound/arm/bcm2835-ctl.c
  15. @@ -349,6 +349,7 @@ struct cea_channel_speaker_allocation {
  16. #define FRW SNDRV_CHMAP_FRW
  17. #define TC SNDRV_CHMAP_TC
  18. #define FCH SNDRV_CHMAP_TFC
  19. +#define NA SNDRV_CHMAP_NA
  20. /*
  21. * CEA-861 channel maps
  22. @@ -356,69 +357,69 @@ struct cea_channel_speaker_allocation {
  23. * Stolen from sound/pci/hda/patch_hdmi.c
  24. * (unlike the source, this uses SNDRV_* constants directly, as by the
  25. * map_tables array in patch_hdmi.c)
  26. - * Unknown entries use 0, which unfortunately is SNDRV_CHMAP_UNKNOWN instead
  27. - * of SNDRV_CHMAP_NA.
  28. + * Entries which do not have a physical output channel use 0. Entries which
  29. + * require userspace to output silence use NA (SNDRV_CHMAP_NA).
  30. */
  31. static struct cea_channel_speaker_allocation channel_allocations[] = {
  32. /* channel: 7 6 5 4 3 2 1 0 */
  33. { .ca_index = 0x00, .speakers = { 0, 0, 0, 0, 0, 0, FR, FL } },
  34. /* 2.1 */
  35. -{ .ca_index = 0x01, .speakers = { 0, 0, 0, 0, 0, LFE, FR, FL } },
  36. +{ .ca_index = 0x01, .speakers = { 0, 0, 0, 0, NA, LFE, FR, FL } },
  37. /* Dolby Surround */
  38. -{ .ca_index = 0x02, .speakers = { 0, 0, 0, 0, FC, 0, FR, FL } },
  39. +{ .ca_index = 0x02, .speakers = { 0, 0, 0, 0, FC, NA, FR, FL } },
  40. /* surround40 */
  41. -{ .ca_index = 0x08, .speakers = { 0, 0, RR, RL, 0, 0, FR, FL } },
  42. +{ .ca_index = 0x08, .speakers = { NA, NA, RR, RL, NA, NA, FR, FL } },
  43. /* surround41 */
  44. -{ .ca_index = 0x09, .speakers = { 0, 0, RR, RL, 0, LFE, FR, FL } },
  45. +{ .ca_index = 0x09, .speakers = { NA, NA, RR, RL, NA, LFE, FR, FL } },
  46. /* surround50 */
  47. -{ .ca_index = 0x0a, .speakers = { 0, 0, RR, RL, FC, 0, FR, FL } },
  48. +{ .ca_index = 0x0a, .speakers = { NA, NA, RR, RL, FC, NA, FR, FL } },
  49. /* surround51 */
  50. -{ .ca_index = 0x0b, .speakers = { 0, 0, RR, RL, FC, LFE, FR, FL } },
  51. +{ .ca_index = 0x0b, .speakers = { NA, NA, RR, RL, FC, LFE, FR, FL } },
  52. /* 6.1 */
  53. -{ .ca_index = 0x0f, .speakers = { 0, RC, RR, RL, FC, LFE, FR, FL } },
  54. +{ .ca_index = 0x0f, .speakers = { NA, RC, RR, RL, FC, LFE, FR, FL } },
  55. /* surround71 */
  56. { .ca_index = 0x13, .speakers = { RRC, RLC, RR, RL, FC, LFE, FR, FL } },
  57. -{ .ca_index = 0x03, .speakers = { 0, 0, 0, 0, FC, LFE, FR, FL } },
  58. -{ .ca_index = 0x04, .speakers = { 0, 0, 0, RC, 0, 0, FR, FL } },
  59. -{ .ca_index = 0x05, .speakers = { 0, 0, 0, RC, 0, LFE, FR, FL } },
  60. -{ .ca_index = 0x06, .speakers = { 0, 0, 0, RC, FC, 0, FR, FL } },
  61. -{ .ca_index = 0x07, .speakers = { 0, 0, 0, RC, FC, LFE, FR, FL } },
  62. -{ .ca_index = 0x0c, .speakers = { 0, RC, RR, RL, 0, 0, FR, FL } },
  63. -{ .ca_index = 0x0d, .speakers = { 0, RC, RR, RL, 0, LFE, FR, FL } },
  64. -{ .ca_index = 0x0e, .speakers = { 0, RC, RR, RL, FC, 0, FR, FL } },
  65. -{ .ca_index = 0x10, .speakers = { RRC, RLC, RR, RL, 0, 0, FR, FL } },
  66. -{ .ca_index = 0x11, .speakers = { RRC, RLC, RR, RL, 0, LFE, FR, FL } },
  67. -{ .ca_index = 0x12, .speakers = { RRC, RLC, RR, RL, FC, 0, FR, FL } },
  68. -{ .ca_index = 0x14, .speakers = { FRC, FLC, 0, 0, 0, 0, FR, FL } },
  69. -{ .ca_index = 0x15, .speakers = { FRC, FLC, 0, 0, 0, LFE, FR, FL } },
  70. -{ .ca_index = 0x16, .speakers = { FRC, FLC, 0, 0, FC, 0, FR, FL } },
  71. -{ .ca_index = 0x17, .speakers = { FRC, FLC, 0, 0, FC, LFE, FR, FL } },
  72. -{ .ca_index = 0x18, .speakers = { FRC, FLC, 0, RC, 0, 0, FR, FL } },
  73. -{ .ca_index = 0x19, .speakers = { FRC, FLC, 0, RC, 0, LFE, FR, FL } },
  74. -{ .ca_index = 0x1a, .speakers = { FRC, FLC, 0, RC, FC, 0, FR, FL } },
  75. -{ .ca_index = 0x1b, .speakers = { FRC, FLC, 0, RC, FC, LFE, FR, FL } },
  76. -{ .ca_index = 0x1c, .speakers = { FRC, FLC, RR, RL, 0, 0, FR, FL } },
  77. -{ .ca_index = 0x1d, .speakers = { FRC, FLC, RR, RL, 0, LFE, FR, FL } },
  78. -{ .ca_index = 0x1e, .speakers = { FRC, FLC, RR, RL, FC, 0, FR, FL } },
  79. +{ .ca_index = 0x03, .speakers = { NA, NA, NA, NA, FC, LFE, FR, FL } },
  80. +{ .ca_index = 0x04, .speakers = { NA, NA, NA, RC, NA, NA, FR, FL } },
  81. +{ .ca_index = 0x05, .speakers = { NA, NA, NA, RC, NA, LFE, FR, FL } },
  82. +{ .ca_index = 0x06, .speakers = { NA, NA, NA, RC, FC, NA, FR, FL } },
  83. +{ .ca_index = 0x07, .speakers = { NA, NA, NA, RC, FC, LFE, FR, FL } },
  84. +{ .ca_index = 0x0c, .speakers = { NA, RC, RR, RL, NA, NA, FR, FL } },
  85. +{ .ca_index = 0x0d, .speakers = { NA, RC, RR, RL, NA, LFE, FR, FL } },
  86. +{ .ca_index = 0x0e, .speakers = { NA, RC, RR, RL, FC, NA, FR, FL } },
  87. +{ .ca_index = 0x10, .speakers = { RRC, RLC, RR, RL, NA, NA, FR, FL } },
  88. +{ .ca_index = 0x11, .speakers = { RRC, RLC, RR, RL, NA, LFE, FR, FL } },
  89. +{ .ca_index = 0x12, .speakers = { RRC, RLC, RR, RL, FC, NA, FR, FL } },
  90. +{ .ca_index = 0x14, .speakers = { FRC, FLC, NA, NA, NA, NA, FR, FL } },
  91. +{ .ca_index = 0x15, .speakers = { FRC, FLC, NA, NA, NA, LFE, FR, FL } },
  92. +{ .ca_index = 0x16, .speakers = { FRC, FLC, NA, NA, FC, NA, FR, FL } },
  93. +{ .ca_index = 0x17, .speakers = { FRC, FLC, NA, NA, FC, LFE, FR, FL } },
  94. +{ .ca_index = 0x18, .speakers = { FRC, FLC, NA, RC, NA, NA, FR, FL } },
  95. +{ .ca_index = 0x19, .speakers = { FRC, FLC, NA, RC, NA, LFE, FR, FL } },
  96. +{ .ca_index = 0x1a, .speakers = { FRC, FLC, NA, RC, FC, NA, FR, FL } },
  97. +{ .ca_index = 0x1b, .speakers = { FRC, FLC, NA, RC, FC, LFE, FR, FL } },
  98. +{ .ca_index = 0x1c, .speakers = { FRC, FLC, RR, RL, NA, NA, FR, FL } },
  99. +{ .ca_index = 0x1d, .speakers = { FRC, FLC, RR, RL, NA, LFE, FR, FL } },
  100. +{ .ca_index = 0x1e, .speakers = { FRC, FLC, RR, RL, FC, NA, FR, FL } },
  101. { .ca_index = 0x1f, .speakers = { FRC, FLC, RR, RL, FC, LFE, FR, FL } },
  102. -{ .ca_index = 0x20, .speakers = { 0, FCH, RR, RL, FC, 0, FR, FL } },
  103. -{ .ca_index = 0x21, .speakers = { 0, FCH, RR, RL, FC, LFE, FR, FL } },
  104. -{ .ca_index = 0x22, .speakers = { TC, 0, RR, RL, FC, 0, FR, FL } },
  105. -{ .ca_index = 0x23, .speakers = { TC, 0, RR, RL, FC, LFE, FR, FL } },
  106. -{ .ca_index = 0x24, .speakers = { FRH, FLH, RR, RL, 0, 0, FR, FL } },
  107. -{ .ca_index = 0x25, .speakers = { FRH, FLH, RR, RL, 0, LFE, FR, FL } },
  108. -{ .ca_index = 0x26, .speakers = { FRW, FLW, RR, RL, 0, 0, FR, FL } },
  109. -{ .ca_index = 0x27, .speakers = { FRW, FLW, RR, RL, 0, LFE, FR, FL } },
  110. -{ .ca_index = 0x28, .speakers = { TC, RC, RR, RL, FC, 0, FR, FL } },
  111. +{ .ca_index = 0x20, .speakers = { NA, FCH, RR, RL, FC, NA, FR, FL } },
  112. +{ .ca_index = 0x21, .speakers = { NA, FCH, RR, RL, FC, LFE, FR, FL } },
  113. +{ .ca_index = 0x22, .speakers = { TC, NA, RR, RL, FC, NA, FR, FL } },
  114. +{ .ca_index = 0x23, .speakers = { TC, NA, RR, RL, FC, LFE, FR, FL } },
  115. +{ .ca_index = 0x24, .speakers = { FRH, FLH, RR, RL, NA, NA, FR, FL } },
  116. +{ .ca_index = 0x25, .speakers = { FRH, FLH, RR, RL, NA, LFE, FR, FL } },
  117. +{ .ca_index = 0x26, .speakers = { FRW, FLW, RR, RL, NA, NA, FR, FL } },
  118. +{ .ca_index = 0x27, .speakers = { FRW, FLW, RR, RL, NA, LFE, FR, FL } },
  119. +{ .ca_index = 0x28, .speakers = { TC, RC, RR, RL, FC, NA, FR, FL } },
  120. { .ca_index = 0x29, .speakers = { TC, RC, RR, RL, FC, LFE, FR, FL } },
  121. -{ .ca_index = 0x2a, .speakers = { FCH, RC, RR, RL, FC, 0, FR, FL } },
  122. +{ .ca_index = 0x2a, .speakers = { FCH, RC, RR, RL, FC, NA, FR, FL } },
  123. { .ca_index = 0x2b, .speakers = { FCH, RC, RR, RL, FC, LFE, FR, FL } },
  124. -{ .ca_index = 0x2c, .speakers = { TC, FCH, RR, RL, FC, 0, FR, FL } },
  125. +{ .ca_index = 0x2c, .speakers = { TC, FCH, RR, RL, FC, NA, FR, FL } },
  126. { .ca_index = 0x2d, .speakers = { TC, FCH, RR, RL, FC, LFE, FR, FL } },
  127. -{ .ca_index = 0x2e, .speakers = { FRH, FLH, RR, RL, FC, 0, FR, FL } },
  128. +{ .ca_index = 0x2e, .speakers = { FRH, FLH, RR, RL, FC, NA, FR, FL } },
  129. { .ca_index = 0x2f, .speakers = { FRH, FLH, RR, RL, FC, LFE, FR, FL } },
  130. -{ .ca_index = 0x30, .speakers = { FRW, FLW, RR, RL, FC, 0, FR, FL } },
  131. +{ .ca_index = 0x30, .speakers = { FRW, FLW, RR, RL, FC, NA, FR, FL } },
  132. { .ca_index = 0x31, .speakers = { FRW, FLW, RR, RL, FC, LFE, FR, FL } },
  133. };