950-0622-drm-vc4-Skip-writes-to-disabled-packet-RAM.patch 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. From f0206374000464f8284826d3bdc50b2fc7c5ea71 Mon Sep 17 00:00:00 2001
  2. From: Dom Cobley <[email protected]>
  3. Date: Fri, 10 Dec 2021 18:03:18 +0000
  4. Subject: [PATCH] drm/vc4: Skip writes to disabled packet RAM
  5. This path actually occurs when audio is started during a hdmi mode set.
  6. As the data will be written by vc4_hdmi_set_infoframes when packet RAM
  7. is enabled again, don't treat as an error
  8. Signed-off-by: Dom Cobley <[email protected]>
  9. ---
  10. drivers/gpu/drm/vc4/vc4_hdmi.c | 5 ++++-
  11. drivers/gpu/drm/vc4/vc4_hdmi.h | 6 ++++++
  12. 2 files changed, 10 insertions(+), 1 deletion(-)
  13. --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
  14. +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
  15. @@ -685,6 +685,7 @@ static void vc4_hdmi_encoder_post_crtc_d
  16. mutex_lock(&vc4_hdmi->mutex);
  17. + vc4_hdmi->output_enabled = false;
  18. spin_lock_irqsave(&vc4_hdmi->hw_lock, flags);
  19. HDMI_WRITE(HDMI_RAM_PACKET_CONFIG, 0);
  20. @@ -1202,6 +1203,7 @@ static void vc4_hdmi_encoder_post_crtc_e
  21. VC4_HDMI_RAM_PACKET_ENABLE);
  22. spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags);
  23. + vc4_hdmi->output_enabled = true;
  24. vc4_hdmi_set_infoframes(encoder);
  25. }
  26. @@ -1607,7 +1609,8 @@ static int vc4_hdmi_audio_prepare(struct
  27. spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags);
  28. memcpy(&vc4_hdmi->audio.infoframe, &params->cea, sizeof(params->cea));
  29. - vc4_hdmi_set_audio_infoframe(encoder);
  30. + if (vc4_hdmi->output_enabled)
  31. + vc4_hdmi_set_audio_infoframe(encoder);
  32. mutex_unlock(&vc4_hdmi->mutex);
  33. --- a/drivers/gpu/drm/vc4/vc4_hdmi.h
  34. +++ b/drivers/gpu/drm/vc4/vc4_hdmi.h
  35. @@ -209,6 +209,12 @@ struct vc4_hdmi {
  36. struct drm_display_mode saved_adjusted_mode;
  37. /**
  38. + * @output_enabled: Is the HDMI controller currently active?
  39. + * Protected by @mutex.
  40. + */
  41. + bool output_enabled;
  42. +
  43. + /**
  44. * @scdc_enabled: Is the HDMI controller currently running with
  45. * the scrambler on? Protected by @mutex.
  46. */