Skip to content

Commit c5bb32f

Browse files
Prashant MalaniEnric Balletbo i Serra
authored andcommitted
platform/chrome: cros_ec_typec: Add DP mode check
There are certain transitional situations where the dp_mode field in the PD_CONTROL response might not be populated with the right DP pin assignment value yet. Add a check for that to avoid sending an invalid value to the Type C mode switch. Signed-off-by: Prashant Malani <[email protected]> Signed-off-by: Enric Balletbo i Serra <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 944b3a6 commit c5bb32f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/platform/chrome/cros_ec_typec.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,11 @@ static int cros_typec_enable_dp(struct cros_typec_data *typec,
487487
return -ENOTSUPP;
488488
}
489489

490+
if (!pd_ctrl->dp_mode) {
491+
dev_err(typec->dev, "No valid DP mode provided.\n");
492+
return -EINVAL;
493+
}
494+
490495
/* Status VDO. */
491496
dp_data.status = DP_STATUS_ENABLED;
492497
if (port->mux_flags & USB_PD_MUX_HPD_IRQ)

0 commit comments

Comments
 (0)