Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: typec: ucsi: Add DATA_RESET option of Connector Reset command

Modify CONNECTOR_RESET command implementation to accommodate
DATA_RESET reset type as defined in UCSI spec v2.0 and later.

Hard Reset bit field was defined with value 1 in UCSI spec version 1.0.
Starting with spec version 1.1, Hard Reset bit field was removed from the
CONNECTOR_RESET command, until spec 2.0 reintroduced it with value 0, so,
the value to pass in to the command for a Hard Reset is different depending
on the UCSI version supported by the LPM.

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Signed-off-by: Venkat Jayaraman <venkat.jayaraman@intel.com>
Link: https://lore.kernel.org/r/20240813231828.1192338-1-pooja.katiyar@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Venkat Jayaraman and committed by
Greg Kroah-Hartman
e8778a25 7393bf34

+19 -2
+15 -1
drivers/usb/typec/ucsi/ucsi.c
··· 1340 1340 1341 1341 /* -------------------------------------------------------------------------- */ 1342 1342 1343 + /* 1344 + * Hard Reset bit field was defined with value 1 in UCSI spec version 1.0. 1345 + * Starting with spec version 1.1, Hard Reset bit field was removed from the 1346 + * CONNECTOR_RESET command, until spec 2.0 reintroduced it with value 0, so, in effect, 1347 + * the value to pass in to the command for a Hard Reset is different depending 1348 + * on the supported UCSI version by the LPM. 1349 + * 1350 + * For performing a Data Reset on LPMs supporting version 2.0 and greater, 1351 + * this function needs to be called with the second argument set to 0. 1352 + */ 1343 1353 static int ucsi_reset_connector(struct ucsi_connector *con, bool hard) 1344 1354 { 1345 1355 u64 command; 1346 1356 1347 1357 command = UCSI_CONNECTOR_RESET | UCSI_CONNECTOR_NUMBER(con->num); 1348 - command |= hard ? UCSI_CONNECTOR_RESET_HARD : 0; 1358 + 1359 + if (con->ucsi->version < UCSI_VERSION_1_1) 1360 + command |= hard ? UCSI_CONNECTOR_RESET_HARD_VER_1_0 : 0; 1361 + else if (con->ucsi->version >= UCSI_VERSION_2_0) 1362 + command |= hard ? 0 : UCSI_CONNECTOR_RESET_DATA_VER_2_0; 1349 1363 1350 1364 return ucsi_send_command(con->ucsi, command, NULL, 0); 1351 1365 }
+4 -1
drivers/usb/typec/ucsi/ucsi.h
··· 29 29 #define UCSIv2_MESSAGE_OUT 272 30 30 31 31 /* UCSI versions */ 32 + #define UCSI_VERSION_1_1 0x0110 32 33 #define UCSI_VERSION_1_2 0x0120 33 34 #define UCSI_VERSION_2_0 0x0200 34 35 #define UCSI_VERSION_2_1 0x0210 ··· 123 122 #define UCSI_DEFAULT_GET_CONNECTOR_NUMBER(_cmd_) (((_cmd_) >> 16) & GENMASK(6, 0)) 124 123 125 124 /* CONNECTOR_RESET command bits */ 126 - #define UCSI_CONNECTOR_RESET_HARD BIT(23) /* Deprecated in v1.1 */ 125 + #define UCSI_CONNECTOR_RESET_HARD_VER_1_0 BIT(23) /* Deprecated in v1.1 */ 126 + #define UCSI_CONNECTOR_RESET_DATA_VER_2_0 BIT(23) /* Redefined in v2.0 */ 127 + 127 128 128 129 /* ACK_CC_CI bits */ 129 130 #define UCSI_ACK_CONNECTOR_CHANGE BIT(16)