Skip to contentSkip to conversation

drm/tinydrm/mi0283qt: Always set rotation value

PATCH Applied Tom Callaway 3 participants 5 messages Apr 23, 2018 – Apr 30, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/tinydrm/mi0283qt: Always set rotation value

The PiTFT (ili9340) has a hardware reset circuit that resets only on power-on and not on each reboot through a gpio like the rpi-display does. As a result, we need to always apply the rotation value regardless of the display "on/off" state. Moved the rotation setting code below out_enable:.

---
 drivers/gpu/drm/tinydrm/mi0283qt.c | 41 +++++++++++++++++++++-----------------
 1 file changed, 23 insertions(+), 18 deletions(-)
drivers/gpu/drm/tinydrm/mi0283qt.c +23 -18
index 4e6d2ee94e55..2bb9e3ce4823 100644
@@ -84,24 +84,6 @@ static void mi0283qt_enable(struct drm_simple_display_pipe *pipe,
 	/* Memory Access Control */
 	mipi_dbi_command(mipi, MIPI_DCS_SET_PIXEL_FORMAT, MIPI_DCS_PIXEL_FMT_16BIT);
 
-	switch (mipi->rotation) {
-	default:
-		addr_mode = ILI9341_MADCTL_MV | ILI9341_MADCTL_MY |
-			    ILI9341_MADCTL_MX;
-		break;
-	case 90:
-		addr_mode = ILI9341_MADCTL_MY;
-		break;
-	case 180:
-		addr_mode = ILI9341_MADCTL_MV;
-		break;
-	case 270:
-		addr_mode = ILI9341_MADCTL_MX;
-		break;
-	}
-	addr_mode |= ILI9341_MADCTL_BGR;
-	mipi_dbi_command(mipi, MIPI_DCS_SET_ADDRESS_MODE, addr_mode);
-
 	/* Frame Rate */
 	mipi_dbi_command(mipi, ILI9341_FRMCTR1, 0x00, 0x1b);
 
@@ -127,6 +109,29 @@ static void mi0283qt_enable(struct drm_simple_display_pipe *pipe,
 	msleep(100);
 
 out_enable:
+	/* The PiTFT (ili9340) has a hardware reset circuit that
+	 * resets only on power-on and not on each reboot through
+	 * a gpio like the rpi-display does.
+	 * As a result, we need to always apply the rotation value
+	 * regardless of the display "on/off" state.
+	 */
+	switch (mipi->rotation) {
+	default:
+		addr_mode = ILI9341_MADCTL_MV | ILI9341_MADCTL_MY |
+			    ILI9341_MADCTL_MX;
+		break;
+	case 90:
+		addr_mode = ILI9341_MADCTL_MY;
+		break;
+	case 180:
+		addr_mode = ILI9341_MADCTL_MV;
+		break;
+	case 270:
+		addr_mode = ILI9341_MADCTL_MX;
+		break;
+	}
+	addr_mode |= ILI9341_MADCTL_BGR;
+	mipi_dbi_command(mipi, MIPI_DCS_SET_ADDRESS_MODE, addr_mode);
 	mipi_dbi_enable_flush(mipi, crtc_state, plane_state);
 }
 
Signature · 6 lines
2.14.3

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#1 lore raw

Den 23.04.2018 18.16, skrev Tom Callaway:

Quoted 60 lines

The PiTFT (ili9340) has a hardware reset circuit that resets only on power-on and not on each reboot through a gpio like the rpi-display does. As a result, we need to always apply the rotation value regardless of the display "on/off" state. Moved the rotation setting code below out_enable:.

---
  drivers/gpu/drm/tinydrm/mi0283qt.c | 41 +++++++++++++++++++++-----------------
  1 file changed, 23 insertions(+), 18 deletions(-)
drivers/gpu/drm/tinydrm/mi0283qt.c +16 -18
index 4e6d2ee94e55..2bb9e3ce4823 100644
@@ -84,24 +84,6 @@ static void mi0283qt_enable(struct drm_simple_display_pipe *pipe,
  	/* Memory Access Control */
  	mipi_dbi_command(mipi, MIPI_DCS_SET_PIXEL_FORMAT, MIPI_DCS_PIXEL_FMT_16BIT);
 
-	switch (mipi->rotation) {
-	default:
-		addr_mode = ILI9341_MADCTL_MV | ILI9341_MADCTL_MY |
-			    ILI9341_MADCTL_MX;
-		break;
-	case 90:
-		addr_mode = ILI9341_MADCTL_MY;
-		break;
-	case 180:
-		addr_mode = ILI9341_MADCTL_MV;
-		break;
-	case 270:
-		addr_mode = ILI9341_MADCTL_MX;
-		break;
-	}
-	addr_mode |= ILI9341_MADCTL_BGR;
-	mipi_dbi_command(mipi, MIPI_DCS_SET_ADDRESS_MODE, addr_mode);
-
  	/* Frame Rate */
  	mipi_dbi_command(mipi, ILI9341_FRMCTR1, 0x00, 0x1b);
 
@@ -127,6 +109,29 @@ static void mi0283qt_enable(struct drm_simple_display_pipe *pipe,
  	msleep(100);
 
  out_enable:
+	/* The PiTFT (ili9340) has a hardware reset circuit that
+	 * resets only on power-on and not on each reboot through
+	 * a gpio like the rpi-display does.
+	 * As a result, we need to always apply the rotation value
+	 * regardless of the display "on/off" state.
+	 */
+	switch (mipi->rotation) {
+	default:
+		addr_mode = ILI9341_MADCTL_MV | ILI9341_MADCTL_MY |
+			    ILI9341_MADCTL_MX;
+		break;
+	case 90:
+		addr_mode = ILI9341_MADCTL_MY;
+		break;
+	case 180:
+		addr_mode = ILI9341_MADCTL_MV;

drivers/gpu/drm/tinydrm/mi0283qt.c static void mi0283qt_enable(struct drm_simple_display_pipe *pipe, · line 137

Quoted 10 lines
drivers/gpu/drm/tinydrm/mi0283qt.c +7 -0
+		break;
+	case 270:
+		addr_mode = ILI9341_MADCTL_MX;
+		break;
+	}
+	addr_mode |= ILI9341_MADCTL_BGR;
+	mipi_dbi_command(mipi, MIPI_DCS_SET_ADDRESS_MODE, addr_mode);
  	mipi_dbi_enable_flush(mipi, crtc_state, plane_state);
  }
 

Thanks for fixing this.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw
Quoted 79 lines · Noralf Trønnes

Den 23.04.2018 18.16, skrev Tom Callaway:

Quoted 63 lines

The PiTFT (ili9340) has a hardware reset circuit that resets only on power-on and not on each reboot through a gpio like the rpi-display does. As a result, we need to always apply the rotation value regardless of the display "on/off" state. Moved the rotation setting code below out_enable:.

---
  drivers/gpu/drm/tinydrm/mi0283qt.c | 41
+++++++++++++++++++++-----------------
  1 file changed, 23 insertions(+), 18 deletions(-)
drivers/gpu/drm/tinydrm/mi0283qt.c +0 -17
index 4e6d2ee94e55..2bb9e3ce4823 100644
@@ -84,24 +84,6 @@ static void mi0283qt_enable(struct
 drm_simple_display_pipe *pipe,
        /* Memory Access Control */
        mipi_dbi_command(mipi, MIPI_DCS_SET_PIXEL_FORMAT,
 MIPI_DCS_PIXEL_FMT_16BIT);
  -     switch (mipi->rotation) {
-       default:
-               addr_mode = ILI9341_MADCTL_MV | ILI9341_MADCTL_MY |
-                           ILI9341_MADCTL_MX;
-               break;
-       case 90:
-               addr_mode = ILI9341_MADCTL_MY;
-               break;
-       case 180:
-               addr_mode = ILI9341_MADCTL_MV;
-               break;
-       case 270:
-               addr_mode = ILI9341_MADCTL_MX;
-               break;
-       }
-       addr_mode |= ILI9341_MADCTL_BGR;
-       mipi_dbi_command(mipi, MIPI_DCS_SET_ADDRESS_MODE, addr_mode);
-
        /* Frame Rate */
        mipi_dbi_command(mipi, ILI9341_FRMCTR1, 0x00, 0x1b);
  @@ -127,6 +109,29 @@ static void mi0283qt_enable(struct

drm_simple_display_pipe *pipe,

        msleep(100);
    out_enable:
drivers/gpu/drm/tinydrm/mi0283qt.c +15 -0
+       /* The PiTFT (ili9340) has a hardware reset circuit that
+        * resets only on power-on and not on each reboot through
+        * a gpio like the rpi-display does.
+        * As a result, we need to always apply the rotation value
+        * regardless of the display "on/off" state.
+        */
+       switch (mipi->rotation) {
+       default:
+               addr_mode = ILI9341_MADCTL_MV | ILI9341_MADCTL_MY |
+                           ILI9341_MADCTL_MX;
+               break;
+       case 90:
+               addr_mode = ILI9341_MADCTL_MY;
+               break;
+       case 180:

drivers/gpu/drm/tinydrm/mi0283qt.c static void mi0283qt_enable(struct drm_simple_display_pipe *pipe, · line 136

Quoted 10 lines
drivers/gpu/drm/tinydrm/mi0283qt.c +8 -0
+               addr_mode = ILI9341_MADCTL_MV;
+               break;
+       case 270:
+               addr_mode = ILI9341_MADCTL_MX;
+               break;
+       }
+       addr_mode |= ILI9341_MADCTL_BGR;
+       mipi_dbi_command(mipi, MIPI_DCS_SET_ADDRESS_MODE, addr_mode);
        mipi_dbi_enable_flush(mipi, crtc_state, plane_state);
  }

Thanks for fixing this.

Quoted 1 line

Tom doesn't have commit rights, so would be on you to get this merged. -Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw

Den 24.04.2018 21.16, skrev Daniel Vetter:

Quoted 77 lines · Noralf Trønnes
Quoted 76 lines

Den 23.04.2018 18.16, skrev Tom Callaway:

Quoted 62 lines

The PiTFT (ili9340) has a hardware reset circuit that resets only on power-on and not on each reboot through a gpio like the rpi-display does. As a result, we need to always apply the rotation value regardless of the display "on/off" state. Moved the rotation setting code below out_enable:.

---
   drivers/gpu/drm/tinydrm/mi0283qt.c | 41
+++++++++++++++++++++-----------------
   1 file changed, 23 insertions(+), 18 deletions(-)
drivers/gpu/drm/tinydrm/mi0283qt.c +0 -17
index 4e6d2ee94e55..2bb9e3ce4823 100644
@@ -84,24 +84,6 @@ static void mi0283qt_enable(struct
 drm_simple_display_pipe *pipe,
         /* Memory Access Control */
         mipi_dbi_command(mipi, MIPI_DCS_SET_PIXEL_FORMAT,
 MIPI_DCS_PIXEL_FMT_16BIT);
   -     switch (mipi->rotation) {
-       default:
-               addr_mode = ILI9341_MADCTL_MV | ILI9341_MADCTL_MY |
-                           ILI9341_MADCTL_MX;
-               break;
-       case 90:
-               addr_mode = ILI9341_MADCTL_MY;
-               break;
-       case 180:
-               addr_mode = ILI9341_MADCTL_MV;
-               break;
-       case 270:
-               addr_mode = ILI9341_MADCTL_MX;
-               break;
-       }
-       addr_mode |= ILI9341_MADCTL_BGR;
-       mipi_dbi_command(mipi, MIPI_DCS_SET_ADDRESS_MODE, addr_mode);
-
         /* Frame Rate */
         mipi_dbi_command(mipi, ILI9341_FRMCTR1, 0x00, 0x1b);
   @@ -127,6 +109,29 @@ static void mi0283qt_enable(struct

drm_simple_display_pipe *pipe,

         msleep(100);
     out_enable:
drivers/gpu/drm/tinydrm/mi0283qt.c +15 -0
+       /* The PiTFT (ili9340) has a hardware reset circuit that
+        * resets only on power-on and not on each reboot through
+        * a gpio like the rpi-display does.
+        * As a result, we need to always apply the rotation value
+        * regardless of the display "on/off" state.
+        */
+       switch (mipi->rotation) {
+       default:
+               addr_mode = ILI9341_MADCTL_MV | ILI9341_MADCTL_MY |
+                           ILI9341_MADCTL_MX;
+               break;
+       case 90:
+               addr_mode = ILI9341_MADCTL_MY;
+               break;
+       case 180:

drivers/gpu/drm/tinydrm/mi0283qt.c static void mi0283qt_enable(struct drm_simple_display_pipe *pipe, · line 136

Quoted 10 lines
drivers/gpu/drm/tinydrm/mi0283qt.c +8 -0
+               addr_mode = ILI9341_MADCTL_MV;
+               break;
+       case 270:
+               addr_mode = ILI9341_MADCTL_MX;
+               break;
+       }
+       addr_mode |= ILI9341_MADCTL_BGR;
+       mipi_dbi_command(mipi, MIPI_DCS_SET_ADDRESS_MODE, addr_mode);
         mipi_dbi_enable_flush(mipi, crtc_state, plane_state);
   }

Thanks for fixing this.

Quoted 3 lines
Quoted 1 line

Tom doesn't have commit rights, so would be on you to get this merged. -Daniel

Sure, that was my intention, should have mentioned it.

Noralf.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#4 lore raw
In reply to Noralf Trønnes

Den 24.04.2018 18.52, skrev Noralf Trønnes:

Quoted 73 lines

Den 23.04.2018 18.16, skrev Tom Callaway:

Quoted 60 lines

The PiTFT (ili9340) has a hardware reset circuit that resets only on power-on and not on each reboot through a gpio like the rpi-display does. As a result, we need to always apply the rotation value regardless of the display "on/off" state. Moved the rotation setting code below out_enable:.

---
  drivers/gpu/drm/tinydrm/mi0283qt.c | 41
+++++++++++++++++++++-----------------

  1 file changed, 23 insertions(+), 18 deletions(-)
drivers/gpu/drm/tinydrm/mi0283qt.c +0 -17
index 4e6d2ee94e55..2bb9e3ce4823 100644
@@ -84,24 +84,6 @@ static void mi0283qt_enable(struct 
 drm_simple_display_pipe *pipe,
       /* Memory Access Control */
       mipi_dbi_command(mipi, MIPI_DCS_SET_PIXEL_FORMAT, MIPI_DCS_PIXEL_FMT_16BIT);
   -    switch (mipi->rotation) {
-    default:
-        addr_mode = ILI9341_MADCTL_MV | ILI9341_MADCTL_MY |
-                ILI9341_MADCTL_MX;
-        break;
-    case 90:
-        addr_mode = ILI9341_MADCTL_MY;
-        break;
-    case 180:
-        addr_mode = ILI9341_MADCTL_MV;
-        break;
-    case 270:
-        addr_mode = ILI9341_MADCTL_MX;
-        break;
-    }
-    addr_mode |= ILI9341_MADCTL_BGR;
-    mipi_dbi_command(mipi, MIPI_DCS_SET_ADDRESS_MODE, addr_mode);
-
       /* Frame Rate */
       mipi_dbi_command(mipi, ILI9341_FRMCTR1, 0x00, 0x1b);

  @@ -127,6 +109,29 @@ static void mi0283qt_enable(struct drm_simple_display_pipe *pipe, msleep(100);
    out_enable:
+    /* The PiTFT (ili9340) has a hardware reset circuit that
+     * resets only on power-on and not on each reboot through
+     * a gpio like the rpi-display does.
+     * As a result, we need to always apply the rotation value
+     * regardless of the display "on/off" state.
+     */
+    switch (mipi->rotation) {
+    default:
+        addr_mode = ILI9341_MADCTL_MV | ILI9341_MADCTL_MY |
+                ILI9341_MADCTL_MX;
+        break;
+    case 90:
+        addr_mode = ILI9341_MADCTL_MY;
+        break;
+    case 180:
+        addr_mode = ILI9341_MADCTL_MV;
+        break;

Quoted 8 lines

+    case 270:
+        addr_mode = ILI9341_MADCTL_MX;
+        break;
+    }
+    addr_mode |= ILI9341_MADCTL_BGR;
+    mipi_dbi_command(mipi, MIPI_DCS_SET_ADDRESS_MODE, addr_mode); mipi_dbi_enable_flush(mipi, crtc_state, plane_state); }

Thanks for fixing this.

Quoted 2 lines

Applied to drm-misc.

Noralf.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel