Skip to contentSkip to conversation

drm/bridge: analogix_dp: use devm_phy_optional_get() for the DP PHY

PATCH RESEND Superseded Jun Yan 1 participant 2 messages Oct 13 – Nov 1

Subsystems (4)

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore

Jun Yan

author
#0 lore raw

PATCH RESEND v2 1/1 drm/bridge: analogix_dp: use devm_phy_optional_get() for the DP PHY

The DP PHY is optional: the Rockchip RK3399 eDP controller (used as the internal eDP port) has no separate PHY device and relies on its built-in PHY, which is programmed directly through the GRF registers, so its DT node carries no "phys"/"phy-names" property.

Requesting the PHY with devm_phy_get() therefore returns -ENODEV (or -ENOSYS when CONFIG_GENERIC_PHY is disabled) and the driver logs a misleading "no DP phy configured" error at probe time before falling back to a NULL phy.

Use devm_phy_optional_get() instead, which returns NULL when the PHY is absent and otherwise behaves identically, and drop the manual -ENODEV/ -ENOSYS handling. This also removes the spurious error message.

Assisted-by Claude:deepseek-v4-flash
---
 .../drm/bridge/analogix/analogix_dp_core.c    | 22 ++++++-------------
 1 file changed, 7 insertions(+), 15 deletions(-)
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c +7 -15
index 6df6963740d2..637b1bff0f6c 100644
@@ -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);
-		}
-	}
+	/*
+	 * RK3288/RK3399 use 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)) {
Signature · 1 line
2.56.0
author
#1 lore raw

Hi all,

Gentle ping - three weeks on the list without comments:

https://lore.kernel.org/dri-devel/[email protected]/

It makes the DP PHY optional, as needed by the RK3288/RK3399 built-in PHY, and drops the misleading "no DP phy configured" error at probe. It has a Reviewed-by from Damon Ding and applies cleanly on drm-next.

Anything else you would like changed, or can it be picked up?

Thanks,
Jun Yan