bcm27xx: add support for linux v5.15
[openwrt/staging/chunkeey.git] / target / linux / bcm27xx / patches-5.15 / 950-0564-drm-vc4-kms-Move-clock-request-to-our-HVS-state.patch
1 From f7d98ba8c30bbc5b29bf740f28bf2daeeec09d2b Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Thu, 4 Nov 2021 14:04:37 +0100
4 Subject: [PATCH] drm/vc4: kms: Move clock request to our HVS state
5
6 Our current clock request has been stored so far on the main HVS
7 structure, but even though we shouldn't have two commits in parallel and
8 it shouldn't cause any functional change, the request itself is linked
9 to a given HVS state.
10
11 Move the request there to make a bit more sense.
12
13 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
14 ---
15 drivers/gpu/drm/vc4/vc4_drv.h | 1 -
16 drivers/gpu/drm/vc4/vc4_kms.c | 8 +++++---
17 2 files changed, 5 insertions(+), 4 deletions(-)
18
19 --- a/drivers/gpu/drm/vc4/vc4_drv.h
20 +++ b/drivers/gpu/drm/vc4/vc4_drv.h
21 @@ -326,7 +326,6 @@ struct vc4_hvs {
22 u32 __iomem *dlist;
23
24 struct clk *core_clk;
25 - struct clk_request *core_req;
26
27 /* Memory manager for CRTCs to allocate space in the display
28 * list. Units are dwords.
29 --- a/drivers/gpu/drm/vc4/vc4_kms.c
30 +++ b/drivers/gpu/drm/vc4/vc4_kms.c
31 @@ -40,6 +40,7 @@ static struct vc4_ctm_state *to_vc4_ctm_
32 struct vc4_hvs_state {
33 struct drm_private_state base;
34 unsigned long core_clock_rate;
35 + struct clk_request *core_req;
36
37 struct {
38 unsigned in_use: 1;
39 @@ -398,7 +399,8 @@ static void vc4_atomic_commit_tail(struc
40 * And remove the previous one based on the HVS
41 * requirements if any.
42 */
43 - clk_request_done(hvs->core_req);
44 + clk_request_done(old_hvs_state->core_req);
45 + old_hvs_state->core_req = NULL;
46 }
47
48 drm_atomic_helper_commit_modeset_disables(dev, state);
49 @@ -432,8 +434,8 @@ static void vc4_atomic_commit_tail(struc
50 * Request a clock rate based on the current HVS
51 * requirements.
52 */
53 - hvs->core_req = clk_request_start(hvs->core_clk,
54 - new_hvs_state->core_clock_rate);
55 + new_hvs_state->core_req = clk_request_start(hvs->core_clk,
56 + new_hvs_state->core_clock_rate);
57
58 /* And drop the temporary request */
59 clk_request_done(core_req);