0250-bcm2835-add-fallback-channel-layouts-if-channel-map-.patch 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. From a9d3c50f084d4d6d1063969c04bc8233fe1437c1 Mon Sep 17 00:00:00 2001
  2. From: wm4 <wm4@nowhere>
  3. Date: Tue, 19 Apr 2016 16:29:41 +0200
  4. Subject: [PATCH 250/381] bcm2835: add fallback channel layouts if channel map
  5. API is not used
  6. Should be more useful than just forcing stereo.
  7. We can't match the exact legacy ALSA channel layouts, so this is a
  8. "best effort" hack.
  9. I'm not sure what happens if the application requests channel counts
  10. that are not power-of-2s. The channel map API hopefully forces
  11. applications which use the channel map API to request the correct
  12. count by adding padding channels, but the bare API enforces
  13. nothing. Possibly this could be added to rate_hw_constraint_channels
  14. at a later point.
  15. ---
  16. sound/arm/bcm2835-vchiq.c | 11 ++++++++++-
  17. 1 file changed, 10 insertions(+), 1 deletion(-)
  18. --- a/sound/arm/bcm2835-vchiq.c
  19. +++ b/sound/arm/bcm2835-vchiq.c
  20. @@ -598,7 +598,16 @@ int bcm2835_audio_set_params(bcm2835_als
  21. if (alsa_stream->chip->cea_chmap >= 0) {
  22. chmap_value = (unsigned)alsa_stream->chip->cea_chmap << 24;
  23. } else {
  24. - chmap_value = 0; /* force stereo */
  25. + /* fallback layouts for applications which do not use chmap API */
  26. + chmap_value = 0x00;
  27. + switch (channels) {
  28. + case 3: chmap_value = 0x01; break;
  29. + case 4: chmap_value = 0x03; break;
  30. + case 5: chmap_value = 0x07; break;
  31. + case 6: chmap_value = 0x0b; break;
  32. + case 7: chmap_value = 0x0f; break;
  33. + case 8: chmap_value = 0x13; break;
  34. + }
  35. for (i = 0; i < 8; i++)
  36. alsa_stream->chip->map_channels[i] = i;
  37. }