From: Molly Sophia <[email protected]>

Preparation for the follow-up nt35596s support, where not all sequences
are provided.

Signed-off-by: Molly Sophia <[email protected]>
Signed-off-by: Arnaud Ferraris <[email protected]>
Signed-off-by: David Heidelberg <[email protected]>
---
 drivers/gpu/drm/panel/panel-novatek-nt36672a.c | 27 ++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-novatek-nt36672a.c 
b/drivers/gpu/drm/panel/panel-novatek-nt36672a.c
index 
29e1f6aea48060384f4639999174b67097a6c8a7..f7518ec469176a4e2d4f2b03f8e77f03511a12a7
 100644
--- a/drivers/gpu/drm/panel/panel-novatek-nt36672a.c
+++ b/drivers/gpu/drm/panel/panel-novatek-nt36672a.c
@@ -117,12 +117,13 @@ static int nt36672a_panel_unprepare(struct drm_panel 
*panel)
        struct nt36672a_panel *pinfo = to_nt36672a_panel(panel);
        int ret;
 
-       /* send off cmds */
-       ret = nt36672a_send_cmds(panel, pinfo->desc->off_cmds,
-                                pinfo->desc->num_off_cmds);
-
-       if (ret < 0)
-               dev_err(panel->dev, "failed to send DCS off cmds: %d\n", ret);
+       if (pinfo->desc->num_off_cmds != 0) {
+               /* send off cmds if present */
+               ret = nt36672a_send_cmds(panel, pinfo->desc->off_cmds,
+                                        pinfo->desc->num_off_cmds);
+               if (ret < 0)
+                       dev_err(panel->dev, "failed to send DCS off cmds: 
%d\n", ret);
+       }
 
        ret = mipi_dsi_dcs_set_display_off(pinfo->link);
        if (ret < 0)
@@ -200,13 +201,15 @@ static int nt36672a_panel_prepare(struct drm_panel *panel)
                goto poweroff;
        }
 
-       /* Send rest of the init cmds */
-       err = nt36672a_send_cmds(panel, pinfo->desc->on_cmds_2,
-                                pinfo->desc->num_on_cmds_2);
+       if (pinfo->desc->num_on_cmds_2 != 0) {
+               /* Send rest of the init cmds if present */
+               err = nt36672a_send_cmds(panel, pinfo->desc->on_cmds_2,
+                                        pinfo->desc->num_on_cmds_2);
 
-       if (err < 0) {
-               dev_err(panel->dev, "failed to send DCS Init 2nd Code: %d\n", 
err);
-               goto poweroff;
+               if (err < 0) {
+                       dev_err(panel->dev, "failed to send DCS Init 2nd Code: 
%d\n", err);
+                       goto poweroff;
+               }
        }
 
        msleep(120);

-- 
2.51.0


Reply via email to