Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp48081pxu; Tue, 24 Nov 2020 18:13:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJy6F2PlzuCbAVr2KVdvd2vaS0SYeKKd9tJi7pWwxjT22WtfqSRU2MpQQa/mtgzOTF3eOr8M X-Received: by 2002:a50:bf4a:: with SMTP id g10mr1444675edk.288.1606270380006; Tue, 24 Nov 2020 18:13:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606270380; cv=none; d=google.com; s=arc-20160816; b=UTktw6xNeYniVFtyM6ZulKv9QtcpvilLoBxK+3t0RHyOnA1e8ID4lZp8LVGWy2sgye FvgYaJrtOiTXDZroV3X+TTHdQtZaRw0InJRQTut0A+9hoNzuuGBejy+i7GW2PDHhDr33 et/bp1EjwjFrO8x+0zhwb4+Jbz0jOWCXWmstTmxq4MaMII8i73Ro2xlrhR75pIO/b8md Z2KfqseBVLj6wokGLbs7Wf/kDscPeKg4k2BPO+i8AgAwYv4j3Rg/bNjtZ8rOv4ycDuwG m6WRH4SwIKd4YFk4rzLPsArAShcwXZPUulylSjWUsOkV9nhcFoLEKsP1/t1LUi5N+tV4 EzMQ== 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 :sender:dkim-signature; bh=chU6/PiPNUBnmLnxFg8uICWgwVV6llfRaSWUbIwbJ/w=; b=m9LXKJaiXEwvIFydpiK7wzA4QRlJl6w+TYpUB2TJc2aOKIEHcGsGrSgIVcLXJQyeEi fDWehNrZ6ERnEvMY/V8LuIHpajvk29xB3rDfXcH48Xr4vIs04Gl52TiCRZjx22CfTcPD WUKClK1R8F4oztBAhUTOddHh2e70ezdyQoEaPinsp2+VVdoTWLUP/gVAQH8l2X5goulj 3Xx5uN/A9NuyVO2jNXR8NiZX4lM+2ErrvJj4a6wKLg8FNCa45T8Zn+SOKjNjeajge5yb WEw4tt3a9PJMc9Qe55yUrEb+N5ahewGAlFrO6/mAG85NyUqLhA+cYADMXr+UQ8TT9v2s +GqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=UTLaRp8v; 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 y11si406948edm.309.2020.11.24.18.12.37; Tue, 24 Nov 2020 18:12:59 -0800 (PST) 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=UTLaRp8v; 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 S1727268AbgKYCHJ (ORCPT + 99 others); Tue, 24 Nov 2020 21:07:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727209AbgKYCHJ (ORCPT ); Tue, 24 Nov 2020 21:07:09 -0500 Received: from mail-pl1-x64a.google.com (mail-pl1-x64a.google.com [IPv6:2607:f8b0:4864:20::64a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 054F4C061A4D for ; Tue, 24 Nov 2020 18:07:08 -0800 (PST) Received: by mail-pl1-x64a.google.com with SMTP id b4so671969plr.15 for ; Tue, 24 Nov 2020 18:07:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:message-id:mime-version:subject:from:to:cc; bh=chU6/PiPNUBnmLnxFg8uICWgwVV6llfRaSWUbIwbJ/w=; b=UTLaRp8vPJgoAOH6mrWpt2j98UWI5fLdLu412Yd2bQp300kqstWLg4kKDobxf6CA48 Lzy/ByBaBJmi9fBnfHlwzJcS6EqkK3qgswqS154YK7r2Yqs9LjCrRhkOJwdWR44kqhCY BZH+Xl0KJvjU216zBFfNKUSEImeVAj8abJH3T9LKoBlNv6dcfsKBuhQKln07XF7odySc zXBmu8/BdUwfnoQ9+0nZIQjXhCugfhPcUoy4rxpiq4XjRfJWtkahCY2rHeHz+5K4XC9n 776eUmP+kenIKl9foTTZMooN5u2s5nNkHgXBpfDxnec2symz3byUSmkAULLC0l6OH7Rz rbJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:mime-version:subject:from :to:cc; bh=chU6/PiPNUBnmLnxFg8uICWgwVV6llfRaSWUbIwbJ/w=; b=GcDOclwov40rHDKSxwjY6cNPMO5KwxPBuEfGv952btGlyciiYcy/+BNg+Was0CGMOk 4OvgKtl/ZhxqjxT4qBkNtX5eHagA00LwPR5XyJt9o6wc3UG5wGxXs0D2fl0XKanO8noY lIdmE4006F1Zq3iRKxWr7I5nPh+iLxIl6zOJ2aS6ZAUVzyMJDjQBc1cp5LAjPzxYhR7+ Cef2AWcrRs4+tQ9vZPUNjaaNqmz3gISuUBzFDCfbqpQDHPsLfozrM0nnFGt0PNLh7OmA m6QZD3Wuah1fVrpyk7WhlabV5+59EUA1JiQuMqoAfJKvjoi1cfbVajwEKZC3KPhuY9Wt ceqw== X-Gm-Message-State: AOAM532z7wr2jiA34ftHTFzSniYh89rAxc53pAbIFXOOwzfl4V6fIvWu 0FiWCQfE3EbblLlxSyaaggOLMJ0ZRm8= Sender: "badhri via sendgmr" X-Received: from badhri.mtv.corp.google.com ([2620:15c:211:201:f292:1cff:fee0:66cf]) (user=badhri job=sendgmr) by 2002:a62:8006:0:b029:196:33f2:4dd7 with SMTP id j6-20020a6280060000b029019633f24dd7mr1137566pfd.38.1606270027414; Tue, 24 Nov 2020 18:07:07 -0800 (PST) Date: Tue, 24 Nov 2020 18:07:03 -0800 Message-Id: <20201125020703.1604979-1-badhri@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.29.2.454.gaff20da3a2-goog Subject: [PATCH v1] usb: typec: tcpm: Disregard vbus off while in PR_SWAP_SNK_SRC_SOURCE_ON From: Badhri Jagan Sridharan To: Guenter Roeck , Heikki Krogerus , Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, linux-kernel@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 sequence, when TCPM is waiting in PR_SWAP_SNK_SRC_SOURCE_ON for the vbus source to ramp up, TCPM would prematurely exit PR_SWAP_SNK_SRC_SOURCE_ON and transition to SNK_UNATTACHED state when a vbus off notification is received. This should not be the case as vbus can still be off while in PR_SWAP_SNK_SRC_SOURCE_ON and the vbus source has PD_T_NEWSRC to ramp up. Signed-off-by: Badhri Jagan Sridharan --- drivers/usb/typec/tcpm/tcpm.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index 4aac0efdb720..277b9d4d9c84 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -4218,6 +4218,14 @@ static void _tcpm_pd_vbus_off(struct tcpm_port *port) /* Do nothing, expected */ break; + case PR_SWAP_SNK_SRC_SOURCE_ON: + /* + * Do nothing when vbus off notification is received. + * TCPM can wait for PD_T_NEWSRC in PR_SWAP_SNK_SRC_SOURCE_ON + * for the vbus source to ramp up. + */ + break; + case PORT_RESET_WAIT_OFF: tcpm_set_state(port, tcpm_default_state(port), 0); break; -- 2.29.2.454.gaff20da3a2-goog