[PATCH v5] drm/bridge: analogix_dp: use devm_phy_optional_get() for the DP PHY
From: Jun Yan
Date: Mon Nov 16 2026 - 07:30:40 EST
The DP PHY is optional: the Rockchip RK3399 eDP controller has an
integrated PHY that is part of the Analogix DP block and is programmed
through the controller's own MMIO registers, so its DT node has no
"phys"/"phy-names" property. The other supported Rockchip variants
describe a separate PHY and are unaffected.
devm_phy_get() therefore returns -ENODEV on RK3399 and the driver logs a
misleading "no DP phy configured" error before falling back to a NULL phy.
Use devm_phy_optional_get() instead, which returns NULL when the PHY is
absent and propagates any other error, and drop the open-coded -ENODEV/
-ENOSYS handling and the spurious error message.
The behaviour is unchanged for both CONFIG_GENERIC_PHY settings, because
the real implementation never returns -ENOSYS:
- CONFIG_GENERIC_PHY=n: devm_phy_optional_get() is a stub returning NULL
(devm_phy_get() returns -ENOSYS, which the old code mapped to NULL).
- CONFIG_GENERIC_PHY=y, no PHY described in DT: devm_phy_optional_get()
converts -ENODEV to NULL, exactly like the old code, which mapped
-ENODEV to NULL in its open-coded check.
- CONFIG_GENERIC_PHY=y, any other error: still propagated, as before.
Signed-off-by: Jun Yan <jerrysteve1101@xxxxxxxxx>
Reviewed-by: Damon Ding <damon.ding@xxxxxxxxxxxxxx>
---
Changes in v5:
- Fix the comment and the commit message to mention RK3399 only.
- Link to v4: https://lore.kernel.org/dri-devel/20261115053625.404795-1-jerrysteve1101@xxxxxxxxx/
Changes in v4:
- Rework the commit message to explain why the behaviour is unchanged
for both CONFIG_GENERIC_PHY settings, with one bullet per case, as
requested by Luca Ceresoli.
- Link to v3: https://lore.kernel.org/dri-devel/20261110023721.2014061-1-jerrysteve1101@xxxxxxxxx/
Changes in v3:
- Add missing changelog entries and reference links
- Link to v2: https://lore.kernel.org/dri-devel/20261013134659.335829-1-jerrysteve1101@xxxxxxxxx/
Changes in v2:
- Added comments to explain the changes made.
- Link to v1: https://lore.kernel.org/dri-devel/20260924020417.868588-1-jerrysteve1101@xxxxxxxxx/
.../drm/bridge/analogix/analogix_dp_core.c | 22 ++++++-------------
1 file changed, 7 insertions(+), 15 deletions(-)
diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
index 6df6963740d2..6d50ffdae17f 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
@@ -1426,21 +1426,13 @@ analogix_dp_probe(struct device *dev, struct analogix_dp_plat_data *plat_data)
if (ret)
return ERR_PTR(ret);
- dp->phy = devm_phy_get(dp->dev, "dp");
- if (IS_ERR(dp->phy)) {
- dev_err(dp->dev, "no DP phy configured\n");
- ret = PTR_ERR(dp->phy);
- if (ret) {
- /*
- * phy itself is not enabled, so we can move forward
- * assigning NULL to phy pointer.
- */
- if (ret == -ENOSYS || ret == -ENODEV)
- dp->phy = NULL;
- else
- return ERR_PTR(ret);
- }
- }
+ /*
+ * RK3399 uses the Analogix DP controller built-in PHY,
+ * no extra PHY configuration is required.
+ */
+ dp->phy = devm_phy_optional_get(dp->dev, "dp");
+ if (IS_ERR(dp->phy))
+ return ERR_CAST(dp->phy);
dp->clock = devm_clk_get(&pdev->dev, "dp");
if (IS_ERR(dp->clock)) {
--
2.56.0