Skip to contentSkip to conversation

usb: typec: ucsi: Add check for UCSI version

PATCH In review Venkat Jayaraman 2 participants 2 messages Sep 5, 2025 – Sep 8, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: typec: ucsi: Add check for UCSI version

"Power Reading" bit is introduced in UCSI v2.1 and so limit the check for that bit only if version supported is 2.1 or above.

Fixes c851b71fd6cd ("usb: typec: ucsi: Add support for READ_POWER_LEVEL command")
---
 drivers/usb/typec/ucsi/ucsi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/typec/ucsi/ucsi.c +2 -1
index 0d6b0cf5a7cd..3f568f790f39 100644
@@ -1293,7 +1293,8 @@ static void ucsi_handle_connector_change(struct work_struct *work)
 	if (change & UCSI_CONSTAT_BC_CHANGE)
 		ucsi_port_psy_changed(con);
 
-	if (UCSI_CONSTAT(con, PWR_READING_READY_V2_1)) {
+	if (con->ucsi->version >= UCSI_VERSION_2_1 &&
+	    UCSI_CONSTAT(con, PWR_READING_READY_V2_1)) {
 		curr_scale = UCSI_CONSTAT(con, CURRENT_SCALE_V2_1);
 		volt_scale = UCSI_CONSTAT(con, VOLTAGE_SCALE_V2_1);
 
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Venkat Jayaraman

"Power Reading" bit is introduced in UCSI v2.1 and so limit the check for that bit only if version supported is 2.1 or above.

Fixes c851b71fd6cd ("usb: typec: ucsi: Add support for READ_POWER_LEVEL command")
---
  drivers/usb/typec/ucsi/ucsi.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/typec/ucsi/ucsi.c +0 -0
index 0d6b0cf5a7cd..3f568f790f39 100644

drivers/usb/typec/ucsi/ucsi.c static void ucsi_handle_connector_change(struct work_struct *work) · line 1300

Quoted 9 lines
drivers/usb/typec/ucsi/ucsi.c +2 -1
@@ -1293,7 +1293,8 @@ static void ucsi_handle_connector_change(struct work_struct *work)
  	if (change & UCSI_CONSTAT_BC_CHANGE)
  		ucsi_port_psy_changed(con);
 
-	if (UCSI_CONSTAT(con, PWR_READING_READY_V2_1)) {
+	if (con->ucsi->version >= UCSI_VERSION_2_1 &&
+	    UCSI_CONSTAT(con, PWR_READING_READY_V2_1)) {
  		curr_scale = UCSI_CONSTAT(con, CURRENT_SCALE_V2_1);
  		volt_scale = UCSI_CONSTAT(con, VOLTAGE_SCALE_V2_1);