9f4cf9d0336dab7aae3541532f253a2d7f9aafbd
[openwrt/openwrt.git] /
1 From 18d185166ca00c9280505ad41fbe036efbb52e67 Mon Sep 17 00:00:00 2001
2 From: Dom Cobley <popcornmix@gmail.com>
3 Date: Mon, 14 Oct 2024 18:55:00 +0100
4 Subject: [PATCH 1323/1350] drm/vc4: Remove request for min clocks when hdmi
5 output is disabled
6
7 Currently, booting with no hdmi connected has:
8 pi@pi4:~ $ vcgencmd measure_clock hdmi pixel
9 frequency(9)=120010256
10 frequency(29)=74988280
11
12 After connecting hdmi we get:
13 pi@pi4:~ $ vcgencmd measure_clock hdmi pixel
14 frequency(9)=300005856
15 frequency(29)=149989744
16
17 and that persists after disconnecting hdmi
18
19 I can measure this on a power supply as 10mA@5.2V (52mW).
20
21 We should always remove clk_set_min_rate requests
22 when we no longer need them.
23
24 Signed-off-by: Dom Cobley <popcornmix@gmail.com>
25 ---
26 drivers/gpu/drm/vc4/vc4_hdmi.c | 4 ++++
27 drivers/gpu/drm/vc4/vc4_hvs.c | 3 +++
28 drivers/gpu/drm/vc4/vc4_v3d.c | 2 ++
29 3 files changed, 9 insertions(+)
30
31 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
32 +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
33 @@ -1224,6 +1224,8 @@ static void vc4_hdmi_encoder_post_crtc_p
34 if (vc4_hdmi->variant->phy_disable)
35 vc4_hdmi->variant->phy_disable(vc4_hdmi);
36
37 + /* we no longer require a minimum clock rate */
38 + clk_set_min_rate(vc4_hdmi->pixel_bvb_clock, 0);
39 clk_disable_unprepare(vc4_hdmi->pixel_bvb_clock);
40 clk_disable_unprepare(vc4_hdmi->pixel_clock);
41
42 @@ -3724,6 +3726,8 @@ static int vc4_hdmi_runtime_suspend(stru
43 struct vc4_hdmi *vc4_hdmi = dev_get_drvdata(dev);
44
45 clk_disable_unprepare(vc4_hdmi->audio_clock);
46 + /* we no longer require a minimum clock rate */
47 + clk_set_min_rate(vc4_hdmi->hsm_clock, 0);
48 clk_disable_unprepare(vc4_hdmi->hsm_clock);
49
50 return 0;
51 --- a/drivers/gpu/drm/vc4/vc4_hvs.c
52 +++ b/drivers/gpu/drm/vc4/vc4_hvs.c
53 @@ -2308,7 +2308,10 @@ static void vc4_hvs_unbind(struct device
54 drm_mm_remove_node(node);
55 drm_mm_takedown(&vc4->hvs->lbm_mm);
56
57 + /* we no longer require a minimum clock rate */
58 + clk_set_min_rate(hvs->disp_clk, 0);
59 clk_disable_unprepare(hvs->disp_clk);
60 + clk_set_min_rate(hvs->core_clk, 0);
61 clk_disable_unprepare(hvs->core_clk);
62
63 vc4->hvs = NULL;
64 --- a/drivers/gpu/drm/vc4/vc4_v3d.c
65 +++ b/drivers/gpu/drm/vc4/vc4_v3d.c
66 @@ -376,6 +376,8 @@ static int vc4_v3d_runtime_suspend(struc
67
68 vc4_irq_disable(&vc4->base);
69
70 + /* we no longer require a minimum clock rate */
71 + clk_set_min_rate(v3d->clk, 0);
72 clk_disable_unprepare(v3d->clk);
73
74 return 0;