usb: typec: fusb302: Check vconn is off when we start toggling
authorHans de Goede <hdegoede@redhat.com>
Mon, 11 Mar 2019 10:48:14 +0000 (11:48 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 15 Jun 2019 09:54:59 +0000 (11:54 +0200)
[ Upstream commit 32a155b1a83d6659e2272e8e1eec199667b1897e ]

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.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/staging/typec/fusb302/fusb302.c

index 7d9f25db1add891f749e4d87c4b4d9022326063e..794dbc34973f1e2394012df4e133182139b61d21 100644 (file)
@@ -671,6 +671,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);