Skip to contentSkip to conversation

drm/stm: ltdc: Silence -EPROBE_DEFER till bridge attached

PATCH In review Jagan Teki 3 participants 4 messages Jul 4, 2021 – Jul 19, 2021

Subsystems (4)
lore
Share & tools
lore

Jagan Teki

author
#0 lore raw

PATCH 1/1 drm/stm: ltdc: Silence -EPROBE_DEFER till bridge attached

As dw-mipi-dsi supported all possible ways to find the DSI devices. It can take multiple iterations for ltdc to find all components attached to the DSI bridge.

The current ltdc driver failed to find the endpoint as it returned -EINVAL for the first iteration itself. This leads to following error:

[    3.099289] [drm:ltdc_load] *ERROR* init encoder endpoint 0

So, check the return value and cleanup the encoder only if it's not -EPROBE_DEFER. This make all components in the attached DSI bridge found properly.

---
 drivers/gpu/drm/stm/ltdc.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/stm/ltdc.c +5 -3
index 08b71248044d..95e983d3ffb5 100644
@@ -1122,8 +1122,9 @@ static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge)
 
 	ret = drm_bridge_attach(encoder, bridge, NULL, 0);
 	if (ret) {
-		drm_encoder_cleanup(encoder);
-		return -EINVAL;
+		if (ret != -EPROBE_DEFER)
+			drm_encoder_cleanup(encoder);
+		return ret;
 	}
 
 	DRM_DEBUG_DRIVER("Bridge encoder:%d created\n", encoder->base.id);
@@ -1266,7 +1267,8 @@ int ltdc_load(struct drm_device *ddev)
 		if (bridge) {
 			ret = ltdc_encoder_init(ddev, bridge);
 			if (ret) {
-				DRM_ERROR("init encoder endpoint %d\n", i);
+				if (ret != -EPROBE_DEFER)
+					DRM_ERROR("init encoder endpoint %d\n", i);
 				goto err;
 			}
 		}
Signature · 1 line
2.25.1
maintainer Tested-by on v1 1/1
#1 lore raw

Hi Jagan,

thanks for the patch.

Quoted 46 lines · Jagan Teki

As dw-mipi-dsi supported all possible ways to find the DSI devices. It can take multiple iterations for ltdc to find all components attached to the DSI bridge.

The current ltdc driver failed to find the endpoint as it returned -EINVAL for the first iteration itself. This leads to following error:

[    3.099289] [drm:ltdc_load] *ERROR* init encoder endpoint 0

So, check the return value and cleanup the encoder only if it's not -EPROBE_DEFER. This make all components in the attached DSI bridge found properly.

---
  drivers/gpu/drm/stm/ltdc.c | 8 +++++---
  1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/stm/ltdc.c +5 -3
index 08b71248044d..95e983d3ffb5 100644
@@ -1122,8 +1122,9 @@ static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge)
 
  	ret = drm_bridge_attach(encoder, bridge, NULL, 0);
  	if (ret) {
-		drm_encoder_cleanup(encoder);
-		return -EINVAL;
+		if (ret != -EPROBE_DEFER)
+			drm_encoder_cleanup(encoder);
+		return ret;
  	}
 
  	DRM_DEBUG_DRIVER("Bridge encoder:%d created\n", encoder->base.id);
@@ -1266,7 +1267,8 @@ int ltdc_load(struct drm_device *ddev)
  		if (bridge) {
  			ret = ltdc_encoder_init(ddev, bridge);
  			if (ret) {
-				DRM_ERROR("init encoder endpoint %d\n", i);
+				if (ret != -EPROBE_DEFER)
+					DRM_ERROR("init encoder endpoint %d\n", i);
  				goto err;
  			}
  		}
maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Jagan Teki

Hi Jagan,

Quoted 24 lines · Jagan Teki

As dw-mipi-dsi supported all possible ways to find the DSI devices. It can take multiple iterations for ltdc to find all components attached to the DSI bridge.

The current ltdc driver failed to find the endpoint as it returned -EINVAL for the first iteration itself. This leads to following error:

[    3.099289] [drm:ltdc_load] *ERROR* init encoder endpoint 0

So, check the return value and cleanup the encoder only if it's not -EPROBE_DEFER. This make all components in the attached DSI bridge found properly.

---
  drivers/gpu/drm/stm/ltdc.c | 8 +++++---
  1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/stm/ltdc.c +0 -0
index 08b71248044d..95e983d3ffb5 100644

drivers/gpu/drm/stm/ltdc.c static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge) · line 1126

Quoted 7 lines
drivers/gpu/drm/stm/ltdc.c +2 -2
@@ -1122,8 +1122,9 @@ static int ltdc_encoder_init(struct drm_device *ddev, struct drm_bridge *bridge)
 
  	ret = drm_bridge_attach(encoder, bridge, NULL, 0);
  	if (ret) {
-		drm_encoder_cleanup(encoder);
-		return -EINVAL;
+		if (ret != -EPROBE_DEFER)
+			drm_encoder_cleanup(encoder);

Many thanks for your patch.

This means that we are counting on the future success of the deferred probe because we do not clean the encoder... However, Yannick gave his "Tested-by" and this patch seems useful so

I will merge it friday or early next week,

Thank you
Philippe :-)

Quoted 15 lines
drivers/gpu/drm/stm/ltdc.c +3 -1
+		return ret;
  	}
 
  	DRM_DEBUG_DRIVER("Bridge encoder:%d created\n", encoder->base.id);
@@ -1266,7 +1267,8 @@ int ltdc_load(struct drm_device *ddev)
  		if (bridge) {
  			ret = ltdc_encoder_init(ddev, bridge);
  			if (ret) {
-				DRM_ERROR("init encoder endpoint %d\n", i);
+				if (ret != -EPROBE_DEFER)
+					DRM_ERROR("init encoder endpoint %d\n", i);
  				goto err;
  			}
  		}
maintainer
#3 lore raw
Quoted 48 lines · Philippe CORNU

Hi Jagan,

Quoted 24 lines · Jagan Teki

As dw-mipi-dsi supported all possible ways to find the DSI devices. It can take multiple iterations for ltdc to find all components attached to the DSI bridge.

The current ltdc driver failed to find the endpoint as it returned -EINVAL for the first iteration itself. This leads to following error:

[    3.099289] [drm:ltdc_load] *ERROR* init encoder endpoint 0

So, check the return value and cleanup the encoder only if it's not -EPROBE_DEFER. This make all components in the attached DSI bridge found properly.

---
  drivers/gpu/drm/stm/ltdc.c | 8 +++++---

  1 file changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/stm/ltdc.c +0 -0
index 08b71248044d..95e983d3ffb5 100644

drivers/gpu/drm/stm/ltdc.c static int ltdc_encoder_init(struct drm_device · line 1126

Quoted 7 lines
drivers/gpu/drm/stm/ltdc.c +2 -2
@@ -1122,8 +1122,9 @@ static int ltdc_encoder_init(struct drm_device 
 *ddev, struct drm_bridge *bridge)
       ret = drm_bridge_attach(encoder, bridge, NULL, 0);
       if (ret) {
-        drm_encoder_cleanup(encoder);
-        return -EINVAL;
+        if (ret != -EPROBE_DEFER)
+            drm_encoder_cleanup(encoder);

Many thanks for your patch.

This means that we are counting on the future success of the deferred probe because we do not clean the encoder... However, Yannick gave his "Tested-by" and this patch seems useful so

I will merge it friday or early next week,

Thank you
Philippe :-)

Quoted 14 lines
Quoted 5 lines
drivers/gpu/drm/stm/ltdc.c +1 -0
+        return ret;
       }
       DRM_DEBUG_DRIVER("Bridge encoder:%d created\n", encoder->base.id);

drivers/gpu/drm/stm/ltdc.c int ltdc_load(struct drm_device *ddev) · line 1274

Quoted 9 lines
drivers/gpu/drm/stm/ltdc.c +2 -1
@@ -1266,7 +1267,8 @@ int ltdc_load(struct drm_device *ddev)
           if (bridge) {
               ret = ltdc_encoder_init(ddev, bridge);
               if (ret) {
-                DRM_ERROR("init encoder endpoint %d\n", i);
+                if (ret != -EPROBE_DEFER)
+                    DRM_ERROR("init encoder endpoint %d\n", i);
                   goto err;
               }
           }

Applied on drm-misc-next.
Many thanks for your patch,
Philippe :-)