diff mbox series

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

Message ID 20190311104818.30216-5-hdegoede@redhat.com (mailing list archive)
State Mainlined
Commit 32a155b1a83d6659e2272e8e1eec199667b1897e
Headers show
Series usb: typec: fusb302: Various fixes | expand

Commit Message

Hans de Goede March 11, 2019, 10:48 a.m. UTC
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>
---
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(+)

Comments

Guenter Roeck March 11, 2019, 1:08 p.m. UTC | #1
On 3/11/19 3:48 AM, Hans de Goede wrote:
> 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>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
> 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(+)
> 
> diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c
> index c947d18cdc0f..a1256855eaa0 100644
> --- a/drivers/usb/typec/tcpm/fusb302.c
> +++ b/drivers/usb/typec/tcpm/fusb302.c
> @@ -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);
>
diff mbox series

Patch

diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c
index c947d18cdc0f..a1256855eaa0 100644
--- a/drivers/usb/typec/tcpm/fusb302.c
+++ b/drivers/usb/typec/tcpm/fusb302.c
@@ -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);