Linux-Amlogic Archive on lore.kernel.org
 help / color / mirror / Atom feed
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 v6 03/13] soc: amlogic: Add Meson GX HHI system controller driver
Date: Tue, 01 Dec 2026 20:24:30 +0000	[thread overview]
Message-ID: <sashiko-outbox-244189@kernel.org> (raw)
In-Reply-To: <20261201-meson-drm-create-hdmitx-phy-v6-3-5ccdf57a6cf5@aliel.fr>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] soc: amlogic: meson_gx_hhi_sysctrl_probe() registers PHY
  provider before PHY
- [High] soc: amlogic: meson_gx_hhi_sysctrl_probe() hijacks child PHY
  node lookups
--

commit 5d78a854bc7adf16d895a668b567c24c0ad39b45
Author: Ronald Claveau <linux-kernel-dev@aliel.fr>

soc: amlogic: Add Meson GX HHI system controller driver

This commit adds a driver for the Amlogic Meson GX HHI system controller
that registers a PHY provider and creates an auxiliary device for the
HDMI TX PHY driver.

> diff --git a/drivers/soc/amlogic/meson-gx-hhi-sysctrl.c b/drivers/soc/amlogic/meson-gx-hhi-sysctrl.c
> new file mode 100644
> index 0000000000000..d4ef41e422a27
> --- /dev/null
> +++ b/drivers/soc/amlogic/meson-gx-hhi-sysctrl.c

[ ... ]

> +static int meson_gx_hhi_sysctrl_probe(struct platform_device *pdev)
> +{
> +	struct phy_provider *phy_provider;
> +	struct auxiliary_device *auxdev;
> +	const char *phy_aux_name;
> +	struct device *dev = &pdev->dev;
> +
> +	phy_aux_name = device_get_match_data(dev);
> +	if (!phy_aux_name)
> +		return dev_err_probe(dev, -ENODEV, "missing PHY match data\n");
> +
> +	phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate);
> +	if (IS_ERR(phy_provider))
> +		return dev_err_probe(dev, PTR_ERR(phy_provider),
> +				     "failed to register PHY provider\n");

[Severity: High]
Does registering the HHI MFD node with devm_of_phy_provider_register()
intercept lookups for child PHY nodes under the HHI node?

devm_of_phy_provider_register() passes NULL for the children node, which
causes __of_phy_provider_register() to set phy_provider->children to
dev->of_node, and of_phy_provider_lookup() matches any direct child of
phy_provider->children:

drivers/phy/phy-core.c:of_phy_provider_lookup() {
	...
		for_each_child_of_node_scoped(phy_provider->children, child)
			if (child == node)
				return phy_provider;
	...
}

On G12A, G12B and SM1 SoCs, the HHI node contains the mipi_analog_dphy
child PHY node (compatible "amlogic,g12a-mipi-dphy-analog").  If
phy_meson_axg_mipi_dphy_probe() calls devm_phy_get(dev, "analog") before
phy_g12a_mipi_dphy_analog_probe() has created that PHY,
of_phy_provider_lookup() returns the HHI phy_provider instead of deferring
and of_phy_simple_xlate() returns -ENODEV, causing the MIPI D-PHY probe to
fail permanently.  Even after the child PHY driver probes,
of_phy_provider_lookup() matches the HHI provider first and pins the wrong
module owner.

> +
> +	auxdev = devm_auxiliary_device_create(dev, phy_aux_name, NULL);

[Severity: High]
Does registering phy_provider before the auxiliary HDMI TX PHY driver binds
break probe deferral for HDMI TX PHY consumers?

_of_phy_get_with_args() only returns -EPROBE_DEFER while
of_phy_provider_lookup() finds no provider for the node.  Once
devm_of_phy_provider_register() succeeds here, any consumer requesting the
PHY before the auxiliary driver has bound and called devm_phy_create()
reaches of_phy_simple_xlate(), which fails class_find_device_by_of_node()
and returns -ENODEV instead of -EPROBE_DEFER.  This happens whenever
CONFIG_MESON_GX_HHI_SYSCTRL=y and the HDMI TX PHY driver is built as a
module or probes later, causing devm_phy_get() callers to fail permanently
and devm_phy_optional_get() callers to treat the PHY as absent.  In
addition, phy_provider->owner is set to this module rather than the PHY
driver module, and devres teardown on unbind destroys auxdev and its struct
phy before unregistering phy_provider.

Since auxiliary_device_create() already copies dev->of_node to
auxdev->dev.of_node, could the auxiliary PHY driver register the PHY
provider itself after calling devm_phy_create()?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261201-meson-drm-create-hdmitx-phy-v6-0-5ccdf57a6cf5@aliel.fr?part=3

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

  reply	other threads:[~2026-12-01 20:24 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 20:12 [PATCH v6 00/13] phy/drm: amlogic: Extract Meson HDMI TX PHY into a dedicated driver Ronald Claveau via B4 Relay
2026-12-01 20:12 ` [PATCH v6 01/13] dt-bindings: soc: amlogic: meson-gx-hhi-sysctrl: Fix compatible matching in conditionals Ronald Claveau via B4 Relay
2026-12-01 20:12 ` [PATCH v6 02/13] dt-bindings: soc: amlogic: meson-gx-hhi-sysctrl: Add #phy-cells Ronald Claveau via B4 Relay
2026-12-01 20:27   ` sashiko-bot
2026-12-01 20:12 ` [PATCH v6 03/13] soc: amlogic: Add Meson GX HHI system controller driver Ronald Claveau via B4 Relay
2026-12-01 20:24   ` sashiko-bot [this message]
2026-12-01 20:12 ` [PATCH v6 04/13] phy: amlogic: rename Meson8 HDMI TX PHY driver to be SoC-generic Ronald Claveau via B4 Relay
2026-12-01 20:12 ` [PATCH v6 05/13] phy: amlogic: meson-hdmi-tx: Add GXBB, GXL, GXM and G12A support Ronald Claveau via B4 Relay
2026-12-01 20:25   ` sashiko-bot
2026-12-01 20:12 ` [PATCH v6 06/13] dt-bindings: display: amlogic,meson-dw-hdmi: Add phys Ronald Claveau via B4 Relay
2026-12-01 20:12 ` [PATCH v6 07/13] pmdomain: amlogic: meson-ee-pwrc: power up memories for boot-enabled domains Ronald Claveau via B4 Relay
2026-12-01 20:12 ` [PATCH v6 08/13] drm/meson: dw-hdmi: Drop manual HHI clock and memory PD setup Ronald Claveau via B4 Relay
2026-12-01 20:12 ` [PATCH v6 09/13] drm/meson: dw-hdmi: Use the generic PHY framework for the HDMI TX PHY Ronald Claveau via B4 Relay
2026-12-01 20:30   ` sashiko-bot
2026-12-01 20:12 ` [PATCH v6 10/13] arm64: dts: amlogic: g12: Use the HHI system controller as HDMI PHY provider Ronald Claveau via B4 Relay
2026-12-01 20:12 ` [PATCH v6 11/13] arm64: dts: amlogic: meson-gx: Add #phy-cells to the HHI system controller Ronald Claveau via B4 Relay
2026-12-01 20:13 ` [PATCH v6 12/13] arm64: dts: amlogic: Add HDMI TX PHY node for GXBB Ronald Claveau via B4 Relay
2026-12-01 20:32   ` sashiko-bot
2026-12-01 20:13 ` [PATCH v6 13/13] arm64: dts: amlogic: Add HDMI TX PHY node for GXL Ronald Claveau via B4 Relay
2026-12-01 20:23   ` 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=sashiko-outbox-244189@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