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
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.
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.
13 Let's add a boolean flag to tell whether we want to poll or not to
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
21 drivers/gpu/drm/vc4/vc4_hdmi.c | 10 +++++++---
22 1 file changed, 7 insertions(+), 3 deletions(-)
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
29 static int vc4_hdmi_stop_packet(struct drm_encoder *encoder,
30 - enum hdmi_infoframe_type type)
31 + enum hdmi_infoframe_type type,
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));
43 return wait_for(!(HDMI_READ(HDMI_RAM_PACKET_STATUS) &
44 BIT(packet_id)), 100);
46 @@ -399,7 +403,7 @@ static void vc4_hdmi_write_infoframe(str
50 - ret = vc4_hdmi_stop_packet(encoder, frame->any.type);
51 + ret = vc4_hdmi_stop_packet(encoder, frame->any.type, true);
53 DRM_ERROR("Failed to wait for infoframe to go idle: %d\n", ret);
55 @@ -1283,7 +1287,7 @@ static void vc4_hdmi_audio_reset(struct
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);
62 dev_err(dev, "Failed to stop audio infoframe: %d\n", ret);