Skip to content

Commit

Permalink
drm: mxsfb: Enable recovery on underflow
Browse files Browse the repository at this point in the history
[ Upstream commit 0c9856e ]

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: 45d59d7 ("drm: Add new driver for MXSFB controller")
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Daniel Abrecht <public@danielabrecht.ch>
Cc: Emil Velikov <emil.l.velikov@gmail.com>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: Stefan Agner <stefan@agner.ch>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210620224701.189289-1-marex@denx.de
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Marek Vasut authored and gregkh committed Sep 15, 2021
1 parent e0f3de1 commit 46f5463
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
29 changes: 29 additions & 0 deletions drivers/gpu/drm/mxsfb/mxsfb_kms.c
Expand Up @@ -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);
}

Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/mxsfb/mxsfb_regs.h
Expand Up @@ -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)
Expand Down

0 comments on commit 46f5463

Please sign in to comment.