Received: by 2002:a05:6520:4211:b029:f4:110d:56bc with SMTP id o17csp724532lkv; Tue, 18 May 2021 18:23:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOzo2LXyrnaxKAX2/QFsmdLWXiIAxv3H8KMkMRRGWHSd65U40SlV/XV1DbGOYfIhBLfuqL X-Received: by 2002:a92:dcc6:: with SMTP id b6mr6781956ilr.224.1621387402681; Tue, 18 May 2021 18:23:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621387402; cv=none; d=google.com; s=arc-20160816; b=j4SDbE7661TSpB+OQUCxPCrp5DC6l7XB2hoi6iWe4sOcI+HGXFeQ5NS9y/41p12uGM TTa5zKHDEJ3ezEcxthviTBxNxqmJEFPxEnM1Hi978FgddnfaN4JL0qfZzJeyUt8VZeHq tq3y9KzOHm2lLdZmNDxHlJabV3Gax4X4MwVMNFLfV8l2Ec4/8rH1E5jzGTm/LzuNZ3/D LOixFUsGrI36yJz1zlFq39BG4QUWBu1BTrsIH53iEitEzWCqLu0RTZ7rfRHordoNlzi+ Jlg4uJ3fWOn7yiDECPc+7QjsU9Lyrc5r3Jwfzu6giQywcrc28pl9mwYraOtbBbP8L5lJ o+ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:mime-version:message-id:date :dkim-signature; bh=WSTZG+Ss5oTMbhW5xlZ+aS48SNwB1nH5u8VKqkHoapw=; b=mmpJnpLEVmMqs0h3w0Wd8qUtBpWGRTD6/vu8lyiFDClISw2Qjijw5go2468TYyX6Sa IQZEJT4fUCfjmKdajSzOclTxpMazFa1gNuxVIhRsLiSpvs87TLny7iCxC0qpAZPqJI+9 JgVnzMpL8JXleza7iCynNgW+77YhPPCDdQbLUpyAfk9WtGvftoxjX/3jyJCOASQRw4hU luNkRktfePucyW4sCi/l3xtMWsaa3sqtIKlOowgk/eSfpFTgVQKMEdRd+4RxqT6GJSxo hypAE8d0c5E/Hv/5rVFnPXFAKmHPtBBEobo2i9StMDHaJz9+ZteZ3z4s6B6rlvHk5vAm 87ug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=dIq1Cdxw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q145si26520796iod.36.2021.05.18.18.23.09; Tue, 18 May 2021 18:23:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=dIq1Cdxw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232812AbhEQTWf (ORCPT + 99 others); Mon, 17 May 2021 15:22:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232515AbhEQTWe (ORCPT ); Mon, 17 May 2021 15:22:34 -0400 Received: from mail-qv1-xf4a.google.com (mail-qv1-xf4a.google.com [IPv6:2607:f8b0:4864:20::f4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6D66C061756 for ; Mon, 17 May 2021 12:21:17 -0700 (PDT) Received: by mail-qv1-xf4a.google.com with SMTP id z93-20020a0ca5e60000b02901ec19d8ff47so5557437qvz.8 for ; Mon, 17 May 2021 12:21:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=WSTZG+Ss5oTMbhW5xlZ+aS48SNwB1nH5u8VKqkHoapw=; b=dIq1Cdxw9F3TLvhfUP3VO6aAtoX8bNno3Ceg6ZqRXI+oS1PMIcvl6QXimPr3pf3Zpm wIe903i4k0i0qwW2CH0ht67bIqKXnCIGjsFDNnM7yg5gGIc/64vzSzpnJ6uxLsY4e7cG TiqlOfssmktWpOg50XlqMqPllu8Yo8O7aMif9Is3vqYHtD2+az3k4DpFMNpq5eLpm5HJ 4N7En/1GyHgfAPmhL80V8kKY1EdDDZ4HwimLaA27ytKeobh/o1Z5wfFrMywb6jvL9jsH 83aVg6EhlhA82iiA4QyBZcU6DVAt33b5BjrEsvZxAM/M7cxpTJhQutSkPdjKKcc96WVs qGGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=WSTZG+Ss5oTMbhW5xlZ+aS48SNwB1nH5u8VKqkHoapw=; b=UcuaLHU4yDxZr6viPBO5om29Dens6WJ4PFRB5RULjU0nFZs/Js1RAqgTLey6IJZdW3 EipFqzUhx7RblC1SYi8pnvns7jSo0thCizypGn6miV4pWkSJZVEAS7a9CqrrUa/X8Jnf IoIrjWO3g8RnXosT9Qgp5LgGnkwCcIhPJw5Z2kC8c4WKzlwvewfCrp75TDlgab1LjjQH Mnd+AWS+hw/7Pwc5pAq8aOcT4IWP+HTzhBb0KERdx/hBqhKBfG7ul1ZhZzY0y5IMcczI czfRYwyzmzDD/jhlBeWxuU2OJ6hmrQuQ+fJ9S7yfqBGeynzgah/BgANe6VlEE+tD/Tmd t8KQ== X-Gm-Message-State: AOAM530V1/c8IjenfO+kiX+IPg+V3RGWmAUFSP5EKu5dN696FQTDSCOC mi2A25R6D9DaFTpocnChsWfPKyrodLs= X-Received: from badhri.mtv.corp.google.com ([2620:15c:211:201:b562:7011:fe35:1c9e]) (user=badhri job=sendgmr) by 2002:a0c:ab88:: with SMTP id j8mr1243811qvb.23.1621279276966; Mon, 17 May 2021 12:21:16 -0700 (PDT) Date: Mon, 17 May 2021 12:21:09 -0700 Message-Id: <20210517192112.40934-1-badhri@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.31.1.751.gd2f1c929bd-goog Subject: [PATCH v2 1/4] usb: typec: tcpm: Fix up PR_SWAP when vsafe0v is signalled From: Badhri Jagan Sridharan To: Guenter Roeck , Heikki Krogerus , Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Kyle Tso , stable@vger.kernel.org, Badhri Jagan Sridharan Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org During PR_SWAP, When TCPM is in PR_SWAP_SNK_SRC_SINK_OFF, vbus is expected to reach VSAFE0V when source turns off vbus. Do not move to SNK_UNATTACHED state when this happens. Fixes: 28b43d3d746b ("usb: typec: tcpm: Introduce vsafe0v for vbus") Signed-off-by: Badhri Jagan Sridharan Reviewed-by: Guenter Roeck --- Changes since V1: - Fixed type s/of/off in commit message. - Added Reviewed-by: Guenter Roeck --- drivers/usb/typec/tcpm/tcpm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index c4fdc00a3bc8..b93c4c8d7b15 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -5114,6 +5114,9 @@ static void _tcpm_pd_vbus_vsafe0v(struct tcpm_port *port) tcpm_set_state(port, SNK_UNATTACHED, 0); } break; + case PR_SWAP_SNK_SRC_SINK_OFF: + /* Do nothing, vsafe0v is expected during transition */ + break; default: if (port->pwr_role == TYPEC_SINK && port->auto_vbus_discharge_enabled) tcpm_set_state(port, SNK_UNATTACHED, 0); -- 2.31.1.751.gd2f1c929bd-goog