Unverified Commit 9f3f5938 authored by Herve Codina's avatar Herve Codina Committed by Maxime Ripard
Browse files

drm/vc4: hdmi: Use drm_atomic_helper_reset_crtc()



The current code uses a the reset_pipe() local function to reset the
CRTC outputs.

drm_atomic_helper_reset_crtc() has been introduced recently and it
performs exact same operations.

In order to avoid code duplication, use the new helper instead of the
local function.

Signed-off-by: default avatarHerve Codina <herve.codina@bootlin.com>
Acked-by: default avatarDmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: default avatarMaxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20250210132620.42263-4-herve.codina@bootlin.com


Signed-off-by: default avatarMaxime Ripard <mripard@kernel.org>
parent ab83b7f6
Loading
Loading
Loading
Loading
+1 −29
Original line number Diff line number Diff line
@@ -270,34 +270,6 @@ static void vc4_hdmi_cec_update_clk_div(struct vc4_hdmi *vc4_hdmi)
static void vc4_hdmi_cec_update_clk_div(struct vc4_hdmi *vc4_hdmi) {}
#endif

static int reset_pipe(struct drm_crtc *crtc,
			struct drm_modeset_acquire_ctx *ctx)
{
	struct drm_atomic_state *state;
	struct drm_crtc_state *crtc_state;
	int ret;

	state = drm_atomic_state_alloc(crtc->dev);
	if (!state)
		return -ENOMEM;

	state->acquire_ctx = ctx;

	crtc_state = drm_atomic_get_crtc_state(state, crtc);
	if (IS_ERR(crtc_state)) {
		ret = PTR_ERR(crtc_state);
		goto out;
	}

	crtc_state->connectors_changed = true;

	ret = drm_atomic_commit(state);
out:
	drm_atomic_state_put(state);

	return ret;
}

static int vc4_hdmi_reset_link(struct drm_connector *connector,
			       struct drm_modeset_acquire_ctx *ctx)
{
@@ -376,7 +348,7 @@ static int vc4_hdmi_reset_link(struct drm_connector *connector,
	 * would be perfectly happy if were to just reconfigure
	 * the SCDC settings on the fly.
	 */
	return reset_pipe(crtc, ctx);
	return drm_atomic_helper_reset_crtc(crtc, ctx);
}

static void vc4_hdmi_handle_hotplug(struct vc4_hdmi *vc4_hdmi,