During initial checks the ANX7625 bridge can be powered on before
setting up the Type-C port. At this point, when
anx7625_ocm_loading_check() checks if it can disable PD or not, it will
notice that typec_port is not set and disable PD, breaking orientation
and HPD handling. Unify the check between anx7625_ocm_loading_check()
anx7625_i2c_probe() and anx7625_typec_register() and check for the
presence of the "connector" node.

Fixes: 8ad0f7d2e6fd ("drm: bridge: anx7625: implement message sending")
Signed-off-by: Dmitry Baryshkov <[email protected]>
---
 drivers/gpu/drm/bridge/analogix/anx7625.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c 
b/drivers/gpu/drm/bridge/analogix/anx7625.c
index c43519097a45..1157a58cf1b1 100644
--- a/drivers/gpu/drm/bridge/analogix/anx7625.c
+++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
@@ -1363,6 +1363,18 @@ static void anx7625_configure_hpd(struct anx7625_data 
*ctx)
        anx7625_hpd_timer_config(ctx);
 }
 
+static bool anx7625_need_pd(struct anx7625_data *ctx)
+{
+       struct fwnode_handle *fwnode;
+
+       fwnode = device_get_named_child_node(ctx->dev, "connector");
+       if (!fwnode)
+               return false;
+
+       fwnode_handle_put(fwnode);
+       return true;
+}
+
 static int anx7625_ocm_loading_check(struct anx7625_data *ctx)
 {
        int ret;
@@ -1378,7 +1390,7 @@ static int anx7625_ocm_loading_check(struct anx7625_data 
*ctx)
        if ((ret & FLASH_LOAD_STA_CHK) != FLASH_LOAD_STA_CHK)
                return -ENODEV;
 
-       if (!ctx->typec_port)
+       if (!anx7625_need_pd(ctx))
                anx7625_disable_pd_protocol(ctx);
        anx7625_configure_hpd(ctx);
 
@@ -2924,12 +2936,7 @@ static int anx7625_i2c_probe(struct i2c_client *client)
        }
 
        if (!platform->pdata.low_power_mode) {
-               struct fwnode_handle *fwnode;
-
-               fwnode = device_get_named_child_node(dev, "connector");
-               if (fwnode)
-                       fwnode_handle_put(fwnode);
-               else
+               if (!anx7625_need_pd(platform))
                        anx7625_disable_pd_protocol(platform);
 
                anx7625_configure_hpd(platform);

---
base-commit: 400a84e1f7a3681ef24d58d49b5d07e81c14f4e9
change-id: 20260211-anx7625-fix-pd-792609132331

Best regards,
-- 
With best wishes
Dmitry

Reply via email to