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
 -----BEGIN PGP SIGNATURE-----
 
 iQJMBAABCgA2FiEEACwLKSDmq+9RDv5P4cpzo8lZTiQFAmiw5k4YHGNodW5rdWFu
 Zy5odUBrZXJuZWwub3JnAAoJEOHKc6PJWU4klDcP+wXMw/9gEBq7JTaFs9dvtvf7
 yXZdoSAmTVgjYT3gArC98kXBA6mbRvKkG4s6M2uJuczVml+6mxarwsLkfFIiRiSB
 Nk9lhV84WKdqvSRcVyYuI47Pkp1QR3yPX7UD9OCm9iq+VjQeHNhIxR5GLZ0Rt8wR
 5OST60KoNHBH9jWMn9GbWh1FYtqtdvcOWr90ZtKvsyPXyHVXfqsoDy8PJ9X+vwJq
 sbgdO2BRd7jEJ8+tcI4ZOJl1x6+Q3RXosYzcxvIXtrDr39ETKLFiloL9o7H27rSU
 z6G1xyGo1dOMQ3LGMYQMr0QziqVPVPBDmrd2cv/Nf1yeCCy1E+msqpm0u6vcOJ2x
 Soq/zaPUMut5VaHKfIpFOCiKiIKhcxlP5krYg3g4rg4JzxHzCUCfawblQrleNDJx
 FUUmHxjELPfuUDbPdAWoq33UVbuUNYpDseSbrGbskKA+gzcYQtwNElae8283fC5H
 47W8y1UmwOutbnoTcVW7RRl2RAbjXjjID6tRtbVGHWS5ST5NnxFbcRX1uwzDoC+3
 T2UCDYXDhJuhUKeahFfDjwMcvy8BcGqIqo3oqptcpr4hRvGPXaLVL7smWXOJNpgF
 qRmN8bbNZjgQlHHdBYN7a9XKRK7nRNmRFtnE9FUQVOmbU7y5q90uOiy4qwZIMw1Q
 nmXAMvjQVfjCbemvU6ad
 =j/Jq
 -----END PGP SIGNATURE-----

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: Dave 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
This commit is contained in:
Dave Airlie 2025-08-29 10:04:26 +10:00
commit 42d2abbfa8
4 changed files with 26 additions and 12 deletions

View file

@ -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,10 +411,17 @@ static bool mtk_drm_get_all_drm_priv(struct device *dev)
if (temp_drm_priv->mtk_drm_bound)
cnt++;
if (cnt == MAX_CRTC) {
of_node_put(node);
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) {

View file

@ -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);

View file

@ -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)

View file

@ -292,7 +292,8 @@ 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;
mtk_crtc_plane_disable(old_state->crtc, plane);
if (old_state && old_state->crtc)
mtk_crtc_plane_disable(old_state->crtc, plane);
}
static void mtk_plane_atomic_update(struct drm_plane *plane,