Skip to contentSkip to conversation

platform/chrome: cros_ec_typec: Add DP mode check

PATCH Applied Prashant Malani 2 participants 2 messages Apr 21, 2021 – Apr 23, 2021

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

PATCH 1/1 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.

---
 drivers/platform/chrome/cros_ec_typec.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/platform/chrome/cros_ec_typec.c +5 -0
index d3df1717a5fd..69646262fa9d 100644
@@ -486,6 +486,11 @@ static int cros_typec_enable_dp(struct cros_typec_data *typec,
 		return -ENOTSUPP;
 	}
 
+	if (!pd_ctrl->dp_mode) {
+		dev_err(typec->dev, "No valid DP mode provided.\n");
+		return -EINVAL;
+	}
+
 	/* Status VDO. */
 	dp_data.status = DP_STATUS_ENABLED;
 	if (port->mux_flags & USB_PD_MUX_HPD_IRQ)
Signature · 1 line
2.31.1.368.gbe11c130af-goog
#1 lore raw
Quoted 4 lines · Prashant Malani

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.

Applied, thanks!

[1/1] platform/chrome: cros_ec_typec: Add DP mode check

      commit: c5bb32f57bf3a30ed03be51f7be0840325ba8b4a

Best regards,

Signature · 1 line
Enric Balletbo i Serra <[email protected]>