Skip to contentSkip to conversation

drm/vc4: hdmi: Don't poll for the infoframes status on setup

PATCH In review Maxime Ripard 2 participants 3 messages Dec 3, 2020 – Dec 7, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drm/vc4: hdmi: Don't poll for the infoframes status on setup

The infoframes are sent at a regular interval as a data island packet, so we don't need to wait for them to be sent when we're setting them up.

However, we do need to poll when we're enabling since the we can't update the packet RAM until it has been sent.

Let's add a boolean flag to tell whether we want to poll or not to support both cases.

---

Changes from v1:
- Inverted when to poll

---
 drivers/gpu/drm/vc4/vc4_hdmi.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/vc4/vc4_hdmi.c +7 -3
index a2c5b5e9786a..d3c4a9b5bb6d 100644
@@ -265,7 +265,8 @@ static int vc4_hdmi_connector_init(struct drm_device *dev,
 }
 
 static int vc4_hdmi_stop_packet(struct drm_encoder *encoder,
-				enum hdmi_infoframe_type type)
+				enum hdmi_infoframe_type type,
+				bool poll)
 {
 	struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
 	u32 packet_id = type - 0x80;
@@ -273,6 +274,9 @@ static int vc4_hdmi_stop_packet(struct drm_encoder *encoder,
 	HDMI_WRITE(HDMI_RAM_PACKET_CONFIG,
 		   HDMI_READ(HDMI_RAM_PACKET_CONFIG) & ~BIT(packet_id));
 
+	if (!poll)
+		return 0;
+
 	return wait_for(!(HDMI_READ(HDMI_RAM_PACKET_STATUS) &
 			  BIT(packet_id)), 100);
 }
@@ -299,7 +303,7 @@ static void vc4_hdmi_write_infoframe(struct drm_encoder *encoder,
 	if (len < 0)
 		return;
 
-	ret = vc4_hdmi_stop_packet(encoder, frame->any.type);
+	ret = vc4_hdmi_stop_packet(encoder, frame->any.type, true);
 	if (ret) {
 		DRM_ERROR("Failed to wait for infoframe to go idle: %d\n", ret);
 		return;
@@ -1056,7 +1060,7 @@ static void vc4_hdmi_audio_reset(struct vc4_hdmi *vc4_hdmi)
 	int ret;
 
 	vc4_hdmi->audio.streaming = false;
-	ret = vc4_hdmi_stop_packet(encoder, HDMI_INFOFRAME_TYPE_AUDIO);
+	ret = vc4_hdmi_stop_packet(encoder, HDMI_INFOFRAME_TYPE_AUDIO, false);
 	if (ret)
 		dev_err(dev, "Failed to stop audio infoframe: %d\n", ret);
 
Signature · 7 lines
2.28.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
maintainer Reviewed-by on v2 1/1
#1 lore raw

Hi Maxime

Quoted 4 lines · Maxime Ripard

The infoframes are sent at a regular interval as a data island packet, so we don't need to wait for them to be sent when we're setting them up.

Quoted 8 lines

However, we do need to poll when we're enabling since the we can't update the packet RAM until it has been sent.

Let's add a boolean flag to tell whether we want to poll or not to support both cases.

That looks like it should do what was intended - thanks.

Quoted 51 lines

---

Changes from v1:
- Inverted when to poll

---
 drivers/gpu/drm/vc4/vc4_hdmi.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/vc4/vc4_hdmi.c +7 -4
index a2c5b5e9786a..d3c4a9b5bb6d 100644
@@ -265,7 +265,8 @@ static int vc4_hdmi_connector_init(struct drm_device *dev,
 }
 
 static int vc4_hdmi_stop_packet(struct drm_encoder *encoder,
-                               enum hdmi_infoframe_type type)
+                               enum hdmi_infoframe_type type,
+                               bool poll)
 {
        struct vc4_hdmi *vc4_hdmi = encoder_to_vc4_hdmi(encoder);
        u32 packet_id = type - 0x80;
@@ -273,6 +274,9 @@ static int vc4_hdmi_stop_packet(struct drm_encoder *encoder,
        HDMI_WRITE(HDMI_RAM_PACKET_CONFIG,
                   HDMI_READ(HDMI_RAM_PACKET_CONFIG) & ~BIT(packet_id));
 
+       if (!poll)
+               return 0;
+
        return wait_for(!(HDMI_READ(HDMI_RAM_PACKET_STATUS) &
                          BIT(packet_id)), 100);
 }
@@ -299,7 +303,7 @@ static void vc4_hdmi_write_infoframe(struct drm_encoder *encoder,
        if (len < 0)
                return;
 
-       ret = vc4_hdmi_stop_packet(encoder, frame->any.type);
+       ret = vc4_hdmi_stop_packet(encoder, frame->any.type, true);
        if (ret) {
                DRM_ERROR("Failed to wait for infoframe to go idle: %d\n", ret);
                return;
@@ -1056,7 +1060,7 @@ static void vc4_hdmi_audio_reset(struct vc4_hdmi *vc4_hdmi)
        int ret;
 
        vc4_hdmi->audio.streaming = false;
-       ret = vc4_hdmi_stop_packet(encoder, HDMI_INFOFRAME_TYPE_AUDIO);
+       ret = vc4_hdmi_stop_packet(encoder, HDMI_INFOFRAME_TYPE_AUDIO, false);
        if (ret)
                dev_err(dev, "Failed to stop audio infoframe: %d\n", ret);
 
--
Quoted 2 lines

2.28.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

author Applied
#2 lore raw
Quoted 13 lines · Dave Stevenson

Hi Maxime

Quoted 10 lines · Maxime Ripard

The infoframes are sent at a regular interval as a data island packet, so we don't need to wait for them to be sent when we're setting them up.

However, we do need to poll when we're enabling since the we can't update the packet RAM until it has been sent.

Let's add a boolean flag to tell whether we want to poll or not to support both cases.

Quoted 6 lines
Quoted 2 lines

That looks like it should do what was intended - thanks.

Applied, thanks!
Maxime

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel