Skip to content

Commit 42d2abb

Browse files
committed
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 <[email protected]> From: Chun-Kuang Hu <[email protected]> Link: https://lore.kernel.org/r/[email protected]
2 parents 4986258 + c344148 commit 42d2abb

File tree

4 files changed

+26
-12
lines changed

4 files changed

+26
-12
lines changed

drivers/gpu/drm/mediatek/mtk_drm_drv.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -387,19 +387,19 @@ static bool mtk_drm_get_all_drm_priv(struct device *dev)
387387

388388
of_id = of_match_node(mtk_drm_of_ids, node);
389389
if (!of_id)
390-
continue;
390+
goto next_put_node;
391391

392392
pdev = of_find_device_by_node(node);
393393
if (!pdev)
394-
continue;
394+
goto next_put_node;
395395

396396
drm_dev = device_find_child(&pdev->dev, NULL, mtk_drm_match);
397397
if (!drm_dev)
398-
continue;
398+
goto next_put_device_pdev_dev;
399399

400400
temp_drm_priv = dev_get_drvdata(drm_dev);
401401
if (!temp_drm_priv)
402-
continue;
402+
goto next_put_device_drm_dev;
403403

404404
if (temp_drm_priv->data->main_len)
405405
all_drm_priv[CRTC_MAIN] = temp_drm_priv;
@@ -411,10 +411,17 @@ static bool mtk_drm_get_all_drm_priv(struct device *dev)
411411
if (temp_drm_priv->mtk_drm_bound)
412412
cnt++;
413413

414-
if (cnt == MAX_CRTC) {
415-
of_node_put(node);
414+
next_put_device_drm_dev:
415+
put_device(drm_dev);
416+
417+
next_put_device_pdev_dev:
418+
put_device(&pdev->dev);
419+
420+
next_put_node:
421+
of_node_put(node);
422+
423+
if (cnt == MAX_CRTC)
416424
break;
417-
}
418425
}
419426

420427
if (drm_priv->data->mmsys_dev_num == cnt) {

drivers/gpu/drm/mediatek/mtk_dsi.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,6 +1002,12 @@ static int mtk_dsi_host_attach(struct mipi_dsi_host *host,
10021002
return PTR_ERR(dsi->next_bridge);
10031003
}
10041004

1005+
/*
1006+
* set flag to request the DSI host bridge be pre-enabled before device bridge
1007+
* in the chain, so the DSI host is ready when the device bridge is pre-enabled
1008+
*/
1009+
dsi->next_bridge->pre_enable_prev_first = true;
1010+
10051011
drm_bridge_add(&dsi->bridge);
10061012

10071013
ret = component_add(host->dev, &mtk_dsi_component_ops);

drivers/gpu/drm/mediatek/mtk_hdmi.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,8 @@ static inline struct mtk_hdmi *hdmi_ctx_from_bridge(struct drm_bridge *b)
182182

183183
static void mtk_hdmi_hw_vid_black(struct mtk_hdmi *hdmi, bool black)
184184
{
185-
regmap_update_bits(hdmi->regs, VIDEO_SOURCE_SEL,
186-
VIDEO_CFG_4, black ? GEN_RGB : NORMAL_PATH);
185+
regmap_update_bits(hdmi->regs, VIDEO_CFG_4,
186+
VIDEO_SOURCE_SEL, black ? GEN_RGB : NORMAL_PATH);
187187
}
188188

189189
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,
310310

311311
static void mtk_hdmi_hw_send_aud_packet(struct mtk_hdmi *hdmi, bool enable)
312312
{
313-
regmap_update_bits(hdmi->regs, AUDIO_PACKET_OFF,
314-
GRL_SHIFT_R2, enable ? 0 : AUDIO_PACKET_OFF);
313+
regmap_update_bits(hdmi->regs, GRL_SHIFT_R2,
314+
AUDIO_PACKET_OFF, enable ? 0 : AUDIO_PACKET_OFF);
315315
}
316316

317317
static void mtk_hdmi_hw_config_sys(struct mtk_hdmi *hdmi)

drivers/gpu/drm/mediatek/mtk_plane.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,8 @@ static void mtk_plane_atomic_disable(struct drm_plane *plane,
292292
wmb(); /* Make sure the above parameter is set before update */
293293
mtk_plane_state->pending.dirty = true;
294294

295-
mtk_crtc_plane_disable(old_state->crtc, plane);
295+
if (old_state && old_state->crtc)
296+
mtk_crtc_plane_disable(old_state->crtc, plane);
296297
}
297298

298299
static void mtk_plane_atomic_update(struct drm_plane *plane,

0 commit comments

Comments
 (0)