linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] platform/chrome: cros_ec_typec: Add DP mode check
@ 2021-04-21  4:21 Prashant Malani
  2021-04-23  6:57 ` Enric Balletbo i Serra
  0 siblings, 1 reply; 2+ messages in thread
From: Prashant Malani @ 2021-04-21  4:21 UTC (permalink / raw)
  To: linux-kernel
  Cc: Prashant Malani, Benson Leung, Enric Balletbo i Serra, Guenter Roeck

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>
---
 drivers/platform/chrome/cros_ec_typec.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c
index d3df1717a5fd..69646262fa9d 100644
--- a/drivers/platform/chrome/cros_ec_typec.c
+++ b/drivers/platform/chrome/cros_ec_typec.c
@@ -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)
-- 
2.31.1.368.gbe11c130af-goog


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] platform/chrome: cros_ec_typec: Add DP mode check
  2021-04-21  4:21 [PATCH] platform/chrome: cros_ec_typec: Add DP mode check Prashant Malani
@ 2021-04-23  6:57 ` Enric Balletbo i Serra
  0 siblings, 0 replies; 2+ messages in thread
From: Enric Balletbo i Serra @ 2021-04-23  6:57 UTC (permalink / raw)
  To: linux-kernel, Prashant Malani; +Cc: Guenter Roeck, Benson Leung

On Tue, 20 Apr 2021 21:21:09 -0700, Prashant Malani wrote:
> 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,
-- 
Enric Balletbo i Serra <enric.balletbo@collabora.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-23  6:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-21  4:21 [PATCH] platform/chrome: cros_ec_typec: Add DP mode check Prashant Malani
2021-04-23  6:57 ` Enric Balletbo i Serra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).