[PATCH RFC 4/5] drm/msm: mdp4 lvds: continue if the panel is not connected

Srinivas Kandagatla srinivas.kandagatla at linaro.org
Fri Aug 14 08:51:04 PDT 2015


Two issues:

1> Intializing panel specific bits without actual panel presence.
2> Bailing out if the detect_panel() return -ENODEV.

With the existing code if detect_panel() returns an error code the
driver would bail out without doing anything, However it could continue
intializing hdmi related things. This patch adds two things.

1> moves the panel specific intialization only if the panel is detected
2> let the driver continue with hdmi intialization if detect_panel()
return -ENODEV.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla at linaro.org>
---
 drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c | 72 +++++++++++++++++++--------------
 1 file changed, 41 insertions(+), 31 deletions(-)

diff --git a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
index 601dcc0..ad02b8b 100644
--- a/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
+++ b/drivers/gpu/drm/msm/mdp/mdp4/mdp4_kms.c
@@ -313,45 +313,55 @@ static int modeset_init(struct mdp4_kms *mdp4_kms)
 	if (IS_ERR(panel)) {
 		ret = PTR_ERR(panel);
 		dev_err(dev->dev, "failed to detect LVDS panel: %d\n", ret);
-		goto fail;
-	}
+		/**
+		 * Only fail if there is panel but not ready yet
+		 * continue with other stuff if there is no panel connected.
+		 */
+		if (ret == -EPROBE_DEFER)
+			goto fail;
+	} else {
+		plane = mdp4_plane_init(dev, RGB2, true);
+		if (IS_ERR(plane)) {
+			dev_err(dev->dev,
+				"failed to construct plane for RGB2\n");
+			ret = PTR_ERR(plane);
+			goto fail;
+		}
 
-	plane = mdp4_plane_init(dev, RGB2, true);
-	if (IS_ERR(plane)) {
-		dev_err(dev->dev, "failed to construct plane for RGB2\n");
-		ret = PTR_ERR(plane);
-		goto fail;
-	}
+		crtc  = mdp4_crtc_init(dev, plane, priv->num_crtcs, 0, DMA_P);
+		if (IS_ERR(crtc)) {
+			dev_err(dev->dev,
+				"failed to construct crtc for DMA_P\n");
+			ret = PTR_ERR(crtc);
+			goto fail;
+		}
 
-	crtc  = mdp4_crtc_init(dev, plane, priv->num_crtcs, 0, DMA_P);
-	if (IS_ERR(crtc)) {
-		dev_err(dev->dev, "failed to construct crtc for DMA_P\n");
-		ret = PTR_ERR(crtc);
-		goto fail;
-	}
+		encoder = mdp4_lcdc_encoder_init(dev, panel);
+		if (IS_ERR(encoder)) {
+			dev_err(dev->dev,
+				"failed to construct LCDC encoder\n");
+			ret = PTR_ERR(encoder);
+			goto fail;
+		}
 
-	encoder = mdp4_lcdc_encoder_init(dev, panel);
-	if (IS_ERR(encoder)) {
-		dev_err(dev->dev, "failed to construct LCDC encoder\n");
-		ret = PTR_ERR(encoder);
-		goto fail;
-	}
+		/* LCDC can be hooked to DMA_P: */
+		encoder->possible_crtcs = 1 << priv->num_crtcs;
 
-	/* LCDC can be hooked to DMA_P: */
-	encoder->possible_crtcs = 1 << priv->num_crtcs;
+		priv->crtcs[priv->num_crtcs++] = crtc;
+		priv->encoders[priv->num_encoders++] = encoder;
 
-	priv->crtcs[priv->num_crtcs++] = crtc;
-	priv->encoders[priv->num_encoders++] = encoder;
+		connector = mdp4_lvds_connector_init(dev, panel, encoder);
+		if (IS_ERR(connector)) {
+			ret = PTR_ERR(connector);
+			dev_err(dev->dev,
+				"failed to initialize LVDS connector: %d\n",
+				ret);
+			goto fail;
+		}
 
-	connector = mdp4_lvds_connector_init(dev, panel, encoder);
-	if (IS_ERR(connector)) {
-		ret = PTR_ERR(connector);
-		dev_err(dev->dev, "failed to initialize LVDS connector: %d\n", ret);
-		goto fail;
+		priv->connectors[priv->num_connectors++] = connector;
 	}
 
-	priv->connectors[priv->num_connectors++] = connector;
-
 	/*
 	 * Setup DTV/HDMI path: RGB1 -> DMA_E -> DTV -> HDMI:
 	 */
-- 
1.9.1



More information about the dri-devel mailing list