From: sashiko-bot@kernel.org
To: "Ronald Claveau" <linux-kernel-dev@aliel.fr>
Cc: devicetree@vger.kernel.org, linux-amlogic@lists.infradead.org,
linux-phy@lists.infradead.org, dri-devel@lists.freedesktop.org,
robh@kernel.org, conor+dt@kernel.org, neil.armstrong@linaro.org,
vkoul@kernel.org, olteanv@gmail.com
Subject: Re: [PATCH v2 08/11] drm/meson: dw-hdmi: Use the generic PHY framework for the HDMI TX PHY
Date: Fri, 20 Nov 2026 19:20:39 +0000 [thread overview]
Message-ID: <sashiko-outbox-225914@kernel.org> (raw)
In-Reply-To: <20261120-meson-drm-create-hdmitx-phy-v2-8-93d622d9bb07@aliel.fr>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] drm/meson: dw-hdmi: missing PHY init in meson_dw_hdmi_init()
breaks CEC/ARC
- [Medium] drm/meson: dw-hdmi: phy_init() leak on error path in
dw_hdmi_phy_init()
--
commit 9c4e52bbd305f6371ee6545c479c9a84e6845324
Author: Ronald Claveau <linux-kernel-dev@aliel.fr>
drm/meson: dw-hdmi: Use the generic PHY framework for the HDMI TX PHY
This commit converts the Meson DW-HDMI driver from direct HHI register
programming to the generic PHY API, with a legacy fallback when the DT
node lacks a "phys" property.
> diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c
> index 20a821936b3af..1ca1ce6173563 100644
> --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c
> +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c
[ ... ]
> @@ -364,10 +276,18 @@ static int dw_hdmi_phy_init(struct dw_hdmi *hdmi, void *data,
> unsigned int wr_clk =
> readl_relaxed(priv->io_base + _REG(VPU_HDMI_SETTING));
> bool mode_is_420 = false;
> + unsigned int pixel_clock = mode->clock;
> + union phy_configure_opts opts = {};
> + int ret;
>
> DRM_DEBUG_DRIVER("\"%s\" div%d\n", mode->name,
> mode->clock > 340000 ? 40 : 10);
>
> + /* Setup PHY */
> + ret = phy_init(dw_hdmi->phy);
> + if (ret)
> + return ret;
> +
> if (drm_mode_is_420_only(display, mode) ||
> (!is_hdmi2_sink && drm_mode_is_420_also(display, mode)) ||
> dw_hdmi_bus_fmt_is_420(hdmi))
> @@ -392,19 +312,22 @@ static int dw_hdmi_phy_init(struct dw_hdmi *hdmi, void *data,
> dw_hdmi->data->top_write(dw_hdmi, HDMITX_TOP_TMDS_CLK_PTTN_CNTL, 0x2);
>
> /* Setup PHY parameters */
> - meson_hdmi_phy_setup_mode(dw_hdmi, mode, mode_is_420);
> -
> - /* Disable clock, fifo, fifo_wr */
> - regmap_update_bits(priv->hhi, HHI_HDMI_PHY_CNTL1, 0xf, 0);
> + if (mode_is_420)
> + pixel_clock /= 2;
> + opts.hdmi.tmds_char_rate = (u64)pixel_clock * 1000;
> + opts.hdmi.bpc = 8;
> + ret = phy_configure(dw_hdmi->phy, &opts);
> + if (ret)
> + return ret;
>
> dw_hdmi_set_high_tmds_clock_ratio(hdmi, display);
>
> msleep(100);
>
> /* Reset PHY 3 times in a row */
> - meson_dw_hdmi_phy_reset(dw_hdmi);
> - meson_dw_hdmi_phy_reset(dw_hdmi);
> - meson_dw_hdmi_phy_reset(dw_hdmi);
> + ret = phy_power_on(dw_hdmi->phy);
> + if (ret)
> + return ret;
[Severity: Medium]
Do the error returns from phy_configure() and phy_power_on() leak a
dw_hdmi->phy->init_count reference?
When dw_hdmi_phy_init() fails, dw_hdmi_setup() leaves hdmi->phy.enabled
false, so dw_hdmi_poweroff() never calls dw_hdmi_phy_disable() to balance
phy_init() with phy_exit(). A non-VIC DMT mode with a pixel clock below
25.175 MHz passes meson_encoder_hdmi_mode_valid() but is rejected with
-EINVAL by meson_hdmi_phy_configure() -> meson_hdmi_phy_find_rate(),
permanently elevating init_count so subsequent phy_init() calls skip
hardware initialization.
[ ... ]
> @@ -623,10 +542,6 @@ static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi)
> /* Enable normal output to PHY */
> meson_dw_hdmi->data->top_write(meson_dw_hdmi, HDMITX_TOP_BIST_CNTL, BIT(12));
>
> - /* Setup PHY */
> - regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL1, meson_dw_hdmi->data->cntl1_init);
> - regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL0, meson_dw_hdmi->data->cntl0_init);
> -
> /* Enable HDMI-TX Interrupt */
> meson_dw_hdmi->data->top_write(meson_dw_hdmi, HDMITX_TOP_INTR_STAT_CLR,
> HDMITX_TOP_INTR_CORE);
[Severity: High]
Does removing the initial PHY setup from meson_dw_hdmi_init() leave the
HDMI TX PHY uninitialized whenever no HDMI video mode is active?
meson_dw_hdmi_init() pulses reset_control_reset(meson_dw_hdmi->hdmitx_phy)
at bind and system resume time, while meson_venc_init() zeroes
HHI_HDMI_PHY_CNTL0. Commits 04703bfd7f99 ("drm/meson: dw-hdmi: power up
phy on device init") and 08001033121d ("drm/meson: dw-hdmi: add bandgap
setting for g12") programmed HHI_HDMI_PHY_CNTL1 and HHI_HDMI_PHY_CNTL0
here because CEC and the G12A ARC/eARC utility pin need the PHY
initialized even before the first HDMI modeset or when another display
interface is used.
With phy_init() deferred to dw_hdmi_phy_init(), which dw_hdmi_setup() only
calls when enabling an active HDMI display mode (and which
meson_dw_hdmi_pm_resume() -> dw_hdmi_resume() does not call), the PHY
stays in its post-reset state at boot and after resume whenever HDMI
video is inactive.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261120-meson-drm-create-hdmitx-phy-v2-0-93d622d9bb07@aliel.fr?part=8
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
next prev parent reply other threads:[~2026-11-20 19:20 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 18:15 [PATCH v2 00/11] phy/drm: amlogic: Extract Meson HDMI TX PHY into a dedicated driver Ronald Claveau via B4 Relay
2026-11-20 18:15 ` [PATCH v2 01/11] dt-bindings: soc: amlogic: meson-gx-hhi-sysctrl: Fix compatible matching in conditionals Ronald Claveau via B4 Relay
2026-11-20 18:15 ` [PATCH v2 02/11] dt-bindings: phy: amlogic: Add Meson HDMI TX PHY binding Ronald Claveau via B4 Relay
2026-11-20 18:15 ` [PATCH v2 03/11] dt-bindings: soc: amlogic: meson-gx-hhi-sysctrl: Add hdmi-phy child node Ronald Claveau via B4 Relay
2026-11-20 18:15 ` [PATCH v2 04/11] phy: amlogic: Add Meson HDMI TX PHY driver Ronald Claveau via B4 Relay
2026-11-20 18:15 ` [PATCH v2 05/11] dt-bindings: display: amlogic,meson-dw-hdmi: Add phys Ronald Claveau via B4 Relay
2026-11-20 18:15 ` [PATCH v2 06/11] pmdomain: amlogic: meson-ee-pwrc: power up memories for boot-enabled domains Ronald Claveau via B4 Relay
2026-11-20 18:58 ` sashiko-bot
2026-11-20 18:15 ` [PATCH v2 07/11] drm/meson: dw-hdmi: Drop manual HHI clock and memory PD setup Ronald Claveau via B4 Relay
2026-11-20 18:15 ` [PATCH v2 08/11] drm/meson: dw-hdmi: Use the generic PHY framework for the HDMI TX PHY Ronald Claveau via B4 Relay
2026-11-20 19:20 ` sashiko-bot [this message]
2026-11-20 18:15 ` [PATCH v2 09/11] arm64: dts: amlogic: Add HDMI TX PHY node for G12 Ronald Claveau via B4 Relay
2026-11-20 18:15 ` [PATCH v2 10/11] arm64: dts: amlogic: Add HDMI TX PHY node for GXBB Ronald Claveau via B4 Relay
2026-11-20 18:15 ` [PATCH v2 11/11] arm64: dts: amlogic: Add HDMI TX PHY node for GXL Ronald Claveau via B4 Relay
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=sashiko-outbox-225914@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-kernel-dev@aliel.fr \
--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