From: sashiko-bot@kernel.org
To: "AngeloGioacchino Del Regno" <angelogioacchino.delregno@collabora.com>
Cc: olteanv@gmail.com, neil.armstrong@linaro.org,
devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org,
robh@kernel.org, vkoul@kernel.org, linux-phy@lists.infradead.org,
conor+dt@kernel.org
Subject: Re: [PATCH 2/2] phy: mediatek: Add support for MT8196 MIPI DSI PHY
Date: Wed, 01 Jul 2026 12:29:35 +0000 [thread overview]
Message-ID: <20260701122936.58E7B1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260701121943.19430-3-angelogioacchino.delregno@collabora.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Calling usleep_range() inside a clk_ops->enable callback will trigger a 'scheduling while atomic' BUG.
- [Medium] The PLL rate is clamped to a maximum of 1.6 GHz, rendering the new high-speed voltage logic for rates >= 2.0 GHz completely unreachable.
--
commit af99b6688956e76bb38344e38d2af3b56056ec47
Author: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
phy: mediatek: Add support for MT8196 MIPI DSI PHY
Add support for the MIPI DSI PHY found in the MediaTek MT8196 SoC
and its variants. This initial driver only adds support for basic
functionality that is necessary to drive MIPI DSI displays as a D-PHY.
> diff --git a/drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8196.c b/drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8196.c
> new file mode 100644
> index 0000000000000..273f236fa7e9e
> --- /dev/null
> +++ b/drivers/phy/mediatek/phy-mtk-mipi-dsi-mt8196.c
[ ... ]
> +static int mtk_mipi_tx_pll_enable(struct clk_hw *hw)
> +{
> + struct mtk_mipi_tx *mipi_tx = mtk_mipi_tx_from_clk_hw(hw);
> + void __iomem *base = mipi_tx->regs;
> + u32 voltage = RG_DSI_PRD_REF_MINI;
> + u32 pres = MIPITX_PRESERVED_MINI;
> + unsigned long long pcw_calc;
> + unsigned int txdiv, txdiv0;
> + u32 pcw;
> +
> + dev_dbg(mipi_tx->dev, "enable: %u bps\n", mipi_tx->data_rate);
> +
> + if (mipi_tx->data_rate >= 2000000000) {
> + /* Select higher signaling voltage for fast data rates */
[Severity: Medium]
Will this condition ever be met?
Further down in this patch, mtk_mipi_tx_pll_determine_rate() unconditionally
clamps the requested rate to a maximum of 1.6 GHz.
Since the framework passes this clamped rate to the set_rate callback, won't
this high-speed logic for 2.0 GHz become unreachable dead code?
> + voltage = RG_DSI_PRD_REF_DEF;
> + pres = MIPITX_PRESERVED_DEF;
> + txdiv = 1;
> + txdiv0 = 0;
> + } else if (mipi_tx->data_rate >= 1000000000) {
[ ... ]
> + mtk_phy_update_field(base + MIPITX_VOLTAGE_SEL, RG_DSI_PRD_REF_SEL, voltage);
> + writel(pres, base + MIPITX_PRESERVED);
> +
> + mtk_phy_set_bits(base + MIPITX_PLL_PWR, AD_DSI_PLL_SDM_PWR_ON);
> + mtk_phy_clear_bits(base + MIPITX_PLL_CON1, RG_DSI_PLL_EN);
> + usleep_range(30, 60);
[Severity: High]
Is it safe to sleep here?
The Common Clock Framework invokes clk_ops->enable callbacks with the
enable_lock spinlock held and local interrupts disabled.
Because mtk_mipi_tx_pll_enable() is registered as the .enable callback,
won't calling usleep_range() here in an atomic context trigger a
scheduling while atomic BUG?
Should this use udelay() instead, or could this logic be moved to the
.prepare callback where sleeping is permitted?
> +
> + mtk_phy_clear_bits(base + MIPITX_PLL_PWR, AD_DSI_PLL_SDM_ISO_EN);
> + writel(pcw, base + MIPITX_PLL_CON0);
> + mtk_phy_update_field(base + MIPITX_PLL_CON1, RG_DSI_PLL_POSDIV, txdiv0);
> + usleep_range(30, 60);
> +
> + mtk_phy_set_bits(base + MIPITX_PLL_CON1, RG_DSI_PLL_EN);
> + usleep_range(30, 60);
> +
> + return 0;
> +}
[ ... ]
> +static int mtk_mipi_tx_pll_determine_rate(struct clk_hw *hw,
> + struct clk_rate_request *req)
> +{
> + req->rate = clamp_val(req->rate, 125000000, 1600000000);
[Severity: Medium]
Is this maximum rate intentional for the MT8196?
This limits the rate to 1.6 GHz, which prevents the 2.0 GHz signaling
voltage logic in mtk_mipi_tx_pll_enable() from ever executing.
> +
> + return 0;
> +}
> +
> +static const struct clk_ops mtk_mipi_tx_pll_ops = {
> + .enable = mtk_mipi_tx_pll_enable,
> + .disable = mtk_mipi_tx_pll_disable,
> + .determine_rate = mtk_mipi_tx_pll_determine_rate,
> + .set_rate = mtk_mipi_tx_pll_set_rate,
> + .recalc_rate = mtk_mipi_tx_pll_recalc_rate,
> +};
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260701121943.19430-1-angelogioacchino.delregno@collabora.com?part=2
prev parent reply other threads:[~2026-07-01 12:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-01 12:19 [PATCH 0/2] PHY: Add support for MT8196 DSI PHY AngeloGioacchino Del Regno
2026-07-01 12:19 ` [PATCH 1/2] dt-bindings: phy: mediatek,dsi-phy: Add support for MT8196 AngeloGioacchino Del Regno
2026-07-01 12:19 ` [PATCH 2/2] phy: mediatek: Add support for MT8196 MIPI DSI PHY AngeloGioacchino Del Regno
2026-07-01 12:29 ` sashiko-bot [this message]
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=20260701122936.58E7B1F000E9@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=linux-phy@lists.infradead.org \
--cc=neil.armstrong@linaro.org \
--cc=olteanv@gmail.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vkoul@kernel.org \
/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