2554944748793afeee019338ea58724ce6b31330
[openwrt/staging/jow.git] /
1 From ab6f22f1747903266a88b73f628eb4f89474c84c 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 @@ -789,7 +789,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 *dsi = to_vc4_dsi(encoder);
27 struct device *dev = &dsi->pdev->dev;
28 @@ -853,17 +854,18 @@ 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 *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 *dsi = to_vc4_dsi(encoder);
38 struct device *dev = &dsi->pdev->dev;
39 + const struct drm_display_mode *mode;
40 bool debug_dump_regs = false;
41 unsigned long hs_clock;
42 u32 ui_ns;
43 /* Minimum LP state duration in escape clock cycles. */
44 u32 lpx = dsi_esc_timing(60);
45 - unsigned long pixel_clock_hz = adjusted_mode->clock * 1000;
46 + unsigned long pixel_clock_hz;
47 unsigned long dsip_clock;
48 unsigned long phy_clock;
49 int ret;
50 @@ -880,6 +882,10 @@ static void vc4_dsi_encoder_mode_set(str
51 drm_print_regset32(&p, &dsi->regset);
52 }
53
54 + mode = &crtc_state->adjusted_mode;
55 +
56 + pixel_clock_hz = mode->clock * 1000;
57 +
58 /* Round up the clk_set_rate() request slightly, since
59 * PLLD_DSI1 is an integer divider and its rate selection will
60 * never round up.
61 @@ -1092,7 +1098,8 @@ static void vc4_dsi_encoder_mode_set(str
62 vc4_dsi_ulps(dsi, false);
63 }
64
65 -static void vc4_dsi_encoder_enable(struct drm_encoder *encoder)
66 +static void vc4_dsi_encoder_enable(struct drm_encoder *encoder,
67 + struct drm_atomic_state *state)
68 {
69 struct vc4_dsi_encoder *vc4_encoder = to_vc4_dsi_encoder(encoder);
70 struct vc4_dsi *dsi = vc4_encoder->dsi;
71 @@ -1349,10 +1356,10 @@ static const struct mipi_dsi_host_ops vc
72 };
73
74 static const struct drm_encoder_helper_funcs vc4_dsi_encoder_helper_funcs = {
75 - .disable = vc4_dsi_encoder_disable,
76 - .enable = vc4_dsi_encoder_enable,
77 + .atomic_disable = vc4_dsi_encoder_disable,
78 + .atomic_enable = vc4_dsi_encoder_enable,
79 .mode_fixup = vc4_dsi_encoder_mode_fixup,
80 - .mode_set = vc4_dsi_encoder_mode_set,
81 + .atomic_mode_set = vc4_dsi_encoder_mode_set,
82 };
83
84 static int vc4_dsi_late_register(struct drm_encoder *encoder)