drm/panel: Add error handling for write of dsi
authorHoegeun Kwon <hoegeun.kwon@samsung.com>
Mon, 18 Feb 2019 05:40:49 +0000 (14:40 +0900)
committerJunghoon Kim <jhoon20.kim@samsung.com>
Thu, 2 Apr 2020 04:09:02 +0000 (13:09 +0900)
There is a problem that dsi write timeout even when dsi interrupt is
activated by adding 'ignore_lcd=1' flag to config.txt. Add error
handling to write once more when timeout occurs.

Change-Id: If1deb9753a02a3082e7a1ba59ee20531828447d9
Signed-off-by: Hoegeun Kwon <hoegeun.kwon@samsung.com>
drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c

index aab6a70..d08faa7 100644 (file)
@@ -238,6 +238,7 @@ static void rpi_touchscreen_i2c_write(struct rpi_touchscreen *ts,
 
 static int rpi_touchscreen_write(struct rpi_touchscreen *ts, u16 reg, u32 val)
 {
+       int ret;
        u8 msg[] = {
                reg,
                reg >> 8,
@@ -247,7 +248,14 @@ static int rpi_touchscreen_write(struct rpi_touchscreen *ts, u16 reg, u32 val)
                val >> 24,
        };
 
-       mipi_dsi_generic_write(ts->dsi, msg, sizeof(msg));
+       ret = mipi_dsi_generic_write(ts->dsi, msg, sizeof(msg));
+       /*
+        * WORKAROUND: There is a problem that timeout occurs even though
+        * dsi interrupts occur. Add error handling to write once more
+        * when timeout occurs.
+        */
+       if (ret == -ETIMEDOUT)
+               mipi_dsi_generic_write(ts->dsi, msg, sizeof(msg));
 
        return 0;
 }