MLK-18605-2 drm/bridge: sec-dsim: allow same panel can be re-attached
authorFancy Fang <chen.fang@nxp.com>
Wed, 13 Jun 2018 10:22:58 +0000 (18:22 +0800)
committerLeonard Crestez <leonard.crestez@nxp.com>
Wed, 17 Apr 2019 23:51:34 +0000 (02:51 +0300)
During the mode set procedure, some dsi client device may detach
itself first and then attach it again according to the target
display mode parameters. In this case, the dsi client device
should be allowed to be re-attached again. So this is also true
for panel device.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit f586625dd1a665c58b976405c7980b7414554481)
(cherry picked from commit 75f65aebfd661151811339d652e3704f5a7e3936)

drivers/gpu/drm/bridge/sec-dsim.c

index 12a9f9c..2aead7d 100644 (file)
@@ -272,10 +272,6 @@ static int sec_mipi_dsim_host_attach(struct mipi_dsi_host *host,
        struct device *dev = dsim->dev;
        struct drm_panel *panel;
 
-       /* Don't support multiple panels */
-       if (dsim->panel)
-               return -EBUSY;
-
        if (!dsi->lanes || dsi->lanes > pdata->max_data_lanes) {
                dev_err(dev, "invalid data lanes number\n");
                return -EINVAL;
@@ -299,11 +295,17 @@ static int sec_mipi_dsim_host_attach(struct mipi_dsi_host *host,
                return -EINVAL;
        }
 
-       if (!dsim->next && !dsim->panel) {
+       if (!dsim->next) {
                /* 'dsi' must be panel device */
                panel = of_drm_find_panel(dsi->dev.of_node);
                WARN_ON(!panel);
 
+               /* Don't support multiple panels */
+               if (dsim->panel && panel && dsim->panel != panel) {
+                       dev_err(dev, "don't support multiple panels\n");
+                       return -EBUSY;
+               }
+
                dsim->panel = panel;
        }