cb5f273fc2009305715e789019347edeac9bdda2
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-5.15 / 950-0430-vc4-Clear-unused-infoframe-packet-RAM-registers.patch
1 From ce3b4ee2f7d315dadd56ba19587b58339e5d6185 Mon Sep 17 00:00:00 2001
2 From: Dom Cobley <popcornmix@gmail.com>
3 Date: Tue, 10 Nov 2020 20:04:08 +0000
4 Subject: [PATCH] vc4: Clear unused infoframe packet RAM registers
5
6 Using a hdmi analyser the bytes in packet ram
7 registers beyond the length were visible in the
8 infoframes and it flagged the checksum as invalid.
9
10 Zeroing unused words of packet RAM avoids this
11
12 Signed-off-by: Dom Cobley <popcornmix@gmail.com>
13 ---
14 drivers/gpu/drm/vc4/vc4_hdmi.c | 11 ++++++++++-
15 1 file changed, 10 insertions(+), 1 deletion(-)
16
17 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
18 +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
19 @@ -440,9 +440,11 @@ static void vc4_hdmi_write_infoframe(str
20 const struct vc4_hdmi_register *ram_packet_start =
21 &vc4_hdmi->variant->registers[HDMI_RAM_PACKET_START];
22 u32 packet_reg = ram_packet_start->offset + VC4_HDMI_PACKET_STRIDE * packet_id;
23 + u32 packet_reg_next = ram_packet_start->offset +
24 + VC4_HDMI_PACKET_STRIDE * (packet_id + 1);
25 void __iomem *base = __vc4_hdmi_get_field_base(vc4_hdmi,
26 ram_packet_start->reg);
27 - uint8_t buffer[VC4_HDMI_PACKET_STRIDE];
28 + uint8_t buffer[VC4_HDMI_PACKET_STRIDE] = {};
29 unsigned long flags;
30 ssize_t len, i;
31 int ret;
32 @@ -478,6 +480,13 @@ static void vc4_hdmi_write_infoframe(str
33 packet_reg += 4;
34 }
35
36 + /*
37 + * clear remainder of packet ram as it's included in the
38 + * infoframe and triggers a checksum error on hdmi analyser
39 + */
40 + for (; packet_reg < packet_reg_next; packet_reg += 4)
41 + writel(0, base + packet_reg);
42 +
43 HDMI_WRITE(HDMI_RAM_PACKET_CONFIG,
44 HDMI_READ(HDMI_RAM_PACKET_CONFIG) | BIT(packet_id));
45