bcm27xx: switch to kernel v6.1
[openwrt/openwrt.git] / target / linux / bcm27xx / patches-5.15 / 950-0714-drm-vc4-Convert-vc4_dsi-to-use-atomic-enable-disable.patch
1 From 2a6dfa1110ab7d6d5fd4fcce0040219346e89498 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Wed, 15 Dec 2021 17:47:14 +0000
4 Subject: [PATCH] drm/vc4: Convert vc4_dsi to use atomic
5 enable/disable/mode_set.
6
7 The atomic calls are preferred as the non-atomic ones
8 are deprecated. In preparation for conversion to a bridge,
9 switch to the atomic calls.
10
11 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
12 ---
13 drivers/gpu/drm/vc4/vc4_dsi.c | 23 +++++++++++++++--------
14 1 file changed, 15 insertions(+), 8 deletions(-)
15
16 --- a/drivers/gpu/drm/vc4/vc4_dsi.c
17 +++ b/drivers/gpu/drm/vc4/vc4_dsi.c
18 @@ -792,7 +792,8 @@ dsi_esc_timing(u32 ns)
19 return DIV_ROUND_UP(ns, ESC_TIME_NS);
20 }
21
22 -static void vc4_dsi_encoder_disable(struct drm_encoder *encoder)
23 +static void vc4_dsi_encoder_disable(struct drm_encoder *encoder,
24 + struct drm_atomic_state *state)
25 {
26 struct vc4_dsi_encoder *vc4_encoder = to_vc4_dsi_encoder(encoder);
27 struct vc4_dsi *dsi = vc4_encoder->dsi;
28 @@ -858,18 +859,19 @@ static bool vc4_dsi_encoder_mode_fixup(s
29 }
30
31 static void vc4_dsi_encoder_mode_set(struct drm_encoder *encoder,
32 - struct drm_display_mode *user_mode,
33 - struct drm_display_mode *adjusted_mode)
34 + struct drm_crtc_state *crtc_state,
35 + struct drm_connector_state *conn_state)
36 {
37 struct vc4_dsi_encoder *vc4_encoder = to_vc4_dsi_encoder(encoder);
38 struct vc4_dsi *dsi = vc4_encoder->dsi;
39 struct device *dev = &dsi->pdev->dev;
40 + const struct drm_display_mode *mode;
41 bool debug_dump_regs = false;
42 unsigned long hs_clock;
43 u32 ui_ns;
44 /* Minimum LP state duration in escape clock cycles. */
45 u32 lpx = dsi_esc_timing(60);
46 - unsigned long pixel_clock_hz = adjusted_mode->clock * 1000;
47 + unsigned long pixel_clock_hz;
48 unsigned long dsip_clock;
49 unsigned long phy_clock;
50 int ret;
51 @@ -886,6 +888,10 @@ static void vc4_dsi_encoder_mode_set(str
52 drm_print_regset32(&p, &dsi->regset);
53 }
54
55 + mode = &crtc_state->adjusted_mode;
56 +
57 + pixel_clock_hz = mode->clock * 1000;
58 +
59 /* Round up the clk_set_rate() request slightly, since
60 * PLLD_DSI1 is an integer divider and its rate selection will
61 * never round up.
62 @@ -1098,7 +1104,8 @@ static void vc4_dsi_encoder_mode_set(str
63 vc4_dsi_ulps(dsi, false);
64 }
65
66 -static void vc4_dsi_encoder_enable(struct drm_encoder *encoder)
67 +static void vc4_dsi_encoder_enable(struct drm_encoder *encoder,
68 + struct drm_atomic_state *state)
69 {
70 struct vc4_dsi_encoder *vc4_encoder = to_vc4_dsi_encoder(encoder);
71 struct vc4_dsi *dsi = vc4_encoder->dsi;
72 @@ -1355,10 +1362,10 @@ static const struct mipi_dsi_host_ops vc
73 };
74
75 static const struct drm_encoder_helper_funcs vc4_dsi_encoder_helper_funcs = {
76 - .disable = vc4_dsi_encoder_disable,
77 - .enable = vc4_dsi_encoder_enable,
78 + .atomic_disable = vc4_dsi_encoder_disable,
79 + .atomic_enable = vc4_dsi_encoder_enable,
80 .mode_fixup = vc4_dsi_encoder_mode_fixup,
81 - .mode_set = vc4_dsi_encoder_mode_set,
82 + .atomic_mode_set = vc4_dsi_encoder_mode_set,
83 };
84
85 static const struct vc4_dsi_variant bcm2711_dsi1_variant = {