Commit 91d04505 authored by Dmitry Baryshkov's avatar Dmitry Baryshkov
Browse files

drm: bridge: anx7625: correctly detect if PD can be disabled



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: 8ad0f7d2 ("drm: bridge: anx7625: implement message sending")
Reviewed-by: default avatarNeil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: default avatarXin Ji <xji@analogixsemi.com>
Tested-by: default avatarLoic Poulain <loic.poulain@oss.qualcomm.com>
Link: https://patch.msgid.link/20260211-anx7625-fix-pd-v1-1-1dd31451b06f@oss.qualcomm.com


Signed-off-by: default avatarDmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
parent 8e3d8b33
Loading
Loading
Loading
Loading
+14 −7
Original line number Diff line number Diff line
@@ -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);

@@ -2910,12 +2922,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);