aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/chrome
diff options
context:
space:
mode:
authorPrashant Malani <pmalani@chromium.org>2021-04-20 21:21:09 -0700
committerEnric Balletbo i Serra <enric.balletbo@collabora.com>2021-04-21 09:33:35 +0200
commitc5bb32f57bf3a30ed03be51f7be0840325ba8b4a (patch)
treed69f57a3eef05f22584d7cd0282fc3cac68a2a86 /drivers/platform/chrome
parentplatform/chrome: cros_ec_typec: Handle hard reset (diff)
downloadlinux-dev-c5bb32f57bf3a30ed03be51f7be0840325ba8b4a.tar.xz
linux-dev-c5bb32f57bf3a30ed03be51f7be0840325ba8b4a.zip
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 <pmalani@chromium.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Link: https://lore.kernel.org/r/20210421042108.2002-1-pmalani@chromium.org
Diffstat (limited to 'drivers/platform/chrome')
-rw-r--r--drivers/platform/chrome/cros_ec_typec.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c
index 60c21911a6c8..27c068c4c38d 100644
--- a/drivers/platform/chrome/cros_ec_typec.c
+++ b/drivers/platform/chrome/cros_ec_typec.c
@@ -487,6 +487,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)