baade60d69d2d846a80881feb7c9a0032ead06b1
[openwrt/staging/rmilecki.git] /
1 From 643f9b3a9e48fb2378d3dde8cfef452f7628e295 Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Thu, 3 Dec 2020 08:46:24 +0100
4 Subject: [PATCH] drm/vc4: hdmi: Don't poll for the infoframes status
5 on setup
6
7 The infoframes are sent at a regular interval as a data island packet,
8 so we don't need to wait for them to be sent when we're setting them up.
9
10 However, we do need to poll when we're enabling since the we can't
11 update the packet RAM until it has been sent.
12
13 Let's add a boolean flag to tell whether we want to poll or not to
14 support both cases.
15
16 Suggested-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
17 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
18 Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
19 Link: https://patchwork.freedesktop.org/patch/msgid/20201203074624.721559-1-maxime@cerno.tech
20 ---
21 drivers/gpu/drm/vc4/vc4_hdmi.c | 10 +++++++---
22 1 file changed, 7 insertions(+), 3 deletions(-)
23
24 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
25 +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
26 @@ -363,7 +363,8 @@ static int vc4_hdmi_connector_init(struc
27 }
28
29 static int vc4_hdmi_stop_packet(struct drm_encoder *encoder,
30 - enum hdmi_infoframe_type type)
31 + enum hdmi_infoframe_type type,
32 + bool poll)
33 {
34 struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
35 u32 packet_id = type - 0x80;
36 @@ -371,6 +372,9 @@ static int vc4_hdmi_stop_packet(struct d
37 HDMI_WRITE(HDMI_RAM_PACKET_CONFIG,
38 HDMI_READ(HDMI_RAM_PACKET_CONFIG) & ~BIT(packet_id));
39
40 + if (!poll)
41 + return 0;
42 +
43 return wait_for(!(HDMI_READ(HDMI_RAM_PACKET_STATUS) &
44 BIT(packet_id)), 100);
45 }
46 @@ -399,7 +403,7 @@ static void vc4_hdmi_write_infoframe(str
47 if (len < 0)
48 return;
49
50 - ret = vc4_hdmi_stop_packet(encoder, frame->any.type);
51 + ret = vc4_hdmi_stop_packet(encoder, frame->any.type, true);
52 if (ret) {
53 DRM_ERROR("Failed to wait for infoframe to go idle: %d\n", ret);
54 return;
55 @@ -1283,7 +1287,7 @@ static void vc4_hdmi_audio_reset(struct
56 int ret;
57
58 vc4_hdmi->audio.streaming = false;
59 - ret = vc4_hdmi_stop_packet(encoder, HDMI_INFOFRAME_TYPE_AUDIO);
60 + ret = vc4_hdmi_stop_packet(encoder, HDMI_INFOFRAME_TYPE_AUDIO, false);
61 if (ret)
62 dev_err(dev, "Failed to stop audio infoframe: %d\n", ret);
63