Commit c856e3ff authored by Prashant Malani's avatar Prashant Malani
Browse files

platform/chrome: cros_ec_typec: Set port alt mode drvdata



Save the ChromeOS-specific Type-C port info in the port altmodes' driver
data. This makes communication with the ChromeOS EC (Embedded
Controller) easier when alt mode drivers need to send messages to
peripherals.

Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: default avatarPrashant Malani <pmalani@chromium.org>
Reviewed-by: default avatarBenson Leung <bleung@chromium.org>
Acked-by: default avatarHeikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20221228004648.793339-5-pmalani@chromium.org
parent 4dc9355c
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -345,6 +345,7 @@ static int cros_typec_register_port_altmodes(struct cros_typec_data *typec,
	if (IS_ERR(amode))
	if (IS_ERR(amode))
		return PTR_ERR(amode);
		return PTR_ERR(amode);
	port->port_altmode[CROS_EC_ALTMODE_DP] = amode;
	port->port_altmode[CROS_EC_ALTMODE_DP] = amode;
	typec_altmode_set_drvdata(amode, port);


	/*
	/*
	 * Register TBT compatibility alt mode. The EC will not enter the mode
	 * Register TBT compatibility alt mode. The EC will not enter the mode
@@ -358,6 +359,7 @@ static int cros_typec_register_port_altmodes(struct cros_typec_data *typec,
	if (IS_ERR(amode))
	if (IS_ERR(amode))
		return PTR_ERR(amode);
		return PTR_ERR(amode);
	port->port_altmode[CROS_EC_ALTMODE_TBT] = amode;
	port->port_altmode[CROS_EC_ALTMODE_TBT] = amode;
	typec_altmode_set_drvdata(amode, port);


	port->state.alt = NULL;
	port->state.alt = NULL;
	port->state.mode = TYPEC_STATE_USB;
	port->state.mode = TYPEC_STATE_USB;