[PATCH v2 3/3] drm/vc4: hvs: Convert to the new clock request API

From: Maxime Ripard
Date: Tue Sep 14 2021 - 05:35:41 EST


From: Dom Cobley <popcornmix@xxxxxxxxx>

The new clock request API allows us to increase the rate of the
core clock as required during mode set while decreasing it when
we're done, resulting in a better power-efficiency.

Signed-off-by: Dom Cobley <popcornmix@xxxxxxxxx>
Signed-off-by: Maxime Ripard <maxime@xxxxxxxxxx>
---
drivers/gpu/drm/vc4/vc4_kms.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c
index f0b3e4cf5bce..3550ae9f782e 100644
--- a/drivers/gpu/drm/vc4/vc4_kms.c
+++ b/drivers/gpu/drm/vc4/vc4_kms.c
@@ -341,6 +341,7 @@ static void vc4_atomic_commit_tail(struct drm_atomic_state *state)
struct drm_crtc_state *new_crtc_state;
struct drm_crtc *crtc;
struct vc4_hvs_state *old_hvs_state;
+ struct clk_request *core_req;
int i;

for_each_new_crtc_in_state(state, crtc, new_crtc_state, i) {
@@ -354,7 +355,7 @@ static void vc4_atomic_commit_tail(struct drm_atomic_state *state)
}

if (vc4->hvs->hvs5)
- clk_set_min_rate(hvs->core_clk, 500000000);
+ core_req = clk_request_start(hvs->core_clk, 500000000);

old_hvs_state = vc4_hvs_get_old_global_state(state);
if (!old_hvs_state)
@@ -399,7 +400,7 @@ static void vc4_atomic_commit_tail(struct drm_atomic_state *state)
drm_atomic_helper_cleanup_planes(dev, state);

if (vc4->hvs->hvs5)
- clk_set_min_rate(hvs->core_clk, 0);
+ clk_request_done(core_req);
}

static int vc4_atomic_commit_setup(struct drm_atomic_state *state)
--
2.31.1