MLK-18605-1 drm/bridge: sec-dsim: add cleanup when detach dsi client
authorFancy Fang <chen.fang@nxp.com>
Wed, 13 Jun 2018 09:32:58 +0000 (17:32 +0800)
committerLeonard Crestez <leonard.crestez@nxp.com>
Wed, 17 Apr 2019 23:51:34 +0000 (02:51 +0300)
When the dsi device is detached, the dsi parameters saved when
the dsi device is attached should be cleaned to avoid to be
misused. And besides, add some sanity check along with this
cleanup.

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit a02c30a0ed8acc4a136d2281431fa4b07d66b933)
(cherry picked from commit 0b78ed9b7c61d2b703c1065850bd5f25ea30482f)

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

index 6356469..12a9f9c 100644 (file)
@@ -326,7 +326,14 @@ static int sec_mipi_dsim_host_detach(struct mipi_dsi_host *host,
 {
        struct sec_mipi_dsim *dsim = to_sec_mipi_dsim(host);
 
-       dev_dbg(dsim->dev, "Nothing to be done\n");
+       if (WARN_ON(!dsim->next && !dsim->panel))
+               return -ENODEV;
+
+       /* clear the saved dsi parameters */
+       dsim->lanes      = 0;
+       dsim->channel    = 0;
+       dsim->format     = 0;
+       dsim->mode_flags = 0;
 
        return 0;
 }