mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Badhri Jagan Sridharan <badhri@google.com>
Cc: Guenter Roeck <linux@roeck-us.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Kyle Tso <kyletso@google.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH v1 2/2] usb: typec: tcpm: Do not disconnect when receiving VSAFE0V
Date: Tue, 25 Jan 2022 11:02:25 +0200	[thread overview]
Message-ID: <Ye+8oRlfz8HS2fsB@kuha.fi.intel.com> (raw)
In-Reply-To: <20220122015520.332507-2-badhri@google.com>

On Fri, Jan 21, 2022 at 05:55:20PM -0800, Badhri Jagan Sridharan wrote:
> With some chargers, vbus might momentarily raise above VSAFE5V and fall
> back to 0V causing VSAFE0V to be triggered. This will
> will report a VBUS off event causing TCPM to transition to
> SNK_UNATTACHED state where it should be waiting in either SNK_ATTACH_WAIT
> or SNK_DEBOUNCED state. This patch makes TCPM avoid VSAFE0V events
> while in SNK_ATTACH_WAIT or SNK_DEBOUNCED state.
> 
> Stub from the spec:
>     "4.5.2.2.4.2 Exiting from AttachWait.SNK State
>     A Sink shall transition to Unattached.SNK when the state of both
>     the CC1 and CC2 pins is SNK.Open for at least tPDDebounce.
>     A DRP shall transition to Unattached.SRC when the state of both
>     the CC1 and CC2 pins is SNK.Open for at least tPDDebounce."
> 
> [23.194131] CC1: 0 -> 0, CC2: 0 -> 5 [state SNK_UNATTACHED, polarity 0, connected]
> [23.201777] state change SNK_UNATTACHED -> SNK_ATTACH_WAIT [rev3 NONE_AMS]
> [23.209949] pending state change SNK_ATTACH_WAIT -> SNK_DEBOUNCED @ 170 ms [rev3 NONE_AMS]
> [23.300579] VBUS off
> [23.300668] state change SNK_ATTACH_WAIT -> SNK_UNATTACHED [rev3 NONE_AMS]
> [23.301014] VBUS VSAFE0V
> [23.301111] Start toggling
> 
> Fixes: 28b43d3d746b8 ("usb: typec: tcpm: Introduce vsafe0v for vbus")
> Cc: stable@vger.kernel.org
> Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>

Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
>  drivers/usb/typec/tcpm/tcpm.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index b8afe3d8c882..5fce795b69c7 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -5264,6 +5264,10 @@ static void _tcpm_pd_vbus_vsafe0v(struct tcpm_port *port)
>  	case PR_SWAP_SNK_SRC_SOURCE_ON:
>  		/* Do nothing, vsafe0v is expected during transition */
>  		break;
> +	case SNK_ATTACH_WAIT:
> +	case SNK_DEBOUNCED:
> +		/*Do nothing, still waiting for VSAFE5V for connect */
> +		break;
>  	default:
>  		if (port->pwr_role == TYPEC_SINK && port->auto_vbus_discharge_enabled)
>  			tcpm_set_state(port, SNK_UNATTACHED, 0);
> -- 
> 2.35.0.rc0.227.g00780c9af4-goog

-- 
heikki

  reply	other threads:[~2022-01-25  9:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-22  1:55 [PATCH v1 1/2] usb: typec: tcpm: Do not disconnect while receiving VBUS off Badhri Jagan Sridharan
2022-01-22  1:55 ` [PATCH v1 2/2] usb: typec: tcpm: Do not disconnect when receiving VSAFE0V Badhri Jagan Sridharan
2022-01-25  9:02   ` Heikki Krogerus [this message]
2022-01-25 17:44   ` Guenter Roeck
2022-01-25  9:01 ` [PATCH v1 1/2] usb: typec: tcpm: Do not disconnect while receiving VBUS off Heikki Krogerus
2022-01-25 17:42 ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Ye+8oRlfz8HS2fsB@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=badhri@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kyletso@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®