From: Hoegeun Kwon Date: Thu, 4 Jul 2019 08:40:58 +0000 (+0900) Subject: drm/vc4: Fix change to find_panel in the dsi_attach func X-Git-Tag: accepted/tizen/unified/20190708.114147~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=33628acb253b88e9c5a5f1777a292731b9217f81;p=platform%2Fkernel%2Flinux-rpi3.git drm/vc4: Fix change to find_panel in the dsi_attach func There is a problem that crtc does not bind while continuously requesting EPROBE_DEFER, if dsi_bind does not successfully bind. We need to change the part of find_panel in bind to dsi_attach function. Change-Id: Ifce518f047f496079eb8fbe112dabbd9bc7488bb Signed-off-by: Hoegeun Kwon --- diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c index fa2e9db..2dcaabb 100644 --- a/drivers/gpu/drm/vc4/vc4_dsi.c +++ b/drivers/gpu/drm/vc4/vc4_dsi.c @@ -1306,6 +1306,8 @@ static int vc4_dsi_host_attach(struct mipi_dsi_host *host, struct mipi_dsi_device *device) { struct vc4_dsi *dsi = host_to_dsi(host); + struct drm_panel *panel; + int ret; dsi->lanes = device->lanes; dsi->channel = device->channel; @@ -1340,6 +1342,28 @@ static int vc4_dsi_host_attach(struct mipi_dsi_host *host, return 0; } + ret = drm_of_find_panel_or_bridge(dsi->pdev->dev.of_node, 0, 0, + &panel, &dsi->bridge); + if (ret) { + /* If the bridge or panel pointed by dev->of_node is not + * enabled, just return 0 here so that we don't prevent the DRM + * dev from being registered. Of course that means the DSI + * encoder won't be exposed, but that's not a problem since + * nothing is connected to it. + */ + if (ret == -ENODEV) + return 0; + + return ret; + } + + if (panel) { + dsi->bridge = devm_drm_panel_bridge_add(&dsi->pdev->dev, panel, + DRM_MODE_CONNECTOR_DSI); + if (IS_ERR(dsi->bridge)) + return PTR_ERR(dsi->bridge); + } + return 0; } @@ -1510,7 +1534,6 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) struct vc4_dev *vc4 = to_vc4_dev(drm); struct vc4_dsi *dsi = dev_get_drvdata(dev); struct vc4_dsi_encoder *vc4_dsi_encoder; - struct drm_panel *panel; const struct of_device_id *match; dma_cap_mask_t dma_mask; int ret; @@ -1616,28 +1639,6 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) return ret; } - ret = drm_of_find_panel_or_bridge(dev->of_node, 0, 0, - &panel, &dsi->bridge); - if (ret) { - /* If the bridge or panel pointed by dev->of_node is not - * enabled, just return 0 here so that we don't prevent the DRM - * dev from being registered. Of course that means the DSI - * encoder won't be exposed, but that's not a problem since - * nothing is connected to it. - */ - if (ret == -ENODEV) - return 0; - - return ret; - } - - if (panel) { - dsi->bridge = devm_drm_panel_bridge_add(dev, panel, - DRM_MODE_CONNECTOR_DSI); - if (IS_ERR(dsi->bridge)) - return PTR_ERR(dsi->bridge); - } - /* The esc clock rate is supposed to always be 100Mhz. */ ret = clk_set_rate(dsi->escape_clock, 100 * 1000000); if (ret) { @@ -1656,10 +1657,12 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) DRM_MODE_ENCODER_DSI, NULL); drm_encoder_helper_add(dsi->encoder, &vc4_dsi_encoder_helper_funcs); - ret = drm_bridge_attach(dsi->encoder, dsi->bridge, NULL); - if (ret) { - dev_err(dev, "bridge attach failed: %d\n", ret); - return ret; + if (dsi->bridge) { + ret = drm_bridge_attach(dsi->encoder, dsi->bridge, NULL); + if (ret) { + dev_err(dev, "bridge attach failed: %d\n", ret); + return ret; + } } /* Disable the atomic helper calls into the bridge. We * manually call the bridge pre_enable / enable / etc. calls