1c51aa16b77e802bac6e362dce633c0db99b12ab
[openwrt/staging/rmilecki.git] /
1 From d1f7e9e87961139c7da9a570b1858a8841a32d6e Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Mon, 7 Feb 2022 17:14:51 +0000
4 Subject: [PATCH] drm/vc4: Move DSI initialisation to encoder_mode_set.
5
6 Breaking the bridge chain does not work for atomic bridges/panels
7 and generally causes issues.
8 We need to initialise the DSI host before the bridge pre_enables
9 are called, so move that to encoder_mode_set in the same way that
10 dw-mipi-dsi does.
11
12 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
13 ---
14 drivers/gpu/drm/vc4/vc4_dsi.c | 17 +++++++++++++----
15 1 file changed, 13 insertions(+), 4 deletions(-)
16
17 --- a/drivers/gpu/drm/vc4/vc4_dsi.c
18 +++ b/drivers/gpu/drm/vc4/vc4_dsi.c
19 @@ -872,19 +872,19 @@ static bool vc4_dsi_encoder_mode_fixup(s
20 return true;
21 }
22
23 -static void vc4_dsi_encoder_enable(struct drm_encoder *encoder)
24 +static void vc4_dsi_encoder_mode_set(struct drm_encoder *encoder,
25 + struct drm_display_mode *user_mode,
26 + struct drm_display_mode *adjusted_mode)
27 {
28 - struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode;
29 struct vc4_dsi_encoder *vc4_encoder = to_vc4_dsi_encoder(encoder);
30 struct vc4_dsi *dsi = vc4_encoder->dsi;
31 struct device *dev = &dsi->pdev->dev;
32 bool debug_dump_regs = false;
33 - struct drm_bridge *iter;
34 unsigned long hs_clock;
35 u32 ui_ns;
36 /* Minimum LP state duration in escape clock cycles. */
37 u32 lpx = dsi_esc_timing(60);
38 - unsigned long pixel_clock_hz = mode->clock * 1000;
39 + unsigned long pixel_clock_hz = adjusted_mode->clock * 1000;
40 unsigned long dsip_clock;
41 unsigned long phy_clock;
42 int ret;
43 @@ -1111,6 +1111,14 @@ static void vc4_dsi_encoder_enable(struc
44 ~DSI_PORT_BIT(PHY_AFEC0_RESET));
45
46 vc4_dsi_ulps(dsi, false);
47 +}
48 +
49 +static void vc4_dsi_encoder_enable(struct drm_encoder *encoder)
50 +{
51 + struct vc4_dsi_encoder *vc4_encoder = to_vc4_dsi_encoder(encoder);
52 + struct vc4_dsi *dsi = vc4_encoder->dsi;
53 + bool debug_dump_regs = false;
54 + struct drm_bridge *iter;
55
56 list_for_each_entry_reverse(iter, &dsi->bridge_chain, chain_node) {
57 if (iter->funcs->pre_enable)
58 @@ -1376,6 +1384,7 @@ static const struct drm_encoder_helper_f
59 .disable = vc4_dsi_encoder_disable,
60 .enable = vc4_dsi_encoder_enable,
61 .mode_fixup = vc4_dsi_encoder_mode_fixup,
62 + .mode_set = vc4_dsi_encoder_mode_set,
63 };
64
65 static const struct vc4_dsi_variant bcm2711_dsi1_variant = {