Skip to content

Commit 1fb50e5

Browse files
committed
Merge tag 'mediatek-drm-fixes-20260729' of https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux into drm-fixes
Mediatek DRM Fixes - 20260729 1. Check CRTC state before freeing 2. mtk_hdmi: Fix DDC adapter double put in v2 3. mtk_hdmi_common: take i2c adapter module reference 4. mtk_dsi: Enable HS clock only at pre-enable 5. ovl_adaptor: balance component registrations Signed-off-by: Dave Airlie <airlied@redhat.com> From: Chun-Kuang Hu <chunkuang.hu@kernel.org> Link: https://patch.msgid.link/20260729131701.4158-1-chunkuang.hu@kernel.org
2 parents f5098b6 + 533e346 commit 1fb50e5

5 files changed

Lines changed: 21 additions & 16 deletions

File tree

drivers/gpu/drm/mediatek/mtk_crtc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,10 @@ static void mtk_crtc_reset(struct drm_crtc *crtc)
154154
{
155155
struct mtk_crtc_state *state;
156156

157-
if (crtc->state)
157+
if (crtc->state) {
158158
__drm_atomic_helper_crtc_destroy_state(crtc->state);
159-
160-
kfree(to_mtk_crtc_state(crtc->state));
159+
kfree(to_mtk_crtc_state(crtc->state));
160+
}
161161
crtc->state = NULL;
162162

163163
state = kzalloc_obj(*state);

drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,7 @@ static void mtk_disp_ovl_adaptor_master_unbind(struct device *dev)
625625
struct mtk_disp_ovl_adaptor *priv = dev_get_drvdata(dev);
626626

627627
priv->children_bound = false;
628+
component_unbind_all(dev, priv->mmsys_dev);
628629
}
629630

630631
static const struct component_master_ops mtk_disp_ovl_adaptor_master_ops = {
@@ -651,12 +652,15 @@ static int mtk_disp_ovl_adaptor_probe(struct platform_device *pdev)
651652

652653
priv->mmsys_dev = pdev->dev.platform_data;
653654

654-
component_master_add_with_match(dev, &mtk_disp_ovl_adaptor_master_ops, match);
655+
ret = component_master_add_with_match(dev, &mtk_disp_ovl_adaptor_master_ops, match);
656+
if (ret)
657+
return dev_err_probe(dev, ret, "Failed to add component master\n");
655658

656659
pm_runtime_enable(dev);
657660

658661
ret = component_add(dev, &mtk_disp_ovl_adaptor_comp_ops);
659662
if (ret != 0) {
663+
component_master_del(dev, &mtk_disp_ovl_adaptor_master_ops);
660664
pm_runtime_disable(dev);
661665
return dev_err_probe(dev, ret, "Failed to add component\n");
662666
}
@@ -666,6 +670,7 @@ static int mtk_disp_ovl_adaptor_probe(struct platform_device *pdev)
666670

667671
static void mtk_disp_ovl_adaptor_remove(struct platform_device *pdev)
668672
{
673+
component_del(&pdev->dev, &mtk_disp_ovl_adaptor_comp_ops);
669674
component_master_del(&pdev->dev, &mtk_disp_ovl_adaptor_master_ops);
670675
pm_runtime_disable(&pdev->dev);
671676
}

drivers/gpu/drm/mediatek/mtk_dsi.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -743,8 +743,6 @@ static int mtk_dsi_poweron(struct mtk_dsi *dsi)
743743
mtk_dsi_set_vm_cmd(dsi);
744744
mtk_dsi_config_vdo_timing(dsi);
745745
mtk_dsi_set_interrupt_enable(dsi);
746-
mtk_dsi_lane_ready(dsi);
747-
mtk_dsi_clk_hs_mode(dsi, 1);
748746

749747
return 0;
750748
err_disable_engine_clk:
@@ -858,6 +856,9 @@ static void mtk_dsi_bridge_atomic_pre_enable(struct drm_bridge *bridge,
858856
ret = mtk_dsi_poweron(dsi);
859857
if (ret < 0)
860858
drm_err(drm, "failed to power on dsi\n");
859+
860+
mtk_dsi_lane_ready(dsi);
861+
mtk_dsi_clk_hs_mode(dsi, 1);
861862
}
862863

863864
static void mtk_dsi_bridge_atomic_post_disable(struct drm_bridge *bridge,

drivers/gpu/drm/mediatek/mtk_hdmi_common.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,13 @@ static int mtk_hdmi_get_cec_dev(struct mtk_hdmi *hdmi, struct device *dev, struc
290290
return 0;
291291
}
292292

293+
static void mtk_hdmi_put_adapter(void *_adap)
294+
{
295+
struct i2c_adapter *adap = _adap;
296+
297+
i2c_put_adapter(adap);
298+
}
299+
293300
static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi, struct platform_device *pdev,
294301
const char * const *clk_names, size_t num_clocks)
295302
{
@@ -328,12 +335,12 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi, struct platform_device
328335
if (!i2c_np)
329336
return dev_err_probe(dev, -EINVAL, "No ddc-i2c-bus in connector\n");
330337

331-
hdmi->ddc_adpt = of_find_i2c_adapter_by_node(i2c_np);
338+
hdmi->ddc_adpt = of_get_i2c_adapter_by_node(i2c_np);
332339
of_node_put(i2c_np);
333340
if (!hdmi->ddc_adpt)
334341
return dev_err_probe(dev, -EPROBE_DEFER, "Failed to get ddc i2c adapter by node\n");
335342

336-
ret = devm_add_action_or_reset(dev, mtk_hdmi_put_device, &hdmi->ddc_adpt->dev);
343+
ret = devm_add_action_or_reset(dev, mtk_hdmi_put_adapter, hdmi->ddc_adpt);
337344
if (ret)
338345
return ret;
339346

drivers/gpu/drm/mediatek/mtk_hdmi_v2.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1499,13 +1499,6 @@ static int mtk_hdmi_v2_probe(struct platform_device *pdev)
14991499
return 0;
15001500
}
15011501

1502-
static void mtk_hdmi_v2_remove(struct platform_device *pdev)
1503-
{
1504-
struct mtk_hdmi *hdmi = platform_get_drvdata(pdev);
1505-
1506-
i2c_put_adapter(hdmi->ddc_adpt);
1507-
}
1508-
15091502
static const struct of_device_id mtk_drm_hdmi_v2_of_ids[] = {
15101503
{ .compatible = "mediatek,mt8188-hdmi-tx", .data = &mtk_hdmi_conf_mt8188 },
15111504
{ .compatible = "mediatek,mt8195-hdmi-tx", .data = &mtk_hdmi_conf_mt8195 },
@@ -1515,7 +1508,6 @@ MODULE_DEVICE_TABLE(of, mtk_drm_hdmi_v2_of_ids);
15151508

15161509
static struct platform_driver mtk_hdmi_v2_driver = {
15171510
.probe = mtk_hdmi_v2_probe,
1518-
.remove = mtk_hdmi_v2_remove,
15191511
.driver = {
15201512
.name = "mediatek-drm-hdmi-v2",
15211513
.of_match_table = mtk_drm_hdmi_v2_of_ids,

0 commit comments

Comments
 (0)