f2424cbfac7a75ed8f6c7cf5bdbe5b19f4a16358
[openwrt/staging/wigyori.git] /
1 From 94bc403a9a7af3bd042ecdc160e6ab0b08331df8 Mon Sep 17 00:00:00 2001
2 From: Maxime Ripard <maxime@cerno.tech>
3 Date: Fri, 2 Jul 2021 12:03:28 +0200
4 Subject: [PATCH] drm/vc4: hdmi: Make sure the controller is powered up during
5 bind
6
7 In the bind hook, we actually need the device to have the HSM clock
8 running during the final part of the display initialisation where we
9 reset the controller and initialise the CEC component.
10
11 Failing to do so will result in a complete, silent, hang of the CPU.
12
13 Fixes: 411efa18e4b0 ("drm/vc4: hdmi: Move the HSM clock enable to runtime_pm")
14 Signed-off-by: Maxime Ripard <maxime@cerno.tech>
15 ---
16 drivers/gpu/drm/vc4/vc4_hdmi.c | 17 +++++++++++++++--
17 1 file changed, 15 insertions(+), 2 deletions(-)
18
19 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
20 +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
21 @@ -2304,6 +2304,18 @@ static int vc4_hdmi_bind(struct device *
22 if (ret)
23 goto err_put_ddc;
24
25 + /*
26 + * We need to have the device powered up at this point to call
27 + * our reset hook and for the CEC init.
28 + */
29 + ret = vc4_hdmi_runtime_resume(dev);
30 + if (ret)
31 + goto err_put_ddc;
32 +
33 + pm_runtime_get_noresume(dev);
34 + pm_runtime_set_active(dev);
35 + pm_runtime_enable(dev);
36 +
37 if (vc4_hdmi->variant->reset)
38 vc4_hdmi->variant->reset(vc4_hdmi);
39
40 @@ -2315,8 +2327,6 @@ static int vc4_hdmi_bind(struct device *
41 clk_prepare_enable(vc4_hdmi->pixel_bvb_clock);
42 }
43
44 - pm_runtime_enable(dev);
45 -
46 drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS);
47 drm_encoder_helper_add(encoder, &vc4_hdmi_encoder_helper_funcs);
48
49 @@ -2340,6 +2350,8 @@ static int vc4_hdmi_bind(struct device *
50 vc4_hdmi_debugfs_regs,
51 vc4_hdmi);
52
53 + pm_runtime_put_sync(dev);
54 +
55 return 0;
56
57 err_free_cec:
58 @@ -2350,6 +2362,7 @@ err_destroy_conn:
59 vc4_hdmi_connector_destroy(&vc4_hdmi->connector);
60 err_destroy_encoder:
61 drm_encoder_cleanup(encoder);
62 + pm_runtime_put_sync(dev);
63 pm_runtime_disable(dev);
64 err_put_ddc:
65 put_device(&vc4_hdmi->ddc->dev);