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