Skip to contentSkip to conversation

usb: typec: fusb302: Check vconn is off when we start toggling

PATCH New Hans de Goede 1 participant 1 message Mar 11, 2019

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

PATCH v3 4/8 usb: typec: fusb302: Check vconn is off when we start toggling

The datasheet says the vconn MUST be off when we start toggling. The tcpm.c state-machine is responsible to make sure vconn is off, but lets add a WARN to catch any cases where vconn is not off for some reason.

---
Changes in v3:
-Use WARN with a message describing the problem, instead of WARN_ON

---
 drivers/usb/typec/tcpm/fusb302.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/usb/typec/tcpm/fusb302.c +2 -0
index c947d18cdc0f..a1256855eaa0 100644
@@ -607,6 +607,8 @@ static int fusb302_set_toggling(struct fusb302_chip *chip,
 			return ret;
 		chip->intr_togdone = false;
 	} else {
+		/* Datasheet says vconn MUST be off when toggling */
+		WARN(chip->vconn_on, "Vconn is on during toggle start");
 		/* unmask TOGDONE interrupt */
 		ret = fusb302_i2c_clear_bits(chip, FUSB_REG_MASKA,
 					     FUSB_REG_MASKA_TOGDONE);