From 89941a8e5343c11364f0fcbeb9dec76afa8f4f2e Mon Sep 17 00:00:00 2001
From: Maxime Ripard <maxime@cerno.tech>
Date: Wed, 16 Mar 2022 09:51:32 +0100
Subject: [PATCH] Revert "drm/vc4: kms: Move clock request to our HVS
 state"

This reverts commit c65633a429b15f9d182a5bc7d6387fecbd5b7bb0.
---
 drivers/gpu/drm/vc4/vc4_drv.h | 1 +
 drivers/gpu/drm/vc4/vc4_kms.c | 8 +++-----
 2 files changed, 4 insertions(+), 5 deletions(-)

--- a/drivers/gpu/drm/vc4/vc4_drv.h
+++ b/drivers/gpu/drm/vc4/vc4_drv.h
@@ -326,6 +326,7 @@ struct vc4_hvs {
 	u32 __iomem *dlist;
 
 	struct clk *core_clk;
+	struct clk_request *core_req;
 
 	/* Memory manager for CRTCs to allocate space in the display
 	 * list.  Units are dwords.
--- a/drivers/gpu/drm/vc4/vc4_kms.c
+++ b/drivers/gpu/drm/vc4/vc4_kms.c
@@ -40,7 +40,6 @@ static struct vc4_ctm_state *to_vc4_ctm_
 struct vc4_hvs_state {
 	struct drm_private_state base;
 	unsigned long core_clock_rate;
-	struct clk_request *core_req;
 
 	struct {
 		unsigned in_use: 1;
@@ -407,8 +406,7 @@ static void vc4_atomic_commit_tail(struc
 		 * And remove the previous one based on the HVS
 		 * requirements if any.
 		 */
-		clk_request_done(old_hvs_state->core_req);
-		old_hvs_state->core_req = NULL;
+               clk_request_done(hvs->core_req);
 	}
 
 	drm_atomic_helper_commit_modeset_disables(dev, state);
@@ -442,8 +440,8 @@ static void vc4_atomic_commit_tail(struc
 		 * Request a clock rate based on the current HVS
 		 * requirements.
 		 */
-		new_hvs_state->core_req = clk_request_start(hvs->core_clk,
-							    new_hvs_state->core_clock_rate);
+		hvs->core_req = clk_request_start(hvs->core_clk,
+						  new_hvs_state->core_clock_rate);
 
 		/* And drop the temporary request */
 		clk_request_done(core_req);
