Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "AngeloGioacchino Del Regno" <angelogioacchino.delregno@collabora.com>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v9 11/13] drm/mediatek: mtk_dsi: Enable PM Runtime on probe
Date: Wed, 16 Sep 2026 11:28:12 +0000	[thread overview]
Message-ID: <20260916112813.11B941F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260916110825.102631-12-angelogioacchino.delregno@collabora.com>

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] drm/mediatek: DSI device is perpetually suspended causing external abort
- [High] drm/mediatek: mtk_dsi_host_transfer accesses unpowered registers
- [High] drm/mediatek: DSI IRQ handler accesses unpowered registers
--

commit 26652cbd743202a1f8035ecf743f6c0b1cf91008
Author: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

drm/mediatek: mtk_dsi: Enable PM Runtime on probe

This commit enables PM runtime at the end of mtk_dsi_probe() for the DSI
device to ensure power domains are turned on and off when necessary. The
commit message indicates that mtk_ddp_comp_power_on() and
mtk_ddp_comp_power_off() will handle the PM runtime resume and put.

> diff --git a/drivers/gpu/drm/mediatek/mtk_dsi.c b/drivers/gpu/drm/mediatek/mtk_dsi.c
> index 3b33419aee2d9..4863d910511e9 100644
> --- a/drivers/gpu/drm/mediatek/mtk_dsi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_dsi.c
> @@ -1735,6 +1735,10 @@ static int mtk_dsi_probe(struct platform_device *pdev)
>  	if (ret)
>  		return dev_err_probe(&pdev->dev, ret, "Failed to request DSI irq\n");
>  
> +	ret = devm_pm_runtime_enable(dev);

[Severity: High]
Does enabling PM runtime here leave the DSI device perpetually suspended,
causing an external abort when mtk_dsi_poweron() accesses the registers?

The commit message assumes mtk_ddp_comp_power_on() will resume the device.
However, mtk_crtc_atomic_enable() in drivers/gpu/drm/mediatek/mtk_crtc.c
only calls mtk_ddp_comp_power_on() for comp[0] (typically OVL or RDMA).

Since the DSI component is always at the end of the pipeline, it is never
passed to this function and remains in the suspended state.

[Severity: High]
Can mtk_dsi_host_transfer() access unpowered registers when called
asynchronously?

This function is an exported MIPI DSI host operation that can be called by
panel drivers to send commands. With PM runtime enabled, the function
directly reads hardware registers without wrapping the access in
pm_runtime_resume_and_get() and pm_runtime_put():

drivers/gpu/drm/mediatek/mtk_dsi.c:mtk_dsi_host_transfer() {
    ...
    dsi_mode = readl(dsi->regs + dsi->driver_data->reg_main[DSI_MODE_CTRL]);
    ...
}

If the power domain is off, this could lead to a synchronous external abort.

[Severity: High]
Will the DSI IRQ handler access unpowered registers if an interrupt fires
while the domain is suspended?

The mtk_dsi_irq() handler directly accesses hardware registers:

drivers/gpu/drm/mediatek/mtk_dsi.c:mtk_dsi_irq() {
    ...
    status = readl(dsi->regs + reg_main[DSI_INTSTA]) & flag;
    ...
}

Since the driver does not appear to call disable_irq() during suspend, a
pending or spurious interrupt firing while the domain is unpowered could
cause the handler to access unpowered registers.

Should the handler use pm_runtime_get_if_active() before accessing
registers, or should the IRQ be disabled during power off?

> +	if (ret)
> +		return ret;
> +
>  	ret = mipi_dsi_host_register(&dsi->host);
>  	if (ret < 0)
>  		return dev_err_probe(dev, ret, "Failed to register DSI host\n");

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260916110825.102631-1-angelogioacchino.delregno@collabora.com?part=11

  reply	other threads:[~2026-09-16 11:28 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-16 11:08 [PATCH v9 00/13] drm/mediatek: Add DSC, WDMA, MT8189/96 DSI support AngeloGioacchino Del Regno
2026-09-16 11:08 ` [PATCH v9 01/13] dt-bindings: display: mediatek: dsc: Add MT8196 compatible AngeloGioacchino Del Regno
2026-09-16 11:08 ` [PATCH v9 02/13] drm/mediatek: Implement Display Stream Compression support AngeloGioacchino Del Regno
2026-09-16 11:22   ` sashiko-bot
2026-09-19  6:52   ` Chaoyi Chen
2026-09-21 10:05     ` AngeloGioacchino Del Regno
2026-09-16 11:08 ` [PATCH v9 03/13] dt-bindings: display: mediatek: dsi: Document MT8189 and MT8196 AngeloGioacchino Del Regno
2026-09-16 11:08 ` [PATCH v9 04/13] drm/mediatek: mtk_dsi: Cleanup encoder if reset fails during bind AngeloGioacchino Del Regno
2026-09-16 11:08 ` [PATCH v9 05/13] drm/mediatek: mtk_dsi: Enable interrupt at component bind time AngeloGioacchino Del Regno
2026-09-16 11:20   ` sashiko-bot
2026-09-16 11:08 ` [PATCH v9 06/13] drm/mediatek: mtk_dsi: Transfer register offsets to per-SoC const AngeloGioacchino Del Regno
2026-09-16 11:08 ` [PATCH v9 07/13] drm/mediatek: mtk_dsi: Move max link rate parameter to platform data AngeloGioacchino Del Regno
2026-09-16 11:08 ` [PATCH v9 08/13] drm/mediatek: mtk_dsi: Add support for MT8189 AngeloGioacchino Del Regno
2026-09-16 11:08 ` [PATCH v9 09/13] drm/mediatek: mtk_dsi: Add support for SRAM QoS setting AngeloGioacchino Del Regno
2026-09-16 11:20   ` sashiko-bot
2026-09-16 11:08 ` [PATCH v9 10/13] drm/mediatek: mtk_dsi: Add support for MT8196 AngeloGioacchino Del Regno
2026-09-16 11:08 ` [PATCH v9 11/13] drm/mediatek: mtk_dsi: Enable PM Runtime on probe AngeloGioacchino Del Regno
2026-09-16 11:28   ` sashiko-bot [this message]
2026-09-16 11:08 ` [PATCH v9 12/13] dt-bindings: display: mediatek: wdma: Add compatibles for more SoCs AngeloGioacchino Del Regno
2026-09-16 11:08 ` [PATCH v9 13/13] drm/mediatek: Add Write DMA (WDMA) Engine for Writeback support AngeloGioacchino Del Regno
2026-09-16 11:22   ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260916112813.11B941F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox