video: tegra: dsi: attempt retry for dsi write fail
Prafull Suryawanshi [Thu, 20 Aug 2015 09:03:52 +0000 (14:03 +0530)]
This logic adds retry attempts for possible dsi write
failure. It also takes care of error to be propagated to
caller.

bug 200124422

Change-Id: I652ac4c6e513585a4f94048b6596e4aec9f22b4b
Signed-off-by: Prafull Suryawanshi <prafulls@nvidia.com>
Reviewed-on: http://git-master/r/786469
(cherry picked from commit e9f89cda70103526c1a524576de6d310fed434f2)
Reviewed-on: http://git-master/r/815057
GVS: Gerrit_Virtual_Submit
Reviewed-by: Mitch Luban <mluban@nvidia.com>

drivers/video/tegra/dc/dsi.c
drivers/video/tegra/dc/dsi.h

index 5a75bef..a0e26c4 100644 (file)
@@ -3382,6 +3382,7 @@ static int tegra_dsi_write_data_nosync(struct tegra_dc *dc,
                        struct tegra_dsi_cmd *cmd, u8 delay_ms)
 {
        int err = 0;
+       int restore_err = 0;
        struct dsi_status *init_status;
 
        init_status = tegra_dsi_prepare_host_transmission(
@@ -3393,8 +3394,13 @@ static int tegra_dsi_write_data_nosync(struct tegra_dc *dc,
        }
 
        err = _tegra_dsi_write_data(dsi, cmd);
-       if (err < 0)
+       if (err < 0) {
                dev_err(&dc->ndev->dev, "Failed DSI write\n");
+               restore_err = tegra_dsi_restore_state(dc, dsi, init_status);
+               if (restore_err < 0)
+                       dev_err(&dc->ndev->dev, "Failed to restore prev state\n");
+               goto fail;
+       }
 
        mdelay(delay_ms);
 
@@ -3494,6 +3500,7 @@ int tegra_dsi_send_panel_cmd(struct tegra_dc *dc,
        u32 i;
        int err;
        u8 delay_ms;
+       int retry_count;
 
        err = 0;
        for (i = 0; i < n_cmd; i++) {
@@ -3534,10 +3541,18 @@ int tegra_dsi_send_panel_cmd(struct tegra_dc *dc,
                                delay_ms = cmd[i + 1].sp_len_dly.delay_ms;
                                i++;
                        }
-                       err = tegra_dsi_write_data_nosync(dc, dsi,
+                       retry_count = DSI_WRITE_DATA_RETRY_ATTEMPTS;
+                       do {
+                               err = tegra_dsi_write_data_nosync(dc, dsi,
                                                        cur_cmd, delay_ms);
-                       if (err < 0)
-                               break;
+                               if (err < 0) {
+                                       retry_count--;
+                                       dev_err(&dsi->dc->ndev->dev,
+                                               "dsi: %s failed, retrying...\n",__func__);
+                               } else {
+                                       retry_count = 0;
+                               }
+                       } while (retry_count);
                }
        }
        return err;
index 93030ed..2d905f4 100644 (file)
@@ -168,6 +168,8 @@ struct tegra_dc_dsi_data {
 
 #define DSI_DELAY_FOR_READ_FIFO 5
 
+#define DSI_WRITE_DATA_RETRY_ATTEMPTS 5
+
 /* Dsi virtual channel bit position, refer to the DSI specs */
 #define DSI_VIR_CHANNEL_BIT_POSITION   6