Skip to content

Commit 019efde

Browse files
Aradhya BhatiaSasha Levin
authored andcommitted
drm/bridge: cdns-dsi: Wait for Clk and Data Lanes to be ready
commit 47c03e6 upstream. Once the DSI Link and DSI Phy are initialized, the code needs to wait for Clk and Data Lanes to be ready, before continuing configuration. This is in accordance with the DSI Start-up procedure, found in the Technical Reference Manual of Texas Instrument's J721E SoC[0] which houses this DSI TX controller. If the previous bridge (or crtc/encoder) are configured pre-maturely, the input signal FIFO gets corrupt. This introduces a color-shift on the display. Allow the driver to wait for the clk and data lanes to get ready during DSI enable. [0]: See section 12.6.5.7.3 "Start-up Procedure" in J721E SoC TRM TRM Link: http://www.ti.com/lit/pdf/spruil1 Fixes: e192339 ("drm/bridge: Add Cadence DSI driver") Cc: [email protected] Tested-by: Dominik Haller <[email protected]> Reviewed-by: Tomi Valkeinen <[email protected]> Tested-by: Tomi Valkeinen <[email protected]> Signed-off-by: Aradhya Bhatia <[email protected]> Signed-off-by: Aradhya Bhatia <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Baryshkov <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 7db8b84 commit 019efde

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

drivers/gpu/drm/bridge/cdns-dsi.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ static void cdns_dsi_bridge_enable(struct drm_bridge *bridge)
806806
struct phy_configure_opts_mipi_dphy *phy_cfg = &output->phy_opts.mipi_dphy;
807807
unsigned long tx_byte_period;
808808
struct cdns_dsi_cfg dsi_cfg;
809-
u32 tmp, reg_wakeup, div;
809+
u32 tmp, reg_wakeup, div, status;
810810
int nlanes;
811811

812812
if (WARN_ON(pm_runtime_get_sync(dsi->base.dev) < 0))
@@ -820,6 +820,19 @@ static void cdns_dsi_bridge_enable(struct drm_bridge *bridge)
820820
cdns_dsi_hs_init(dsi);
821821
cdns_dsi_init_link(dsi);
822822

823+
/*
824+
* Now that the DSI Link and DSI Phy are initialized,
825+
* wait for the CLK and Data Lanes to be ready.
826+
*/
827+
tmp = CLK_LANE_RDY;
828+
for (int i = 0; i < nlanes; i++)
829+
tmp |= DATA_LANE_RDY(i);
830+
831+
if (readl_poll_timeout(dsi->regs + MCTL_MAIN_STS, status,
832+
(tmp == (status & tmp)), 100, 500000))
833+
dev_err(dsi->base.dev,
834+
"Timed Out: DSI-DPhy Clock and Data Lanes not ready.\n");
835+
823836
writel(HBP_LEN(dsi_cfg.hbp) | HSA_LEN(dsi_cfg.hsa),
824837
dsi->regs + VID_HSIZE1);
825838
writel(HFP_LEN(dsi_cfg.hfp) | HACT_LEN(dsi_cfg.hact),

0 commit comments

Comments
 (0)