Skip to contentSkip to conversation

drm: mxsfb: Enable recovery on underflow

PATCH In review Marek Vasut 4 participants 6 messages Jun 20, 2021 – Jul 2, 2021

Subsystems (4)
lore
Share & tools
lore

Marek Vasut

author maintainer
#0 lore raw

PATCH 1/1 drm: mxsfb: Enable recovery on underflow

There is some sort of corner case behavior of the controller, which could rarely be triggered at least on i.MX6SX connected to 800x480 DPI panel and i.MX8MM connected to DPI->DSI->LVDS bridged 1920x1080 panel (and likely on other setups too), where the image on the panel shifts to the right and wraps around. This happens either when the controller is enabled on boot or even later during run time. The condition does not correct itself automatically, i.e. the display image remains shifted.

It seems this problem is known and is due to sporadic underflows of the LCDIF FIFO. While the LCDIF IP does have underflow/overflow IRQs, neither of the IRQs trigger and neither IRQ status bit is asserted when this condition occurs.

All known revisions of the LCDIF IP have CTRL1 RECOVER_ON_UNDERFLOW bit, which is described in the reference manual since i.MX23 as "
Set this bit to enable the LCDIF block to recover in the next field/frame if there was an underflow in the current field/frame.
"
Enable this bit to mitigate the sporadic underflows.

Fixes 45d59d704080 ("drm: Add new driver for MXSFB controller")
Cc Daniel Abrecht <[email protected]>
Cc Emil Velikov <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Lucas Stach <[email protected]>
Cc Stefan Agner <[email protected]>
---
 drivers/gpu/drm/mxsfb/mxsfb_kms.c  | 29 +++++++++++++++++++++++++++++
 drivers/gpu/drm/mxsfb/mxsfb_regs.h |  1 +
 2 files changed, 30 insertions(+)
drivers/gpu/drm/mxsfb/mxsfb_kms.c +29 -0
index 300e7bab0f43..01e0f525360f 100644
@@ -115,6 +115,35 @@ static void mxsfb_enable_controller(struct mxsfb_drm_private *mxsfb)
 	reg |= VDCTRL4_SYNC_SIGNALS_ON;
 	writel(reg, mxsfb->base + LCDC_VDCTRL4);
 
+	/*
+	 * Enable recovery on underflow.
+	 *
+	 * There is some sort of corner case behavior of the controller,
+	 * which could rarely be triggered at least on i.MX6SX connected
+	 * to 800x480 DPI panel and i.MX8MM connected to DPI->DSI->LVDS
+	 * bridged 1920x1080 panel (and likely on other setups too), where
+	 * the image on the panel shifts to the right and wraps around.
+	 * This happens either when the controller is enabled on boot or
+	 * even later during run time. The condition does not correct
+	 * itself automatically, i.e. the display image remains shifted.
+	 *
+	 * It seems this problem is known and is due to sporadic underflows
+	 * of the LCDIF FIFO. While the LCDIF IP does have underflow/overflow
+	 * IRQs, neither of the IRQs trigger and neither IRQ status bit is
+	 * asserted when this condition occurs.
+	 *
+	 * All known revisions of the LCDIF IP have CTRL1 RECOVER_ON_UNDERFLOW
+	 * bit, which is described in the reference manual since i.MX23 as
+	 * "
+	 *   Set this bit to enable the LCDIF block to recover in the next
+	 *   field/frame if there was an underflow in the current field/frame.
+	 * "
+	 * Enable this bit to mitigate the sporadic underflows.
+	 */
+	reg = readl(mxsfb->base + LCDC_CTRL1);
+	reg |= CTRL1_RECOVER_ON_UNDERFLOW;
+	writel(reg, mxsfb->base + LCDC_CTRL1);
+
 	writel(CTRL_RUN, mxsfb->base + LCDC_CTRL + REG_SET);
 }
 
drivers/gpu/drm/mxsfb/mxsfb_regs.h +1 -0
index 55d28a27f912..df90e960f495 100644
@@ -54,6 +54,7 @@
 #define CTRL_DF24			BIT(1)
 #define CTRL_RUN			BIT(0)
 
+#define CTRL1_RECOVER_ON_UNDERFLOW	BIT(24)
 #define CTRL1_FIFO_CLEAR		BIT(21)
 #define CTRL1_SET_BYTE_PACKAGING(x)	(((x) & 0xf) << 16)
 #define CTRL1_GET_BYTE_PACKAGING(x)	(((x) >> 16) & 0xf)
Signature · 1 line
2.30.2
Reviewed-by on v1 1/1
#1 lore raw

Am Montag, dem 21.06.2021 um 00:47 +0200 schrieb Marek Vasut:

Quoted 22 lines

There is some sort of corner case behavior of the controller, which could rarely be triggered at least on i.MX6SX connected to 800x480 DPI panel and i.MX8MM connected to DPI->DSI->LVDS bridged 1920x1080 panel (and likely on other setups too), where the image on the panel shifts to the right and wraps around. This happens either when the controller is enabled on boot or even later during run time. The condition does not correct itself automatically, i.e. the display image remains shifted.

It seems this problem is known and is due to sporadic underflows of the LCDIF FIFO. While the LCDIF IP does have underflow/overflow IRQs, neither of the IRQs trigger and neither IRQ status bit is asserted when this condition occurs.

All known revisions of the LCDIF IP have CTRL1 RECOVER_ON_UNDERFLOW bit, which is described in the reference manual since i.MX23 as "
Set this bit to enable the LCDIF block to recover in the next field/frame if there was an underflow in the current field/frame.
"
Enable this bit to mitigate the sporadic underflows.

Quoted 2 lines
Fixes 45d59d704080 ("drm: Add new driver for MXSFB controller")
Quoted 62 lines
Cc Daniel Abrecht <[email protected]>
Cc Emil Velikov <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Lucas Stach <[email protected]>
Cc Stefan Agner <[email protected]>
---
 drivers/gpu/drm/mxsfb/mxsfb_kms.c  | 29 +++++++++++++++++++++++++++++
 drivers/gpu/drm/mxsfb/mxsfb_regs.h |  1 +
 2 files changed, 30 insertions(+)
drivers/gpu/drm/mxsfb/mxsfb_kms.c +29 -0
index 300e7bab0f43..01e0f525360f 100644
@@ -115,6 +115,35 @@ static void mxsfb_enable_controller(struct mxsfb_drm_private *mxsfb)
 	reg |= VDCTRL4_SYNC_SIGNALS_ON;
 	writel(reg, mxsfb->base + LCDC_VDCTRL4);
 
+	/*
+	 * Enable recovery on underflow.
+	 *
+	 * There is some sort of corner case behavior of the controller,
+	 * which could rarely be triggered at least on i.MX6SX connected
+	 * to 800x480 DPI panel and i.MX8MM connected to DPI->DSI->LVDS
+	 * bridged 1920x1080 panel (and likely on other setups too), where
+	 * the image on the panel shifts to the right and wraps around.
+	 * This happens either when the controller is enabled on boot or
+	 * even later during run time. The condition does not correct
+	 * itself automatically, i.e. the display image remains shifted.
+	 *
+	 * It seems this problem is known and is due to sporadic underflows
+	 * of the LCDIF FIFO. While the LCDIF IP does have underflow/overflow
+	 * IRQs, neither of the IRQs trigger and neither IRQ status bit is
+	 * asserted when this condition occurs.
+	 *
+	 * All known revisions of the LCDIF IP have CTRL1 RECOVER_ON_UNDERFLOW
+	 * bit, which is described in the reference manual since i.MX23 as
+	 * "
+	 *   Set this bit to enable the LCDIF block to recover in the next
+	 *   field/frame if there was an underflow in the current field/frame.
+	 * "
+	 * Enable this bit to mitigate the sporadic underflows.
+	 */
+	reg = readl(mxsfb->base + LCDC_CTRL1);
+	reg |= CTRL1_RECOVER_ON_UNDERFLOW;
+	writel(reg, mxsfb->base + LCDC_CTRL1);
+
 	writel(CTRL_RUN, mxsfb->base + LCDC_CTRL + REG_SET);
 }
 
drivers/gpu/drm/mxsfb/mxsfb_regs.h +1 -0
index 55d28a27f912..df90e960f495 100644
@@ -54,6 +54,7 @@
 #define CTRL_DF24			BIT(1)
 #define CTRL_RUN			BIT(0)
 
+#define CTRL1_RECOVER_ON_UNDERFLOW	BIT(24)
 #define CTRL1_FIFO_CLEAR		BIT(21)
 #define CTRL1_SET_BYTE_PACKAGING(x)	(((x) & 0xf) << 16)
 #define CTRL1_GET_BYTE_PACKAGING(x)	(((x) >> 16) & 0xf)
Reviewed-by on v1 1/1
#2 lore raw
In reply to Marek Vasut

Hi Marek,

Thank you for the patch.

Quoted 60 lines · Marek Vasut

There is some sort of corner case behavior of the controller, which could rarely be triggered at least on i.MX6SX connected to 800x480 DPI panel and i.MX8MM connected to DPI->DSI->LVDS bridged 1920x1080 panel (and likely on other setups too), where the image on the panel shifts to the right and wraps around. This happens either when the controller is enabled on boot or even later during run time. The condition does not correct itself automatically, i.e. the display image remains shifted.

It seems this problem is known and is due to sporadic underflows of the LCDIF FIFO. While the LCDIF IP does have underflow/overflow IRQs, neither of the IRQs trigger and neither IRQ status bit is asserted when this condition occurs.

All known revisions of the LCDIF IP have CTRL1 RECOVER_ON_UNDERFLOW bit, which is described in the reference manual since i.MX23 as "
Set this bit to enable the LCDIF block to recover in the next field/frame if there was an underflow in the current field/frame.
"
Enable this bit to mitigate the sporadic underflows.

Fixes 45d59d704080 ("drm: Add new driver for MXSFB controller")
Cc Daniel Abrecht <[email protected]>
Cc Emil Velikov <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Lucas Stach <[email protected]>
Cc Stefan Agner <[email protected]>
---
 drivers/gpu/drm/mxsfb/mxsfb_kms.c  | 29 +++++++++++++++++++++++++++++
 drivers/gpu/drm/mxsfb/mxsfb_regs.h |  1 +
 2 files changed, 30 insertions(+)
drivers/gpu/drm/mxsfb/mxsfb_kms.c +18 -0
index 300e7bab0f43..01e0f525360f 100644
@@ -115,6 +115,35 @@ static void mxsfb_enable_controller(struct mxsfb_drm_private *mxsfb)
 	reg |= VDCTRL4_SYNC_SIGNALS_ON;
 	writel(reg, mxsfb->base + LCDC_VDCTRL4);
 
+	/*
+	 * Enable recovery on underflow.
+	 *
+	 * There is some sort of corner case behavior of the controller,
+	 * which could rarely be triggered at least on i.MX6SX connected
+	 * to 800x480 DPI panel and i.MX8MM connected to DPI->DSI->LVDS
+	 * bridged 1920x1080 panel (and likely on other setups too), where
+	 * the image on the panel shifts to the right and wraps around.
+	 * This happens either when the controller is enabled on boot or
+	 * even later during run time. The condition does not correct
+	 * itself automatically, i.e. the display image remains shifted.
+	 *
+	 * It seems this problem is known and is due to sporadic underflows
+	 * of the LCDIF FIFO. While the LCDIF IP does have underflow/overflow
+	 * IRQs, neither of the IRQs trigger and neither IRQ status bit is
+	 * asserted when this condition occurs.
+	 *
+	 * All known revisions of the LCDIF IP have CTRL1 RECOVER_ON_UNDERFLOW

drivers/gpu/drm/mxsfb/mxsfb_kms.c static void mxsfb_enable_controller(struct mxsfb_drm_private *mxsfb) · line 145

Quoted 10 lines
drivers/gpu/drm/mxsfb/mxsfb_kms.c +10 -0
+	 * bit, which is described in the reference manual since i.MX23 as
+	 * "
+	 *   Set this bit to enable the LCDIF block to recover in the next
+	 *   field/frame if there was an underflow in the current field/frame.
+	 * "
+	 * Enable this bit to mitigate the sporadic underflows.
+	 */
+	reg = readl(mxsfb->base + LCDC_CTRL1);
+	reg |= CTRL1_RECOVER_ON_UNDERFLOW;
+	writel(reg, mxsfb->base + LCDC_CTRL1);

Looks good to me. Thanks for the detailed explanation.

Quoted 16 lines
drivers/gpu/drm/mxsfb/mxsfb_kms.c +1 -0
+
 	writel(CTRL_RUN, mxsfb->base + LCDC_CTRL + REG_SET);
 }
 
drivers/gpu/drm/mxsfb/mxsfb_regs.h +1 -0
index 55d28a27f912..df90e960f495 100644
@@ -54,6 +54,7 @@
 #define CTRL_DF24			BIT(1)
 #define CTRL_RUN			BIT(0)
 
+#define CTRL1_RECOVER_ON_UNDERFLOW	BIT(24)
 #define CTRL1_FIFO_CLEAR		BIT(21)
 #define CTRL1_SET_BYTE_PACKAGING(x)	(((x) & 0xf) << 16)
 #define CTRL1_GET_BYTE_PACKAGING(x)	(((x) >> 16) & 0xf)
Signature · 3 lines
Regards,

Laurent Pinchart
author maintainer
#3 lore raw
Quoted 78 lines · Laurent Pinchart

Hi Marek,

Thank you for the patch.

Quoted 60 lines · Marek Vasut

There is some sort of corner case behavior of the controller, which could rarely be triggered at least on i.MX6SX connected to 800x480 DPI panel and i.MX8MM connected to DPI->DSI->LVDS bridged 1920x1080 panel (and likely on other setups too), where the image on the panel shifts to the right and wraps around. This happens either when the controller is enabled on boot or even later during run time. The condition does not correct itself automatically, i.e. the display image remains shifted.

It seems this problem is known and is due to sporadic underflows of the LCDIF FIFO. While the LCDIF IP does have underflow/overflow IRQs, neither of the IRQs trigger and neither IRQ status bit is asserted when this condition occurs.

All known revisions of the LCDIF IP have CTRL1 RECOVER_ON_UNDERFLOW bit, which is described in the reference manual since i.MX23 as "
Set this bit to enable the LCDIF block to recover in the next field/frame if there was an underflow in the current field/frame.
"
Enable this bit to mitigate the sporadic underflows.

Fixes 45d59d704080 ("drm: Add new driver for MXSFB controller")
Cc Daniel Abrecht <[email protected]>
Cc Emil Velikov <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Lucas Stach <[email protected]>
Cc Stefan Agner <[email protected]>
---
  drivers/gpu/drm/mxsfb/mxsfb_kms.c  | 29 +++++++++++++++++++++++++++++
  drivers/gpu/drm/mxsfb/mxsfb_regs.h |  1 +
  2 files changed, 30 insertions(+)
drivers/gpu/drm/mxsfb/mxsfb_kms.c +18 -0
index 300e7bab0f43..01e0f525360f 100644
@@ -115,6 +115,35 @@ static void mxsfb_enable_controller(struct mxsfb_drm_private *mxsfb)
  	reg |= VDCTRL4_SYNC_SIGNALS_ON;
  	writel(reg, mxsfb->base + LCDC_VDCTRL4);
 
+	/*
+	 * Enable recovery on underflow.
+	 *
+	 * There is some sort of corner case behavior of the controller,
+	 * which could rarely be triggered at least on i.MX6SX connected
+	 * to 800x480 DPI panel and i.MX8MM connected to DPI->DSI->LVDS
+	 * bridged 1920x1080 panel (and likely on other setups too), where
+	 * the image on the panel shifts to the right and wraps around.
+	 * This happens either when the controller is enabled on boot or
+	 * even later during run time. The condition does not correct
+	 * itself automatically, i.e. the display image remains shifted.
+	 *
+	 * It seems this problem is known and is due to sporadic underflows
+	 * of the LCDIF FIFO. While the LCDIF IP does have underflow/overflow
+	 * IRQs, neither of the IRQs trigger and neither IRQ status bit is
+	 * asserted when this condition occurs.
+	 *
+	 * All known revisions of the LCDIF IP have CTRL1 RECOVER_ON_UNDERFLOW

drivers/gpu/drm/mxsfb/mxsfb_kms.c static void mxsfb_enable_controller(struct mxsfb_drm_private *mxsfb) · line 145

Quoted 10 lines
drivers/gpu/drm/mxsfb/mxsfb_kms.c +10 -0
+	 * bit, which is described in the reference manual since i.MX23 as
+	 * "
+	 *   Set this bit to enable the LCDIF block to recover in the next
+	 *   field/frame if there was an underflow in the current field/frame.
+	 * "
+	 * Enable this bit to mitigate the sporadic underflows.
+	 */
+	reg = readl(mxsfb->base + LCDC_CTRL1);
+	reg |= CTRL1_RECOVER_ON_UNDERFLOW;
+	writel(reg, mxsfb->base + LCDC_CTRL1);

Looks good to me. Thanks for the detailed explanation.

Quoted 1 line

So who do I CC to pick it? Robert ? There are a few more mxsfb fixes which are RB'd and would be nice if they were picked too.

author maintainer
#4 lore raw
Quoted 82 lines · Marek Vasut
Quoted 81 lines · Laurent Pinchart

Hi Marek,

Thank you for the patch.

Quoted 65 lines · Marek Vasut

There is some sort of corner case behavior of the controller, which could rarely be triggered at least on i.MX6SX connected to 800x480 DPI panel and i.MX8MM connected to DPI->DSI->LVDS bridged 1920x1080 panel (and likely on other setups too), where the image on the panel shifts to the right and wraps around. This happens either when the controller is enabled on boot or even later during run time. The condition does not correct itself automatically, i.e. the display image remains shifted.

It seems this problem is known and is due to sporadic underflows of the LCDIF FIFO. While the LCDIF IP does have underflow/overflow IRQs, neither of the IRQs trigger and neither IRQ status bit is asserted when this condition occurs.

All known revisions of the LCDIF IP have CTRL1 RECOVER_ON_UNDERFLOW bit, which is described in the reference manual since i.MX23 as "
   Set this bit to enable the LCDIF block to recover in the next field/frame if there was an underflow in the current field/frame. "
Enable this bit to mitigate the sporadic underflows.

Fixes 45d59d704080 ("drm: Add new driver for MXSFB controller")
Cc Daniel Abrecht <[email protected]>
Cc Emil Velikov <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Lucas Stach <[email protected]>
Cc Stefan Agner <[email protected]>

---
  drivers/gpu/drm/mxsfb/mxsfb_kms.c  | 29 +++++++++++++++++++++++++++++ drivers/gpu/drm/mxsfb/mxsfb_regs.h |  1 +

  2 files changed, 30 insertions(+)
drivers/gpu/drm/mxsfb/mxsfb_kms.c +14 -0
index 300e7bab0f43..01e0f525360f 100644
@@ -115,6 +115,35 @@ static void mxsfb_enable_controller(struct 
 mxsfb_drm_private *mxsfb)
       reg |= VDCTRL4_SYNC_SIGNALS_ON;
       writel(reg, mxsfb->base + LCDC_VDCTRL4);
+    /*
+     * Enable recovery on underflow.
+     *
+     * There is some sort of corner case behavior of the controller,
+     * which could rarely be triggered at least on i.MX6SX connected
+     * to 800x480 DPI panel and i.MX8MM connected to DPI->DSI->LVDS
+     * bridged 1920x1080 panel (and likely on other setups too), where
+     * the image on the panel shifts to the right and wraps around.
+     * This happens either when the controller is enabled on boot or
+     * even later during run time. The condition does not correct
+     * itself automatically, i.e. the display image remains shifted.
+     *
+     * It seems this problem is known and is due to sporadic underflows
+     * of the LCDIF FIFO. While the LCDIF IP does have 

underflow/overflow
+     * IRQs, neither of the IRQs trigger and neither IRQ status bit is +     * asserted when this condition occurs.
+     *
+     * All known revisions of the LCDIF IP have CTRL1 RECOVER_ON_UNDERFLOW
+     * bit, which is described in the reference manual since i.MX23 as +     * "
+     *   Set this bit to enable the LCDIF block to recover in the next

Quoted 8 lines

+     *   field/frame if there was an underflow in the current field/frame.
+     * "
+     * Enable this bit to mitigate the sporadic underflows. +     */
+    reg = readl(mxsfb->base + LCDC_CTRL1);
+    reg |= CTRL1_RECOVER_ON_UNDERFLOW;
+    writel(reg, mxsfb->base + LCDC_CTRL1);

Looks good to me. Thanks for the detailed explanation.

Quoted 3 lines
Quoted 1 line

So who do I CC to pick it? Robert ? There are a few more mxsfb fixes which are RB'd and would be nice if they were picked too.

+CC Daniel, can those RB'd mxsfb patches be picked ?

Reviewed-by on v1 1/1
#5 lore raw
In reply to Marek Vasut
Quoted 23 lines · Marek Vasut

There is some sort of corner case behavior of the controller, which could rarely be triggered at least on i.MX6SX connected to 800x480 DPI panel and i.MX8MM connected to DPI->DSI->LVDS bridged 1920x1080 panel (and likely on other setups too), where the image on the panel shifts to the right and wraps around. This happens either when the controller is enabled on boot or even later during run time. The condition does not correct itself automatically, i.e. the display image remains shifted.

It seems this problem is known and is due to sporadic underflows of the LCDIF FIFO. While the LCDIF IP does have underflow/overflow IRQs, neither of the IRQs trigger and neither IRQ status bit is asserted when this condition occurs.

All known revisions of the LCDIF IP have CTRL1 RECOVER_ON_UNDERFLOW bit, which is described in the reference manual since i.MX23 as "
Set this bit to enable the LCDIF block to recover in the next field/frame if there was an underflow in the current field/frame.
"
Enable this bit to mitigate the sporadic underflows.

Quoted 8 lines
Fixes 45d59d704080 ("drm: Add new driver for MXSFB controller")
Cc Daniel Abrecht <[email protected]>
Cc Emil Velikov <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Lucas Stach <[email protected]>
Cc Stefan Agner <[email protected]>

---