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)
committerHoegeun Kwon <hoegeun.kwon@samsung.com>
Mon, 7 Feb 2022 07:09:31 +0000 (16: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 3f0c11f..1044838 100644 (file)
@@ -262,6 +262,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,
@@ -271,7 +272,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;
 }