Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/vc4: Make DSI call into the bridge after the DSI link is enabled.

This allows panels or bridges that need to send DSI commands during
pre_enable() to successfully send them. We delay DISP0 (aka the
actual display) enabling until after pre_enable so that pixels aren't
streaming before then.

v2: Just clear out the encoder->bridge value to disable the midlayer
calls (idea by Andrzej Hajda).

Signed-off-by: Eric Anholt <eric@anholt.net>
Cc: Andrzej Hajda <a.hajda@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180621231759.29604-1-eric@anholt.net
Reviewed-by: Andrzej Hajda <a.hajda@samsung.com>

+27 -15
+27 -15
drivers/gpu/drm/vc4/vc4_dsi.c
··· 814 814 struct vc4_dsi *dsi = vc4_encoder->dsi; 815 815 struct device *dev = &dsi->pdev->dev; 816 816 817 + drm_bridge_disable(dsi->bridge); 817 818 vc4_dsi_ulps(dsi, true); 819 + drm_bridge_post_disable(dsi->bridge); 818 820 819 821 clk_disable_unprepare(dsi->pll_phy_clock); 820 822 clk_disable_unprepare(dsi->escape_clock); ··· 1091 1089 /* Display reset sequence timeout */ 1092 1090 DSI_PORT_WRITE(PR_TO_CNT, 100000); 1093 1091 1094 - if (dsi->mode_flags & MIPI_DSI_MODE_VIDEO) { 1095 - DSI_PORT_WRITE(DISP0_CTRL, 1096 - VC4_SET_FIELD(dsi->divider, 1097 - DSI_DISP0_PIX_CLK_DIV) | 1098 - VC4_SET_FIELD(dsi->format, DSI_DISP0_PFORMAT) | 1099 - VC4_SET_FIELD(DSI_DISP0_LP_STOP_PERFRAME, 1100 - DSI_DISP0_LP_STOP_CTRL) | 1101 - DSI_DISP0_ST_END | 1102 - DSI_DISP0_ENABLE); 1103 - } else { 1104 - DSI_PORT_WRITE(DISP0_CTRL, 1105 - DSI_DISP0_COMMAND_MODE | 1106 - DSI_DISP0_ENABLE); 1107 - } 1108 - 1109 1092 /* Set up DISP1 for transferring long command payloads through 1110 1093 * the pixfifo. 1111 1094 */ ··· 1114 1127 } 1115 1128 1116 1129 vc4_dsi_ulps(dsi, false); 1130 + 1131 + drm_bridge_pre_enable(dsi->bridge); 1132 + 1133 + if (dsi->mode_flags & MIPI_DSI_MODE_VIDEO) { 1134 + DSI_PORT_WRITE(DISP0_CTRL, 1135 + VC4_SET_FIELD(dsi->divider, 1136 + DSI_DISP0_PIX_CLK_DIV) | 1137 + VC4_SET_FIELD(dsi->format, DSI_DISP0_PFORMAT) | 1138 + VC4_SET_FIELD(DSI_DISP0_LP_STOP_PERFRAME, 1139 + DSI_DISP0_LP_STOP_CTRL) | 1140 + DSI_DISP0_ST_END | 1141 + DSI_DISP0_ENABLE); 1142 + } else { 1143 + DSI_PORT_WRITE(DISP0_CTRL, 1144 + DSI_DISP0_COMMAND_MODE | 1145 + DSI_DISP0_ENABLE); 1146 + } 1147 + 1148 + drm_bridge_enable(dsi->bridge); 1117 1149 1118 1150 if (debug_dump_regs) { 1119 1151 DRM_INFO("DSI regs after:\n"); ··· 1645 1639 dev_err(dev, "bridge attach failed: %d\n", ret); 1646 1640 return ret; 1647 1641 } 1642 + /* Disable the atomic helper calls into the bridge. We 1643 + * manually call the bridge pre_enable / enable / etc. calls 1644 + * from our driver, since we need to sequence them within the 1645 + * encoder's enable/disable paths. 1646 + */ 1647 + dsi->encoder->bridge = NULL; 1648 1648 1649 1649 pm_runtime_enable(dev); 1650 1650