Unverified Commit 9c6e4f6e authored by Maxime Ripard's avatar Maxime Ripard
Browse files

drm/vc4: hdmi: Make sure the controller is powered up during bind

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: 411efa18 ("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: default avatarDave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: default avatarMaxime Ripard <maxime@cerno.tech>
parent 0f525133
Loading
Loading
Loading
Loading
+15 −2
Original line number Diff line number Diff line
@@ -2199,6 +2199,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);

@@ -2210,8 +2222,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);

@@ -2235,6 +2245,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:
@@ -2245,6 +2257,7 @@ static int vc4_hdmi_bind(struct device *dev, struct device *master, void *data)
	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);