lkml.org 
[lkml]   [2022]   [Jan]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.16 083/200] usb: typec: tcpm: Do not disconnect when receiving VSAFE0V
    Date
    From: Badhri Jagan Sridharan <badhri@google.com>

    commit 746f96e7d6f7a276726860f696671766bfb24cf0 upstream.

    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
    Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
    Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
    Link: https://lore.kernel.org/r/20220122015520.332507-2-badhri@google.com
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ---
    drivers/usb/typec/tcpm/tcpm.c | 4 ++++
    1 file changed, 4 insertions(+)

    --- 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
    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);

    \
     
     \ /
      Last update: 2022-01-31 12:41    [W:2.030 / U:0.036 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site