Skip to content

Commit 69d494d

Browse files
mripardpelwell
authored andcommitted
drm/vc4: hdmi: Convert to the new clock request API
The new clock request API allows us to increase the rate of the HSM clock to match our pixel rate requirements while decreasing it when we're done, resulting in a better power-efficiency. Signed-off-by: Maxime Ripard <[email protected]>
1 parent 34bd78d commit 69d494d

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

drivers/gpu/drm/vc4/vc4_hdmi.c

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,9 @@ static void vc4_hdmi_encoder_post_crtc_powerdown(struct drm_encoder *encoder,
969969
vc4_hdmi->variant->phy_disable(vc4_hdmi);
970970

971971
clk_disable_unprepare(vc4_hdmi->pixel_bvb_clock);
972+
clk_request_done(vc4_hdmi->bvb_req);
973+
clk_disable_unprepare(vc4_hdmi->hsm_clock);
974+
clk_request_done(vc4_hdmi->hsm_req);
972975
clk_disable_unprepare(vc4_hdmi->pixel_clock);
973976

974977
ret = pm_runtime_put(&vc4_hdmi->pdev->dev);
@@ -1258,9 +1261,9 @@ static void vc4_hdmi_encoder_pre_crtc_configure(struct drm_encoder *encoder,
12581261
* pixel clock, but HSM ends up being the limiting factor.
12591262
*/
12601263
hsm_rate = max_t(unsigned long, 120000000, (pixel_rate / 100) * 101);
1261-
ret = clk_set_min_rate(vc4_hdmi->hsm_clock, hsm_rate);
1262-
if (ret) {
1263-
DRM_ERROR("Failed to set HSM clock rate: %d\n", ret);
1264+
vc4_hdmi->hsm_req = clk_request_start(vc4_hdmi->hsm_clock, hsm_rate);
1265+
if (IS_ERR(vc4_hdmi->hsm_req)) {
1266+
DRM_ERROR("Failed to set HSM clock rate: %ld\n", PTR_ERR(vc4_hdmi->hsm_req));
12641267
return;
12651268
}
12661269

@@ -1273,16 +1276,21 @@ static void vc4_hdmi_encoder_pre_crtc_configure(struct drm_encoder *encoder,
12731276
else
12741277
bvb_rate = 75000000;
12751278

1276-
ret = clk_set_min_rate(vc4_hdmi->pixel_bvb_clock, bvb_rate);
1277-
if (ret) {
1278-
DRM_ERROR("Failed to set pixel bvb clock rate: %d\n", ret);
1279+
vc4_hdmi->bvb_req = clk_request_start(vc4_hdmi->pixel_bvb_clock, bvb_rate);
1280+
if (IS_ERR(vc4_hdmi->bvb_req)) {
1281+
DRM_ERROR("Failed to set pixel bvb clock rate: %ld\n", PTR_ERR(vc4_hdmi->bvb_req));
1282+
clk_request_done(vc4_hdmi->hsm_req);
1283+
clk_disable_unprepare(vc4_hdmi->hsm_clock);
12791284
clk_disable_unprepare(vc4_hdmi->pixel_clock);
12801285
return;
12811286
}
12821287

12831288
ret = clk_prepare_enable(vc4_hdmi->pixel_bvb_clock);
12841289
if (ret) {
12851290
DRM_ERROR("Failed to turn on pixel bvb clock: %d\n", ret);
1291+
clk_request_done(vc4_hdmi->bvb_req);
1292+
clk_request_done(vc4_hdmi->hsm_req);
1293+
clk_disable_unprepare(vc4_hdmi->hsm_clock);
12861294
clk_disable_unprepare(vc4_hdmi->pixel_clock);
12871295
return;
12881296
}

drivers/gpu/drm/vc4/vc4_hdmi.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,9 @@ struct vc4_hdmi {
184184

185185
struct reset_control *reset;
186186

187+
struct clk_request *bvb_req;
188+
struct clk_request *hsm_req;
189+
187190
/* Common debugfs regset */
188191
struct debugfs_regset32 hdmi_regset;
189192
struct debugfs_regset32 hd_regset;

0 commit comments

Comments
 (0)