bcm27xx: add support for linux v5.15
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-5.15 / 950-0622-drm-vc4-Skip-writes-to-disabled-packet-RAM.patch
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
5
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
9
10 Signed-off-by: Dom Cobley <popcornmix@gmail.com>
11 ---
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(-)
15
16 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
17 +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
18 @@ -684,6 +684,7 @@ static void vc4_hdmi_encoder_post_crtc_d
19
20 mutex_lock(&vc4_hdmi->mutex);
21
22 + vc4_hdmi->output_enabled = false;
23 spin_lock_irqsave(&vc4_hdmi->hw_lock, flags);
24
25 HDMI_WRITE(HDMI_RAM_PACKET_CONFIG, 0);
26 @@ -1200,6 +1201,7 @@ static void vc4_hdmi_encoder_post_crtc_e
27 VC4_HDMI_RAM_PACKET_ENABLE);
28
29 spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags);
30 + vc4_hdmi->output_enabled = true;
31
32 vc4_hdmi_set_infoframes(encoder);
33 }
34 @@ -1605,7 +1607,8 @@ static int vc4_hdmi_audio_prepare(struct
35 spin_unlock_irqrestore(&vc4_hdmi->hw_lock, flags);
36
37 memcpy(&vc4_hdmi->audio.infoframe, &params->cea, sizeof(params->cea));
38 - vc4_hdmi_set_audio_infoframe(encoder);
39 + if (vc4_hdmi->output_enabled)
40 + vc4_hdmi_set_audio_infoframe(encoder);
41
42 mutex_unlock(&vc4_hdmi->mutex);
43
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;
48
49 /**
50 + * @output_enabled: Is the HDMI controller currently active?
51 + * Protected by @mutex.
52 + */
53 + bool output_enabled;
54 +
55 + /**
56 * @scdc_enabled: Is the HDMI controller currently running with
57 * the scrambler on? Protected by @mutex.
58 */