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: submit/tizen/20200402.094258~93 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4866faeb778538da80c8e23640dbc1a6c51e72de;p=platform%2Fkernel%2Flinux-rpi.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 79972da..980224f 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; @@ -1620,30 +1643,6 @@ static int vc4_dsi_bind(struct device *dev, struct device *master, void *data) goto rel_dma_exit; } - 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; - - goto rel_dma_exit; - } - - if (panel) { - dsi->bridge = devm_drm_panel_bridge_add(dev, panel, - DRM_MODE_CONNECTOR_DSI); - if (IS_ERR(dsi->bridge)){ - ret = PTR_ERR(dsi->bridge); - goto rel_dma_exit; - } - } - /* The esc clock rate is supposed to always be 100Mhz. */ ret = clk_set_rate(dsi->escape_clock, 100 * 1000000); if (ret) { @@ -1662,10 +1661,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); - goto rel_dma_exit; + if (dsi->bridge) { + ret = drm_bridge_attach(dsi->encoder, dsi->bridge, NULL); + if (ret) { + dev_err(dev, "bridge attach failed: %d\n", ret); + goto rel_dma_exit; + } } /* Disable the atomic helper calls into the bridge. We * manually call the bridge pre_enable / enable / etc. calls