Commit 42d2abbf authored by Dave Airlie's avatar Dave Airlie
Browse files

Merge tag 'mediatek-drm-fixes-20250829' of...

Merge tag 'mediatek-drm-fixes-20250829' of https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux

 into drm-fixes

Mediatek DRM Fixes - 20250829

1. Add error handling for old state CRTC in atomic_disable
2. Fix DSI host and panel bridge pre-enable order
3. Fix device/node reference count leaks in mtk_drm_get_all_drm_priv
4. mtk_hdmi: Fix inverted parameters in some regmap_update_bits calls

Signed-off-by: default avatarDave Airlie <airlied@redhat.com>

From: Chun-Kuang Hu <chunkuang.hu@kernel.org>
Link: https://lore.kernel.org/r/20250828234116.4960-1-chunkuang.hu@kernel.org
parents 49862587 c3441488
Loading
Loading
Loading
Loading
+14 −7
Original line number Diff line number Diff line
@@ -387,19 +387,19 @@ static bool mtk_drm_get_all_drm_priv(struct device *dev)

		of_id = of_match_node(mtk_drm_of_ids, node);
		if (!of_id)
			continue;
			goto next_put_node;

		pdev = of_find_device_by_node(node);
		if (!pdev)
			continue;
			goto next_put_node;

		drm_dev = device_find_child(&pdev->dev, NULL, mtk_drm_match);
		if (!drm_dev)
			continue;
			goto next_put_device_pdev_dev;

		temp_drm_priv = dev_get_drvdata(drm_dev);
		if (!temp_drm_priv)
			continue;
			goto next_put_device_drm_dev;

		if (temp_drm_priv->data->main_len)
			all_drm_priv[CRTC_MAIN] = temp_drm_priv;
@@ -411,11 +411,18 @@ static bool mtk_drm_get_all_drm_priv(struct device *dev)
		if (temp_drm_priv->mtk_drm_bound)
			cnt++;

		if (cnt == MAX_CRTC) {
next_put_device_drm_dev:
		put_device(drm_dev);

next_put_device_pdev_dev:
		put_device(&pdev->dev);

next_put_node:
		of_node_put(node);

		if (cnt == MAX_CRTC)
			break;
	}
	}

	if (drm_priv->data->mmsys_dev_num == cnt) {
		for (i = 0; i < cnt; i++)
+6 −0
Original line number Diff line number Diff line
@@ -1002,6 +1002,12 @@ static int mtk_dsi_host_attach(struct mipi_dsi_host *host,
			return PTR_ERR(dsi->next_bridge);
	}

	/*
	 * set flag to request the DSI host bridge be pre-enabled before device bridge
	 * in the chain, so the DSI host is ready when the device bridge is pre-enabled
	 */
	dsi->next_bridge->pre_enable_prev_first = true;

	drm_bridge_add(&dsi->bridge);

	ret = component_add(host->dev, &mtk_dsi_component_ops);
+4 −4
Original line number Diff line number Diff line
@@ -182,8 +182,8 @@ static inline struct mtk_hdmi *hdmi_ctx_from_bridge(struct drm_bridge *b)

static void mtk_hdmi_hw_vid_black(struct mtk_hdmi *hdmi, bool black)
{
	regmap_update_bits(hdmi->regs, VIDEO_SOURCE_SEL,
			   VIDEO_CFG_4, black ? GEN_RGB : NORMAL_PATH);
	regmap_update_bits(hdmi->regs, VIDEO_CFG_4,
			   VIDEO_SOURCE_SEL, black ? GEN_RGB : NORMAL_PATH);
}

static void mtk_hdmi_hw_make_reg_writable(struct mtk_hdmi *hdmi, bool enable)
@@ -310,8 +310,8 @@ static void mtk_hdmi_hw_send_info_frame(struct mtk_hdmi *hdmi, u8 *buffer,

static void mtk_hdmi_hw_send_aud_packet(struct mtk_hdmi *hdmi, bool enable)
{
	regmap_update_bits(hdmi->regs, AUDIO_PACKET_OFF,
			   GRL_SHIFT_R2, enable ? 0 : AUDIO_PACKET_OFF);
	regmap_update_bits(hdmi->regs, GRL_SHIFT_R2,
			   AUDIO_PACKET_OFF, enable ? 0 : AUDIO_PACKET_OFF);
}

static void mtk_hdmi_hw_config_sys(struct mtk_hdmi *hdmi)
+2 −1
Original line number Diff line number Diff line
@@ -292,6 +292,7 @@ static void mtk_plane_atomic_disable(struct drm_plane *plane,
	wmb(); /* Make sure the above parameter is set before update */
	mtk_plane_state->pending.dirty = true;

	if (old_state && old_state->crtc)
		mtk_crtc_plane_disable(old_state->crtc, plane);
}