lkml.org 
[lkml]   [2022]   [Jan]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.16 0099/1039] drm/vc4: hdmi: Make sure the controller is powered up during bind
    Date
    From: Maxime Ripard <maxime@cerno.tech>

    [ Upstream commit 9c6e4f6ed1d61d5f46946e5c151ceb279eedadb1 ]

    In the bind hook, we actually need the device to have the HSM clock
    running during the final part of the display initialisation where we
    reset the controller and initialise the CEC component.

    Failing to do so will result in a complete, silent, hang of the CPU.

    Fixes: 411efa18e4b0 ("drm/vc4: hdmi: Move the HSM clock enable to runtime_pm")
    Link: https://patchwork.freedesktop.org/patch/msgid/20210819135931.895976-3-maxime@cerno.tech
    Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
    Signed-off-by: Maxime Ripard <maxime@cerno.tech>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    drivers/gpu/drm/vc4/vc4_hdmi.c | 17 +++++++++++++++--
    1 file changed, 15 insertions(+), 2 deletions(-)

    diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
    index f7e48bc6cb114..29ee9264b0870 100644
    --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
    +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
    @@ -2191,6 +2191,18 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
    if (ret)
    goto err_put_ddc;

    + /*
    + * We need to have the device powered up at this point to call
    + * our reset hook and for the CEC init.
    + */
    + ret = vc4_hdmi_runtime_resume(dev);
    + if (ret)
    + goto err_put_ddc;
    +
    + pm_runtime_get_noresume(dev);
    + pm_runtime_set_active(dev);
    + pm_runtime_enable(dev);
    +
    if (vc4_hdmi->variant->reset)
    vc4_hdmi->variant->reset(vc4_hdmi);

    @@ -2202,8 +2214,6 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
    clk_prepare_enable(vc4_hdmi->pixel_bvb_clock);
    }

    - pm_runtime_enable(dev);
    -
    drm_simple_encoder_init(drm, encoder, DRM_MODE_ENCODER_TMDS);
    drm_encoder_helper_add(encoder, &vc4_hdmi_encoder_helper_funcs);

    @@ -2227,6 +2237,8 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
    vc4_hdmi_debugfs_regs,
    vc4_hdmi);

    + pm_runtime_put_sync(dev);
    +
    return 0;

    err_free_cec:
    @@ -2237,6 +2249,7 @@ err_destroy_conn:
    vc4_hdmi_connector_destroy(&vc4_hdmi->connector);
    err_destroy_encoder:
    drm_encoder_cleanup(encoder);
    + pm_runtime_put_sync(dev);
    pm_runtime_disable(dev);
    err_put_ddc:
    put_device(&vc4_hdmi->ddc->dev);
    --
    2.34.1


    \
     
     \ /
      Last update: 2022-01-25 01:11    [W:2.494 / U:0.792 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site